FreeModeSceneSelectBase.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using System;
  2. using System.Collections.Generic;
  3. using Schedule;
  4. using UnityEngine;
  5. public class FreeModeSceneSelectBase : WfScreenChildren
  6. {
  7. public override void Awake()
  8. {
  9. base.Awake();
  10. EventDelegate.Add(UTY.GetChildObject(base.root_obj, "Cancel", false).GetComponent<UIButton>().onClick, new EventDelegate.Callback(this.OnClickCancel));
  11. this.ok_btn_ = UTY.GetChildObject(base.root_obj, "OK", false).GetComponent<UIButton>();
  12. EventDelegate.Add(this.ok_btn_.onClick, new EventDelegate.Callback(this.OnClickOk));
  13. if (this.mode == FreeModeSceneSelectBase.SelectMode.Vip)
  14. {
  15. this.night_task_viewer_ = UTY.GetChildObject(base.root_obj, "TaskViewer", false).GetComponent<ScheduleTaskViewer>();
  16. this.night_task_viewer_.gameObject.SetActive(true);
  17. this.night_task_viewer_.AlwaysDrawDescriptionViewer = true;
  18. }
  19. }
  20. protected override void OnCall()
  21. {
  22. SubtitleMovieManager.DestroyGlobalInstance();
  23. this.is_scenario_load_ = false;
  24. if (this.maid_ != null)
  25. {
  26. this.maid_.Visible = true;
  27. return;
  28. }
  29. this.mgr_ = (base.parent_mgr as SceneFreeModeSelectManager);
  30. NDebug.AssertNull(this.mgr_ != null);
  31. this.maid_ = GameMain.Instance.CharacterMgr.GetMaid(0);
  32. this.freemode_item_list_ = UTY.GetChildObject(base.root_obj, "FreeModeItemList", false).GetComponent<FreeModeItemList>();
  33. bool isEnabled;
  34. if (this.mode == FreeModeSceneSelectBase.SelectMode.Story)
  35. {
  36. isEnabled = this.freemode_item_list_.SetList(FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Story, null).ToArray());
  37. }
  38. else if (this.mode == FreeModeSceneSelectBase.SelectMode.Everyday)
  39. {
  40. isEnabled = this.freemode_item_list_.SetList(FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Nitijyou, this.maid_.status).ToArray());
  41. }
  42. else
  43. {
  44. this.freemode_item_list_.gameObject.SetActive(false);
  45. this.night_task_viewer_.gameObject.SetActive(true);
  46. ScheduleCSVData.Yotogi yotogi = null;
  47. int num = int.MaxValue;
  48. int num2 = int.MaxValue;
  49. this.vip_list_ = FreeModeItemVip.CreateItemVipList(this.maid_.status);
  50. List<ScheduleTaskViewer.ViewData> list = new List<ScheduleTaskViewer.ViewData>();
  51. foreach (FreeModeItemVip freeModeItemVip in this.vip_list_)
  52. {
  53. ScheduleTaskViewer.ViewData item = default(ScheduleTaskViewer.ViewData);
  54. item.is_enabled = freeModeItemVip.is_enabled;
  55. item.schedule = freeModeItemVip.vip_data;
  56. if (!GameMain.Instance.CharacterMgr.status.lockNTRPlay || !ScheduleCSVData.NetorareFlag.Contains(item.schedule.id))
  57. {
  58. if (ScheduleAPI.VisibleNightWork(item.schedule.id, this.maid_, false))
  59. {
  60. list.Add(item);
  61. if (item.is_enabled)
  62. {
  63. if (item.schedule.categoryID == num)
  64. {
  65. if (item.schedule.id <= num2)
  66. {
  67. yotogi = (ScheduleCSVData.Yotogi)item.schedule;
  68. num2 = item.schedule.id;
  69. }
  70. }
  71. else if (item.schedule.categoryID <= num)
  72. {
  73. yotogi = (ScheduleCSVData.Yotogi)item.schedule;
  74. num = item.schedule.categoryID;
  75. num2 = item.schedule.id;
  76. }
  77. }
  78. }
  79. }
  80. }
  81. this.night_task_viewer_.onClickWorkUnitEvent = delegate(ScheduleCSVData.ScheduleBase click_data)
  82. {
  83. if (click_data == null)
  84. {
  85. this.freemode_item_list_.select_item_data = null;
  86. return;
  87. }
  88. foreach (FreeModeItemVip freeModeItemVip2 in this.vip_list_)
  89. {
  90. if (freeModeItemVip2.vip_data == click_data)
  91. {
  92. this.freemode_item_list_.select_item_data = freeModeItemVip2;
  93. break;
  94. }
  95. }
  96. };
  97. this.night_task_viewer_.onClickWorkUnitEvent(yotogi);
  98. Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleTaskViewer.ViewData>> dictionary = new Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleTaskViewer.ViewData>>();
  99. Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase> dictionary2 = new Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase>();
  100. dictionary.Add(ScheduleTaskCtrl.TaskType.Yotogi, list);
  101. dictionary2.Add(ScheduleMgr.ScheduleTime.Night, yotogi);
  102. this.night_task_viewer_.Call(this.maid_, ScheduleMgr.ScheduleTime.Night, dictionary, dictionary2);
  103. isEnabled = (this.freemode_item_list_.select_item_data != null);
  104. }
  105. this.ok_btn_.isEnabled = isEnabled;
  106. this.maid_.Visible = true;
  107. }
  108. private void OnClickOk()
  109. {
  110. if (this.freemode_item_list_ == null || this.freemode_item_list_.select_item_data == null)
  111. {
  112. return;
  113. }
  114. GameMain.Instance.SoundMgr.StopBGM(0.3f);
  115. this.is_scenario_load_ = true;
  116. AbstractFreeModeItem select_item_data = this.freemode_item_list_.select_item_data;
  117. string text = select_item_data.play_file_name;
  118. text = ScriptManager.ReplacePersonal(this.maid_, text);
  119. GameMain.Instance.ScriptMgr.EvalScript("tf['シーン再生_ファイル名'] = '" + text + "';");
  120. if (select_item_data.type == AbstractFreeModeItem.ItemType.Vip)
  121. {
  122. this.mgr_.CallScenePlayVip();
  123. }
  124. else if (select_item_data.type == AbstractFreeModeItem.ItemType.Normal)
  125. {
  126. this.mgr_.CallScenePlayEveryday();
  127. }
  128. else if (select_item_data.type == AbstractFreeModeItem.ItemType.MainStory)
  129. {
  130. this.mgr_.CallScenePlayMainStory();
  131. }
  132. }
  133. protected override void OnFinish()
  134. {
  135. base.OnFinish();
  136. if (this.is_scenario_load_)
  137. {
  138. GameMain.Instance.MainLight.Reset();
  139. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  140. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  141. GameMain.Instance.SoundMgr.VoiceStopAll();
  142. GameMain.Instance.CharacterMgr.SetCharaAllPos(Vector3.zero);
  143. GameMain.Instance.CharacterMgr.SetCharaAllRot(Vector3.zero);
  144. GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
  145. GameMain.Instance.ScriptMgr.StopMotionScript();
  146. }
  147. this.is_scenario_load_ = false;
  148. }
  149. private void OnClickCancel()
  150. {
  151. this.mgr_.CallScreen("Select");
  152. }
  153. public FreeModeSceneSelectBase.SelectMode mode;
  154. private Maid maid_;
  155. private SceneFreeModeSelectManager mgr_;
  156. private UIButton ok_btn_;
  157. private FreeModeItemList freemode_item_list_;
  158. private ScheduleTaskViewer night_task_viewer_;
  159. private bool is_scenario_load_;
  160. private List<FreeModeItemVip> vip_list_;
  161. public enum SelectMode
  162. {
  163. Everyday,
  164. Vip,
  165. Story
  166. }
  167. }