public static void SaveData(string dataName, string pathName, LogicObjectContainer data) { string path = LogicSystemEditorTools.GetPath(dataName, pathName); string content = JsonUtils.ClassOrStructToJson(data); FileUtils.CreateTextFile(path, content); if (!ResourcePathManager.ContainsFileName(dataName)) { ResourcePathManager.Clear(); } }
static void InternalVariableGUI() { GUIStyle style0 = "IN GameObjectHeader"; style0.fontSize = 12; GUILayout.Label("新建内部变量", style0); //GUIStyle style = "flow overlay header lower left"; GUILayout.BeginHorizontal("box"); GUILayout.BeginVertical(); internalValueName = EditorDrawGUIUtil.DrawBaseValue("名字", internalValueName).ToString(); internalValueType = EditorDrawGUIUtil.DrawPopup("数据类型", internalValueType, internalValueTypeList); GUILayout.EndVertical(); if (GUILayout.Button("+", GUILayout.Width(35))) { if (!string.IsNullOrEmpty(internalValueName) && data.GetBaseValue(internalValueName) == null) { data.internalValueList.Add(new BaseValue(internalValueName, LogicSystemEditorTools.GetDefultValueByTypeName(internalValueType))); } else { EditorUtility.DisplayDialog("错误", "名字不能重复!", "OK"); } } GUILayout.EndHorizontal(); GUILayout.Space(10); pos = GUILayout.BeginScrollView(pos, true, true); GUILayout.BeginVertical("box"); foreach (BaseValue vt in data.internalValueList) { GUILayout.BeginHorizontal("box"); GUILayout.BeginVertical(); vt.name = EditorDrawGUIUtil.DrawBaseValue("名字(" + vt.typeName + ")", vt.name).ToString(); object v = EditorDrawGUIUtil.DrawBaseValue("Value", vt.GetValue()); vt.SetValue(v); GUILayout.EndVertical(); if (GUILayout.Button("-", GUILayout.Width(25))) { data.internalValueList.Remove(vt); return; } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.EndVertical(); }
void Init() { dataNameDic.Clear(); ms = LogicSystemEditorTools.GetMessageStringData(); ms.hideFlags = HideFlags.NotEditable; for (int i = 0; i < ms.mesList.Count; i++) { MessageString m = ms.mesList[i]; string pathDic = PathUtils.GetSpecialPath(m.value, SpecialPathType.Resources); if (!Directory.Exists(pathDic)) { Directory.CreateDirectory(pathDic); AssetDatabase.Refresh(); } string[] temp = PathUtils.GetDirectoryFileNames(pathDic, new string[] { ".txt" }); Debug.Log("Name:" + m.name); dataNameDic.Add(m.name, new List <string>(temp)); } }