private void start2(EventX e) { string upkEditorWorkspace = EditorConfigUtils.GetProjectResource("upk/"); if (Directory.Exists(upkEditorWorkspace) == false) { EditorUtility.DisplayDialog("error", "path not found:" + upkEditorWorkspace, "ok"); return; } string selectedPath = EditorUtility.OpenFolderPanel("选择upk文件夹", upkEditorWorkspace, ""); if (string.IsNullOrEmpty(selectedPath)) { return; } DirectoryInfo directoryInfo = new DirectoryInfo(selectedPath); DirectoryInfo[] list = directoryInfo.GetDirectories(); foreach (DirectoryInfo info in list) { doSingle(info.FullName, false); } AssetDatabase.Refresh(); }
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); }
protected void reload(EventX e) { skillProjectDirectory = EditorConfigUtils.GetProjectResource("All/skill/"); string editorPrefabPath = "Assets/Prefabs"; modelWindow.init(editorPrefabPath, "avatar"); effectWindow.init(editorPrefabPath, "effect"); soundWindow.init(editorPrefabPath, "sound"); }
private void start(EventX e) { string upkEditorWorkspace = EditorConfigUtils.GetProjectResource("upk/"); if (Directory.Exists(upkEditorWorkspace) == false) { EditorUtility.DisplayDialog("error", "path not found:" + upkEditorWorkspace, "ok"); return; } string selectedPath = EditorUtility.OpenFolderPanel("选择upk文件夹", upkEditorWorkspace, ""); if (string.IsNullOrEmpty(selectedPath)) { return; } doSingle(selectedPath); }
protected override void initialization() { base.initialization(); this.titleContent = new GUIContent("Upk"); this.maxSize = new Vector2(200, 300); EditorConfigUtils.load(); EditorButton btn = new EditorButton("选择"); btn.addEventListener(EventX.ITEM_CLICK, start); this.addChild(btn); btn = new EditorButton("选择2(深度遍历子文件夹)"); btn.addEventListener(EventX.ITEM_CLICK, start2); this.addChild(btn); }
public void init(string editorPrefabPath, params string[] types) { dataList.Clear(); key = ""; foreach (string type in types) { key += type + "_"; string prefabPath = editorPrefabPath + "/" + type + "/"; string[] exportKeys = EditorConfigUtils.GetPrefabExports(type); if (exportKeys == null || exportKeys.Length < 1) { exportKeys = new[] { prefabPath }; } List <string> nameList = new List <string>(); foreach (string exportPrefabPath in exportKeys) { List <string> list = FileHelper.FindFile(exportPrefabPath, exNameArr, searchOption); for (int i = 0; i < list.Count; i++) { string itemPath = list[i]; itemPath = itemPath.Replace(Application.dataPath, "Assets"); ResourceVO item = new ResourceVO(); item.itemPath = itemPath; item.fileFullName = Path.GetFileName(itemPath); string fileName = Path.GetFileNameWithoutExtension(item.fileFullName); item.fileName = fileName; item.typeKey = type; nameList.Add(fileName); dataList.Add(item); } } DataSource.Add(type, dataList); DataSource.Add(type, nameList); } pageList.dataProvider = dataList; }
private void drawExportUI() { using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("导入")) { string sceneName = EditorSceneManager.GetActiveScene().name; string mapPathPrefix = EditorConfigUtils.GetProjectResource("All/map/" + sceneName + "/"); FileHelper.AutoCreateDirectory(mapPathPrefix); string path = EditorUtility.OpenFilePanel("选择文件", mapPathPrefix, "json"); if (string.IsNullOrEmpty(path) == false) { string json = FileHelper.GetUTF8Text(path); JsonUtility.FromJsonOverwrite(json, mTarget); mTarget.fileName = Path.GetFileNameWithoutExtension(path); } } if (GUILayout.Button("导出")) { string sceneName = EditorSceneManager.GetActiveScene().name; string mapPathPrefix = EditorConfigUtils.GetProjectResource("All/map/" + sceneName + "/"); FileHelper.AutoCreateDirectory(mapPathPrefix); string fileName = mTarget.fileName; if (string.IsNullOrEmpty(fileName)) { fileName = "default"; } string path = EditorUtility.SaveFilePanel("选择文件", mapPathPrefix, fileName, "json"); if (string.IsNullOrEmpty(path) == false) { mTarget.fileName = Path.GetFileNameWithoutExtension(path); string json = JsonUtility.ToJson(mTarget, false); FileHelper.SaveUTF8(json, path); } } } }
static void autoCopy() { ASDictionary <string, string> dic = EditorConfigUtils.GetAutoCopys(); int count = 0; foreach (string fromPath in dic.Keys) { string fPath = fromPath; if (Directory.Exists(fPath)) { continue; } string tPath = dic[fromPath]; if (Directory.Exists(tPath)) { continue; } FileHelper.CopyDirectory(fPath, tPath); count++; } Debug.Log("auto copy directory count:" + count); }
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; }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { float w = position.width; position.width = w - 50; EditorGUI.PropertyField(position, property); position.x += position.width; position.width = 50; if (GUI.Button(position, "select", EditorStyles.miniButton)) { PathSelecterAttribute selecterAttribute = attribute as PathSelecterAttribute; string extention = selecterAttribute.extention; string value = property.stringValue; string path = ""; switch (selecterAttribute.type) { case PathSelecterType.SKILL: path = EditorConfigUtils.GetProjectResource("All/skill/"); break; case PathSelecterType.STOTY: path = EditorConfigUtils.GetProjectResource("All/story/"); break; case PathSelecterType.SKILL_STOTY: path = EditorConfigUtils.GetProjectResource("All/"); if (string.IsNullOrEmpty(value) == false) { path = EditorConfigUtils.GetProjectResource("All/story/") + value + "." + extention; if (File.Exists(path) == false) { path = EditorConfigUtils.GetProjectResource("All/skill/") + value + "." + extention; } path = FileHelper.GetFullPathParent(path); } break; default: path = EditorConfigUtils.ProjectResource; break; } string fullPath = EditorUtility.OpenFilePanel("选取文件", path, extention); if (string.IsNullOrEmpty(fullPath) == false) { string[] list = fullPath.As3Split("All/skill/"); if (list.Length < 2) { list = fullPath.As3Split("All/story/"); } if (list.Length > 1) { fullPath = list[1]; } list = fullPath.As3Split("."); if (list.Length > 0) { fullPath = list[0]; } property.stringValue = fullPath; } } }
protected override void initialization() { base.initialization(); BaseRigsterUtils.init(); this.titleContent = new GUIContent("技能"); EditorConfigUtils.load(); resourcePath = EditorConfigUtils.ProjectResource; resourcePath = resourcePath.Replace("\\", "/"); string basePrefabPath = ""; PathDefine.effectPath = "file:///" + basePrefabPath; PathDefine.avatarPath = "file:///" + basePrefabPath; PathDefine.scenePath = "file:///" + basePrefabPath; PathDefine.soundPath = "file:///" + basePrefabPath; EditorBox vbox = new EditorBox(); vbox.widthOption = GUILayout.Width(300); vbox.styleString = "box"; tabNav = new EditorTabNav(); tabNav.addEventListener(EventX.CHANGE, tabNavHandle); modelWindow = new ModelWindow(); modelWindow.addEventListener(EventX.SELECT, modelSelectHandle); tabNav.addItem("avatar", modelWindow); effectWindow = new ModelWindow(); effectWindow.addEventListener(EventX.SELECT, effectSelectHandle); tabNav.addItem("effect", effectWindow); soundWindow = new ModelWindow(); soundWindow.exNameArr = new[] { "*.mp3", "*.ogg", "*.wav" }; soundWindow.addEventListener(EventX.SELECT, soundSelectHandle); tabNav.addItem("sound", soundWindow); EditorBox box = new EditorBox(false); EditorButton btn; btn = new EditorButton("reload"); btn.addEventListener(EventX.ITEM_CLICK, reload); box.addChild(btn); btn = new EditorButton("updateSVN"); btn.addEventListener(EventX.ITEM_CLICK, updateSVN); box.addChild(btn); btn = new EditorButton("editor"); btn.addEventListener(EventX.ITEM_CLICK, editor); box.addChild(btn); autoMononType = new EditorFormItem("自动代码"); autoMononType.addEventListener(EventX.CHANGE, autoMononTypeHandle); autoMononType.value = autoMononTypeName; vbox.addChild(tabNav); vbox.addChild(new EditorFlexibleSpace()); vbox.addChild(autoMononType); vbox.addChild(box); btn = new EditorButton("打包Assetbundle"); btn.addEventListener(EventX.ITEM_CLICK, assetbundleClickHandle); vbox.addChild(btn); addChild(vbox); propertyWindow = new PropertyWindow(); propertyWindow.widthOption = GUILayout.Width(300); timeWindow = new TimeWindow(); timeWindow.addEventListener(EventX.SELECT, timeLineSelectHandle); timeWindow.init(resourcePath + "All/skill/", propertyWindow); addChild(timeWindow); addChild(propertyWindow); reload(null); tabNav.selectedIndex = tabSelectedIndex; modelWindow.selectedIndex = modelSelectedIndex; }