SceneEmpireLifeMode.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using UnityEngine;
  5. using UnityEngine.Events;
  6. using UnityEngine.UI;
  7. public class SceneEmpireLifeMode : MonoBehaviour
  8. {
  9. private EmpireLifeModeManager lifeModeMgr
  10. {
  11. get
  12. {
  13. EmpireLifeModeManager result;
  14. if ((result = this.m_LifeModeMgr) == null)
  15. {
  16. result = (this.m_LifeModeMgr = GameMain.Instance.LifeModeMgr);
  17. }
  18. return result;
  19. }
  20. }
  21. private string strNextJumpLabel { get; set; }
  22. private void Start()
  23. {
  24. if (EmpireLifeModeData.GetAllDatas(true).Count <= 0)
  25. {
  26. NDebug.Assert("不正な処理が実行されました。", false);
  27. return;
  28. }
  29. GameMain.Instance.MainLight.Reset();
  30. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  31. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  32. GameMain.Instance.SoundMgr.VoiceStopAll();
  33. GameMain.Instance.SoundMgr.StopSe();
  34. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  35. ADVKagManager adv_kag = GameMain.Instance.ScriptMgr.adv_kag;
  36. if (!adv_kag.tag_backup.TryGetValue("label_start", out this.m_StrScenarioStartLabel))
  37. {
  38. Debug.LogFormat("イベント開始時のラベルが未指定です\nラベル名 : {0}", new object[]
  39. {
  40. "label_start"
  41. });
  42. }
  43. if (!adv_kag.tag_backup.TryGetValue("label_end", out this.m_StrOKLabel))
  44. {
  45. Debug.LogFormat("終了時のラベルが未指定です\nラベル名 : {0}", new object[]
  46. {
  47. "label_end"
  48. });
  49. }
  50. this.m_ButtonOK.onClick.AddListener(new UnityAction(this.OnClickOK));
  51. if (SceneEmpireLifeMode.m_SelectedEventObject != null)
  52. {
  53. }
  54. if (this.lifeModeMgr.executedEventList.Count <= 0)
  55. {
  56. this.lifeModeMgr.CreateStoryEvent();
  57. this.lifeModeMgr.AllMaidRandomAllocate();
  58. this.lifeModeMgr.CreateEventListOfMaidAllocateData();
  59. Debug.Log("イベントを作成しました。");
  60. }
  61. this.m_FacilityListUI.ShowFacilityList();
  62. this.ShowMaidIconsOfEventData();
  63. GameMain.Instance.MainCamera.FadeIn(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeIn), true, true, default(Color));
  64. }
  65. private void OnCompleteFadeIn()
  66. {
  67. }
  68. private void OnCompleteFadeOut()
  69. {
  70. if (SceneEmpireLifeMode.m_SelectedEventObject != null)
  71. {
  72. this.lifeModeMgr.SetupScenarioEvent(SceneEmpireLifeMode.m_SelectedEventObject, delegate
  73. {
  74. ADVKagManager adv_kag2 = GameMain.Instance.ScriptMgr.adv_kag;
  75. NDebug.Assert(!string.IsNullOrEmpty(this.strNextJumpLabel), "SceneEmpireLifeMode.cs\n飛び先ラベルが空でした");
  76. adv_kag2.JumpLabel(this.strNextJumpLabel);
  77. adv_kag2.Exec();
  78. });
  79. return;
  80. }
  81. Debug.Log("エンパイアライフモードのループを終了。");
  82. ADVKagManager adv_kag = GameMain.Instance.ScriptMgr.adv_kag;
  83. NDebug.Assert(!string.IsNullOrEmpty(this.strNextJumpLabel), "SceneEmpireLifeMode.cs\n飛び先ラベルが空でした");
  84. adv_kag.JumpLabel(this.strNextJumpLabel);
  85. adv_kag.Exec();
  86. }
  87. private void OnClickOK()
  88. {
  89. SceneEmpireLifeMode.m_SelectedEventObject = null;
  90. this.strNextJumpLabel = this.m_StrOKLabel;
  91. GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeOut), true, default(Color));
  92. }
  93. private void OnClickEventFrame(EmpireLifeModeManager.EventDataObject eventObj)
  94. {
  95. StringBuilder stringBuilder = new StringBuilder();
  96. stringBuilder.AppendLine(string.Format("[{0}] {1} 種類:{2}[{3}]", new object[]
  97. {
  98. eventObj.targetEvent.ID,
  99. eventObj.targetEvent.strUniqueName,
  100. eventObj.targetEvent.dataScenarioType,
  101. eventObj.targetEvent.GetPriorityScenarioType()
  102. }));
  103. stringBuilder.AppendLine(string.Format("実行する施設 : {0} ({1})", eventObj.targetFacility.facilityName, eventObj.targetFacility.defaultName));
  104. foreach (Maid maid in eventObj.targetMaidList)
  105. {
  106. stringBuilder.AppendLine(string.Format("{0} ({1})", maid.status.fullNameJpStyle, maid.status.personal.drawName));
  107. }
  108. Debug.Log(stringBuilder.ToString());
  109. SceneEmpireLifeMode.m_SelectedEventObject = eventObj;
  110. this.strNextJumpLabel = this.m_StrScenarioStartLabel;
  111. GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeOut), true, default(Color));
  112. }
  113. public void MaidRandomAllocate()
  114. {
  115. this.lifeModeMgr.DeleteNowEventList();
  116. this.lifeModeMgr.CreateStoryEvent();
  117. this.lifeModeMgr.AllMaidRandomAllocate();
  118. this.lifeModeMgr.CreateEventListOfMaidAllocateData();
  119. }
  120. public void ShowMaidIconsOfNowAllocateState()
  121. {
  122. Debug.LogWarning("ShowMaidIconsOfNowAllocateState()\nこの関数は使わなくなる?");
  123. foreach (EmpireLifeModeFacilityUI.FacilityLifeModeViewer facilityLifeModeViewer in this.m_FacilityListUI.GetAllItem())
  124. {
  125. Facility nowShowingFacility = facilityLifeModeViewer.GetNowShowingFacility();
  126. List<Maid> maidList;
  127. if (!(nowShowingFacility == null) && this.lifeModeMgr.nowMaidAllocationDic.TryGetValue(nowShowingFacility, out maidList))
  128. {
  129. facilityLifeModeViewer.listViewerParentMaidIcon.Show<uGUIListViewer>(maidList.Count, delegate(int index, uGUIListViewer viewer)
  130. {
  131. viewer.Show<Transform>(1, delegate(int notUseIndex, Transform trans)
  132. {
  133. RawImage componentInChildren = trans.GetComponentInChildren<RawImage>();
  134. Maid maid = maidList[index];
  135. componentInChildren.texture = maid.GetThumIcon();
  136. Text componentInChildren2 = componentInChildren.GetComponentInChildren<Text>();
  137. if (componentInChildren2 != null)
  138. {
  139. if (componentInChildren.texture == null)
  140. {
  141. componentInChildren2.text = string.Format("{0}\n({1})", maid.status.fullNameJpStyle, maid.status.personal.drawName);
  142. }
  143. else
  144. {
  145. componentInChildren2.text = string.Empty;
  146. }
  147. }
  148. });
  149. });
  150. }
  151. }
  152. }
  153. public void ShowMaidIconsOfEventData()
  154. {
  155. List<EmpireLifeModeManager.EventDataObject> nowEventList = this.lifeModeMgr.nowEventList;
  156. Debug.LogFormat("現在の発生イベント数 : {0}", new object[]
  157. {
  158. nowEventList.Count
  159. });
  160. foreach (EmpireLifeModeFacilityUI.FacilityLifeModeViewer facilityLifeModeViewer in this.m_FacilityListUI.GetAllItem())
  161. {
  162. SceneEmpireLifeMode.<ShowMaidIconsOfEventData>c__AnonStorey2 <ShowMaidIconsOfEventData>c__AnonStorey = new SceneEmpireLifeMode.<ShowMaidIconsOfEventData>c__AnonStorey2();
  163. <ShowMaidIconsOfEventData>c__AnonStorey.$this = this;
  164. Facility nowShowingFacility = facilityLifeModeViewer.GetNowShowingFacility();
  165. if (!(nowShowingFacility == null))
  166. {
  167. <ShowMaidIconsOfEventData>c__AnonStorey.eventList = new List<EmpireLifeModeManager.EventDataObject>();
  168. foreach (EmpireLifeModeManager.EventDataObject eventDataObject in nowEventList)
  169. {
  170. if (eventDataObject.targetFacility == nowShowingFacility)
  171. {
  172. <ShowMaidIconsOfEventData>c__AnonStorey.eventList.Add(eventDataObject);
  173. }
  174. }
  175. facilityLifeModeViewer.listViewerParentMaidIcon.Show<uGUIListViewer>(<ShowMaidIconsOfEventData>c__AnonStorey.eventList.Count, delegate(int eventIndex, uGUIListViewer viewer)
  176. {
  177. RawImage component = viewer.transform.Find("event type icon").GetComponent<RawImage>();
  178. component.texture = EmpireLifeModeAPI.GetIconScenarioType(<ShowMaidIconsOfEventData>c__AnonStorey.eventList[eventIndex].targetEvent.dataScenarioType);
  179. viewer.Show<Transform>(<ShowMaidIconsOfEventData>c__AnonStorey.eventList[eventIndex].targetMaidList.Count, delegate(int maidIndex, Transform trans)
  180. {
  181. RawImage componentInChildren = trans.GetComponentInChildren<RawImage>();
  182. Maid maid = <ShowMaidIconsOfEventData>c__AnonStorey.eventList[eventIndex].targetMaidList[maidIndex];
  183. componentInChildren.texture = maid.GetThumIcon();
  184. Text componentInChildren2 = componentInChildren.GetComponentInChildren<Text>();
  185. if (componentInChildren2 != null)
  186. {
  187. if (componentInChildren.texture == null)
  188. {
  189. componentInChildren2.text = string.Format("{0}\n({1})", maid.status.fullNameJpStyle, maid.status.personal.drawName);
  190. }
  191. else
  192. {
  193. componentInChildren2.text = string.Empty;
  194. }
  195. }
  196. });
  197. Button component2 = viewer.GetComponent<Button>();
  198. component2.onClick.AddListener(delegate()
  199. {
  200. <ShowMaidIconsOfEventData>c__AnonStorey.OnClickEventFrame(<ShowMaidIconsOfEventData>c__AnonStorey.eventList[eventIndex]);
  201. });
  202. });
  203. }
  204. }
  205. }
  206. [SerializeField]
  207. private EmpireLifeModeFacilityUI m_FacilityListUI;
  208. [SerializeField]
  209. private Button m_ButtonOK;
  210. private string m_StrScenarioStartLabel;
  211. private string m_StrOKLabel;
  212. private static EmpireLifeModeManager.EventDataObject m_SelectedEventObject;
  213. private EmpireLifeModeManager m_LifeModeMgr;
  214. }