FreeModeSceneSelectBase.cs 6.0 KB

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