protected bool RegisterClickEvent(string btnName, UUIEventListener.VoidDelegate clickEvent) { GameObject btn = HelperAboutUnity.FindChildNode(this.gameObject, btnName); if (null != btn) { UUIEventListener.Get(btn).onClick = clickEvent; return(true); } return(false); }
/// <summary> /// 获取挂载unity单例脚本的节点 /// </summary> private static GameObject GetOrCreateUnitySingletonScriptsRoot() { GameObject _Manager = HelperAboutUnity.FindObjByTag(SysDefine.UNITY_SINGLETON_SCRIPTS_ROOT); if (null == _Manager) { _Manager = new GameObject("UnitySingletonScriptsRoot"); _Manager.tag = SysDefine.UNITY_SINGLETON_SCRIPTS_ROOT; } return(_Manager); }
/// <summary> /// 初始化字段 /// </summary> private void InitField() { _UIRoot = ResourcesMgr.Instance.LoadAsset(SysDefine.SYS_PATH_UIROOT, false); _NormalRoot = HelperAboutUnity.FindChildNode(_UIRoot.transform, SysDefine.SYS_PATH_NORMALROOT); _FixedRoot = HelperAboutUnity.FindChildNode(_UIRoot.transform, SysDefine.SYS_PATH_FIXEDROOT); _PopupRoot = HelperAboutUnity.FindChildNode(_UIRoot.transform, SysDefine.SYS_PATH_POPUPROOT); _UIScriptsRoot = HelperAboutUnity.FindChildNode(_UIRoot.transform, SysDefine.SYS_PATH_UISCRIPTSROOT); this.transform.SetParent(_UIScriptsRoot, false); DontDestroyOnLoad(_UIRoot); }
protected override void Awake() { base.Awake(); _UIRoot = UIManager.Instance.UIRoot.transform; _UIMaskPanel = HelperAboutUnity.FindChildNode(_UIRoot, "_UIMaskPanel"); if (null != _UIMaskPanel) { _UIMaskObj = _UIMaskPanel.gameObject; } _UIMaskImage = _UIMaskPanel.GetComponent <Image>(); _UICamera = HelperAboutUnity.FindComponent <Camera>(_UIRoot); if (null != _UICamera) { _OriginCameraDpeth = _UICamera.depth; } }
public void IsShowFPS(bool isShow) { GameObject obj = GameObject.FindGameObjectWithTag(SysDefine.UNITY_SINGLETON_SCRIPTS_ROOT); GameObject fps = HelperAboutUnity.FindChildNode(obj, typeof(ShowFPS).Name); if (isShow) { if (null == fps) { obj.AddComponent <ShowFPS>(); } } else { if (null != fps) { Destroy(fps); } } }