示例#1
0
    void Awake()
    {
        _GoCanvasRoot     = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CANVAS);
        _TraUIScriptsNode = _GoCanvasRoot.transform.Find("_ScriptMgr");

        UnityHelper.AddChildNodeToParentNode(_TraUIScriptsNode, this.transform);
        _GoTopPanel  = _GoCanvasRoot;
        _GoMaskPanel = UnityHelper.FindChildNode(_GoCanvasRoot, "UIMaskPanel").gameObject;
        _UICamera    = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CAMERA).GetComponent <Camera>();

        if (_UICamera != null)
        {
            _OriginalUICameraDepth = _UICamera.depth;
        }
    }
示例#2
0
 void Awake()
 {
     //得到UI根节点对象、脚本节点对象
     _GoCanvasRoot     = GameObject.FindGameObjectWithTag("Canvas");
     _TraUIScriptsNode = UnityHelper.FindTheChildNode(_GoCanvasRoot, "Scripts");
     //把本脚本实例,作为“脚本节点对象”的子节点。
     UnityHelper.AddChildNodeToParentNode(_TraUIScriptsNode, gameObject.transform);
     //得到“顶层面板”、“遮罩面板”
     _GoTopPanel  = _GoCanvasRoot;
     _GoMaskPanel = UnityHelper.FindTheChildNode(_GoCanvasRoot, "UiMaskPanel").gameObject;
     //得到UI摄像机原始的“层深”
     _UICamera = GameObject.FindGameObjectWithTag("TagUiCamera").GetComponent <Camera>();
     if (_UICamera != null)
     {
         //得到UI摄像机原始“层深”
         _OriginalUICameralDepth = _UICamera.depth;
     }
     else
     {
         Debug.Log(GetType() + "/Start()/UI_Camera is Null!,Please Check! ");
     }
 }
示例#3
0
 private void Awake()
 {
     //获得UI的根节点对象、脚本节点对象
     _goCanvasRoot    = GameObject.FindGameObjectWithTag(SysDefine.CANVAS_TAG);
     _traUIScriptNode = _goCanvasRoot.transform.Find(SysDefine.UISCRIPTS_NODE);
     //实例化该脚本并作为“脚本节点对象”的子物体
     UnityHelper.AddChildNodeToParentNode(_traUIScriptNode, gameObject.transform);
     //得到“顶层面板”,“遮罩面板”
     _goTopPanel  = _goCanvasRoot;
     _goMaskPanel = UnityHelper.FindTheChildNode(_goCanvasRoot, SysDefine.UI_MASKPANEL_NAME).gameObject;
     //得到UI摄像机
     _uiCamera = GameObject.FindGameObjectWithTag(SysDefine.UICAMERA_TAG).GetComponent <Camera>();
     if (_uiCamera != null)
     {
         //得到UI摄像机的景深
         _originalUICameraDepth = _uiCamera.depth;
     }
     else
     {
         Debug.Log("UI_Camera is null");
     }
 }
示例#4
0
 private void Awake()
 {
     //得到UI根节点对象
     _rootCanvas      = GameObject.FindGameObjectWithTag(UISysDefine.SYS_TAG_ROOTCANVAS);
     _transScriptNode = UnityHelper.FindTheChildNode(_rootCanvas.transform, UISysDefine.SYS_TAG_GLOBALCANVAS);
     //将本脚本实例作为脚本节点对象子节点
     transform.SetParent(_transScriptNode);
     UnityHelper.AddChildNodeToParentNode(_transScriptNode, transform);
     //顶层面板、遮罩面板
     _topPanel  = _rootCanvas;
     _maskPanel = UnityHelper.FindTheChildNode(_rootCanvas.transform, "Panel_Mask").gameObject;
     _maskPanel.SetActive(true);
     _maskImage         = _maskPanel.GetComponent <Image>();
     _maskImage.enabled = false;
     //_maskBtn = _maskPanel.GetComponent<Button>();
     //_maskBtn.enabled = false;
     //获得摄像机层深
     _uiCamera = GameObject.FindGameObjectWithTag(UISysDefine.SYS_TAG_UICAMERA).GetComponent <Camera>();
     if (_uiCamera != null)
     {
         _oriUICameraDepth = _uiCamera.depth;
     }
 }