新版本游戏储存

This commit is contained in:
ZouJin 2023-12-12 16:06:49 +08:00
parent 6ca3f6bb6d
commit aad5266c5a
3 changed files with 27 additions and 20 deletions

View File

@ -14,30 +14,33 @@ namespace VPet_Simulator.Core
/// 宠物名字 /// 宠物名字
/// </summary> /// </summary>
[Line(name: "name")] [Line(name: "name")]
public virtual string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 金钱 /// 金钱
/// </summary> /// </summary>
[Line(Type = LPSConvert.ConvertType.ToFloat, Name = "money")] [Line(Type = LPSConvert.ConvertType.ToFloat, Name = "money")]
public virtual double Money { get; set; } public double Money { get; set; }
/// <summary> /// <summary>
/// 经验值 /// 经验值
/// </summary> /// </summary>
[Line(type: LPSConvert.ConvertType.ToFloat, name: "exp")] public virtual double Exp { get; set; } [Line(type: LPSConvert.ConvertType.ToFloat, name: "exp")] public double Exp { get; set; }
/// <summary> /// <summary>
/// 等级 /// 等级
/// </summary> /// </summary>
public virtual int Level => Exp < 0 ? 1 : (int)(Math.Sqrt(Exp) / 10) + 1; public int Level => Exp < 0 ? 1 : (int)(Math.Sqrt(Exp) / 10) + 1;
/// <summary> /// <summary>
/// 升级所需经验值 /// 升级所需经验值
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual int LevelUpNeed() => (int)(Math.Pow((Level) * 10, 2)); public int LevelUpNeed() => (int)(Math.Pow((Level) * 10, 2));
/// <summary> /// <summary>
/// 体力 0-100 /// 体力 0-100
/// </summary> /// </summary>
public virtual double Strength { get => strength; set => strength = Math.Min(100, Math.Max(0, value)); } public double Strength { get => strength; set => strength = Math.Min(StrengthMax, Math.Max(0, value)); }
public double StrengthMax { get;} = 100;
[Line(Type = LPSConvert.ConvertType.ToFloat, IgnoreCase = true)] [Line(Type = LPSConvert.ConvertType.ToFloat, IgnoreCase = true)]
protected double strength { get; set; } protected double strength { get; set; }
/// <summary> /// <summary>
@ -48,8 +51,8 @@ namespace VPet_Simulator.Core
/// <summary> /// <summary>
/// 变化 体力 /// 变化 体力
/// </summary> /// </summary>
public double ChangeStrength = 0; public double ChangeStrength { get; set; } = 0;
public virtual void StrengthChange(double value) public void StrengthChange(double value)
{ {
ChangeStrength += value; ChangeStrength += value;
Strength += value; Strength += value;
@ -57,7 +60,7 @@ namespace VPet_Simulator.Core
/// <summary> /// <summary>
/// 饱腹度 /// 饱腹度
/// </summary> /// </summary>
public virtual double StrengthFood public double StrengthFood
{ {
get => strengthFood; set get => strengthFood; set
{ {
@ -77,8 +80,8 @@ namespace VPet_Simulator.Core
/// 待补充的饱腹度,随着时间缓慢加给桌宠 /// 待补充的饱腹度,随着时间缓慢加给桌宠
/// </summary>//让游戏更有游戏性 /// </summary>//让游戏更有游戏性
[Line(Type = LPSConvert.ConvertType.ToFloat)] [Line(Type = LPSConvert.ConvertType.ToFloat)]
public virtual double StoreStrengthFood { get; set; } public double StoreStrengthFood { get; set; }
public virtual void StrengthChangeFood(double value) public void StrengthChangeFood(double value)
{ {
ChangeStrengthFood += value; ChangeStrengthFood += value;
StrengthFood += value; StrengthFood += value;
@ -86,11 +89,11 @@ namespace VPet_Simulator.Core
/// <summary> /// <summary>
/// 变化 食物 /// 变化 食物
/// </summary> /// </summary>
public double ChangeStrengthFood = 0; public double ChangeStrengthFood { get; set; } = 0;
/// <summary> /// <summary>
/// 口渴度 /// 口渴度
/// </summary> /// </summary>
public virtual double StrengthDrink public double StrengthDrink
{ {
get => strengthDrink; set get => strengthDrink; set
{ {
@ -111,11 +114,11 @@ namespace VPet_Simulator.Core
/// 待补充的口渴度,随着时间缓慢加给桌宠 /// 待补充的口渴度,随着时间缓慢加给桌宠
/// </summary>//让游戏更有游戏性 /// </summary>//让游戏更有游戏性
[Line(Type = LPSConvert.ConvertType.ToFloat)] [Line(Type = LPSConvert.ConvertType.ToFloat)]
public virtual double StoreStrengthDrink { get; set; } public double StoreStrengthDrink { get; set; }
/// <summary> /// <summary>
/// 变化 口渴度 /// 变化 口渴度
/// </summary> /// </summary>
public double ChangeStrengthDrink = 0; public double ChangeStrengthDrink { get; set; } = 0;
public void StrengthChangeDrink(double value) public void StrengthChangeDrink(double value)
{ {
ChangeStrengthDrink += value; ChangeStrengthDrink += value;
@ -124,7 +127,7 @@ namespace VPet_Simulator.Core
/// <summary> /// <summary>
/// 心情 /// 心情
/// </summary> /// </summary>
public virtual double Feeling public double Feeling
{ {
get => feeling; set get => feeling; set
{ {
@ -152,7 +155,7 @@ namespace VPet_Simulator.Core
/// 变化 心情 /// 变化 心情
/// </summary> /// </summary>
public double ChangeFeeling = 0; public double ChangeFeeling = 0;
public virtual void FeelingChange(double value) public void FeelingChange(double value)
{ {
ChangeFeeling += value; ChangeFeeling += value;
Feeling += value; Feeling += value;

View File

@ -38,7 +38,7 @@ namespace VPet_Simulator.Core
/// <summary> /// <summary>
/// 最大体力值 /// 最大体力值
/// </summary> /// </summary>
double StrengthMax { get; set; } double StrengthMax { get;}
/// <summary> /// <summary>
/// 待补充的体力,随着时间缓慢加给桌宠 /// 待补充的体力,随着时间缓慢加给桌宠
/// </summary>//让游戏更有游戏性 /// </summary>//让游戏更有游戏性
@ -109,7 +109,7 @@ namespace VPet_Simulator.Core
/// <summary> /// <summary>
/// 好感度(隐藏)(最大值) /// 好感度(隐藏)(最大值)
/// </summary> /// </summary>
double LikabilityMax { get; set; } double LikabilityMax { get;}
/// <summary> /// <summary>
/// 清除变化 /// 清除变化
@ -125,6 +125,10 @@ namespace VPet_Simulator.Core
/// <param name="food">食物类</param> /// <param name="food">食物类</param>
void EatFood(IFood food); void EatFood(IFood food);
/// <summary> /// <summary>
/// 宠物当前状态
/// </summary>
ModeType Mode { get; set; }
/// <summary>
/// 宠物状态模式 /// 宠物状态模式
/// </summary> /// </summary>
public enum ModeType public enum ModeType

View File

@ -1,4 +1,4 @@
chcp 65001 chcp 65001
mklink /d "%~dp0\bin\x64\Debug\net462\mod" "%~dp0\mod" mklink /d "%~dp0\bin\x64\Debug\net462\mod" "%~dp0\mod"