Beispiel #1
0
        void Awake()
        {
            //字段初始化

            _DicUIFormsPaths       = new Dictionary <string, string>();
            _DicALLUIForms         = new Dictionary <string, BaseUIForms>();
            _StaCurrentUIForms     = new Stack <BaseUIForms>();
            _DicCurrentShowUIForms = new Dictionary <string, BaseUIForms>();

            //初始化项目开始必须的资源加载
            if (SceneManager.GetActiveScene().name == "start")
            {
                InitRootCanvasLoading();
            }
            //得到UI根节点、及其重要子节点
            _CanvasTransform = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CANVAS).transform;
            //得到普通全屏界面节点、固定界面节点、弹出模式节点、UI脚本节点
            _CanTransformNormal    = UnityHelper.FindTheChild(_CanvasTransform.gameObject, SysDefine.SYS_CANVAS_NORMAL_NODE_NAME);
            _CanTransformFixed     = UnityHelper.FindTheChild(_CanvasTransform.gameObject, SysDefine.SYS_CANVAS_FIXED_NODE_NAME);
            _CanTransformPopUp     = UnityHelper.FindTheChild(_CanvasTransform.gameObject, SysDefine.SYS_CANVAS_POPUP_NODE_NAME);
            _CanTransformUIScripts = UnityHelper.FindTheChild(_CanvasTransform.gameObject, SysDefine.SYS_CANVAS_UISCRIPTS_NODE_NAME);

            //把本脚本实例,作为Canvas的子节点
            UnityHelper.AddChildToParent(_CanTransformUIScripts, this.gameObject.transform);

            //本UI节点信息,场景转换时,不允许销毁
            DontDestroyOnLoad(_CanvasTransform);
            //初始化“UI窗体预设”路径数据
            InitUIFormsPathsData();
        }
Beispiel #2
0
        void Awake()
        {
            //得到UI根节点、UI脚本节点
            _GoCanvasRoot          = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CANVAS);
            _CanTransformUIScripts = UnityHelper.FindTheChild(_GoCanvasRoot, SysDefine.SYS_CANVAS_UISCRIPTS_NODE_NAME);
            //把本脚本实例,作为Canvas的子节点
            UnityHelper.AddChildToParent(_CanTransformUIScripts, this.gameObject.transform);

            //得到“顶层面板”与“遮罩面板”
            _GoTopPlane  = _GoCanvasRoot;
            _GoMaskPlane = UnityHelper.FindTheChild(_GoCanvasRoot.gameObject, SysDefine.SYS_CANVAS_UIMASKPANELS_NODE_NAME).gameObject;

            //得到UI摄像机的原始“层深”
            _UICamear = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_UICAMERA).GetComponent <Camera>();
            if (_UICamear != null)
            {
                _OriginalUICameraDepth = _UICamear.depth;
            }
            else
            {
                Log.Write(GetType() + "/Start()/_UICamera is Null ,please Check!");
            }
        }
Beispiel #3
0
        /// <summary>
        /// 注册按钮对象事件
        /// </summary>
        /// <param name="strButtonName">(UI预设)需要注册事件的按钮名称</param>
        /// <param name="delHandle">([委托类型]按钮的注册方法)</param>
        protected void RigisteButtonObjectEvent(string strButtonName, EventTriggerListener.VoidDelegate delHandle)
        {
            GameObject goNeedRigistButton = UnityHelper.FindTheChild(this.gameObject, strButtonName).gameObject;

            EventTriggerListener.Get(goNeedRigistButton).onClick = delHandle;
        }