Beispiel #1
0
        public void MoveToRight()
        {
            if (m_current == null)
            {
                return;
            }

            if (m_current.Right != null)
            {
                m_current = m_current.Right;
                //UpdateMousePos();
            }
        }
Beispiel #2
0
        public void MoveToDown()
        {
            if (m_current == null)
            {
                return;
            }

            if (m_current.Down != null)
            {
                m_current = m_current.Down;
                //UpdateMousePos();
            }
        }
Beispiel #3
0
        public void MoveToUp()
        {
            if (m_current == null)
            {
                return;
            }

            if (m_current.Up != null)
            {
                m_current = m_current.Up;
                //UpdateMousePos();
            }
        }
Beispiel #4
0
        public void MoveToLeft()
        {
            if (m_current == null)
            {
                return;
            }

            if (m_current.Left != null)
            {
                m_current = m_current.Left;
                //UpdateMousePos();
            }
        }
Beispiel #5
0
        public void RebuildGUISet()
        {
            RemoveInactiveItems();
            Vector2 minsize = new Vector2(Screen.width, Screen.height);

            for (int i = 0; i < uiItems.Count; i++)
            {
                Bounds _bound = GetUIScreenBounds(uiItems[i].transform);

                Vector2 _localSize = _bound.size;
                if (minsize.x > _localSize.x)
                {
                    minsize.x = _localSize.x;
                }
                if (minsize.y > _localSize.y)
                {
                    minsize.y = _localSize.y;
                }
            }
            //LogModule.DebugLog("minsize " + minsize);
            uiLocations.Clear();
            Camera _temp = null;

            if (UICamera.mainCamera != null)
            {
                _temp = UICamera.mainCamera;
            }
            for (int i = 0; i < uiItems.Count; i++)
            {//使用最小的按钮大小分割空间,然后确定每个按钮的位置
                //思考:会出现这样分割的按钮仍然被判定为同一位置的情况吗?
                Vector2 location   = new Vector2();
                Vector2 uiposition = _temp.WorldToScreenPoint(uiItems[i].transform.position);
                //LogModule.DebugLog(uiItems[i].name + " " + uiposition);
                location.x = Mathf.Floor(uiposition.x / minsize.x);
                location.y = Mathf.Floor(uiposition.y / minsize.y);
                uiLocations.Add(new UILocation(uiItems[i], location));
            }

            uiLocations.Sort(yxcomparer);
            string haha = "";

            for (int i = 0; i < uiLocations.Count - 1; i++)
            {
                uiLocations[i].Right    = uiLocations[i + 1];
                uiLocations[i + 1].Left = uiLocations[i];
                haha += (uiLocations[i].ToString());
            }
            uiLocations.Sort(xycomparer);
            //LogModule.DebugLog(haha);
            haha = "";
            for (int i = 0; i < uiLocations.Count - 1; i++)
            {
                uiLocations[i].Down   = uiLocations[i + 1];
                uiLocations[i + 1].Up = uiLocations[i];
                haha += (uiLocations[i].ToString());
            }
            if (uiLocations.Count > 0)
            {
                m_current = uiLocations[0];
                //if (MouseSimulator.Instance != null)
                //{
                //    MouseSimulator.Instance._trans.position = m_current.Item.transform.position;
                //}
            }
            //LogModule.DebugLog(haha);
        }
Beispiel #6
0
 public void ClearGUIItems()
 {
     uiItems.Clear();
     uiLocations.Clear();
     m_current = null;
 }