private static void InitData() { _iniTool = new IniTool(); _iniTool.Open(UIEditorUtils._configFilePath); _panelUIPath = _iniTool.ReadValue("UI", "PanelPath", ""); _panelCodePath = _iniTool.ReadValue("UIScript", "PanelGeneratedScriptPath", ""); _panelCodePath = Path.Combine(Application.dataPath, _panelCodePath); int index = _panelUIPath.IndexOf("Resources"); _panelUIResPath = _panelUIPath.Substring(index + UIEditorUtils.RESOURCES_LENGTH, _panelUIPath.Length - index - UIEditorUtils.RESOURCES_LENGTH); }
internal static bool CheckUIConfig() { if (!File.Exists(_configFilePath)) { First(); } IniTool iniTool = new IniTool(); iniTool.Open(_configFilePath); string panelPath = iniTool.ReadValue("UI", "PanelPath", ""); string itemPath = iniTool.ReadValue("UI", "ItemPath", ""); string panelScriptPath = iniTool.ReadValue("UIScript", "PanelGeneratedScriptPath", ""); string itemScriptPath = iniTool.ReadValue("UIScript", "ItemGeneratedScriptPath", ""); if (string.IsNullOrWhiteSpace(panelPath) || string.IsNullOrWhiteSpace(itemPath) || string.IsNullOrWhiteSpace(panelScriptPath) || string.IsNullOrWhiteSpace(itemScriptPath)) { return(false); } return(true); }
internal static string GetExportType(string name, IniTool ini) { int index = name.IndexOf("_"); string str = name.Substring(0, index + 1); string typeName = ini.ReadValue("UIExport", str, ""); if (string.IsNullOrWhiteSpace(typeName)) { return(typeof(GameObject).Name); } return(typeName); }
private static void GenerateUserCode(string name) { string panelPath = _iniTool.ReadValue("UIScript", "PanelScriptPath", ""); string panelModelPath = _iniTool.ReadValue("UIScript", "PanelDataModelPath", ""); string modelName = ""; if (!string.IsNullOrWhiteSpace(panelModelPath)) { modelName = name + "Data"; panelModelPath = Path.Combine(Application.dataPath, panelModelPath, modelName + ".cs"); if (!File.Exists(panelModelPath)) { string temp = ModelTemplate; temp = temp.Replace("{ClassName}", modelName); File.WriteAllText(panelModelPath, temp, new UTF8Encoding()); } } if (!string.IsNullOrWhiteSpace(panelPath)) { panelPath = Path.Combine(Application.dataPath, panelPath, name + ".cs"); if (!File.Exists(panelPath)) { if (string.IsNullOrWhiteSpace(modelName)) { modelName = "NullModel"; } string modelFieldName = modelName; string tempChar = modelFieldName[0].ToString(); tempChar = tempChar.ToLower(); modelFieldName = modelFieldName.Remove(0, 1); modelFieldName = modelFieldName.Insert(0, tempChar); string temp = UITemplate; temp = temp.Replace("{ClassName}", name); temp = temp.Replace("{ModelClass}", modelName); temp = temp.Replace("{ModelClassName}", modelFieldName); File.WriteAllText(panelPath, temp, new UTF8Encoding()); } } }