Esempio n. 1
0
        protected Vector3 GetPositon(EditorPosition position)
        {
            if (position == null)
            {
                return(Vector3.zero);
            }

            return(new Vector3(position.x, position.y, position.z));
        }
Esempio n. 2
0
        private void RefreshMap()
        {
            float widthRate  = m_MiniMapSize / m_ActMapWidth;
            float heightRate = m_MiniMapSize / m_ActMapHeight;

            if (m_PlanetAreas != null && m_PlanetAreas.Count > 0)
            {
                for (int iArea = 0; iArea < m_PlanetAreas.Count; iArea++)
                {
                    PlanetAreaElement element  = m_PlanetAreas[iArea];
                    EditorArea        areaData = element.m_AreaData;
                    if (areaData == null)
                    {
                        continue;
                    }
                    EditorPosition editorPosition = areaData.position;
                    element.GetComponent <RectTransform>().anchoredPosition = new Vector2(editorPosition.x * widthRate, editorPosition.z * heightRate);
                    //element.transform.position = new Vector3(editorPosition.x*widthRate- m_MiniMapWidth/2,editorPosition.z*heightRate - m_MiniMapHeight/2,0);
                }
            }

            if (m_MiniMap == null)
            {
                Transform     miniMap     = transform.Find("map");
                RectTransform miniMapRect = null;
                if (miniMap == null)
                {
                    GameObject imageObj = new GameObject("map");
                    imageObj.transform.SetParent(transform);
                    Image image = imageObj.AddComponent <Image>();
                    image.color = new Color(1, 0, 0, 0.5f);
                    miniMapRect = image.rectTransform;
                }
                else
                {
                    miniMapRect = miniMap.GetComponent <RectTransform>();
                }
                m_MiniMap = miniMapRect;
            }
            m_MiniMap.SetAsFirstSibling();
            m_MiniMap.anchoredPosition3D = Vector3.zero;
            m_MiniMap.sizeDelta          = m_MiniMapSize * Vector2.one;
        }