Beispiel #1
0
        public static UIContextMenu AddContextMenu(string id)
        {
            UIContextMenu menu = new UIContextMenu();

            instance._menus.Add(id, menu);
            return(menu);
        }
Beispiel #2
0
 void Update()
 {
     if (instance._isOpen && Input.GetKeyUp(KeyCode.Mouse0))
     {
         Vector2 mPos = Input.mousePosition;
         mPos.y = Screen.height - mPos.y;
         Rect          curRect = instance._curRect;
         UIContextMenu curMenu = _menus[_openMenu];
         Debug.Log(curRect);
         curRect.x      -= curMenu.left;
         curRect.width  += curMenu.left + curMenu.right;
         curRect.y      += curMenu.top;
         curRect.height += curMenu.top + curMenu.bottom;
         Debug.Log(curRect);
         if (!curRect.Contains(mPos))
         {
             CloseContextMenu();
             Debug.Log("Closing menu");
         }
     }
 }