mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
自动备份存档
This commit is contained in:
parent
11181f89b6
commit
0ff325cc1f
@ -20,7 +20,10 @@ namespace VPet_Simulator.Core
|
|||||||
/// 处理说话内容
|
/// 处理说话内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<string> OnSay;
|
public event Action<string> OnSay;
|
||||||
|
/// <summary>
|
||||||
|
/// 上次交互时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime LastInteractionTime { get; set; } = DateTime.Now;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 事件Timer
|
/// 事件Timer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -88,6 +91,11 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
Core.Save.CleanChange();
|
Core.Save.CleanChange();
|
||||||
Core.Save.StoreTake();
|
Core.Save.StoreTake();
|
||||||
|
double freedrop = (DateTime.Now - LastInteractionTime).TotalMinutes;
|
||||||
|
if (freedrop < 1)
|
||||||
|
freedrop = 0;
|
||||||
|
else
|
||||||
|
freedrop = Math.Sqrt(freedrop) * TimePass;
|
||||||
switch (State)
|
switch (State)
|
||||||
{
|
{
|
||||||
case WorkingState.Sleep:
|
case WorkingState.Sleep:
|
||||||
@ -98,10 +106,9 @@ namespace VPet_Simulator.Core
|
|||||||
if (Core.Save.StrengthFood >= 75)
|
if (Core.Save.StrengthFood >= 75)
|
||||||
Core.Save.Health += TimePass * 2;
|
Core.Save.Health += TimePass * 2;
|
||||||
}
|
}
|
||||||
else
|
Core.Save.StrengthChangeFood(-TimePass / 2);
|
||||||
lowStrengthFood();
|
Core.Save.StrengthChangeDrink(-TimePass / 2);
|
||||||
Core.Save.StrengthChangeFood(-TimePass);
|
Core.Save.FeelingChange(-freedrop / 2);
|
||||||
Core.Save.StrengthChangeDrink(-TimePass);
|
|
||||||
break;
|
break;
|
||||||
case WorkingState.WorkONE:
|
case WorkingState.WorkONE:
|
||||||
//工作
|
//工作
|
||||||
@ -129,8 +136,9 @@ namespace VPet_Simulator.Core
|
|||||||
Core.Save.Money += addmoney;
|
Core.Save.Money += addmoney;
|
||||||
WorkTimer.GetCount += addmoney;
|
WorkTimer.GetCount += addmoney;
|
||||||
}
|
}
|
||||||
Core.Save.StrengthChangeFood(-TimePass * 4);
|
Core.Save.StrengthChangeFood(-TimePass * 3.5);
|
||||||
Core.Save.StrengthChangeDrink(-TimePass * 3);
|
Core.Save.StrengthChangeDrink(-TimePass * 2.5);
|
||||||
|
Core.Save.FeelingChange(-freedrop * 1.5);
|
||||||
break;
|
break;
|
||||||
case WorkingState.WorkTWO:
|
case WorkingState.WorkTWO:
|
||||||
//工作2 更加消耗体力
|
//工作2 更加消耗体力
|
||||||
@ -157,8 +165,9 @@ namespace VPet_Simulator.Core
|
|||||||
Core.Save.Money += addmoney;
|
Core.Save.Money += addmoney;
|
||||||
WorkTimer.GetCount += addmoney;
|
WorkTimer.GetCount += addmoney;
|
||||||
}
|
}
|
||||||
Core.Save.StrengthChangeFood(-TimePass * 5);
|
Core.Save.StrengthChangeFood(-TimePass * 4.5);
|
||||||
Core.Save.StrengthChangeDrink(-TimePass * 8);
|
Core.Save.StrengthChangeDrink(-TimePass * 7.5);
|
||||||
|
Core.Save.FeelingChange(-freedrop * 2.5);
|
||||||
break;
|
break;
|
||||||
case WorkingState.Study:
|
case WorkingState.Study:
|
||||||
//学习
|
//学习
|
||||||
@ -188,6 +197,7 @@ namespace VPet_Simulator.Core
|
|||||||
}
|
}
|
||||||
Core.Save.StrengthChangeFood(-TimePass * 3);
|
Core.Save.StrengthChangeFood(-TimePass * 3);
|
||||||
Core.Save.StrengthChangeDrink(-TimePass * 4);
|
Core.Save.StrengthChangeDrink(-TimePass * 4);
|
||||||
|
Core.Save.FeelingChange(-freedrop * 3);
|
||||||
goto default;
|
goto default;
|
||||||
default://默认
|
default://默认
|
||||||
//饮食等乱七八糟的消耗
|
//饮食等乱七八糟的消耗
|
||||||
@ -201,8 +211,9 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
Core.Save.Health -= Function.Rnd.Next(0, 1) * TimePass;
|
Core.Save.Health -= Function.Rnd.Next(0, 1) * TimePass;
|
||||||
}
|
}
|
||||||
Core.Save.StrengthChangeFood(-TimePass * 2);
|
Core.Save.StrengthChangeFood(-TimePass * 1.5);
|
||||||
Core.Save.StrengthChangeDrink(-TimePass * 2);
|
Core.Save.StrengthChangeDrink(-TimePass * 1.5);
|
||||||
|
Core.Save.FeelingChange(-freedrop);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ namespace VPet_Simulator.Windows
|
|||||||
//游戏存档
|
//游戏存档
|
||||||
if (Set != null)
|
if (Set != null)
|
||||||
{
|
{
|
||||||
|
var st = Set.Statistics[(gint)"savetimes"]++;
|
||||||
if (Main != null)
|
if (Main != null)
|
||||||
{
|
{
|
||||||
Set.VoiceVolume = Main.PlayVoiceVolume;
|
Set.VoiceVolume = Main.PlayVoiceVolume;
|
||||||
@ -62,12 +63,21 @@ namespace VPet_Simulator.Windows
|
|||||||
Foods.FindAll(x => x.Star).ForEach(x => list.Add(x.Name));
|
Foods.FindAll(x => x.Star).ForEach(x => list.Add(x.Name));
|
||||||
Set["betterbuy"]["star"].info = string.Join(",", list);
|
Set["betterbuy"]["star"].info = string.Join(",", list);
|
||||||
}
|
}
|
||||||
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString());
|
|
||||||
}
|
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps"))
|
||||||
if (Core != null && Core.Save != null)
|
{
|
||||||
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", Core.Save.ToLine().ToString());
|
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString());
|
||||||
if (CGPTClient != null)
|
var ds = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\UserData");
|
||||||
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json", CGPTClient.Save());
|
if (ds.Length > 20)
|
||||||
|
File.Delete(ds[0]);
|
||||||
|
|
||||||
|
File.Move(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps");
|
||||||
|
if (Core != null && Core.Save != null)
|
||||||
|
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", Core.Save.ToLine().ToString());
|
||||||
|
if (CGPTClient != null)
|
||||||
|
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json", CGPTClient.Save());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重载DIY按钮区域
|
/// 重载DIY按钮区域
|
||||||
|
Loading…
Reference in New Issue
Block a user