浏览代码

Made Save Progress Optional

/main
Thomas ICHÉ 5 年前
当前提交
47c388fc
共有 1 个文件被更改,包括 31 次插入5 次删除
  1. 36
      Runtime/Managers/Implementations/GameManager.cs

36
Runtime/Managers/Implementations/GameManager.cs


public GameLevel[] MainGameLevels;
[Header("Save")]
public bool EnableSaveProgress = true;
public string ProgressSaveName = "Progress";
public static string MainMenuStartMessage = "GAME_MANAGER_MAINMENU_START";

public int currentSaveProgress
{
get { Manager.Get<GameSaveManager>().LoadUserSave(0); return Manager.Get<GameSaveManager>().GetInt(ProgressSaveName, GameSaveManager.Location.User); }
set { Manager.Get<GameSaveManager>().SetInt(ProgressSaveName, GameSaveManager.Location.User, value); Manager.Get<GameSaveManager>().SaveUserSave(0); }
get
{
if(EnableSaveProgress)
{
Manager.Get<GameSaveManager>().LoadUserSave(0);
return Manager.Get<GameSaveManager>().GetInt(ProgressSaveName, GameSaveManager.Location.User);
}
else
{
Debug.LogWarning("Game Manager : Saving Game Progress is Disabled, Returing first level instead.");
return 0;
}
}
set
{
if(EnableSaveProgress)
{
Manager.Get<GameSaveManager>().SetInt(ProgressSaveName, GameSaveManager.Location.User, value);
Manager.Get<GameSaveManager>().SaveUserSave(0);
}
else
{
Debug.LogWarning("Game Manager : Saving Game Progress is Disabled");
}
}
}
GameObject m_CurrentLevelSwitch;

currentLevel = int.MinValue;
Callable.Call(OnGameStart);
Manager.Get<GameSaveManager>().LoadUserSave(0);
if(EnableSaveProgress)
Manager.Get<GameSaveManager>().LoadUserSave(0);
}
Callable GetCurrentLevelSwitch(int targetLevel, bool showUI = false, Callable[] onComplete = null)

call.Execute();
currentLevel = nextLevel;
// Save Progression if not mainmenu
if(nextLevel != -1 && saveProgress)
// Save Progression if Enabled and not mainmenu
if(EnableSaveProgress && nextLevel != -1 && saveProgress)
currentSaveProgress = currentLevel;
}
else

正在加载...
取消
保存