From b162309c58313dea515c25dc5138256740df5783 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Sun, 24 Sep 2023 23:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=96=B0=E6=88=90=E5=B0=B1=E5=87=86?= =?UTF-8?q?=E5=A4=87=E7=9A=84=E6=96=B0=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/WorkTimer.xaml.cs | 43 +++++++++++++++++-- VPet-Simulator.Windows/MainWindow.cs | 5 +++ VPet-Simulator.Windows/MainWindow.xaml.cs | 12 ++++++ .../WinDesign/TalkSelect.xaml.cs | 28 +++++++++++- 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/VPet-Simulator.Core/Display/WorkTimer.xaml.cs b/VPet-Simulator.Core/Display/WorkTimer.xaml.cs index bf3b8d3..61b2a64 100644 --- a/VPet-Simulator.Core/Display/WorkTimer.xaml.cs +++ b/VPet-Simulator.Core/Display/WorkTimer.xaml.cs @@ -41,6 +41,39 @@ namespace VPet_Simulator.Core /// public DateTime StartTime; /// + /// 任务完成时调用该参数 + /// + public event Action E_FinishWork; + /// + /// 完成工作信息 + /// + public struct FinishWorkInfo + { + /// + /// 当前完成工作 + /// + public Work work; + /// + /// 当前完成工作收入 + /// + public double count; + /// + /// 当前完成工作花费时间 + /// + public double spendtime; + /// + /// 完成工作信息 + /// + /// 当前工作 + /// 当前盈利(自动计算附加) + public FinishWorkInfo(Work work, double count) + { + this.work = work; + this.count = count * (1 + work.FinishBonus); + this.spendtime = work.Time; + } + } + /// /// UI相关显示 /// /// @@ -55,17 +88,19 @@ namespace VPet_Simulator.Core //ts = TimeSpan.FromMinutes(MaxTime); //tleft = TimeSpan.Zero; //PBLeft.Value = MaxTime; + var fwi = new FinishWorkInfo(nowWork, GetCount); + E_FinishWork?.Invoke(fwi); if (nowWork.Type == Work.WorkType.Work) { m.Core.Save.Money += GetCount * nowWork.FinishBonus; - Stop(() => m.SayRnd(LocalizeCore.Translate("{2}完成啦, 累计赚了 {0:f2} 金钱\n共计花费了{1}分钟", GetCount * (1 + nowWork.FinishBonus), - nowWork.Time, nowWork.NameTrans), true)); + Stop(() => m.SayRnd(LocalizeCore.Translate("{2}完成啦, 累计赚了 {0:f2} 金钱\n共计花费了{1}分钟", fwi.count, + fwi.spendtime, fwi.work.NameTrans), true)); } else { m.Core.Save.Exp += GetCount * nowWork.FinishBonus; - Stop(() => m.SayRnd(LocalizeCore.Translate("{2}完成啦, 累计获得 {0:f2} 经验\n共计花费了{1}分钟", GetCount * (1 + nowWork.FinishBonus), - nowWork.Time, nowWork.NameTrans), true)); + Stop(() => m.SayRnd(LocalizeCore.Translate("{2}完成啦, 累计获得 {0:f2} 经验\n共计花费了{1}分钟", fwi.count, + fwi.spendtime, fwi.work.NameTrans), true)); } return; } diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index c50e3af..8e03731 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -459,6 +459,7 @@ namespace VPet_Simulator.Windows Core.Save.Money -= item.Price; //统计 + GameSavesData.Statistics[(gint)"stat_buytimes"]++; GameSavesData.Statistics[(gint)("buy_" + item.Name)]++; GameSavesData.Statistics[(gdbe)"stat_betterbuy"] += item.Price; switch (item.Type) @@ -471,6 +472,7 @@ namespace VPet_Simulator.Windows break; case Food.FoodType.Drug: GameSavesData.Statistics[(gdbe)"stat_bb_drug"] += item.Price; + GameSavesData.Statistics[(gdbe)"stat_bb_drug_exp"] += item.Exp; break; case Food.FoodType.Snack: GameSavesData.Statistics[(gdbe)"stat_bb_snack"] += item.Price; @@ -483,6 +485,7 @@ namespace VPet_Simulator.Windows break; case Food.FoodType.Gift: GameSavesData.Statistics[(gdbe)"stat_bb_gift"] += item.Price; + GameSavesData.Statistics[(gdbe)"stat_bb_gift_like"] += item.Likability; break; } } @@ -714,6 +717,8 @@ namespace VPet_Simulator.Windows if (CurrMusicType != null && Main.IsIdel) {//识别通过,开始跑跳舞动画 + //先统计下 + GameSavesData.Statistics[(gint)"stat_music"]++; Main.Display(Core.Graph.FindGraph("music", AnimatType.A_Start, Core.Save.Mode), Display_Music); } else diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 8c70396..3e47ae9 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -545,6 +545,7 @@ namespace VPet_Simulator.Windows winSetting.Show(); }; Main.FunctionSpendHandle += lowStrength; + Main.WorkTimer.E_FinishWork += WorkTimer_E_FinishWork; Main.ToolBar.MenuMODConfig.Items.Add(m); try { @@ -802,6 +803,17 @@ namespace VPet_Simulator.Windows } + private void WorkTimer_E_FinishWork(WorkTimer.FinishWorkInfo obj) + { + if (obj.work.Type == GraphHelper.Work.WorkType.Work) + { + GameSavesData.Statistics[(gint)"stat_single_profit_money"] = (int)obj.count; + } + else + { + GameSavesData.Statistics[(gint)"stat_single_profit_exp"] = (int)obj.count; + } + } private void Main_Event_TouchBody() { diff --git a/VPet-Simulator.Windows/WinDesign/TalkSelect.xaml.cs b/VPet-Simulator.Windows/WinDesign/TalkSelect.xaml.cs index b6e1dbe..9878ab7 100644 --- a/VPet-Simulator.Windows/WinDesign/TalkSelect.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/TalkSelect.xaml.cs @@ -1,4 +1,5 @@ -using LinePutScript.Localization.WPF; +using LinePutScript; +using LinePutScript.Localization.WPF; using System; using System.Collections.Generic; using System.Linq; @@ -115,6 +116,29 @@ namespace VPet_Simulator.Windows var say = textList[tbTalk.SelectedIndex]; textList.RemoveAt(tbTalk.SelectedIndex); //聊天效果 + if (say.Exp != 0) + { + if (say.Exp > 0) + { + mw.GameSavesData.Statistics[(gint)"stat_say_exp_p"]++; + } + else + mw.GameSavesData.Statistics[(gint)"stat_say_exp_d"]++; + } + if (say.Likability != 0) + { + if (say.Likability > 0) + mw.GameSavesData.Statistics[(gint)"stat_say_like_p"]++; + else + mw.GameSavesData.Statistics[(gint)"stat_say_like_d"]++; + } + if(say.Money != 0) + { + if (say.Money > 0) + mw.GameSavesData.Statistics[(gint)"stat_say_money_p"]++; + else + mw.GameSavesData.Statistics[(gint)"stat_say_money_d"]++; + } mw.Main.Core.Save.EatFood(say); mw.Main.Core.Save.Money += say.Money; @@ -136,7 +160,7 @@ namespace VPet_Simulator.Windows break; } } - } + } RelsSelect(); } }