为新成就准备的新统计数据

This commit is contained in:
ZouJin 2023-09-24 23:35:49 +08:00
parent c82155f3d5
commit b162309c58
4 changed files with 82 additions and 6 deletions

View File

@ -41,6 +41,39 @@ namespace VPet_Simulator.Core
/// </summary>
public DateTime StartTime;
/// <summary>
/// 任务完成时调用该参数
/// </summary>
public event Action<FinishWorkInfo> E_FinishWork;
/// <summary>
/// 完成工作信息
/// </summary>
public struct FinishWorkInfo
{
/// <summary>
/// 当前完成工作
/// </summary>
public Work work;
/// <summary>
/// 当前完成工作收入
/// </summary>
public double count;
/// <summary>
/// 当前完成工作花费时间
/// </summary>
public double spendtime;
/// <summary>
/// 完成工作信息
/// </summary>
/// <param name="work">当前工作</param>
/// <param name="count">当前盈利(自动计算附加)</param>
public FinishWorkInfo(Work work, double count)
{
this.work = work;
this.count = count * (1 + work.FinishBonus);
this.spendtime = work.Time;
}
}
/// <summary>
/// UI相关显示
/// </summary>
/// <param name="m"></param>
@ -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;
}

View File

@ -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

View File

@ -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()
{

View File

@ -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;