mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
为说话添加变化描述
This commit is contained in:
parent
86a72d2813
commit
3e4fd51b96
@ -33,15 +33,15 @@ namespace VPet_Simulator.Core
|
||||
/// <summary>
|
||||
/// 说话,使用随机表情
|
||||
/// </summary>
|
||||
public void SayRnd(string text, bool force = false)
|
||||
public void SayRnd(string text, bool force = false, string desc = null)
|
||||
{
|
||||
Say(text, Core.Graph.FindName(GraphType.Say), force);
|
||||
Say(text, Core.Graph.FindName(GraphType.Say), force, desc);
|
||||
}
|
||||
/// <summary>
|
||||
/// 说话
|
||||
/// </summary>
|
||||
/// <param name="text">说话内容</param>
|
||||
public void Say(string text, string graphname = null, bool force = false)
|
||||
public void Say(string text, string graphname = null, bool force = false, string desc = null)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
@ -49,12 +49,22 @@ namespace VPet_Simulator.Core
|
||||
if (force || !string.IsNullOrWhiteSpace(graphname) && DisplayType.Type == GraphType.Default)//这里不使用idle是因为idle包括学习等
|
||||
Display(graphname, AnimatType.A_Start, () =>
|
||||
{
|
||||
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text, graphname));
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(desc))
|
||||
MsgBar.MessageBoxContent.Children.Add(new TextBlock() { Text = desc, FontSize = 20, ToolTip = desc, HorizontalAlignment = System.Windows.HorizontalAlignment.Right });
|
||||
MsgBar.Show(Core.Save.Name, text, graphname);
|
||||
});
|
||||
DisplayBLoopingForce(graphname);
|
||||
});
|
||||
else
|
||||
{
|
||||
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text));
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(desc))
|
||||
MsgBar.MessageBoxContent.Children.Add(new TextBlock() { Text = desc, FontSize = 20, ToolTip = desc, HorizontalAlignment = System.Windows.HorizontalAlignment.Right });
|
||||
MsgBar.Show(Core.Save.Name, text);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using VPet_Simulator.Core;
|
||||
using static VPet_Simulator.Core.GraphHelper;
|
||||
|
||||
namespace VPet_Simulator.Windows.Interface
|
||||
@ -25,7 +26,7 @@ namespace VPet_Simulator.Windows.Interface
|
||||
var spend = ((work.StrengthFood >= 0 ? 1 : -1) * Math.Pow(work.StrengthFood * 2 + 1, 2) / 6 +
|
||||
(work.StrengthDrink >= 0 ? 1 : -1) * Math.Pow(work.StrengthDrink * 2 + 1, 2) / 9 +
|
||||
(work.Feeling >= 0 ? 1 : -1) * Math.Pow((work.Type == Work.WorkType.Play ? -1 : 1) * work.Feeling * 2 + 1, 2) / 12) *
|
||||
(Math.Pow(work.LevelLimit / 2 + 1, 0.5) / 4 + 1) - 0.5;
|
||||
(Math.Pow(work.LevelLimit / 2 + 1, 0.5) / 4 + 1) - 0.5;
|
||||
var get = (work.MoneyBase + work.MoneyLevel * 10) * (work.MoneyLevel + 1) * (1 + work.FinishBonus / 2);
|
||||
if (work.Type != Work.WorkType.Work)
|
||||
{
|
||||
@ -38,6 +39,41 @@ namespace VPet_Simulator.Windows.Interface
|
||||
return true;
|
||||
return rel > 2; // 推荐rel为1.0-1.4之间 超过2.0就是超模
|
||||
}
|
||||
|
||||
public static string FoodToDescription(this IFood food)
|
||||
{
|
||||
var dic = new List<Tuple<string, double, string>>()
|
||||
{
|
||||
new Tuple<string, double, string>(LocalizeCore.Translate("经验值"), food.Exp, ValueToPlusPlus(food.Exp, 1 / 4, 5)),
|
||||
new Tuple<string, double, string>(LocalizeCore.Translate("饱腹度"),food.StrengthFood, ValueToPlusPlus(food.StrengthFood, 1 / 2, 5)) ,
|
||||
new Tuple<string, double, string>(LocalizeCore.Translate("口渴度"), food.StrengthDrink, ValueToPlusPlus(food.StrengthDrink, 1 / 2.5, 5)),
|
||||
new Tuple<string, double, string>(LocalizeCore.Translate("体力"),food.Strength, ValueToPlusPlus(food.Strength, 1 / 4, 5)),
|
||||
new Tuple<string, double, string>(LocalizeCore.Translate("心情"), food.Feeling, ValueToPlusPlus(food.Feeling, 1 / 3, 5)),
|
||||
new Tuple<string, double, string>(LocalizeCore.Translate("健康"),food.Health, ValueToPlusPlus(food.Health, 1, 5)) ,
|
||||
new Tuple<string, double, string>(LocalizeCore.Translate("好感度"),food.Likability, ValueToPlusPlus(food.Likability, 1.5, 5))
|
||||
};
|
||||
var dic2 = dic.Where(kv => kv.Item2 != 0)
|
||||
.Select(x => x.Item1 + x.Item3);
|
||||
return string.Join("\n", dic2);
|
||||
}
|
||||
/// <summary>
|
||||
/// 把值变成++
|
||||
/// </summary>
|
||||
/// <param name="value">值</param>
|
||||
/// <param name="magnification">倍率</param>
|
||||
/// <returns></returns>
|
||||
public static string ValueToPlusPlus(double value, double magnification, int max = 10)
|
||||
{
|
||||
int v = (int)Math.Abs(value);
|
||||
v = (int)(Math.Pow(v, magnification));
|
||||
v = Math.Min(Math.Max(v, 0), max);
|
||||
if (value < 0)
|
||||
return new string('-', v);
|
||||
|
||||
else
|
||||
return new string('+', v);
|
||||
}
|
||||
|
||||
}
|
||||
public static class ExtensionValue
|
||||
{
|
||||
@ -46,4 +82,5 @@ namespace VPet_Simulator.Windows.Interface
|
||||
/// </summary>
|
||||
public static string BaseDirectory = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ using Line = LinePutScript.Line;
|
||||
using static VPet_Simulator.Core.GraphInfo;
|
||||
using System.Globalization;
|
||||
using static VPet_Simulator.Windows.Interface.ExtensionFunction;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace VPet_Simulator.Windows
|
||||
{
|
||||
@ -403,7 +404,7 @@ namespace VPet_Simulator.Windows
|
||||
else//新玩家,默认设置为
|
||||
Set["CGPT"][(gstr)"type"] = "LB";
|
||||
|
||||
|
||||
|
||||
await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "尝试加载游戏MOD".Translate()));
|
||||
|
||||
//当前桌宠动画
|
||||
@ -445,7 +446,7 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
//var food = new Food();
|
||||
foreach (var selet in SelectTexts)
|
||||
{
|
||||
{
|
||||
selet.Exp = Math.Max(Math.Min(selet.Exp, 1000), -1000);
|
||||
//food.Exp += selet.Exp;
|
||||
selet.Feeling = Math.Max(Math.Min(selet.Feeling, 1000), -1000);
|
||||
@ -682,7 +683,7 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
Main.Core.Save.EatFood(rt);
|
||||
Main.Core.Save.Money += rt.Money;
|
||||
Main.SayRnd(rt.TranslateText);
|
||||
Main.SayRnd(rt.TranslateText, desc: rt.FoodToDescription());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -132,7 +132,7 @@ namespace VPet_Simulator.Windows
|
||||
else
|
||||
mw.GameSavesData.Statistics[(gint)"stat_say_like_d"]++;
|
||||
}
|
||||
if(say.Money != 0)
|
||||
if (say.Money != 0)
|
||||
{
|
||||
if (say.Money > 0)
|
||||
mw.GameSavesData.Statistics[(gint)"stat_say_money_p"]++;
|
||||
@ -145,7 +145,7 @@ namespace VPet_Simulator.Windows
|
||||
textSaid.Add(say.Choose);
|
||||
RelsTime = RelsTime.AddMinutes(5);
|
||||
|
||||
mw.Main.SayRnd(say.ConverText(mw.Main));
|
||||
mw.Main.SayRnd(say.ConverText(mw.Main), desc: say.FoodToDescription());
|
||||
if (say.ToTags.Count > 0)
|
||||
{
|
||||
var list = mw.SelectTexts.FindAll(x => x.ContainsTag(say.ToTags)).ToList();
|
||||
|
Loading…
Reference in New Issue
Block a user