Ejemplo n.º 1
0
        public void Init(EditorArea area, EditorStarMapArea starMapArea)
        {
            if (area == null)
            {
                return;
            }
            if (rectTrans == null)
            {
                rectTrans = GetComponent <RectTransform>();
            }

            if (starMapArea != null)
            {
                m_Res = starMapArea.area_res;
                rectTrans.anchoredPosition = starMapArea.position.ToVector2();
                m_Resobj = StarMapEditorRoot.FindResAsset(m_Res);
            }
            m_AreaData      = area;
            gameObject.name = area.areaName;
            if (m_Tip == null)
            {
                Transform tipTrans = transform.Find("tip");
                if (tipTrans != null)
                {
                    m_Tip = tipTrans.gameObject.GetComponent <Text>();
                }
            }

            if (m_Tip != null)
            {
                m_Tip.text = "";
                EditorLeap[] leaps = area.leapList;
                if (leaps != null && leaps.Length > 0)
                {
                    EditorLeap leap = leaps[0];
                    if (leap.leapType == (int)LeapType.Main)
                    {
                        m_Tip.text = "主";
                    }
                    else if (leap.leapType == (int)LeapType.Child)
                    {
                        m_Tip.text = "副";
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void Init(EditorLeap[] leapList)
        {
            if (leapList == null || leapList.Length <= 0)
            {
                return;
            }

            EditorLeap editorLeap = leapList[0];

            m_LeapId          = editorLeap.leapId;
            m_LeapName        = editorLeap.leapName;
            m_LeapDescription = editorLeap.description;
            m_LeapType        = (LeapType)editorLeap.leapType;
            m_MainLeapId      = editorLeap.mainLeapId;
            m_AutoVisible     = editorLeap.autoVisible == 1 ? true : false;
            m_VisibleLeapList = editorLeap.visibleLeapList;
            m_Range           = editorLeap.range;
            m_IconConfId      = editorLeap.iconConfId;
            //string[] resAssets = AssetDatabase.FindAssets(string.Format("{0} t:Sprite", editorLeap.iconName));
            //string assetPath = resAssets[0];
            //for (int iRes = 0; iRes < resAssets.Length; iRes++)
            //{
            //    string resPath = AssetDatabase.GUIDToAssetPath(resAssets[iRes]);
            //    string[] resSplit = resPath.Split('/');
            //    if (resSplit != null && resSplit.Length > 0)
            //    {
            //        string lastName = resSplit[resSplit.Length - 1];
            //        string[] lastNameSplit = lastName.Split('_');
            //        if (lastNameSplit != null && lastNameSplit.Length > 0)
            //        {
            //            if (lastNameSplit[lastNameSplit.Length - 1].Equals(string.Format("{0}.png", editorLeap.iconName)))
            //            {
            //                assetPath = resAssets[iRes];
            //                break;
            //            }
            //        }
            //    }
            //}
            //string iconPath = AssetDatabase.GUIDToAssetPath(assetPath);
            //m_Icon = AssetDatabase.LoadAssetAtPath<Sprite>(iconPath);
        }