Thomas ICHÉ
6 年前
当前提交
9280e6cb
共有 5 个文件被更改,包括 106 次插入 和 17 次删除
-
34Runtime/Managers/Implementations/GameSaveManager.cs
-
37Runtime/Actions/GameSaveLoadSaveAction.cs
-
11Runtime/Actions/GameSaveLoadSaveAction.cs.meta
-
30Runtime/Actions/GameSaveSetValueAction.cs
-
11Runtime/Actions/GameSaveSetValueAction.cs.meta
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace GameplayIngredients.Actions |
|||
{ |
|||
public class GameSaveLoadSaveAction : ActionBase |
|||
{ |
|||
public enum Action |
|||
{ |
|||
Load, |
|||
Save, |
|||
} |
|||
|
|||
public GameSaveManager.Location saveLocation = GameSaveManager.Location.System; |
|||
public Action action = Action.Load; |
|||
public byte UserSaveIndex = 0; |
|||
|
|||
public override void Execute() |
|||
{ |
|||
if(action == Action.Load) |
|||
{ |
|||
if (saveLocation == GameSaveManager.Location.System) |
|||
Manager.Get<GameSaveManager>().LoadSystemSave(); |
|||
else |
|||
Manager.Get<GameSaveManager>().LoadUserSave(UserSaveIndex); |
|||
} |
|||
else |
|||
{ |
|||
if (saveLocation == GameSaveManager.Location.System) |
|||
Manager.Get<GameSaveManager>().SaveSystemSave(); |
|||
else |
|||
Manager.Get<GameSaveManager>().SaveUserSave(UserSaveIndex); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b961b0f0b44c73940bdbe58fb10266af |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace GameplayIngredients.Actions |
|||
{ |
|||
public class GameSaveSetValueAction : ActionBase |
|||
{ |
|||
public string Key = "SomeKey"; |
|||
public GameSaveManager.Location saveLocation = GameSaveManager.Location.System; |
|||
public GameSaveManager.ValueType valueType = GameSaveManager.ValueType.String; |
|||
|
|||
public string StringValue; |
|||
public int IntValue; |
|||
public bool BoolValue; |
|||
public float FloatValue; |
|||
|
|||
public override void Execute() |
|||
{ |
|||
var gsm = Manager.Get<GameSaveManager>(); |
|||
switch(valueType) |
|||
{ |
|||
case GameSaveManager.ValueType.Bool: gsm.SetBool(Key, saveLocation, BoolValue); break; |
|||
case GameSaveManager.ValueType.Int: gsm.SetInt(Key, saveLocation, IntValue); break; |
|||
case GameSaveManager.ValueType.Float: gsm.SetFloat(Key, saveLocation, FloatValue); break; |
|||
case GameSaveManager.ValueType.String: gsm.SetString(Key, saveLocation, StringValue); break; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 418629731ee76d94981950d2da411d63 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue