Пример #1
0
 public void OnPointerExit(PointerEventData eventData)
 {
     if (ButtonColors.dragCursor)
     {
         BerryCursor cursor = new BerryCursor();
         cursor.cursorTex  = Resources.Load <Texture2D>("BerrySystem/UI/cursors/drag_up");
         cursor.pos        = new Vector2(0, 0);
         cursor.cursorMode = CursorMode.Auto;
         UiManager.SetCursorTexture(cursor, true);
     }
     signalState(5);
     switchColor(2, ButtonColors.normalColor);
 }
Пример #2
0
        /*
         *      public static GameObject clamp2DObjInScreen(GameObject targetObj, bool queryChildrenCheck = false, bool clampScale = false)
         *      {
         *              Resolution curRes = new Resolution();
         *              curRes.width = Screen.width;
         *              curRes.height = Screen.height;
         *              Vector2 curPos = targetObj.GetComponent<RectTransform>().anchoredPosition;
         *              if(queryChildrenCheck)
         *              {
         *
         *              }else
         *              {
         *                      Debug.Log(curRes.height);
         *                      Debug.Log(curPos.x);
         *                      if(curPos.x < 0 || curPos.x > curRes.height)
         *                      {
         *                              Debug.Log("Height correction!");
         *                      }
         *
         *                      if(curRes.width < curPos.y || curRes.width >= curPos.y)
         *                      {
         *                              Debug.Log("Width correction!");
         *                      }
         *              }
         *
         *
         *              if(clampScale)
         *              {
         *
         *              }
         *              return targetObj;
         *      }
         */

        /*
         * UI STANDARD
         */

        public static void SetCursorTexture(BerryCursor cursorTarget, bool hold = false)
        {
            if (cursorTarget == null)
            {
                Cursor.SetCursor(curCursor.cursorTex, curCursor.pos, curCursor.cursorMode);
            }
            else
            {
                if (!isHold)
                {
                    curCursor = cursorTarget;
                    Cursor.SetCursor(cursorTarget.cursorTex, cursorTarget.pos, cursorTarget.cursorMode);
                }
                else
                {
                    holdCursor = cursorTarget;
                    Cursor.SetCursor(cursorTarget.cursorTex, cursorTarget.pos, cursorTarget.cursorMode);
                }
            }
        }