コード例 #1
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 private void Awake()
 {
     //初始化ResourcesMgr对象,加载Canvas对象。
     InitRootCanvasLoading();
     //字段初始化
     _DicFormPaths          = new Dictionary <string, string>();
     _DicALLUIForms         = new Dictionary <string, BaseUIForm>();
     _DicCurrentShowUIForms = new Dictionary <string, BaseUIForm>();
     _StaCurrentUIForms     = new Stack <BaseUIForm>();
     _TraCanvasTransform    = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CANVAS).transform;
     //得到UI根节点、全屏节点、固定节点、弹出节点
     _TraNormal    = _TraCanvasTransform.Find(SysDefine.SYS_Node_Normal);
     _TraFixed     = _TraCanvasTransform.Find(SysDefine.SYS_Node_Fixed);
     _TraPopUp     = _TraCanvasTransform.Find(SysDefine.SYS_Node_PopUp);
     _TraUIScripts = _TraCanvasTransform.Find(SysDefine.SYS_Node_ScriptMgr);
     //将该对象加入__TraUIScripts节点下
     UnityHelper.AddChildNodeToParentNode(_TraUIScripts, transform);
     DontDestroyOnLoad(_TraCanvasTransform);
     if (_DicFormPaths != null)
     {
         _DicFormPaths.Add("LoginUIForm", @"UIPrefabs\LoginUIForm");
         _DicFormPaths.Add("SelectHeroUIForm", @"UIPrefabs\SelectHeroUIForm");
     }
 }
コード例 #2
0
 // Update is called once per frame
 void Awake()
 {
     _GoCanvasRoot     = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CANVAS);
     _TraUIScriptsNode = UnityHelper.FindTheChildNode(_GoCanvasRoot, SysDefine.SYS_Node_ScriptMgr);
     UnityHelper.AddChildNodeToParentNode(_TraUIScriptsNode, this.gameObject.transform);
 }