diff --git a/VPet-Simulator.Core/Display/MainDisplay.cs b/VPet-Simulator.Core/Display/MainDisplay.cs
index 31f77c3..f9e63f1 100644
--- a/VPet-Simulator.Core/Display/MainDisplay.cs
+++ b/VPet-Simulator.Core/Display/MainDisplay.cs
@@ -123,6 +123,7 @@ namespace VPet_Simulator.Core
if (!DisplayStop(EndAction))
EndAction?.Invoke();
}
+
///
/// 尝试触发移动
///
@@ -146,6 +147,10 @@ namespace VPet_Simulator.Core
return false;
}
///
+ /// 当发生摸头时触发改方法
+ ///
+ public event Action Event_TouchHead;
+ ///
/// 显示摸头情况
///
public void DisplayTouchHead()
@@ -173,11 +178,16 @@ namespace VPet_Simulator.Core
return;
}
}
+ Event_TouchHead?.Invoke();
Display(GraphType.Touch_Head, AnimatType.A_Start, (graphname) =>
Display(graphname, AnimatType.B_Loop, (graphname) =>
DisplayCEndtoNomal(graphname)));
}
///
+ /// 当发生摸身体时触发改方法
+ ///
+ public event Action Event_TouchBody;
+ ///
/// 显示摸身体情况
///
public void DisplayTouchBody()
@@ -205,6 +215,7 @@ namespace VPet_Simulator.Core
return;
}
}
+ Event_TouchBody?.Invoke();
Display(GraphType.Touch_Body, AnimatType.A_Start, (graphname) =>
Display(graphname, AnimatType.B_Loop, (graphname) =>
DisplayCEndtoNomal(graphname)));
diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs
index 0b5d1b5..7ce363f 100644
--- a/VPet-Simulator.Core/Display/MainLogic.cs
+++ b/VPet-Simulator.Core/Display/MainLogic.cs
@@ -264,7 +264,7 @@ namespace VPet_Simulator.Core
//TODO:切换显示动画
Core.Save.Mode = newmod;
//看情况播放停止工作动画
- if (newmod == GameSave.ModeType.Ill && (State != WorkingState.Nomal || State != WorkingState.Sleep))
+ if (newmod == GameSave.ModeType.Ill && State != WorkingState.Nomal && State != WorkingState.Sleep)
{
WorkTimer.Stop();
}
diff --git a/VPet-Simulator.Core/Handle/GameSave.cs b/VPet-Simulator.Core/Handle/GameSave.cs
index 92c76a4..e67d9b6 100644
--- a/VPet-Simulator.Core/Handle/GameSave.cs
+++ b/VPet-Simulator.Core/Handle/GameSave.cs
@@ -14,43 +14,43 @@ namespace VPet_Simulator.Core
/// 宠物名字
///
[Line(name: "name")]
- public string Name { get; set; }
+ public virtual string Name { get; set; }
///
/// 金钱
///
[Line(Type = LPSConvert.ConvertType.ToFloat, Name = "money")]
- public double Money { get; set; }
+ public virtual double Money { get; set; }
///
/// 经验值
///
- [Line(type: LPSConvert.ConvertType.ToFloat, name: "exp")] public double Exp { get; set; }
+ [Line(type: LPSConvert.ConvertType.ToFloat, name: "exp")] public virtual double Exp { get; set; }
///
/// 等级
///
- public int Level => Exp < 0 ? 1 : (int)(Math.Sqrt(Exp) / 10) + 1;
-
+ public virtual int Level => Exp < 0 ? 1 : (int)(Math.Sqrt(Exp) / 10) + 1;
+ private int level = -1;
///
/// 升级所需经验值
///
///
- public int LevelUpNeed() => (int)(Math.Pow((Level) * 10, 2));
+ public virtual int LevelUpNeed() => (int)(Math.Pow((Level) * 10, 2));
///
/// 体力 0-100
///
- public double Strength { get => strength; set => strength = Math.Min(100, Math.Max(0, value)); }
- [Line(Type = LPSConvert.ConvertType.ToFloat)]
- private double strength { get; set; }
+ public virtual double Strength { get => strength; set => strength = Math.Min(100, Math.Max(0, value)); }
+ [Line(Type = LPSConvert.ConvertType.ToFloat, IgnoreCase = true)]
+ protected double strength { get; set; }
///
/// 待补充的体力,随着时间缓慢加给桌宠
/// //让游戏更有游戏性
- [Line(Type = LPSConvert.ConvertType.ToFloat)]
+ [Line(Type = LPSConvert.ConvertType.ToFloat, IgnoreCase = true)]
public double StoreStrength { get; set; }
///
/// 变化 体力
///
public double ChangeStrength = 0;
- public void StrengthChange(double value)
+ public virtual void StrengthChange(double value)
{
ChangeStrength += value;
Strength += value;
@@ -58,7 +58,7 @@ namespace VPet_Simulator.Core
///
/// 饱腹度
///
- public double StrengthFood
+ public virtual double StrengthFood
{
get => strengthFood; set
{
@@ -73,13 +73,13 @@ namespace VPet_Simulator.Core
}
}
[Line(Type = LPSConvert.ConvertType.ToFloat)]
- private double strengthFood { get; set; }
+ protected double strengthFood { get; set; }
///
/// 待补充的饱腹度,随着时间缓慢加给桌宠
/// //让游戏更有游戏性
[Line(Type = LPSConvert.ConvertType.ToFloat)]
- public double StoreStrengthFood { get; set; }
- public void StrengthChangeFood(double value)
+ public virtual double StoreStrengthFood { get; set; }
+ public virtual void StrengthChangeFood(double value)
{
ChangeStrengthFood += value;
StrengthFood += value;
@@ -91,7 +91,7 @@ namespace VPet_Simulator.Core
///
/// 口渴度
///
- public double StrengthDrink
+ public virtual double StrengthDrink
{
get => strengthDrink; set
{
@@ -107,12 +107,12 @@ namespace VPet_Simulator.Core
}
[Line(Type = LPSConvert.ConvertType.ToFloat)]
- private double strengthDrink { get; set; }
+ protected double strengthDrink { get; set; }
///
/// 待补充的口渴度,随着时间缓慢加给桌宠
/// //让游戏更有游戏性
[Line(Type = LPSConvert.ConvertType.ToFloat)]
- public double StoreStrengthDrink { get; set; }
+ public virtual double StoreStrengthDrink { get; set; }
///
/// 变化 口渴度
///
@@ -125,7 +125,7 @@ namespace VPet_Simulator.Core
///
/// 心情
///
- public double Feeling
+ public virtual double Feeling
{
get => feeling; set
{
@@ -143,7 +143,7 @@ namespace VPet_Simulator.Core
}
[Line(Type = LPSConvert.ConvertType.ToFloat)]
- private double feeling { get; set; }
+ protected double feeling { get; set; }
///
/// 待补充的心情,随着时间缓慢加给桌宠
/// //让游戏更有游戏性
@@ -153,7 +153,7 @@ namespace VPet_Simulator.Core
/// 变化 心情
///
public double ChangeFeeling = 0;
- public void FeelingChange(double value)
+ public virtual void FeelingChange(double value)
{
ChangeFeeling += value;
Feeling += value;
@@ -164,7 +164,7 @@ namespace VPet_Simulator.Core
public double Health { get => health; set => health = Math.Min(100, Math.Max(0, value)); }
[Line(Type = LPSConvert.ConvertType.ToFloat)]
- private double health { get; set; }
+ protected double health { get; set; }
///
/// 好感度(隐藏)(累加值)
///
@@ -185,7 +185,7 @@ namespace VPet_Simulator.Core
}
[Line(Type = LPSConvert.ConvertType.ToFloat)]
- private double likability { get; set; }
+ protected double likability { get; set; }
///
/// 清除变化
diff --git a/VPet-Simulator.Windows.Interface/Setting.cs b/VPet-Simulator.Windows.Interface/Setting.cs
index d77b256..3974609 100644
--- a/VPet-Simulator.Windows.Interface/Setting.cs
+++ b/VPet-Simulator.Windows.Interface/Setting.cs
@@ -1,6 +1,7 @@
using LinePutScript;
using LinePutScript.Dictionary;
using System;
+using System.Collections.ObjectModel;
using System.Windows;
using VPet_Simulator.Core;
@@ -32,12 +33,17 @@ namespace VPet_Simulator.Windows.Interface
allowmove = !this["gameconfig"].GetBool("allowmove");
smartmove = this["gameconfig"].GetBool("smartmove");
enablefunction = !this["gameconfig"].GetBool("nofunction");
- Statistics = this["statistics"];
+ Statistics = new Statistics(this["statistics"].ToList());
+ }
+ public override string ToString()
+ {
+ this["statistics"] = new Line("statistics", "", "", Statistics.ToSubs().ToArray());
+ return base.ToString();
}
///
/// 统计数据信息
///
- public ILine Statistics;
+ public Statistics Statistics;
//public Size WindowsSize
//{
@@ -229,7 +235,7 @@ namespace VPet_Simulator.Windows.Interface
}
}
///
- /// 计算间隔
+ /// 计算间隔 (秒)
///
public double LogicInterval
{
diff --git a/VPet-Simulator.Windows.Interface/Statistics.cs b/VPet-Simulator.Windows.Interface/Statistics.cs
new file mode 100644
index 0000000..c3f9946
--- /dev/null
+++ b/VPet-Simulator.Windows.Interface/Statistics.cs
@@ -0,0 +1,132 @@
+using LinePutScript;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VPet_Simulator.Windows.Interface
+{
+ ///
+ /// 统计
+ ///
+ public class Statistics : IGetOBJ
+ {
+ public Statistics(IEnumerable subs)
+ {
+ AddRange(subs);
+ }
+ public void AddRange(IEnumerable subs)
+ {
+ foreach (var sub in subs)
+ {
+ Data.Add(sub.Name, sub.info);
+ }
+ }
+ ///
+ /// 统计变化通知事件
+ ///
+ /// 发送的统计(this)
+ /// 变动的名称
+ /// 变动的值
+ public delegate void StatisticChangedEventHandler(Statistics sender, string name, SetObject value);
+
+ public event StatisticChangedEventHandler StatisticChanged;
+ ///
+ /// 统计数据字典
+ ///
+ public SortedDictionary Data = new SortedDictionary();
+
+ #region IGetOBJ
+ public DateTime this[gdat subName]
+ {
+ get => GetDateTime((string)subName);
+ set => SetDateTime((string)subName, value);
+ }
+ public double this[gflt subName]
+ {
+ get => GetFloat((string)subName);
+ set => SetFloat((string)subName, value);
+ }
+ public double this[gdbe subName]
+ {
+ get => GetDouble((string)subName);
+ set => SetDouble((string)subName, value);
+ }
+ public long this[gi64 subName]
+ {
+ get => GetInt64((string)subName);
+ set => SetInt64((string)subName, value);
+ }
+ public int this[gint subName]
+ {
+ get => GetInt((string)subName);
+ set => SetInt((string)subName, value);
+ }
+ public bool this[gbol subName]
+ {
+ get => GetBool((string)subName);
+ set => SetBool((string)subName, value);
+ }
+ public string this[gstr subName]
+ {
+ get => GetString((string)subName);
+ set => SetString((string)subName, value);
+ }
+ public SetObject this[string subName] { get => Find(subName) ?? new SetObject(); set => Set(subName, value); }
+ public SetObject Find(string subName)
+ {
+ if (Data.TryGetValue(subName, out SetObject value))
+ return value;
+ else
+ return null;
+ }
+ public void Set(string subName, SetObject value)
+ {
+ StatisticChanged?.Invoke(this, subName, value);
+ Data[subName] = value;
+ }
+ ///
+ /// 输出统计数据
+ ///
+ public List ToSubs()
+ {
+ List subs = new List();
+ foreach (var item in Data)
+ {
+ subs.Add(new Sub(item.Key, item.Value));
+ }
+ return subs;
+ }
+
+ public bool GetBool(string subName) => Find(subName)?.GetBoolean() ?? false;
+
+ public void SetBool(string subName, bool value) => Set(subName, value);
+
+ public int GetInt(string subName, int defaultvalue = 0) => Find(subName)?.GetInteger() ?? defaultvalue;
+
+ public void SetInt(string subName, int value) => Set(subName, value);
+
+ public long GetInt64(string subName, long defaultvalue = 0) => Find(subName)?.GetInteger64() ?? defaultvalue;
+
+ public void SetInt64(string subName, long value) => Set(subName, value);
+
+ public double GetFloat(string subName, double defaultvalue = 0) => Find(subName)?.GetFloat() ?? defaultvalue;
+
+ public void SetFloat(string subName, double value) => Set(subName, value);
+
+ public DateTime GetDateTime(string subName, DateTime defaultvalue = default) => Find(subName)?.GetDateTime() ?? defaultvalue;
+
+ public void SetDateTime(string subName, DateTime value) => Set(subName, value);
+
+ public string GetString(string subName, string defaultvalue = null) => Find(subName)?.GetString() ?? defaultvalue;
+
+ public void SetString(string subName, string value) => Set(subName, value);
+
+ public double GetDouble(string subName, double defaultvalue = 0) => Find(subName)?.GetDouble() ?? defaultvalue;
+
+ public void SetDouble(string subName, double value) => Set(subName, value);
+ #endregion
+ }
+}
diff --git a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj
index 4eace35..09c36b8 100644
--- a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj
+++ b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj
@@ -122,6 +122,7 @@
+
diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs
index d88735b..41e03aa 100644
--- a/VPet-Simulator.Windows/MainWindow.cs
+++ b/VPet-Simulator.Windows/MainWindow.cs
@@ -58,6 +58,7 @@ namespace VPet_Simulator.Windows
petHelper.ReloadLocation();
}
}
+ //private DateTime timecount = DateTime.Now;
///
/// 保存设置
///
@@ -75,6 +76,8 @@ namespace VPet_Simulator.Windows
List list = new List();
Foods.FindAll(x => x.Star).ForEach(x => list.Add(x.Name));
Set["betterbuy"]["star"].info = string.Join(",", list);
+ //Set.Statistics[(gint)"stat_time"] = (int)(DateTime.Now - timecount).TotalMinutes;
+ //timecount = DateTime.Now;
}
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString());
@@ -171,22 +174,23 @@ namespace VPet_Simulator.Windows
{
lowstrengthAskCountFood = Set.InteractionCycle;
var like = Core.Save.Likability < 40 ? 0 : (Core.Save.Likability < 70 ? 1 : (Core.Save.Likability < 100 ? 2 : 3));
- var txt = LowFoodText.FindAll(x => x.Mode == LowText.ModeType.H && (int)x.Like < like);
- if (Core.Save.StrengthFood > 60)
- {
- txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L);
- Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
- }
- else if (Core.Save.StrengthFood > 40)
- {
- txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M);
- Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
- }
- else
- {
- txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S);
- Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
- }
+ var txt = LowFoodText.FindAll(x => x.Mode == LowText.ModeType.H && (int)x.Like <= like);
+ if (txt.Count != 0)
+ if (Core.Save.StrengthFood > 60)
+ {
+ txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L);
+ Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
+ }
+ else if (Core.Save.StrengthFood > 40)
+ {
+ txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M);
+ Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
+ }
+ else
+ {
+ txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S);
+ Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
+ }
Main.DisplayStopForce(() => Main.Display(GraphType.Switch_Hunger, AnimatType.Single, Main.DisplayToNomal));
return;
}
@@ -194,22 +198,23 @@ namespace VPet_Simulator.Windows
{
lowstrengthAskCountDrink = Set.InteractionCycle;
var like = Core.Save.Likability < 40 ? 0 : (Core.Save.Likability < 70 ? 1 : (Core.Save.Likability < 100 ? 2 : 3));
- var txt = LowDrinkText.FindAll(x => x.Mode == LowText.ModeType.H && (int)x.Like < like);
- if (Core.Save.StrengthDrink > 60)
- {
- txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L);
- Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
- }
- else if (Core.Save.StrengthDrink > 40)
- {
- txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M);
- Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
- }
- else
- {
- txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S);
- Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
- }
+ var txt = LowDrinkText.FindAll(x => x.Mode == LowText.ModeType.H && (int)x.Like <= like);
+ if (txt.Count != 0)
+ if (Core.Save.StrengthDrink > 60)
+ {
+ txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L);
+ Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
+ }
+ else if (Core.Save.StrengthDrink > 40)
+ {
+ txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M);
+ Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
+ }
+ else
+ {
+ txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S);
+ Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText);
+ }
Main.DisplayStopForce(() => Main.Display(GraphType.Switch_Thirsty, AnimatType.Single, Main.DisplayToNomal));
return;
}
@@ -300,5 +305,73 @@ namespace VPet_Simulator.Windows
break;
}
}
+ ///
+ /// Steam统计相关变化
+ ///
+ private void Statistics_StatisticChanged(Statistics sender, string name, SetObject value)
+ {
+ if (name.StartsWith("stat_"))
+ {
+ Steamworks.SteamUserStats.SetStat(name, (int)value);
+ }
+ }
+ ///
+ /// 计算统计数据
+ ///
+ private void StatisticsCalHandle()
+ {
+ var stat = Set.Statistics;
+ var save = Core.Save;
+ stat["stat_money"] = save.Money;
+ stat["stat_level"] = save.Level;
+ stat["stat_likability"] = save.Likability;
+
+ stat[(gi64)"stat_total_time"] += (int)Set.LogicInterval;
+ switch (Main.State)
+ {
+ case Main.WorkingState.Work:
+ if (Core.Graph.GraphConfig.Works[Main.StateID].Type == GraphHelper.Work.WorkType.Work)
+ stat[(gi64)"stat_work_time"] += (int)Set.LogicInterval;
+ else
+ stat[(gi64)"stat_study_time"] += (int)Set.LogicInterval;
+ break;
+ case Main.WorkingState.Sleep:
+ stat[(gi64)"stat_work_time"] += (int)Set.LogicInterval;
+ break;
+ }
+ if (save.Mode == GameSave.ModeType.Ill)
+ {
+ if (save.Money < 10)
+ stat["stat_ill_nomoney"] = 1;
+ }
+ if (save.Money < save.Level)
+ {
+ stat["stat_level_g_money"] = 1;
+ }
+ if (save.Feeling < 1)
+ {
+ stat["stat_0_feel"] = 1;
+ if (save.StrengthDrink < 1)
+ stat["stat_0_f_sd"] = 1;
+ }
+ if (save.Strength < 1 && save.Feeling < 1 && save.StrengthFood < 1 && save.StrengthDrink < 1)
+ stat["stat_0_all"] = 1;
+ if (save.StrengthFood < 1)
+ stat["stat_0_strengthfood"] = 1;
+ if (save.StrengthDrink < 1)
+ {
+ stat["stat_0_strengthdrink"] = 1;
+ if (save.StrengthFood < 1)
+ stat["stat_0_sd_sf"] = 1;
+ }
+ if (save.Strength > 99 && save.Feeling > 99 && save.StrengthFood > 99 && save.StrengthDrink > 99)
+ stat[(gint)"stat_100_all"]++;
+
+ if (IsSteamUser)
+ {
+ Task.Run(Steamworks.SteamUserStats.StoreStats);
+ }
+ }
+
}
}
diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs
index f2605a0..e47d3b5 100644
--- a/VPet-Simulator.Windows/MainWindow.xaml.cs
+++ b/VPet-Simulator.Windows/MainWindow.xaml.cs
@@ -30,6 +30,8 @@ using static VPet_Simulator.Windows.PerformanceDesktopTransparentWindow;
using System.Windows.Shapes;
using Line = LinePutScript.Line;
using static VPet_Simulator.Core.GraphInfo;
+using LinePutScript.Converter;
+using System.Windows.Markup;
namespace VPet_Simulator.Windows
{
@@ -167,7 +169,7 @@ namespace VPet_Simulator.Windows
{
var latestsave = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\UserData")
.GetFiles("*.lps").OrderByDescending(x => x.LastWriteTime).FirstOrDefault();
- if(latestsave != null)
+ if (latestsave != null)
{
Core.Save = GameSave.Load(new Line(File.ReadAllText(latestsave.FullName)));
return;
@@ -267,6 +269,8 @@ namespace VPet_Simulator.Windows
if (IsSteamUser)
{
rndtext.Add("关注 {0} 谢谢喵".Translate(SteamClient.Name));
+ //Steam成就
+ Set.Statistics.StatisticChanged += Statistics_StatisticChanged;
}
else
{
@@ -330,6 +334,7 @@ namespace VPet_Simulator.Windows
}
};
Main.PlayVoiceVolume = Set.VoiceVolume;
+ Main.FunctionSpendHandle += StatisticsCalHandle;
DisplayGrid.Child = Main;
Task.Run(() =>
{
@@ -388,6 +393,8 @@ namespace VPet_Simulator.Windows
if (Set.PetHelper)
LoadPetHelper();
+
+
m_menu = new ContextMenu();
m_menu.MenuItems.Add(new MenuItem("鼠标穿透".Translate(), (x, y) => { SetTransparentHitThrough(); }) { });
m_menu.MenuItems.Add(new MenuItem("操作教程".Translate(), (x, y) => { Process.Start(AppDomain.CurrentDomain.BaseDirectory + @"\Tutorial.html"); }));
@@ -421,6 +428,13 @@ namespace VPet_Simulator.Windows
winSetting.Show();
};
+ //成就和统计
+ Set.Statistics[(gint)"stat_open_times"]++;
+ Main.MoveTimer.Elapsed += MoveTimer_Elapsed;
+ Main.OnSay += Main_OnSay;
+ Main.Event_TouchHead += Main_Event_TouchHead;
+ Main.Event_TouchBody += Main_Event_TouchBody;
+
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Tutorial.html") && Set["SingleTips"].GetDateTime("tutorial") <= new DateTime(2023, 6, 20))
{
Set["SingleTips"].SetDateTime("tutorial", DateTime.Now);
@@ -461,6 +475,26 @@ namespace VPet_Simulator.Windows
}
+ private void Main_Event_TouchBody()
+ {
+ Set.Statistics[(gint)"stat_touch_body"]++;
+ }
+
+ private void Main_Event_TouchHead()
+ {
+ Set.Statistics[(gint)"stat_touch_head"]++;
+ }
+
+ private void Main_OnSay(string obj)
+ {
+ Set.Statistics[(gint)"stat_say_times"]++;
+ }
+
+ private void MoveTimer_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ Set.Statistics[(gint)"stat_move_length"] += (int)(Math.Abs(Main.MoveTimerPoint.X) + Math.Abs(Main.MoveTimerPoint.Y));
+ }
+
private void AutoSaveTimer_Elapsed(object sender, ElapsedEventArgs e)
{
Save();
@@ -485,8 +519,11 @@ namespace VPet_Simulator.Windows
petHelper?.Close();
Main?.Dispose();
- notifyIcon.Visible = false;
- notifyIcon?.Dispose();
+ if(notifyIcon != null)
+ {
+ notifyIcon.Visible = false;
+ notifyIcon.Dispose();
+ }
System.Environment.Exit(0);
}
diff --git a/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs b/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs
index ad9a262..2446c89 100644
--- a/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs
+++ b/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs
@@ -1,4 +1,5 @@
using IWshRuntimeLibrary;
+using LinePutScript;
using LinePutScript.Localization.WPF;
using Panuon.WPF;
using Panuon.WPF.UI;
@@ -175,6 +176,33 @@ namespace VPet_Simulator.Windows
//开始加点
mw.Core.Save.EatFood(item);
mw.Core.Save.Money -= item.Price;
+ //统计
+ mw.Set.Statistics[(gint)("buy_" + item.Name)]++;
+ mw.Set.Statistics[(gdbe)"stat_betterbuy"] += item.Price;
+ switch (item.Type)
+ {
+ case Food.FoodType.Food:
+ mw.Set.Statistics[(gdbe)"stat_bb_food"] += item.Price;
+ break;
+ case Food.FoodType.Drink:
+ mw.Set.Statistics[(gdbe)"stat_bb_drink"] += item.Price;
+ break;
+ case Food.FoodType.Drug:
+ mw.Set.Statistics[(gdbe)"stat_bb_drug"] += item.Price;
+ break;
+ case Food.FoodType.Snack:
+ mw.Set.Statistics[(gdbe)"stat_bb_snack"] += item.Price;
+ break;
+ case Food.FoodType.Functional:
+ mw.Set.Statistics[(gdbe)"stat_bb_functional"] += item.Price;
+ break;
+ case Food.FoodType.Meal:
+ mw.Set.Statistics[(gdbe)"stat_bb_meal"] += item.Price;
+ break;
+ case Food.FoodType.Gift:
+ mw.Set.Statistics[(gdbe)"stat_bb_gift"] += item.Price;
+ break;
+ }
}
if (!_puswitch.IsChecked.Value)
TryClose();