public static void AutoFill() { string path = EditorConfigUtils.GetPrifix(ExcelFileIDType.Npc); Dictionary <string, object> o = (Dictionary <string, object>)FileHelper.GetAMF(path, false); path = EditorConfigUtils.GetPrifix(ExcelFileIDType.Monster); path = EditorConfigUtils.GetPrifix(ExcelFileIDType.Collection); }
public void import() { string path = EditorConfigUtils.GetPrifix("flashUI"); if (string.IsNullOrEmpty(path)) { EditorUtility.DisplayDialog("ui导入", "请配置ui导入目录", "确定"); return; } GameObject canvas = GameObject.Find("Canvas"); if (canvas == null) { EditorUtility.DisplayDialog("ui导入", "场景内必须有canvas", "确定"); return; } path = EditorUtility.OpenFilePanel("选择场景", path, ",xml"); if (string.IsNullOrEmpty(path)) { return; } string fileName = Path.GetFileNameWithoutExtension(path); XmlDocument doc = new XmlDocument(); FileStream fileStream = File.OpenRead(path); doc.Load(fileStream); XmlNode rootNode = doc.SelectSingleNode("component"); GameObject go = new GameObject(fileName); go.AddComponent <RectTransform>(); createChild(rootNode.ChildNodes, go); }
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; }