using System; using UnityEngine; public abstract class BaseCreatePanel : BasePanelMgr { protected GameObject GetPanel(string panelName) { return this.GetPanel(panelName, this.m_uiRootPath); } protected GameObject GetPanel(string panelName, string rootPath) { this.m_goUIRoot = this.GetUIRoot(rootPath); NDebug.Assert(this.m_goUIRoot != null, string.Format("{0}が見つかりませんでした。", "UI Root")); this.m_goPanel = this.m_goUIRoot.transform.Find(panelName).gameObject; NDebug.Assert(this.m_goPanel != null, string.Format("{0}が見つかりませんでした。", panelName)); return this.m_goPanel; } private GameObject GetUIRoot(string uiRootPath) { return (!(this.m_goUIRoot == null)) ? this.m_goUIRoot : GameObject.Find(uiRootPath); } protected Type GetCtrl() where Type : Component { Type component = this.m_goPanel.GetComponent(); NDebug.Assert(component != null, string.Format("{0}が見つかりませんでした。", typeof(Type) + "コンポーネント")); return component; } public bool IsValidateButton(string clickButtonName) { if (!Enum.IsDefined(typeof(T), clickButtonName)) { Debug.LogError(string.Format("不適切なボタンがクリックされました。クリックされたボタン名={0}", clickButtonName)); return false; } return true; } public bool IsValidatePopupValue(string value) { if (!Enum.IsDefined(typeof(T), value)) { Debug.LogError(string.Format("ポップアップリストから不適切な値が選択されました。選択されたボタン名={0}", value)); return false; } return true; } protected GameObject m_goPanel; protected string m_uiRootPath = "/UI Root"; private GameObject m_goUIRoot; }