mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
修改存档为可自定义接口
This commit is contained in:
parent
f13a2fd874
commit
a544a0ab88
@ -45,7 +45,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 如果不开启功能模式,默认状态设置
|
/// 如果不开启功能模式,默认状态设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameSave.ModeType NoFunctionMOD = GameSave.ModeType.Happy;
|
public IGameSave.ModeType NoFunctionMOD = IGameSave.ModeType.Happy;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否开始运行
|
/// 是否开始运行
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -145,7 +145,7 @@ namespace VPet_Simulator.Core
|
|||||||
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchBodyLocate, Core.Graph.GraphConfig.TouchBodySize, () => { DisplayTouchBody(); return true; }));
|
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchBodyLocate, Core.Graph.GraphConfig.TouchBodySize, () => { DisplayTouchBody(); return true; }));
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
GameSave.ModeType m = (GameSave.ModeType)i;
|
IGameSave.ModeType m = (IGameSave.ModeType)i;
|
||||||
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate[i], Core.Graph.GraphConfig.TouchRaisedSize[i],
|
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate[i], Core.Graph.GraphConfig.TouchRaisedSize[i],
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
|
@ -285,12 +285,12 @@ namespace VPet_Simulator.Core
|
|||||||
Core.Save.Mode = newmod;
|
Core.Save.Mode = newmod;
|
||||||
}
|
}
|
||||||
//看情况播放停止工作动画
|
//看情况播放停止工作动画
|
||||||
if (Core.Save.Mode == GameSave.ModeType.Ill && State == WorkingState.Work)
|
if (Core.Save.Mode == IGameSave.ModeType.Ill && State == WorkingState.Work)
|
||||||
{
|
{
|
||||||
WorkTimer.Stop();
|
WorkTimer.Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void playSwitchAnimat(GameSave.ModeType before, GameSave.ModeType after)
|
private void playSwitchAnimat(IGameSave.ModeType before, IGameSave.ModeType after)
|
||||||
{
|
{
|
||||||
if (!(DisplayType.Type == GraphType.Default || DisplayType.Type == GraphType.Switch_Down || DisplayType.Type == GraphType.Switch_Up))
|
if (!(DisplayType.Type == GraphType.Default || DisplayType.Type == GraphType.Switch_Down || DisplayType.Type == GraphType.Switch_Up))
|
||||||
{
|
{
|
||||||
@ -304,12 +304,12 @@ namespace VPet_Simulator.Core
|
|||||||
else if (before < after)
|
else if (before < after)
|
||||||
{
|
{
|
||||||
Display(Core.Graph.FindGraph(Core.Graph.FindName(GraphType.Switch_Down), AnimatType.Single, before),
|
Display(Core.Graph.FindGraph(Core.Graph.FindName(GraphType.Switch_Down), AnimatType.Single, before),
|
||||||
() => playSwitchAnimat((GameSave.ModeType)(((int)before) + 1), after));
|
() => playSwitchAnimat((IGameSave.ModeType)(((int)before) + 1), after));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Display(Core.Graph.FindGraph(Core.Graph.FindName(GraphType.Switch_Up), AnimatType.Single, before),
|
Display(Core.Graph.FindGraph(Core.Graph.FindName(GraphType.Switch_Up), AnimatType.Single, before),
|
||||||
() => playSwitchAnimat((GameSave.ModeType)(((int)before) - 1), after));
|
() => playSwitchAnimat((IGameSave.ModeType)(((int)before) - 1), after));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -153,7 +153,7 @@ namespace VPet_Simulator.Core
|
|||||||
public Func<Work, bool> WorkCheck;
|
public Func<Work, bool> WorkCheck;
|
||||||
public void StartWork(Work work)
|
public void StartWork(Work work)
|
||||||
{
|
{
|
||||||
if (!m.Core.Controller.EnableFunction || m.Core.Save.Mode != GameSave.ModeType.Ill)
|
if (!m.Core.Controller.EnableFunction || m.Core.Save.Mode != IGameSave.ModeType.Ill)
|
||||||
if (!m.Core.Controller.EnableFunction || m.Core.Save.Level >= work.LevelLimit)
|
if (!m.Core.Controller.EnableFunction || m.Core.Save.Level >= work.LevelLimit)
|
||||||
if (m.State == Main.WorkingState.Work && m.StateID == m.Core.Graph.GraphConfig.Works.IndexOf(work))
|
if (m.State == Main.WorkingState.Work && m.StateID == m.Core.Graph.GraphConfig.Works.IndexOf(work))
|
||||||
m.WorkTimer.Stop();
|
m.WorkTimer.Stop();
|
||||||
@ -188,7 +188,7 @@ namespace VPet_Simulator.Core
|
|||||||
tMoney.Text = "$ " + m.Core.Save.Money.ToString("N2");
|
tMoney.Text = "$ " + m.Core.Save.Money.ToString("N2");
|
||||||
if (m.Core.Controller.EnableFunction)
|
if (m.Core.Controller.EnableFunction)
|
||||||
{
|
{
|
||||||
till.Visibility = m.Core.Save.Mode == GameSave.ModeType.Ill ? Visibility.Visible : Visibility.Collapsed;
|
till.Visibility = m.Core.Save.Mode == IGameSave.ModeType.Ill ? Visibility.Visible : Visibility.Collapsed;
|
||||||
tfun.Visibility = Visibility.Collapsed;
|
tfun.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -432,7 +432,7 @@ namespace VPet_Simulator.Core
|
|||||||
private void Sleep_Click(object sender, RoutedEventArgs e)
|
private void Sleep_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
this.Visibility = Visibility.Collapsed;
|
||||||
if (m.Core.Save.Mode != GameSave.ModeType.Ill)
|
if (m.Core.Save.Mode != IGameSave.ModeType.Ill)
|
||||||
if (m.State == Main.WorkingState.Sleep)
|
if (m.State == Main.WorkingState.Sleep)
|
||||||
{
|
{
|
||||||
m.State = WorkingState.Nomal;
|
m.State = WorkingState.Nomal;
|
||||||
|
@ -96,7 +96,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// <param name="GraphName">动画名字</param>
|
/// <param name="GraphName">动画名字</param>
|
||||||
/// <param name="mode">状态类型,找不到就找相同动画类型</param>
|
/// <param name="mode">状态类型,找不到就找相同动画类型</param>
|
||||||
/// <param name="animat">动画的动作 Start Loop End</param>
|
/// <param name="animat">动画的动作 Start Loop End</param>
|
||||||
public IGraph FindGraph(string GraphName, AnimatType animat, GameSave.ModeType mode)
|
public IGraph FindGraph(string GraphName, AnimatType animat, IGameSave.ModeType mode)
|
||||||
{
|
{
|
||||||
if (GraphName == null)
|
if (GraphName == null)
|
||||||
return null;
|
return null;
|
||||||
@ -109,7 +109,7 @@ namespace VPet_Simulator.Core
|
|||||||
return list[0];
|
return list[0];
|
||||||
return list[Function.Rnd.Next(list.Count)];
|
return list[Function.Rnd.Next(list.Count)];
|
||||||
}
|
}
|
||||||
if (mode == GameSave.ModeType.Ill)
|
if (mode == IGameSave.ModeType.Ill)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ namespace VPet_Simulator.Core
|
|||||||
if (i < 3)
|
if (i < 3)
|
||||||
{
|
{
|
||||||
//向下兼容的动画
|
//向下兼容的动画
|
||||||
list = gl.FindAll(x => x.GraphInfo.ModeType == (GameSave.ModeType)i);
|
list = gl.FindAll(x => x.GraphInfo.ModeType == (IGameSave.ModeType)i);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
return list[Function.Rnd.Next(list.Count)];
|
return list[Function.Rnd.Next(list.Count)];
|
||||||
}
|
}
|
||||||
@ -125,12 +125,12 @@ namespace VPet_Simulator.Core
|
|||||||
if (i >= 1)
|
if (i >= 1)
|
||||||
{
|
{
|
||||||
//向上兼容的动画
|
//向上兼容的动画
|
||||||
list = gl.FindAll(x => x.GraphInfo.ModeType == (GameSave.ModeType)i);
|
list = gl.FindAll(x => x.GraphInfo.ModeType == (IGameSave.ModeType)i);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
return list[Function.Rnd.Next(list.Count)];
|
return list[Function.Rnd.Next(list.Count)];
|
||||||
}
|
}
|
||||||
//如果实在找不到,就走随机数(无生病)
|
//如果实在找不到,就走随机数(无生病)
|
||||||
list = gl.FindAll(x => x.GraphInfo.ModeType != GameSave.ModeType.Ill);
|
list = gl.FindAll(x => x.GraphInfo.ModeType != IGameSave.ModeType.Ill);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
return list[Function.Rnd.Next(list.Count)];
|
return list[Function.Rnd.Next(list.Count)];
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mode">状态类型,找不到就找相同动画类型</param>
|
/// <param name="mode">状态类型,找不到就找相同动画类型</param>
|
||||||
/// <param name="animat">动画的动作 Start Loop End</param>
|
/// <param name="animat">动画的动作 Start Loop End</param>
|
||||||
public List<IGraph> FindGraphs(string GraphName, AnimatType animat, GameSave.ModeType mode)
|
public List<IGraph> FindGraphs(string GraphName, AnimatType animat, IGameSave.ModeType mode)
|
||||||
{
|
{
|
||||||
if (GraphName == null)
|
if (GraphName == null)
|
||||||
return null;
|
return null;
|
||||||
@ -156,7 +156,7 @@ namespace VPet_Simulator.Core
|
|||||||
if (i < 3)
|
if (i < 3)
|
||||||
{
|
{
|
||||||
//向下兼容的动画
|
//向下兼容的动画
|
||||||
list = gl.FindAll(x => x.GraphInfo.ModeType == (GameSave.ModeType)i);
|
list = gl.FindAll(x => x.GraphInfo.ModeType == (IGameSave.ModeType)i);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ namespace VPet_Simulator.Core
|
|||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
{
|
{
|
||||||
//向上兼容的动画
|
//向上兼容的动画
|
||||||
list = gl.FindAll(x => x.GraphInfo.ModeType == (GameSave.ModeType)i);
|
list = gl.FindAll(x => x.GraphInfo.ModeType == (IGameSave.ModeType)i);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -270,17 +270,17 @@ namespace VPet_Simulator.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Ill = 16,
|
Ill = 16,
|
||||||
}
|
}
|
||||||
public static ModeType GetModeType(GameSave.ModeType type)
|
public static ModeType GetModeType(IGameSave.ModeType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case GameSave.ModeType.Happy:
|
case IGameSave.ModeType.Happy:
|
||||||
return ModeType.Happy;
|
return ModeType.Happy;
|
||||||
case GameSave.ModeType.Nomal:
|
case IGameSave.ModeType.Nomal:
|
||||||
return ModeType.Nomal;
|
return ModeType.Nomal;
|
||||||
case GameSave.ModeType.PoorCondition:
|
case IGameSave.ModeType.PoorCondition:
|
||||||
return ModeType.PoorCondition;
|
return ModeType.PoorCondition;
|
||||||
case GameSave.ModeType.Ill:
|
case IGameSave.ModeType.Ill:
|
||||||
return ModeType.Ill;
|
return ModeType.Ill;
|
||||||
default:
|
default:
|
||||||
return ModeType.Nomal;
|
return ModeType.Nomal;
|
||||||
|
@ -28,7 +28,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// <param name="animat">动作: 动画的动作 Start Loop End</param>
|
/// <param name="animat">动作: 动画的动作 Start Loop End</param>
|
||||||
/// <param name="type">类型: 主要动作分类</param>
|
/// <param name="type">类型: 主要动作分类</param>
|
||||||
/// <param name="modeType">状态: 4种状态</param>
|
/// <param name="modeType">状态: 4种状态</param>
|
||||||
public GraphInfo(string name, GraphType type = GraphType.Common, AnimatType animat = AnimatType.Single, GameSave.ModeType modeType = GameSave.ModeType.Nomal)
|
public GraphInfo(string name, GraphType type = GraphType.Common, AnimatType animat = AnimatType.Single, IGameSave.ModeType modeType = IGameSave.ModeType.Nomal)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Animat = animat;
|
Animat = animat;
|
||||||
@ -50,27 +50,27 @@ namespace VPet_Simulator.Core
|
|||||||
|
|
||||||
var path_name = pn.Replace('\\', '_').Split('_').ToList();
|
var path_name = pn.Replace('\\', '_').Split('_').ToList();
|
||||||
path_name.RemoveAll(string.IsNullOrWhiteSpace);
|
path_name.RemoveAll(string.IsNullOrWhiteSpace);
|
||||||
if (!Enum.TryParse(info[(gstr)"mode"], true, out GameSave.ModeType modetype))
|
if (!Enum.TryParse(info[(gstr)"mode"], true, out IGameSave.ModeType modetype))
|
||||||
{
|
{
|
||||||
if (path_name.Remove("happy"))
|
if (path_name.Remove("happy"))
|
||||||
{
|
{
|
||||||
modetype = GameSave.ModeType.Happy;
|
modetype = IGameSave.ModeType.Happy;
|
||||||
}
|
}
|
||||||
else if (path_name.Remove("nomal"))
|
else if (path_name.Remove("nomal"))
|
||||||
{
|
{
|
||||||
modetype = GameSave.ModeType.Nomal;
|
modetype = IGameSave.ModeType.Nomal;
|
||||||
}
|
}
|
||||||
else if (path_name.Remove("poorcondition"))
|
else if (path_name.Remove("poorcondition"))
|
||||||
{
|
{
|
||||||
modetype = GameSave.ModeType.PoorCondition;
|
modetype = IGameSave.ModeType.PoorCondition;
|
||||||
}
|
}
|
||||||
else if (path_name.Remove("ill"))
|
else if (path_name.Remove("ill"))
|
||||||
{
|
{
|
||||||
modetype = GameSave.ModeType.Ill;
|
modetype = IGameSave.ModeType.Ill;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
modetype = GameSave.ModeType.Nomal;
|
modetype = IGameSave.ModeType.Nomal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 状态: 4种状态
|
/// 状态: 4种状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameSave.ModeType ModeType { get; set; }
|
public IGameSave.ModeType ModeType { get; set; }
|
||||||
///// <summary>
|
///// <summary>
|
||||||
///// 其他附带的储存信息
|
///// 其他附带的储存信息
|
||||||
///// </summary>
|
///// </summary>
|
||||||
|
@ -24,7 +24,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏数据
|
/// 游戏数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameSave Save;
|
public IGameSave Save;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 触摸范围事件
|
/// 触摸范围事件
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
using LinePutScript;
|
using LinePutScript;
|
||||||
using LinePutScript.Converter;
|
using LinePutScript.Converter;
|
||||||
using System;
|
using System;
|
||||||
|
using static VPet_Simulator.Core.IGameSave;
|
||||||
|
|
||||||
namespace VPet_Simulator.Core
|
namespace VPet_Simulator.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏存档
|
/// 游戏存档
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GameSave
|
public class GameSave : IGameSave
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 宠物名字
|
/// 宠物名字
|
||||||
@ -252,27 +253,8 @@ namespace VPet_Simulator.Core
|
|||||||
Likability += food.Likability;
|
Likability += food.Likability;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 宠物状态模式
|
/// 宠物当前状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ModeType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 高兴
|
|
||||||
/// </summary>
|
|
||||||
Happy,
|
|
||||||
/// <summary>
|
|
||||||
/// 普通
|
|
||||||
/// </summary>
|
|
||||||
Nomal,
|
|
||||||
/// <summary>
|
|
||||||
/// 状态不佳
|
|
||||||
/// </summary>
|
|
||||||
PoorCondition,
|
|
||||||
/// <summary>
|
|
||||||
/// 生病(躺床)
|
|
||||||
/// </summary>
|
|
||||||
Ill
|
|
||||||
}
|
|
||||||
[Line(name: "mode")]
|
[Line(name: "mode")]
|
||||||
public ModeType Mode { get; set; } = ModeType.Nomal;
|
public ModeType Mode { get; set; } = ModeType.Nomal;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -360,4 +342,4 @@ namespace VPet_Simulator.Core
|
|||||||
return LPSConvert.SerializeObject(this, "vpet");
|
return LPSConvert.SerializeObject(this, "vpet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
161
VPet-Simulator.Core/Handle/IGameSave.cs
Normal file
161
VPet-Simulator.Core/Handle/IGameSave.cs
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
using LinePutScript;
|
||||||
|
using LinePutScript.Converter;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace VPet_Simulator.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏存档
|
||||||
|
/// </summary>
|
||||||
|
public interface IGameSave
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 宠物名字
|
||||||
|
/// </summary>
|
||||||
|
string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 金钱
|
||||||
|
/// </summary>
|
||||||
|
double Money { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 经验值
|
||||||
|
/// </summary>
|
||||||
|
double Exp { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 等级
|
||||||
|
/// </summary>
|
||||||
|
int Level { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// 升级所需经验值
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
int LevelUpNeed();
|
||||||
|
/// <summary>
|
||||||
|
/// 体力 0-100
|
||||||
|
/// </summary>
|
||||||
|
double Strength { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 最大体力值
|
||||||
|
/// </summary>
|
||||||
|
double StrengthMax { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 待补充的体力,随着时间缓慢加给桌宠
|
||||||
|
/// </summary>//让游戏更有游戏性
|
||||||
|
double StoreStrength { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 变化 体力
|
||||||
|
/// </summary>
|
||||||
|
double ChangeStrength { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改体力
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
void StrengthChange(double value);
|
||||||
|
/// <summary>
|
||||||
|
/// 饱腹度
|
||||||
|
/// </summary>
|
||||||
|
double StrengthFood { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 待补充的饱腹度,随着时间缓慢加给桌宠
|
||||||
|
/// </summary>//让游戏更有游戏性
|
||||||
|
double StoreStrengthFood { get; set; }
|
||||||
|
void StrengthChangeFood(double value);
|
||||||
|
/// <summary>
|
||||||
|
/// 变化 食物
|
||||||
|
/// </summary>
|
||||||
|
double ChangeStrengthFood { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 口渴度
|
||||||
|
/// </summary>
|
||||||
|
double StrengthDrink { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 待补充的口渴度,随着时间缓慢加给桌宠
|
||||||
|
/// </summary>//让游戏更有游戏性
|
||||||
|
double StoreStrengthDrink { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 变化 口渴度
|
||||||
|
/// </summary>
|
||||||
|
double ChangeStrengthDrink { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改口渴度
|
||||||
|
/// </summary>
|
||||||
|
void StrengthChangeDrink(double value);
|
||||||
|
/// <summary>
|
||||||
|
/// 修改心情
|
||||||
|
/// </summary>
|
||||||
|
void FeelingChange(double value);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 心情
|
||||||
|
/// </summary>
|
||||||
|
double Feeling { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 待补充的心情,随着时间缓慢加给桌宠
|
||||||
|
/// </summary>//让游戏更有游戏性
|
||||||
|
double StoreFeeling { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 健康(生病)(隐藏)
|
||||||
|
/// </summary>
|
||||||
|
double Health { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 好感度(隐藏)(累加值)
|
||||||
|
/// </summary>
|
||||||
|
double Likability { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 好感度(隐藏)(最大值)
|
||||||
|
/// </summary>
|
||||||
|
double LikabilityMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除变化
|
||||||
|
/// </summary>
|
||||||
|
void CleanChange();
|
||||||
|
/// <summary>
|
||||||
|
/// 取回被储存的体力
|
||||||
|
/// </summary>
|
||||||
|
void StoreTake();
|
||||||
|
/// <summary>
|
||||||
|
/// 吃食物
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="food">食物类</param>
|
||||||
|
void EatFood(IFood food);
|
||||||
|
/// <summary>
|
||||||
|
/// 宠物状态模式
|
||||||
|
/// </summary>
|
||||||
|
public enum ModeType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 高兴
|
||||||
|
/// </summary>
|
||||||
|
Happy,
|
||||||
|
/// <summary>
|
||||||
|
/// 普通
|
||||||
|
/// </summary>
|
||||||
|
Nomal,
|
||||||
|
/// <summary>
|
||||||
|
/// 状态不佳
|
||||||
|
/// </summary>
|
||||||
|
PoorCondition,
|
||||||
|
/// <summary>
|
||||||
|
/// 生病(躺床)
|
||||||
|
/// </summary>
|
||||||
|
Ill
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算宠物当前状态
|
||||||
|
/// </summary>
|
||||||
|
ModeType CalMode();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 存档
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>存档行</returns>
|
||||||
|
Line ToLine();
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using static VPet_Simulator.Core.GameSave;
|
using static VPet_Simulator.Core.IGameSave;
|
||||||
using static VPet_Simulator.Core.GraphCore;
|
using static VPet_Simulator.Core.GraphCore;
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public GameSave_v2(string petname)
|
public GameSave_v2(string petname)
|
||||||
{
|
{
|
||||||
GameSave = new GameSave(petname);
|
GameSave = new IGameSave(petname);
|
||||||
Statistics = new Statistics();
|
Statistics = new Statistics();
|
||||||
}
|
}
|
||||||
protected void load(ILPS lps, Statistics oldStatistics = null, GameSave oldGameSave = null, ILPS olddata = null)
|
protected void load(ILPS lps, Statistics oldStatistics = null, IGameSave oldGameSave = null, ILPS olddata = null)
|
||||||
{
|
{
|
||||||
if (lps.FindLine("statistics") == null)
|
if (lps.FindLine("statistics") == null)
|
||||||
{//尝试从老存档加载
|
{//尝试从老存档加载
|
||||||
@ -39,7 +39,7 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
long hash;
|
long hash;
|
||||||
if (vpet != null)
|
if (vpet != null)
|
||||||
{
|
{
|
||||||
GameSave = GameSave.Load(vpet);
|
GameSave = IGameSave.Load(vpet);
|
||||||
hash = vpet.GetInt64("hash");
|
hash = vpet.GetInt64("hash");
|
||||||
if (vpet.Remove("hash"))
|
if (vpet.Remove("hash"))
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// <param name="oldStatistics">老统计</param>
|
/// <param name="oldStatistics">老统计</param>
|
||||||
/// <param name="oldGameSave">老存档</param>
|
/// <param name="oldGameSave">老存档</param>
|
||||||
/// <param name="olddata">老数据</param>
|
/// <param name="olddata">老数据</param>
|
||||||
public GameSave_v2(ILPS lps, Statistics oldStatistics = null, GameSave oldGameSave = null, ILPS olddata = null)
|
public GameSave_v2(ILPS lps, Statistics oldStatistics = null, IGameSave oldGameSave = null, ILPS olddata = null)
|
||||||
{
|
{
|
||||||
load(lps, oldStatistics, oldGameSave, olddata);
|
load(lps, oldStatistics, oldGameSave, olddata);
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏存档
|
/// 游戏存档
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameSave GameSave;
|
public IGameSave GameSave;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 统计
|
/// 统计
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -145,7 +145,7 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查部分状态是否满足需求
|
/// 检查部分状态是否满足需求
|
||||||
/// </summary>之所以不是全部的,是因为挨个取效率太差了
|
/// </summary>之所以不是全部的,是因为挨个取效率太差了
|
||||||
public virtual bool CheckState(GameSave save)
|
public virtual bool CheckState(IGameSave save)
|
||||||
{
|
{
|
||||||
if (save.Likability < LikeMin || save.Likability > LikeMax)
|
if (save.Likability < LikeMin || save.Likability > LikeMax)
|
||||||
return false;
|
return false;
|
||||||
|
@ -117,9 +117,9 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 非计算模式下默认模式
|
/// 非计算模式下默认模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameSave.ModeType CalFunState
|
public IGameSave.ModeType CalFunState
|
||||||
{
|
{
|
||||||
get => (GameSave.ModeType)this[(gint)"calfunstate"];
|
get => (IGameSave.ModeType)this[(gint)"calfunstate"];
|
||||||
set => this[(gint)"calfunstate"] = (int)value;
|
set => this[(gint)"calfunstate"] = (int)value;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -318,7 +318,7 @@ namespace VPet_Simulator.Windows
|
|||||||
/// <param name="save">存档</param>
|
/// <param name="save">存档</param>
|
||||||
/// <param name="food">食物</param>
|
/// <param name="food">食物</param>
|
||||||
/// <param name="buff">默认1倍</param>
|
/// <param name="buff">默认1倍</param>
|
||||||
public static void EatFood(this GameSave save, IFood food, double buff)
|
public static void EatFood(this IGameSave save, IFood food, double buff)
|
||||||
{
|
{
|
||||||
save.Exp += food.Exp * buff;
|
save.Exp += food.Exp * buff;
|
||||||
var tmp = food.Strength / 2 * buff;
|
var tmp = food.Strength / 2 * buff;
|
||||||
|
@ -112,17 +112,17 @@ namespace VPet_Simulator.Windows
|
|||||||
ClickText.ModeType mt;
|
ClickText.ModeType mt;
|
||||||
switch (Core.Save.Mode)
|
switch (Core.Save.Mode)
|
||||||
{
|
{
|
||||||
case GameSave.ModeType.PoorCondition:
|
case IGameSave.ModeType.PoorCondition:
|
||||||
mt = ClickText.ModeType.PoorCondition;
|
mt = ClickText.ModeType.PoorCondition;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case GameSave.ModeType.Nomal:
|
case IGameSave.ModeType.Nomal:
|
||||||
mt = ClickText.ModeType.Nomal;
|
mt = ClickText.ModeType.Nomal;
|
||||||
break;
|
break;
|
||||||
case GameSave.ModeType.Happy:
|
case IGameSave.ModeType.Happy:
|
||||||
mt = ClickText.ModeType.Happy;
|
mt = ClickText.ModeType.Happy;
|
||||||
break;
|
break;
|
||||||
case GameSave.ModeType.Ill:
|
case IGameSave.ModeType.Ill:
|
||||||
mt = ClickText.ModeType.Ill;
|
mt = ClickText.ModeType.Ill;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -404,7 +404,7 @@ namespace VPet_Simulator.Windows
|
|||||||
Main.Display(item.GetGraph(), item.ImageSource, Main.DisplayToNomal);
|
Main.Display(item.GetGraph(), item.ImageSource, Main.DisplayToNomal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Core.Save.Mode == GameSave.ModeType.Happy || Core.Save.Mode == GameSave.ModeType.Nomal)
|
else if (Core.Save.Mode == IGameSave.ModeType.Happy || Core.Save.Mode == IGameSave.ModeType.Nomal)
|
||||||
{
|
{
|
||||||
if (Core.Save.StrengthFood < 75 && Function.Rnd.Next(lowstrengthAskCountFood--) == 0)
|
if (Core.Save.StrengthFood < 75 && Function.Rnd.Next(lowstrengthAskCountFood--) == 0)
|
||||||
{
|
{
|
||||||
@ -632,7 +632,7 @@ namespace VPet_Simulator.Windows
|
|||||||
stat[(gi64)"stat_sleep_time"] += (int)Set.LogicInterval;
|
stat[(gi64)"stat_sleep_time"] += (int)Set.LogicInterval;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (save.Mode == GameSave.ModeType.Ill)
|
if (save.Mode == IGameSave.ModeType.Ill)
|
||||||
{
|
{
|
||||||
if (save.Money < 100)
|
if (save.Money < 100)
|
||||||
stat["stat_ill_nomoney"] = 1;
|
stat["stat_ill_nomoney"] = 1;
|
||||||
@ -778,7 +778,7 @@ namespace VPet_Simulator.Windows
|
|||||||
{
|
{
|
||||||
SteamFriends.SetRichPresence("lv", " ");
|
SteamFriends.SetRichPresence("lv", " ");
|
||||||
}
|
}
|
||||||
if (Core.Save.Mode == GameSave.ModeType.Ill)
|
if (Core.Save.Mode == IGameSave.ModeType.Ill)
|
||||||
{
|
{
|
||||||
SteamFriends.SetRichPresence("steam_display", "#Status_Ill");
|
SteamFriends.SetRichPresence("steam_display", "#Status_Ill");
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ namespace VPet_Simulator.Windows
|
|||||||
if (GraphListBox.SelectedItem == null)
|
if (GraphListBox.SelectedItem == null)
|
||||||
return;
|
return;
|
||||||
var kv = Sub.Split((string)GraphListBox.SelectedItem, "++");
|
var kv = Sub.Split((string)GraphListBox.SelectedItem, "++");
|
||||||
var graph = mw.Main.Core.Graph.FindGraph(kv[0], (AnimatType)Enum.Parse(typeof(AnimatType), kv[1]), (GameSave.ModeType)ComboxMode.SelectedIndex);
|
var graph = mw.Main.Core.Graph.FindGraph(kv[0], (AnimatType)Enum.Parse(typeof(AnimatType), kv[1]), (IGameSave.ModeType)ComboxMode.SelectedIndex);
|
||||||
if (graph == null)
|
if (graph == null)
|
||||||
{
|
{
|
||||||
LabelNowPlay.Content = "未找到对应类型图像资源".Translate();
|
LabelNowPlay.Content = "未找到对应类型图像资源".Translate();
|
||||||
@ -100,19 +100,19 @@ namespace VPet_Simulator.Windows
|
|||||||
{
|
{
|
||||||
DestanceTimer.Stop();
|
DestanceTimer.Stop();
|
||||||
}
|
}
|
||||||
List<Tuple<string, GameSave.ModeType>> playlist = new List<Tuple<string, GameSave.ModeType>>();
|
List<Tuple<string, IGameSave.ModeType>> playlist = new List<Tuple<string, IGameSave.ModeType>>();
|
||||||
private void GraphListPlayerBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void GraphListPlayerBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
playlist.Add(new Tuple<string, GameSave.ModeType>((string)GraphListPlayerBox.SelectedItem,
|
playlist.Add(new Tuple<string, IGameSave.ModeType>((string)GraphListPlayerBox.SelectedItem,
|
||||||
(GameSave.ModeType)Enum.Parse(typeof(GameSave.ModeType), (string)(((ComboBoxItem)ComboxPlayMode.SelectedItem).Content))));
|
(IGameSave.ModeType)Enum.Parse(typeof(IGameSave.ModeType), (string)(((ComboBoxItem)ComboxPlayMode.SelectedItem).Content))));
|
||||||
GraphListWillPlayBox.Items.Add((string)GraphListPlayerBox.SelectedItem + "_" + (string)((ComboBoxItem)ComboxPlayMode.SelectedItem).Content);
|
GraphListWillPlayBox.Items.Add((string)GraphListPlayerBox.SelectedItem + "_" + (string)((ComboBoxItem)ComboxPlayMode.SelectedItem).Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Play_Click(object sender, RoutedEventArgs e)
|
private void Play_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
DisplayList(new Queue<Tuple<string, GameSave.ModeType>>(playlist));
|
DisplayList(new Queue<Tuple<string, IGameSave.ModeType>>(playlist));
|
||||||
}
|
}
|
||||||
public void DisplayList(Queue<Tuple<string, GameSave.ModeType>> list)
|
public void DisplayList(Queue<Tuple<string, IGameSave.ModeType>> list)
|
||||||
{
|
{
|
||||||
if (list.Count == 0)
|
if (list.Count == 0)
|
||||||
{
|
{
|
||||||
|
@ -1320,8 +1320,8 @@ namespace VPet_Simulator.Windows
|
|||||||
{
|
{
|
||||||
if (!AllowChange)
|
if (!AllowChange)
|
||||||
return;
|
return;
|
||||||
mw.Set.CalFunState = (GameSave.ModeType)combCalFunState.SelectedIndex;
|
mw.Set.CalFunState = (IGameSave.ModeType)combCalFunState.SelectedIndex;
|
||||||
mw.Main.NoFunctionMOD = (GameSave.ModeType)combCalFunState.SelectedIndex;
|
mw.Main.NoFunctionMOD = (IGameSave.ModeType)combCalFunState.SelectedIndex;
|
||||||
mw.Main.EventTimer_Elapsed();
|
mw.Main.EventTimer_Elapsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user