static void AddLayerToAssetsSort() { if (AssetsSortManagement.AddLayer(configLayerName)) { AssetsSortManagement.Save(); } }
void OnGUI() { toolbarOption = GUILayout.Toolbar(toolbarOption, toolbarTexts, GUILayout.Width(Screen.width)); switch (toolbarOption) { case 0: SetLayersTagsGUI(); break; case 1: SearchLayersTagesGUI(); break; case 2: AddLayersTagesGUI(); break; } if (GUILayout.Button("保存")) { AssetsSortManagement.Save(); } }
private void NewTableConfig() { GUILayout.BeginHorizontal("box"); newFileName = EditorDrawGUIUtil.DrawBaseValue("新建配置文件:", newFileName).ToString(); if (GUILayout.Button("确定", GUILayout.Width(50))) { if (ResourcePathManager.ContainsFileName(newFileName) || string.IsNullOrEmpty(newFileName)) { EditorUtility.DisplayDialog("警告", "名字不能为空或重复", "OK"); } else { chooseFileName = newFileName; fileNames.Add(newFileName); } } GUILayout.EndHorizontal(); if (string.IsNullOrEmpty(newFileName)) { return; } if (ResourcePathManager.ContainsFileName(newFileName)) { EditorGUILayout.HelpBox("文件名重复!!", MessageType.Error); return; } if (newConfigInfo == null) { newConfigInfo = new TableConfigOtherInfo(); } newConfigInfo.configDescription = EditorDrawGUIUtil.DrawBaseValue("配置文件描述:", newConfigInfo.configDescription).ToString(); GUILayout.Space(5); GUILayout.BeginHorizontal("box"); GUILayout.Box("添加字段:"); GUILayout.FlexibleSpace(); if (GUILayout.Button("+", GUILayout.Width(50))) { TableConfigFieldInfo f = new TableConfigFieldInfo(); f.fieldName = "NewField" + newConfigInfo.fieldInfoDic.Count; while (newConfigInfo.fieldInfoDic.ContainsKey(f.fieldName)) { f.fieldName += "_0"; } newConfigInfo.fieldInfoDic.Add(f.fieldName, f); } GUILayout.EndHorizontal(); DrawFieldData(newConfigInfo); if (newConfigInfo.fieldInfoDic.Count > 0 && GUILayout.Button("创建")) { GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, (t) => { Debug.Log("OnResourcesAssetsChange"); AssetsSortManagement.SetLayer(newFileName, configLayerName); AssetsSortManagement.Save(); newFileName = ""; newConfigInfo = null; }, true); string content = TableConfigTool.ConfigInfo2TableText(newConfigInfo, null); string path = CreateConfigClassEditor.SaveConfigFilePath + "/" + newFileName + ".txt"; FileUtils.CreateTextFile(path, content); CreateConfigClassEditor.CreateConfigClassFile(content, newFileName); AssetDatabase.Refresh(); } }