using System; using System.Collections.Generic; using System.Text; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; public class SceneEmpireLifeMode : MonoBehaviour { private EmpireLifeModeManager lifeModeMgr { get { EmpireLifeModeManager result; if ((result = this.m_LifeModeMgr) == null) { result = (this.m_LifeModeMgr = GameMain.Instance.LifeModeMgr); } return result; } } private string strNextJumpLabel { get; set; } private void Start() { if (EmpireLifeModeData.GetAllDatas(true).Count <= 0) { NDebug.Assert("不正な処理が実行されました。", false); return; } GameMain.Instance.MainLight.Reset(); GameMain.Instance.CharacterMgr.DeactivateCharaAll(); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); GameMain.Instance.SoundMgr.VoiceStopAll(); GameMain.Instance.SoundMgr.StopSe(); GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color)); ADVKagManager adv_kag = GameMain.Instance.ScriptMgr.adv_kag; if (!adv_kag.tag_backup.TryGetValue("label_start", out this.m_StrScenarioStartLabel)) { Debug.LogFormat("イベント開始時のラベルが未指定です\nラベル名 : {0}", new object[] { "label_start" }); } if (!adv_kag.tag_backup.TryGetValue("label_end", out this.m_StrOKLabel)) { Debug.LogFormat("終了時のラベルが未指定です\nラベル名 : {0}", new object[] { "label_end" }); } this.m_ButtonOK.onClick.AddListener(new UnityAction(this.OnClickOK)); this.m_ButtonShuffle.onClick.AddListener(delegate() { this.MaidRandomAllocate(); this.ShowMaidIconsOfEventData(); }); if (SceneEmpireLifeMode.m_SelectedEventObject != null) { } if (this.lifeModeMgr.executedEventList.Count <= 0) { this.lifeModeMgr.CreateStoryEvent(); int num = (10 > this.lifeModeMgr.lifeModeAllMaidList.Count) ? 1 : 2; for (int i = 0; i < num; i++) { if (UnityEngine.Random.Range(0, 100) > 80) { this.lifeModeMgr.CreateRandomEventOfNowState(); } } this.lifeModeMgr.AllMaidRandomAllocate(); this.lifeModeMgr.CreateEventListOfMaidAllocateData(); Debug.Log("イベントを作成しました。"); } this.m_FacilityListUI.ShowFacilityList(); this.ShowMaidIconsOfEventData(); GameMain.Instance.MainCamera.FadeIn(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeIn), true, true, default(Color)); } private void OnCompleteFadeIn() { } private void OnCompleteFadeOut() { if (SceneEmpireLifeMode.m_SelectedEventObject != null) { this.lifeModeMgr.SetupScenarioEvent(SceneEmpireLifeMode.m_SelectedEventObject, delegate { ADVKagManager adv_kag2 = GameMain.Instance.ScriptMgr.adv_kag; NDebug.Assert(!string.IsNullOrEmpty(this.strNextJumpLabel), "SceneEmpireLifeMode.cs\n飛び先ラベルが空でした"); adv_kag2.JumpLabel(this.strNextJumpLabel); adv_kag2.Exec(); }); return; } Debug.Log("エンパイアライフモードのループを終了。"); ADVKagManager adv_kag = GameMain.Instance.ScriptMgr.adv_kag; NDebug.Assert(!string.IsNullOrEmpty(this.strNextJumpLabel), "SceneEmpireLifeMode.cs\n飛び先ラベルが空でした"); adv_kag.JumpLabel(this.strNextJumpLabel); adv_kag.Exec(); } private void OnClickOK() { SceneEmpireLifeMode.m_SelectedEventObject = null; this.strNextJumpLabel = this.m_StrOKLabel; GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeOut), true, default(Color)); } private void OnClickEventFrame(EmpireLifeModeManager.EventDataObject eventObj) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(string.Format("[{0}] {1} 種類:{2}[{3}]", new object[] { eventObj.targetEvent.ID, eventObj.targetEvent.strUniqueName, eventObj.targetEvent.dataScenarioType, eventObj.targetEvent.GetPriorityScenarioType() })); stringBuilder.AppendLine(string.Format("実行する施設 : {0} ({1})", eventObj.targetFacility.facilityName, eventObj.targetFacility.defaultName)); foreach (Maid maid in eventObj.targetMaidList) { stringBuilder.AppendLine(string.Format("{0} ({1})", maid.status.fullNameJpStyle, maid.status.personal.drawName)); } Debug.Log(stringBuilder.ToString()); SceneEmpireLifeMode.m_SelectedEventObject = eventObj; this.strNextJumpLabel = this.m_StrScenarioStartLabel; GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeOut), true, default(Color)); } public void MaidRandomAllocate() { this.lifeModeMgr.DeleteNowEventList(); this.lifeModeMgr.CreateStoryEvent(); int num = (10 > this.lifeModeMgr.lifeModeAllMaidList.Count) ? 1 : 2; for (int i = 0; i < num; i++) { if (UnityEngine.Random.Range(0, 100) > 80) { this.lifeModeMgr.CreateRandomEventOfNowState(); } } this.lifeModeMgr.AllMaidRandomAllocate(); this.lifeModeMgr.CreateEventListOfMaidAllocateData(); } public void ShowMaidIconsOfNowAllocateState() { Debug.LogWarning("ShowMaidIconsOfNowAllocateState()\nこの関数は使わなくなる?"); foreach (EmpireLifeModeFacilityUI.FacilityLifeModeViewer facilityLifeModeViewer in this.m_FacilityListUI.GetAllItem()) { Facility nowShowingFacility = facilityLifeModeViewer.GetNowShowingFacility(); List maidList; if (!(nowShowingFacility == null) && this.lifeModeMgr.nowMaidAllocationDic.TryGetValue(nowShowingFacility, out maidList)) { facilityLifeModeViewer.listViewerParentMaidIcon.Show(maidList.Count, delegate(int index, uGUIListViewer viewer) { viewer.Show(1, delegate(int notUseIndex, Transform trans) { RawImage componentInChildren = trans.GetComponentInChildren(); Maid maid = maidList[index]; componentInChildren.texture = maid.GetThumIcon(); Text componentInChildren2 = componentInChildren.GetComponentInChildren(); if (componentInChildren2 != null) { if (componentInChildren.texture == null) { componentInChildren2.text = string.Format("{0}\n({1})", maid.status.charaName.GetFullName(" "), maid.status.personal.drawName); } else { componentInChildren2.text = string.Empty; } } }); }); } } } public void ShowMaidIconsOfEventData() { List nowEventList = this.lifeModeMgr.nowEventList; foreach (EmpireLifeModeFacilityUI.FacilityLifeModeViewer facilityLifeModeViewer in this.m_FacilityListUI.GetAllItem()) { SceneEmpireLifeMode.c__AnonStorey2 c__AnonStorey = new SceneEmpireLifeMode.c__AnonStorey2(); c__AnonStorey.$this = this; Facility nowShowingFacility = facilityLifeModeViewer.GetNowShowingFacility(); if (!(nowShowingFacility == null)) { c__AnonStorey.eventList = new List(); foreach (EmpireLifeModeManager.EventDataObject eventDataObject in nowEventList) { if (eventDataObject.targetFacility == nowShowingFacility) { c__AnonStorey.eventList.Add(eventDataObject); } } facilityLifeModeViewer.listViewerParentMaidIcon.Show(c__AnonStorey.eventList.Count, delegate(int eventIndex, uGUIListViewer viewer) { RawImage component = viewer.transform.Find("event type icon").GetComponent(); component.texture = EmpireLifeModeAPI.GetIconScenarioType(c__AnonStorey.eventList[eventIndex].targetEvent.dataScenarioType); component.gameObject.SetActive(component.texture != null); viewer.Show(c__AnonStorey.eventList[eventIndex].targetMaidList.Count, delegate(int maidIndex, Transform trans) { RawImage componentInChildren = trans.GetComponentInChildren(); Maid maid = c__AnonStorey.eventList[eventIndex].targetMaidList[maidIndex]; componentInChildren.texture = maid.GetThumIcon(); Text componentInChildren2 = componentInChildren.GetComponentInChildren(); if (componentInChildren2 != null) { if (componentInChildren.texture == null) { componentInChildren2.text = string.Format("{0}\n({1})", maid.status.charaName.GetFullName(" "), maid.status.personal.drawName); } else { componentInChildren2.text = string.Empty; } } trans.SetAsFirstSibling(); }); Button component2 = viewer.GetComponent