Ejemplo n.º 1
0
 private void Start()
 {
     instance     = this;
     traRoot      = GameObject.FindGameObjectWithTag(SysDefine.canvasTag).transform;
     traUISprites = UnityHelper.Find(traRoot, SysDefine.scriptsMgrNode);
     //把脚本节点添加到总脚本的子节点
     UnityHelper.SetParent(traUISprites, gameObject.transform);
     //得到顶层面版 遮罩面板
     TopPanle  = traRoot;
     MaskPanle = UnityHelper.Find(traRoot, "UIMaskPanel");
     //得到UI摄像机原始的层深
     UICamera = GameObject.FindGameObjectWithTag(SysDefine.UICameraTag).GetComponent <Camera>();
     if (UICamera != null)
     {
         OriginalUICameraDepth = UICamera.depth;
     }
     else
     {
         Debug.Log($"{GetType()} UICamera==null Please Check!");
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 注册按钮事件
        /// </summary>
        protected void RigisterBtnOnClick(string btnName, EventTriggerListener.VoidDelegate del)
        {
            Transform btn = UnityHelper.Find(gameObject.transform, btnName);

            EventTriggerListener.Get(btn?.gameObject).onClick = del;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 注册滑动条
        /// </summary>
        /// <param name="sliderName"></param>
        /// <param name="del"></param>
        protected void RegisterSlider(string sliderName, EventTriggerListener.VoidDelegate del)
        {
            Transform slider = UnityHelper.Find(gameObject.transform, sliderName);

            EventTriggerListener.Get(slider?.gameObject).onUp = del;
        }