123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- 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<SceneMgr>();
- 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<UserEditMgr>();
- }
- else if (this.m_sceneName == "SceneStartDaily")
- {
- this.m_mgr.GetManager<StartDailyMgr>().OpenStartDailyPanel();
- }
- else if (this.m_sceneName == "SceneTitle")
- {
- BaseMgr<TitleMgr>.Instance.OpenTitlePanel();
- }
- else if (!(this.m_sceneName == "SceneCompetitiveShow"))
- {
- if (this.m_sceneName == "SceneStaffRoll")
- {
- this.m_mgr.GetManager<StaffRollMgr>().OpenStaffRollPanel();
- }
- }
- }
- }
- private void DispatcherSceneDaily(string openType)
- {
- if (openType == "Daytime")
- {
- this.m_mgr.GetManager<DailyMgr>().OpenDaytimePanel();
- }
- else if (openType == "Night")
- {
- this.m_mgr.GetManager<DailyMgr>().OpenNightPanel();
- }
- else if (openType == "ResultIncome")
- {
- this.m_mgr.GetManager<ResultIncomeMgr>().OpenResultIncomePanel();
- }
- else if (openType == "ResultWorkDaytime")
- {
- this.m_mgr.GetManager<ResultWorkMgr>().OpenResultDaytimePanel();
- }
- else if (openType == "ResultWorkNight")
- {
- this.m_mgr.GetManager<ResultWorkMgr>().OpenResultNightPanel();
- }
- else if (openType == "Status")
- {
- }
- }
- public void OpenMaidExaminationPanel()
- {
- this.m_mgr.GetManager<MaidExaminationMgr>().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<T>() where T : BasePanelMgr
- {
- if (this.m_poolMgr == null)
- {
- this.m_poolMgr = new Dictionary<Type, BasePanelMgr>();
- }
- if (this.m_poolMgr.ContainsKey(typeof(T)))
- {
- return (T)((object)this.m_poolMgr[typeof(T)]);
- }
- T componentInManager = this.GetComponentInManager<T>();
- componentInManager.BaseInit();
- this.m_poolMgr.Add(typeof(T), componentInManager);
- return componentInManager;
- }
- private T GetComponentInManager<T>() 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<T>();
- 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<Type, BasePanelMgr> m_poolMgr;
- private Dictionary<string, string> m_tagBackup;
- private string m_sceneName;
- private string m_openType;
- private string uiRootPath = "/UI Root";
- }
- }
|