PhotoModeMain.cs 2.4 KB

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