private List <string> GetBtnComponentList(bool pNeedTip = true) { ; List <string> tBtnComponentList = null; if (null != _exportInfoDic && _exportInfoDic.Count > 0) { var tEnum = _exportInfoDic.GetEnumerator(); UIComponentInfo tUIComponentInfo = null; while (tEnum.MoveNext()) { tUIComponentInfo = tEnum.Current.Value; if (null != tUIComponentInfo && tUIComponentInfo.comType == "Button") { if (null == tBtnComponentList) { tBtnComponentList = new List <string>(); } tBtnComponentList.Add(tUIComponentInfo.memberName); } } } if ((null == tBtnComponentList || tBtnComponentList.Count <= 0) && pNeedTip) { GameDebuger.Log("界面中没有按钮组件,不设置按钮相关事件监听和回掉。"); } return(tBtnComponentList); }
private void UpdateFileContent(string pFilePath) { if (!string.IsNullOrEmpty(pFilePath) && File.Exists(pFilePath)) { string tFileContent = File.ReadAllText(pFilePath); if (!string.IsNullOrEmpty(tFileContent)) { tFileContent = tFileContent.Replace(KEY_WORD_MODULE_NAME, mModuleName).Replace(KEY_WORD_AUTHOR, mAuthor).Replace(KEY_WORD_CREATED_TIME, mCreateTime); File.WriteAllText(pFilePath, tFileContent); GameDebuger.Log(string.Format("Generate File {0} success !", pFilePath)); } } }
private void GenerateFile(string pTemplatePath, string pCreatedFilePath) { if (File.Exists(pTemplatePath)) { if (!File.Exists(pCreatedFilePath)) { Refactor.RefactorUtils.CreateFileDirectory(pCreatedFilePath, false); FileUtil.CopyFileOrDirectory(pTemplatePath, pCreatedFilePath); UpdateFileContent(pCreatedFilePath); } else { GameDebuger.Log(string.Format("Generate File canceled for file is already exists. File Path:{0}", pCreatedFilePath)); } } }
public static void LoadPathList() { string sFileContent = File.ReadAllText(_savePathFile); string[] strs = sFileContent.Split('\n'); GameDebuger.Log(sFileContent); foreach (var str in strs) { string[] list = str.Split(' '); GameDebuger.Log(str + "\n"); if (list.Length != 2) { continue; } view2ScriptPath[list[0]] = list[1].Replace("\\", "/"); } }
public static bool UpdateProxyFileFromStaticToInstance(string pProxyFileFullPath) { if (File.Exists(pProxyFileFullPath)) { string tFileContent = File.ReadAllText(pProxyFileFullPath); if (!string.IsNullOrEmpty(tFileContent)) { tFileContent = tFileContent.Replace("public static ", "public "); if (!string.IsNullOrEmpty(tFileContent)) { File.WriteAllText(pProxyFileFullPath, tFileContent); GameDebuger.Log(string.Format(" Proxy 内容已更新。pProxyFileFullPath:{0}", pProxyFileFullPath)); return(true); } } } return(false); }
//检索文档中模板代码段,复制之并替换模块名字为目标名字 private static void UpdateFileCopyCodeBetweenKeyWord(string pFilePath, string pPrefixKeyWord, string pInValidKeyWord = "", string pModuleName = KEY_WORD_MODULE_NAME, string pAuthor = KEY_WORD_AUTHOR, string pCreateTime = KEY_WORD_CREATED_TIME) { if (string.IsNullOrEmpty(pModuleName) || pModuleName == KEY_WORD_MODULE_NAME) { return; } if (!string.IsNullOrEmpty(pFilePath) && File.Exists(pFilePath)) { string tFileContent = File.ReadAllText(pFilePath); if (tFileContent.IndexOf(pInValidKeyWord) != -1) { GameDebuger.Log(string.Format("文件更新取消,存在禁止关键词,pModuleName:{0},pInValidKeyWord:{1}", pModuleName, pInValidKeyWord)); return; } UpdateFileContentCopyCodeBetweenKeyWord(ref tFileContent, pPrefixKeyWord, 0, pModuleName, pAuthor, pCreateTime); File.WriteAllText(pFilePath, tFileContent); } }
public static void ShowNotificationStr(this EditorWindow pEditorWindow, string pMessage) { GameDebuger.Log("ShowNotification:" + pMessage); pEditorWindow.ShowNotification(new GUIContent(pMessage)); }