浏览代码

Fixes in Save Data

/main
Thomas ICHÉ 6 年前
当前提交
5edac8e5
共有 2 个文件被更改,包括 73 次插入44 次删除
  1. 115
      Runtime/LevelScripting/Logic/SaveDataLogic.cs
  2. 2
      Runtime/Managers/Implementations/GameSaveManager.cs

115
Runtime/LevelScripting/Logic/SaveDataLogic.cs


Greater,
GreaterOrEqual,
Less,
LessOrEqual
LessOrEqual,
Exists
}
public Evaluation Test = Evaluation.Equal;

bool isBool() {return ValueType == GameSaveManager.ValueType.Bool;}
bool isInt() {return ValueType == GameSaveManager.ValueType.Int;}
bool isFloat() {return ValueType == GameSaveManager.ValueType.Float;}
bool isString() {return ValueType == GameSaveManager.ValueType.String;}
[ShowIf("isBool")]
[ShowIf("isInt")]
[ShowIf("isFloat")]
[ShowIf("isString")]
public Callable[] OnTesFail;
public Callable[] OnTestFail;
public override void Execute(GameObject instigator = null)
{

switch(ValueType)
if(Test == Evaluation.Exists)
case GameSaveManager.ValueType.Bool:
if (!gsm.HasBool(Key, SaveLocation))
{
WarnNotExist(Key, ValueType, SaveLocation);
}
else
{
result = TestValue(gsm.GetBool(Key, SaveLocation), BoolTargetValue);
}
break;
case GameSaveManager.ValueType.Int:
if (!gsm.HasInt(Key, SaveLocation))
{
WarnNotExist(Key, ValueType, SaveLocation);
}
else
{
result = TestValue(gsm.GetInt(Key, SaveLocation), IntTargetValue);
}
break;
case GameSaveManager.ValueType.Float:
if (!gsm.HasFloat(Key, SaveLocation))
{
WarnNotExist(Key, ValueType, SaveLocation);
}
else
{
result = TestValue(gsm.GetFloat(Key, SaveLocation), FloatTargetValue);
}
break;
case GameSaveManager.ValueType.String:
if (!gsm.HasSting(Key, SaveLocation))
{
WarnNotExist(Key, ValueType, SaveLocation);
}
else
{
result = TestValue(gsm.GetString(Key, SaveLocation), StringTargetValue);
}
break;
switch(ValueType)
{
case GameSaveManager.ValueType.Bool: result = gsm.HasBool(Key, SaveLocation); break;
case GameSaveManager.ValueType.Float: result = gsm.HasFloat(Key, SaveLocation); break;
case GameSaveManager.ValueType.Int: result = gsm.HasInt(Key, SaveLocation); break;
case GameSaveManager.ValueType.String: result = gsm.HasString(Key, SaveLocation); break;
}
}
else
{
switch(ValueType)
{
case GameSaveManager.ValueType.Bool:
if (!gsm.HasBool(Key, SaveLocation))
{
WarnNotExist(Key, ValueType, SaveLocation);
}
else
{
result = TestValue(gsm.GetBool(Key, SaveLocation), BoolTargetValue);
}
break;
case GameSaveManager.ValueType.Int:
if (!gsm.HasInt(Key, SaveLocation))
{
WarnNotExist(Key, ValueType, SaveLocation);
}
else
{
result = TestValue(gsm.GetInt(Key, SaveLocation), IntTargetValue);
}
break;
case GameSaveManager.ValueType.Float:
if (!gsm.HasFloat(Key, SaveLocation))
{
WarnNotExist(Key, ValueType, SaveLocation);
}
else
{
result = TestValue(gsm.GetFloat(Key, SaveLocation), FloatTargetValue);
}
break;
case GameSaveManager.ValueType.String:
if (!gsm.HasString(Key, SaveLocation))
{
WarnNotExist(Key, ValueType, SaveLocation);
}
else
{
result = TestValue(gsm.GetString(Key, SaveLocation), StringTargetValue);
}
break;
}
if (result)
Callable.Call(OnTestSuccess, instigator);
else
Callable.Call(OnTestFail, instigator);
}

2
Runtime/Managers/Implementations/GameSaveManager.cs


public bool HasBool(string name, Location location) { return HasValue<bool>(name, location); }
public bool HasInt(string name, Location location) { return HasValue<int>(name, location); }
public bool HasFloat(string name, Location location) { return HasValue<float>(name, location); }
public bool HasSting(string name, Location location) { return HasValue<string>(name, location); }
public bool HasString(string name, Location location) { return HasValue<string>(name, location); }
public bool GetBool(string name, Location location) { return GetValue<bool>(name, location); }
public int GetInt(string name, Location location) { return GetValue<int>(name, location); }

正在加载...
取消
保存