PrivateEventManager.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System;
  2. using System.Collections;
  3. using PrivateMaidMode;
  4. using UnityEngine;
  5. public class PrivateEventManager : WfScreenChildren
  6. {
  7. protected bool isNoon
  8. {
  9. get
  10. {
  11. return GameMain.Instance.CharacterMgr.status.isDaytime;
  12. }
  13. }
  14. public override void Awake()
  15. {
  16. base.Awake();
  17. if (this.eventHelpObject != null)
  18. {
  19. this.eventHelpObject.SetActive(false);
  20. }
  21. }
  22. protected override void OnCall()
  23. {
  24. this.okButton.gameObject.SetActive(false);
  25. if (ScenePrivateEventModeAwake.callEventId == -1)
  26. {
  27. if (this.eventHelpObject != null)
  28. {
  29. this.eventHelpObject.SetActive(true);
  30. }
  31. base.StartCoroutine(this.SetupPrivateMode());
  32. }
  33. }
  34. protected IEnumerator SetupPrivateMode()
  35. {
  36. this.setupCompleted = false;
  37. PrivateModeMgr privateModeData = PrivateModeMgr.Instance;
  38. this.maid = privateModeData.PrivateMaid;
  39. if (privateModeData.SelectBG == null)
  40. {
  41. NDebug.Assert("プライベートモードの設定が未設定で始まりました", false);
  42. privateModeData.SetPrivateBG(DataBase.GetData(10).bgData);
  43. }
  44. if (this.maid == null)
  45. {
  46. this.maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  47. }
  48. else
  49. {
  50. GameMain.Instance.CharacterMgr.SetActiveMaid(this.maid, 0);
  51. }
  52. this.maid.AllProcPropSeqStart();
  53. this.maid.Visible = true;
  54. while (this.maid.IsBusy)
  55. {
  56. yield return null;
  57. }
  58. MaidColliderCollect.SuspendColliderAll(this.maid, false);
  59. privateModeData.SelectBG.Apply(this.isNoon);
  60. this.bgEvent = privateModeData.SelectBG.GetEvent(this.isNoon);
  61. if (this.bgEvent != null)
  62. {
  63. if (this.eventHelpObject != null && this.bgEvent.eventPointList.Length <= 0)
  64. {
  65. UILabel component = UTY.GetChildObject(this.eventHelpObject, "Text/Text", false).GetComponent<UILabel>();
  66. if (component != null)
  67. {
  68. component.text = "イベントがありません";
  69. }
  70. }
  71. if (this.eventHitObject != null)
  72. {
  73. UnityEngine.Object.DestroyImmediate(this.eventHitObject);
  74. }
  75. this.eventHitObject = this.bgEvent.InstantiateHitPrefab(this.bgHitPrefabParent.gameObject);
  76. this.eventHitObject.SetActive(true);
  77. }
  78. PrivateModeEventObject.onClickObject = new Action<int>(this.OnClickEventObject);
  79. privateModeData.LoadLocation();
  80. yield return null;
  81. this.okButton.gameObject.SetActive(true);
  82. this.setupCompleted = true;
  83. uGUITutorialPanel.OpenTutorial("ScenePrivateEventMode", null, false);
  84. yield break;
  85. }
  86. protected override bool IsCallFadeIn()
  87. {
  88. return this.setupCompleted;
  89. }
  90. public void OnClickOK()
  91. {
  92. if (!this.setupCompleted)
  93. {
  94. return;
  95. }
  96. this.Finish();
  97. }
  98. protected override void OnFinish()
  99. {
  100. if (this.loadScriptAction != null)
  101. {
  102. this.loadScriptAction();
  103. this.loadScriptAction = null;
  104. return;
  105. }
  106. if (this.eventHitObject != null)
  107. {
  108. this.eventHitObject.SetActive(false);
  109. }
  110. PartColliderData.SetDefaultCursor();
  111. string returnFile = ScenePrivateEventModeAwake.returnFile;
  112. if (!string.IsNullOrEmpty(returnFile))
  113. {
  114. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(returnFile, string.Empty);
  115. }
  116. base.parent_mgr.CallScreen("Move");
  117. }
  118. protected void OnClickEventObject(int eventNo)
  119. {
  120. if (this.bgEvent == null || this.maid == null || GameMain.Instance.MainCamera.IsFadeProc())
  121. {
  122. return;
  123. }
  124. this.loadScriptAction = delegate()
  125. {
  126. bool flag = this.bgEvent.LoadScript(this.maid, eventNo);
  127. if (!flag)
  128. {
  129. Debug.LogError("イベントNo" + eventNo + "のイベントは設定されていません");
  130. }
  131. return flag;
  132. };
  133. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Click);
  134. this.Finish();
  135. }
  136. [SerializeField]
  137. private Transform bgHitPrefabParent;
  138. [SerializeField]
  139. private UIButton okButton;
  140. [SerializeField]
  141. private GameObject eventHelpObject;
  142. protected bool setupCompleted;
  143. protected Maid maid;
  144. protected DataBase.BG.Event bgEvent;
  145. protected GameObject eventHitObject;
  146. protected Func<bool> loadScriptAction;
  147. }