123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- 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<Maid> maidList;
- if (!(nowShowingFacility == null) && this.lifeModeMgr.nowMaidAllocationDic.TryGetValue(nowShowingFacility, out maidList))
- {
- facilityLifeModeViewer.listViewerParentMaidIcon.Show<uGUIListViewer>(maidList.Count, delegate(int index, uGUIListViewer viewer)
- {
- viewer.Show<Transform>(1, delegate(int notUseIndex, Transform trans)
- {
- RawImage componentInChildren = trans.GetComponentInChildren<RawImage>();
- Maid maid = maidList[index];
- componentInChildren.texture = maid.GetThumIcon();
- Text componentInChildren2 = componentInChildren.GetComponentInChildren<Text>();
- 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<EmpireLifeModeManager.EventDataObject> nowEventList = this.lifeModeMgr.nowEventList;
- foreach (EmpireLifeModeFacilityUI.FacilityLifeModeViewer facilityLifeModeViewer in this.m_FacilityListUI.GetAllItem())
- {
- SceneEmpireLifeMode.<ShowMaidIconsOfEventData>c__AnonStorey2 <ShowMaidIconsOfEventData>c__AnonStorey = new SceneEmpireLifeMode.<ShowMaidIconsOfEventData>c__AnonStorey2();
- <ShowMaidIconsOfEventData>c__AnonStorey.$this = this;
- Facility nowShowingFacility = facilityLifeModeViewer.GetNowShowingFacility();
- if (!(nowShowingFacility == null))
- {
- <ShowMaidIconsOfEventData>c__AnonStorey.eventList = new List<EmpireLifeModeManager.EventDataObject>();
- foreach (EmpireLifeModeManager.EventDataObject eventDataObject in nowEventList)
- {
- if (eventDataObject.targetFacility == nowShowingFacility)
- {
- <ShowMaidIconsOfEventData>c__AnonStorey.eventList.Add(eventDataObject);
- }
- }
- facilityLifeModeViewer.listViewerParentMaidIcon.Show<uGUIListViewer>(<ShowMaidIconsOfEventData>c__AnonStorey.eventList.Count, delegate(int eventIndex, uGUIListViewer viewer)
- {
- RawImage component = viewer.transform.Find("event type icon").GetComponent<RawImage>();
- component.texture = EmpireLifeModeAPI.GetIconScenarioType(<ShowMaidIconsOfEventData>c__AnonStorey.eventList[eventIndex].targetEvent.dataScenarioType);
- component.gameObject.SetActive(component.texture != null);
- viewer.Show<Transform>(<ShowMaidIconsOfEventData>c__AnonStorey.eventList[eventIndex].targetMaidList.Count, delegate(int maidIndex, Transform trans)
- {
- RawImage componentInChildren = trans.GetComponentInChildren<RawImage>();
- Maid maid = <ShowMaidIconsOfEventData>c__AnonStorey.eventList[eventIndex].targetMaidList[maidIndex];
- componentInChildren.texture = maid.GetThumIcon();
- Text componentInChildren2 = componentInChildren.GetComponentInChildren<Text>();
- 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<Button>();
- component2.onClick.AddListener(delegate()
- {
- <ShowMaidIconsOfEventData>c__AnonStorey.OnClickEventFrame(<ShowMaidIconsOfEventData>c__AnonStorey.eventList[eventIndex]);
- });
- });
- }
- }
- }
- [SerializeField]
- private EmpireLifeModeFacilityUI m_FacilityListUI;
- [SerializeField]
- private Button m_ButtonOK;
- [SerializeField]
- private Button m_ButtonShuffle;
- private string m_StrScenarioStartLabel;
- private string m_StrOKLabel;
- private static EmpireLifeModeManager.EventDataObject m_SelectedEventObject;
- private EmpireLifeModeManager m_LifeModeMgr;
- }
|