using System; using System.Collections.Generic; using UnityEngine; namespace com.workman.cm3d2.scene.dailyEtc { public class SceneMgr : MonoBehaviour { private void Start() { this.m_tagBackup = null; this.advKag = GameMain.Instance.ScriptMgr.adv_kag; if (this.advKag.tag_backup != null && 0 < this.advKag.tag_backup.Count) { NDebug.Assert(this.advKag.tag_backup.ContainsKey("label"), "SceneCallにlabelの設定がされていませんでした"); this.m_tagBackup = this.advKag.tag_backup; this.m_sceneName = this.advKag.tag_backup["name"]; this.m_mgr = base.GetComponent(); if (this.m_sceneName == "SceneDaily") { NDebug.Assert(this.advKag.tag_backup.ContainsKey("type"), "SceneCallにtypeの設定がされていませんでした"); this.m_openType = this.advKag.tag_backup["type"]; this.DispatcherSceneDaily(this.m_openType); } else if (this.m_sceneName == "SceneUserEdit") { this.m_mgr.GetManager(); } else if (this.m_sceneName == "SceneStartDaily") { this.m_mgr.GetManager().OpenStartDailyPanel(); } else if (this.m_sceneName == "SceneTitle") { BaseMgr.Instance.OpenTitlePanel(); } else if (!(this.m_sceneName == "SceneCompetitiveShow")) { if (this.m_sceneName == "SceneStaffRoll") { this.m_mgr.GetManager().OpenStaffRollPanel(); } } } } private void DispatcherSceneDaily(string openType) { if (openType == "Daytime") { this.m_mgr.GetManager().OpenDaytimePanel(); } else if (openType == "Night") { this.m_mgr.GetManager().OpenNightPanel(); } else if (openType == "ResultIncome") { this.m_mgr.GetManager().OpenResultIncomePanel(); } else if (openType == "ResultWorkDaytime") { this.m_mgr.GetManager().OpenResultDaytimePanel(); } else if (openType == "ResultWorkNight") { this.m_mgr.GetManager().OpenResultNightPanel(); } else if (openType == "Status") { } } public void OpenMaidExaminationPanel() { this.m_mgr.GetManager().OpenMaidExaminationPanel(null, null, null); } public void CloseScene() { this.GoToLabel("label"); } public void GoToLabel(string labelName) { if (this.advKag != null && this.m_tagBackup != null) { if (this.m_tagBackup.ContainsKey(labelName)) { string text = this.m_tagBackup[labelName]; if (text != null) { Debug.Log(string.Format("Call 名前={0}, タイプ={1}, ラベル={2}", this.m_sceneName, this.m_openType, labelName)); this.advKag.JumpLabel(text); this.advKag.Exec(); } else { Debug.LogError(string.Format("指定したラベルが取得できません。名前={0}, タイプ={1}, ラベル={2}", this.m_sceneName, this.m_openType, labelName)); } } else { Debug.LogError(string.Format("指定したラベルが取得できません。名前={0}, タイプ={1}, ラベル={2}", this.m_sceneName, this.m_openType, labelName)); } } } public T GetManager() where T : BasePanelMgr { if (this.m_poolMgr == null) { this.m_poolMgr = new Dictionary(); } if (this.m_poolMgr.ContainsKey(typeof(T))) { return (T)((object)this.m_poolMgr[typeof(T)]); } T componentInManager = this.GetComponentInManager(); componentInManager.BaseInit(); this.m_poolMgr.Add(typeof(T), componentInManager); return componentInManager; } private T GetComponentInManager() where T : BasePanelMgr { this.m_goUIRoot = this.GetUIRoot(this.uiRootPath); GameObject childObject = UTY.GetChildObject(this.m_goUIRoot, "Manager", false); string arg = this.uiRootPath + "/Manager"; NDebug.Assert(childObject != null, string.Format("{0}が見つかりませんでした", arg)); T componentInChildren = childObject.GetComponentInChildren(); NDebug.Assert(childObject != null, string.Format("{0}の子供に指定されたコンポーネント({1})が存在しません。", arg, typeof(T))); return componentInChildren; } private GameObject GetUIRoot(string uiRootPath) { if (this.m_goUIRoot == null) { return GameObject.Find(uiRootPath); } return this.m_goUIRoot; } private ADVKagManager advKag; private SceneMgr m_mgr; private GameObject m_goUIRoot; private Dictionary m_poolMgr; private Dictionary m_tagBackup; private string m_sceneName; private string m_openType; private string uiRootPath = "/UI Root"; } }