mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
统计&成就系统
This commit is contained in:
parent
8eddd5b318
commit
0e760c9585
@ -123,6 +123,7 @@ namespace VPet_Simulator.Core
|
||||
if (!DisplayStop(EndAction))
|
||||
EndAction?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 尝试触发移动
|
||||
/// </summary>
|
||||
@ -146,6 +147,10 @@ namespace VPet_Simulator.Core
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 当发生摸头时触发改方法
|
||||
/// </summary>
|
||||
public event Action Event_TouchHead;
|
||||
/// <summary>
|
||||
/// 显示摸头情况
|
||||
/// </summary>
|
||||
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)));
|
||||
}
|
||||
/// <summary>
|
||||
/// 当发生摸身体时触发改方法
|
||||
/// </summary>
|
||||
public event Action Event_TouchBody;
|
||||
/// <summary>
|
||||
/// 显示摸身体情况
|
||||
/// </summary>
|
||||
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)));
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -14,43 +14,43 @@ namespace VPet_Simulator.Core
|
||||
/// 宠物名字
|
||||
/// </summary>
|
||||
[Line(name: "name")]
|
||||
public string Name { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金钱
|
||||
/// </summary>
|
||||
[Line(Type = LPSConvert.ConvertType.ToFloat, Name = "money")]
|
||||
public double Money { get; set; }
|
||||
public virtual double Money { get; set; }
|
||||
/// <summary>
|
||||
/// 经验值
|
||||
/// </summary>
|
||||
[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; }
|
||||
/// <summary>
|
||||
/// 等级
|
||||
/// </summary>
|
||||
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;
|
||||
/// <summary>
|
||||
/// 升级所需经验值
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int LevelUpNeed() => (int)(Math.Pow((Level) * 10, 2));
|
||||
public virtual int LevelUpNeed() => (int)(Math.Pow((Level) * 10, 2));
|
||||
/// <summary>
|
||||
/// 体力 0-100
|
||||
/// </summary>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// 待补充的体力,随着时间缓慢加给桌宠
|
||||
/// </summary>//让游戏更有游戏性
|
||||
[Line(Type = LPSConvert.ConvertType.ToFloat)]
|
||||
[Line(Type = LPSConvert.ConvertType.ToFloat, IgnoreCase = true)]
|
||||
public double StoreStrength { get; set; }
|
||||
/// <summary>
|
||||
/// 变化 体力
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// 饱腹度
|
||||
/// </summary>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// 待补充的饱腹度,随着时间缓慢加给桌宠
|
||||
/// </summary>//让游戏更有游戏性
|
||||
[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
|
||||
/// <summary>
|
||||
/// 口渴度
|
||||
/// </summary>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// 待补充的口渴度,随着时间缓慢加给桌宠
|
||||
/// </summary>//让游戏更有游戏性
|
||||
[Line(Type = LPSConvert.ConvertType.ToFloat)]
|
||||
public double StoreStrengthDrink { get; set; }
|
||||
public virtual double StoreStrengthDrink { get; set; }
|
||||
/// <summary>
|
||||
/// 变化 口渴度
|
||||
/// </summary>
|
||||
@ -125,7 +125,7 @@ namespace VPet_Simulator.Core
|
||||
/// <summary>
|
||||
/// 心情
|
||||
/// </summary>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// 待补充的心情,随着时间缓慢加给桌宠
|
||||
/// </summary>//让游戏更有游戏性
|
||||
@ -153,7 +153,7 @@ namespace VPet_Simulator.Core
|
||||
/// 变化 心情
|
||||
/// </summary>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// 好感度(隐藏)(累加值)
|
||||
/// </summary>
|
||||
@ -185,7 +185,7 @@ namespace VPet_Simulator.Core
|
||||
}
|
||||
|
||||
[Line(Type = LPSConvert.ConvertType.ToFloat)]
|
||||
private double likability { get; set; }
|
||||
protected double likability { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 清除变化
|
||||
|
@ -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();
|
||||
}
|
||||
/// <summary>
|
||||
/// 统计数据信息
|
||||
/// </summary>
|
||||
public ILine Statistics;
|
||||
public Statistics Statistics;
|
||||
|
||||
//public Size WindowsSize
|
||||
//{
|
||||
@ -229,7 +235,7 @@ namespace VPet_Simulator.Windows.Interface
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算间隔
|
||||
/// 计算间隔 (秒)
|
||||
/// </summary>
|
||||
public double LogicInterval
|
||||
{
|
||||
|
132
VPet-Simulator.Windows.Interface/Statistics.cs
Normal file
132
VPet-Simulator.Windows.Interface/Statistics.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 统计
|
||||
/// </summary>
|
||||
public class Statistics : IGetOBJ<SetObject>
|
||||
{
|
||||
public Statistics(IEnumerable<ISub> subs)
|
||||
{
|
||||
AddRange(subs);
|
||||
}
|
||||
public void AddRange(IEnumerable<ISub> subs)
|
||||
{
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
Data.Add(sub.Name, sub.info);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 统计变化通知事件
|
||||
/// </summary>
|
||||
/// <param name="sender">发送的统计(this)</param>
|
||||
/// <param name="name">变动的名称</param>
|
||||
/// <param name="value">变动的值</param>
|
||||
public delegate void StatisticChangedEventHandler(Statistics sender, string name, SetObject value);
|
||||
|
||||
public event StatisticChangedEventHandler StatisticChanged;
|
||||
/// <summary>
|
||||
/// 统计数据字典
|
||||
/// </summary>
|
||||
public SortedDictionary<string, SetObject> Data = new SortedDictionary<string, SetObject>();
|
||||
|
||||
#region IGetOBJ<SetObject>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 输出统计数据
|
||||
/// </summary>
|
||||
public List<Sub> ToSubs()
|
||||
{
|
||||
List<Sub> subs = new List<Sub>();
|
||||
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
|
||||
}
|
||||
}
|
@ -122,6 +122,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Setting.cs" />
|
||||
<Compile Include="Source.cs" />
|
||||
<Compile Include="Statistics.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VPet-Simulator.Core\VPet-Simulator.Core.csproj">
|
||||
|
@ -58,6 +58,7 @@ namespace VPet_Simulator.Windows
|
||||
petHelper.ReloadLocation();
|
||||
}
|
||||
}
|
||||
//private DateTime timecount = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 保存设置
|
||||
/// </summary>
|
||||
@ -75,6 +76,8 @@ namespace VPet_Simulator.Windows
|
||||
List<string> list = new List<string>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Steam统计相关变化
|
||||
/// </summary>
|
||||
private void Statistics_StatisticChanged(Statistics sender, string name, SetObject value)
|
||||
{
|
||||
if (name.StartsWith("stat_"))
|
||||
{
|
||||
Steamworks.SteamUserStats.SetStat(name, (int)value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算统计数据
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user