public void reload(EventX e = null) { RemoveAllChildren(); ProjectPrefabSearchList item; dataProvider = PrefabVODB.Reload(); tabNav.removeAllChildren(); foreach (string key in dataProvider.Keys) { item = new ProjectPrefabSearchList();; item.itemEventHandle = itemEventHandle; item.dataProvider = dataProvider[key]; tabNav.addItem(key, item); } this.addChild(tabNav); this.addChild(new EditorFlexibleSpace()); tabNav.autoSelected(); EditorButton btn; EditorBox box = new EditorBox(false); btn = new EditorButton("reload"); btn.addEventListener(EventX.ITEM_CLICK, reload); box.addChild(btn); this.addChild(box); }
public void searchView(string uri) { if (dataProvider == null) { dataProvider = PrefabVODB.Reload(); } PrefabVO prefabVo = PrefabVODB.Get(uri); if (prefabVo == null) { return; } tabNav.selectedTabLabel(prefabVo.rootKey); ProjectPrefabSearchList searchList = tabNav.selectedItem as ProjectPrefabSearchList; if (searchList != null) { EditorCallLater.Add(() => { searchList.search(prefabVo.fileName); viewPrefabInfo(prefabVo, false); }, 0.5f); } }
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; }