SaveDebugGUI.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class SaveDebugGUI : DebugGuiBase
  5. {
  6. protected override void GUIStart()
  7. {
  8. }
  9. protected override string UIDebugButtonName
  10. {
  11. get
  12. {
  13. return "存档管理";
  14. }
  15. }
  16. public override void OnDebugGUI()
  17. {
  18. if (GUILayout.Button("AutoSave", new GUILayoutOption[]
  19. {
  20. GUILayout.Height(100f)
  21. }))
  22. {
  23. R.GameData.Save(false);
  24. }
  25. if (GUILayout.Button("AutoLoad", new GUILayoutOption[]
  26. {
  27. GUILayout.Height(100f)
  28. }))
  29. {
  30. base.StartCoroutine(this.LoadGame());
  31. }
  32. if (GUILayout.Button("DeleteAutoSave", new GUILayoutOption[]
  33. {
  34. GUILayout.Height(100f)
  35. }))
  36. {
  37. SaveManager.AutoDelete();
  38. }
  39. }
  40. private IEnumerator LoadGame()
  41. {
  42. R.GameData.Load();
  43. if (R.GameData.SceneName != LevelManager.SceneName)
  44. {
  45. yield return LevelManager.LoadLevelByGateId(R.GameData.SceneName, SceneGate.OpenType.None);
  46. }
  47. R.Player.Transform.position = R.GameData.PlayerPosition;
  48. R.Player.Action.TurnRound(R.GameData.PlayerAttributeGameData.faceDir);
  49. R.Camera.Controller.CameraResetPostionAfterSwitchScene();
  50. yield break;
  51. }
  52. }