private void CreateOriginMain() { appender.Clean(); //appender.AppendLine($"#if {u3DAppSetting.LocAppId}Play"); //AppendHead(); //AppendVConst(); //AppendRxModelPropertyDefine(); //AppendInitRxModel(); //appender.AppendCsFooter(); //appender.AppendLine("#endif"); //var content = appender.ToString(); //YuIOUtility.WriteAllText(uiMeta.OriginModelScriptPath2(u3DAppSetting), content); }
private void CreateScript() { Appender.Clean(); //Appender.AppendLine($"#if {u3DAppSetting.LocAppId}Play"); Appender.AppCsNoteHeader(); Appender.AppendUsingNamespace( "Client.LegoUI", "UnityEngine", "YuU3dPlay" ); Appender.AppendSingleComment("在这里处理UI的生命周期!"); //Appender.AppendLine($"namespace {u3DAppSetting.LocAppId}Play"); Appender.AppendLine("{"); Appender.ToRight(); Appender.AppendLine($"public class {ClassId} : IYuLegoUIPipelineHandler"); Appender.AppendLine("{"); Appender.ToRight(); Appender.AppendLine($"public string UiId => \"{uiRect.name}\";"); Appender.AppendLine($"public YuUIPipelineType PipelineType => " + $"YuUIPipelineType.{pipelineType};"); Appender.AppendLine(); Appender.AppendLine($"public void Execute(IYuLegoUI legoUI)"); Appender.AppendLine("{"); Appender.ToRight(); Appender.AppendLine("#if UNITY_EDITOR"); Appender.AppendLine($"Debug.Log(\"{ClassId} is Invoked!\");"); Appender.AppendLine("#endif"); Appender.ToLeft(); Appender.AppendLine("}"); Appender.AppendCsFooter(); Appender.AppendLine("#endif"); //var developerId = YuU3dAppSettingDati.CurrentActual.CurrentDeveloper.Name; //var path = u3DAppSetting.Helper.CsLegoUIDir + developerId + "/" // + GetUITypeDir() + "/" + uiRect.name + "/LogicCode/LogicAndPipeline/" // + ClassId + ".cs"; //var codeContent = Appender.ToString(); //YuIOUtility.TryWriteAllText(path, codeContent); }
private void CreateScript() { TargetDir = TargetDir.EnsureDirEnd(); var appender = new StringAppender(); var successfulSettings = new List <YuScriptCreateSetting>(); foreach (var setting in ScriptCreateSettings) { if (string.IsNullOrEmpty(setting.ScriptId)) { //YuEditorAPIInvoker.DisplayTip("脚本名不能为空!"); return; } var scriptPath = TargetDir + setting.ScriptId + ".cs"; if (File.Exists(scriptPath)) { Debug.Log($"目标脚本{scriptPath}已存在,创建取消!"); continue; } AppendNoteHead(appender, setting); AppendBody(appender, setting); var content = appender.ToString(); IOUtility.WriteAllText(scriptPath, content); appender.Clean(); successfulSettings.Add(setting); } foreach (var setting in successfulSettings) { ScriptCreateSettings.Remove(setting); } AssetDatabase.Refresh(); }