public static void AddMapItem(ExcelMapVO excelVO)
 {
     ExcelMapMapping.Add(excelVO.uri, excelVO);
 }
예제 #2
0
        public void OnEnable()
        {
            //autoFSMEvent init;
            //List<FsmEvent> EventList = FsmEvent.EventList;
            PrefabVODB.Reload();
            string path;
            IList  o;

            string[] excelFileIDTypes = new string[]
            { ExcelFileIDType.Npc, ExcelFileIDType.Monster, ExcelFileIDType.Collection };
            foreach (string excelFileIDType in excelFileIDTypes)
            {
                path = EditorConfigUtils.GetPrifix(excelFileIDType);
                o    = FileHelper.GetAMF(path, false) as IList;
                if (o == null)
                {
                    continue;
                }
                List <ExcelRefVO> list = new List <ExcelRefVO>();
                foreach (Dictionary <string, object> item in o)
                {
                    ExcelRefVO excelVO = new ExcelRefVO();
                    excelVO.id         = item.Get <string>("id");
                    excelVO.name       = item.Get <string>("name");
                    excelVO.uri        = item.Get <string>("uri");
                    excelVO.prefabPath = PrefabVODB.GetPath(excelVO.uri);
                    list.Add(excelVO);
                }
                ExcelIDSelecterDrawer.Fill(excelFileIDType, list);
            }

            path = EditorConfigUtils.GetPrifix(ExcelFileIDType.Map);
            o    = FileHelper.GetAMF(path, false) as IList;
            if (o != null)
            {
                foreach (Dictionary <string, object> item in o)
                {
                    ExcelMapVO excelVO = new ExcelMapVO();
                    excelVO.id   = item.Get <string>("id");
                    excelVO.name = item.Get <string>("name");
                    excelVO.uri  = item.Get <string>("uri");
                    ExcelIDSelecterDrawer.AddMapItem(excelVO);
                }
            }

            this.titleContent = new GUIContent("SceneEditor");


            allReleaseScenes.Clear();
            scenesGenericMenu = new GenericMenu();
            string[] fileList = new string[0];
            if (Directory.Exists("Assets/Prefabs/scene"))
            {
                fileList = Directory.GetFiles("Assets/Prefabs/scene", "*.unity", SearchOption.AllDirectories);
            }
            foreach (string file in fileList)
            {
                allReleaseScenes.Add(file);
                string fileName = Path.GetFileNameWithoutExtension(file);
                scenesGenericMenu.AddItem(new GUIContent(fileName), false, (object item) =>
                {
                    string scenePath = item.ToString();
                    if (File.Exists(scenePath))
                    {
                        Scene scene = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single);
                        CheckSceneInfo(true);
                        _selectedSceneCfgMode = SceneCFGMode.SceneSettings;
                        Repaint();
                    }
                }, file);
            }

            SceneView.duringSceneGui += OnSceneGUI;
            EditorApplication.playModeStateChanged -= playmodeStateChanged;
            EditorApplication.playModeStateChanged += playmodeStateChanged;
        }