Пример #1
0
        public IEnumerator OnUpdate(LeapOverview leapOverview, GamingMapArea area, GamingMapArea showArea)
        {
            m_LeapOverview = leapOverview;
            m_MeshRender   = GetComponent <MeshRenderer>();
            gameObject.SetActive(m_IsExportToJson);
            if (m_MeshRender != null)
            {
                if (showArea == null)
                {
                    m_MeshRender.enabled = false;
                }
                else
                {
                    LeapRoot root = showArea.m_LeapRoot;
                    bool     show = false;
                    if (root != null && root.m_VisibleLeapList.Length > 0)
                    {
                        for (int iVisible = 0; iVisible < root.m_VisibleLeapList.Length; iVisible++)
                        {
                            if (m_LeapId == root.m_VisibleLeapList[iVisible])
                            {
                                show = true;
                                break;
                            }
                        }
                    }
                    m_MeshRender.enabled = show;
                }
            }
            yield return(null);

            if (area != null && area.m_LeapRoot != null)
            {
                LeapRoot leapRoot = area.m_LeapRoot;
                m_LeapName           = leapRoot.m_LeapName;
                m_LeapType           = leapRoot.m_LeapType;
                m_MainLeapId         = leapRoot.m_MainLeapId;
                transform.position   = leapRoot.transform.position;
                gameObject.name      = string.Format("{0}_{1}", m_LeapId, m_LeapName);
                transform.localScale = Vector3.one * leapRoot.m_Range;
            }
        }
Пример #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);
        }