PhotoModeMain.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using System;
  2. using System.Collections;
  3. using System.Xml.Linq;
  4. using UnityEngine;
  5. public class PhotoModeMain : WfScreenChildren
  6. {
  7. public static void ResetComebackData()
  8. {
  9. PhotoModeMain.editTargetMaid = null;
  10. PhotoModeMain.backupSaveData = null;
  11. }
  12. public override void Awake()
  13. {
  14. base.Awake();
  15. GameMain.Instance.StartCoroutine(this.Setup());
  16. }
  17. private IEnumerator Setup()
  18. {
  19. GameMain.Instance.LoadIcon.NextLoadIcontImmediatelyDisplay();
  20. GameMain.Instance.LoadIcon.force_draw_new = true;
  21. do
  22. {
  23. yield return null;
  24. }
  25. while (!GameMain.Instance.MenuDataBase.JobFinished());
  26. for (int i = 0; i < 5; i++)
  27. {
  28. yield return null;
  29. }
  30. GameMain.Instance.LoadIcon.force_draw_new = false;
  31. this.photo_mgr_ = this.RootPanel.GetComponentInChildren<PhotoWindowManager>();
  32. EventDelegate.Add(this.photo_mgr_.EndButton.onClick, new EventDelegate.Callback(this.OnEnd));
  33. this.photo_mgr_.CallEditSceneFunction = new Action<Maid>(this.OnCallEdit);
  34. if (PhotoModeMain.backupSaveData != null)
  35. {
  36. base.SetFadeStatus(WfScreenChildren.FadeStatus.Wait);
  37. this.photo_mgr_.SaveAndLoadManager.ReadSave(PhotoModeMain.backupSaveData);
  38. }
  39. this.completedSetUp = true;
  40. this.photo_mgr_.Initialize();
  41. yield break;
  42. }
  43. protected override void OnCall()
  44. {
  45. }
  46. protected override bool IsCallFadeIn()
  47. {
  48. return PhotoModeMain.backupSaveData == null && this.completedSetUp;
  49. }
  50. public void OnDestroy()
  51. {
  52. if (GameMain.Instance.isQuitting)
  53. {
  54. return;
  55. }
  56. GizmoRender.global_control_lock = false;
  57. if (GameMain.Instance != null && GameMain.Instance.MainCamera != null && GameMain.Instance.MainCamera.camera != null)
  58. {
  59. GameMain.Instance.MainCamera.camera.backgroundColor = Color.black;
  60. }
  61. if (GameMain.Instance != null && GameMain.Instance.CharacterMgr != null && PhotoModeMain.editTargetMaid != null)
  62. {
  63. GameMain.Instance.CharacterMgr.SetActiveMaid(PhotoModeMain.editTargetMaid, 0);
  64. PhotoModeMain.editTargetMaid = null;
  65. }
  66. else
  67. {
  68. PhotoModeMain.ResetComebackData();
  69. }
  70. }
  71. public void OnEnd()
  72. {
  73. if (GameMain.Instance.SysDlg.IsDecided)
  74. {
  75. GameMain.Instance.SysDlg.ShowFromLanguageTerm("ScenePhotoMode/セーブしていないデータは失われます。終了しますか?", null, SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.OnEndOk), null);
  76. }
  77. }
  78. public void OnEndOk()
  79. {
  80. GameMain.Instance.SysDlg.Close();
  81. this.Finish();
  82. }
  83. public void OnCallEdit(Maid maid)
  84. {
  85. PhotoModeMain.backupSaveData = this.photo_mgr_.SaveAndLoadManager.WriteSaveToXdocument(string.Empty, string.Empty);
  86. PhotoModeMain.editTargetMaid = maid;
  87. PhotoMode photoMode = base.parent_mgr as PhotoMode;
  88. this.photo_mgr_.OnEnd();
  89. photoMode.move_screen.SetNextLabel(photoMode.edit_label_name);
  90. base.parent_mgr.CallScreen("Move");
  91. }
  92. protected override void OnFinish()
  93. {
  94. this.photo_mgr_.OnEnd();
  95. base.parent_mgr.CallScreen("Move");
  96. }
  97. private static Maid editTargetMaid;
  98. private static XDocument backupSaveData;
  99. private bool completedSetUp;
  100. private PhotoWindowManager photo_mgr_;
  101. }