示例#1
0
 public static void AddTip(this GameObject gameObj, string tip)
 {
     EventUtil.AddHover(gameObj, (o, b) => {
         if (b)
         {
             ToolTipManager.Show(tip);
         }
         else
         {
             ToolTipManager.Hide();
         }
     });
 }
示例#2
0
 protected override void OnHover(bool b)
 {
     base.OnHover(b);
     if (b && ToolTip != "")
     {
         ToolTipManager.Show(ToolTip, tipDely, tipWidth);
     }
     else if (b == false)
     {
         ToolTipManager.Hide();
     }
     if (b == true && _isEnable)
     {
         FuncUtil.SetCursor("CURSOR_CLICK_OVER");
         //currentTouch为null是为了防止在按钮上放开鼠标时触发OnHover
         //当鼠标离开时currentTouch为null,鼠标进入时currentTouch也为null,鼠标按下时才不为null
         if (UICamera.currentTouch == null)
         {
             if (_rollOverFun != null)
             {
                 _rollOverFun(gameObject);
             }
         }
     }
     else if (_isEnable == false)
     {
         FuncUtil.SetCursor("CURSOR_NORMAL");
     }
     else
     {
         if (_rollOutFun != null)
         {
             _rollOutFun(gameObject);
         }
         //if (/*!UICamera.IsPressIng && */FuncUtil.IsUICursor()) {
         //    FuncUtil.SetCursor("CURSOR_NORMAL");
         //}
     }
     if (relateChild)
     {
         GetChildBtns();
         foreach (Component child in childBtn)
         {
             if (child != this)
             {
                 (child as CButton).isEnabled = true;
                 (child as CButton).OnHover(b);
             }
         }
     }
 }