public void AutoTuneLoading() { if (GenGlobal.GetSetting(GenGlobal.AutoTuneSettings.OLD_GEN_CONFIG)) { GenConfigBindingSource.DataSource = GenGlobal.AppConfig; } else { GenGlobal.AppConfig = new AppConfig(); GenConfigBindingSource.DataSource = GenGlobal.AppConfig; } rdbMultiline.Checked = GenGlobal.AppConfig.Multiline; rdbSignleline.Checked = GenGlobal.AppConfig.SingleLine; GenGlobal.ProjectManager = new ProjectManager(); OpenProjects = new List <Project>(); GenGlobal.ProjectManager.LockProjectByDefault = false; OpenProjects = new List <Project>(GenGlobal.ProjectManager.OpenProjects); if (OpenProjects != null) { cbbDesProject.Items.Clear(); cbbDesProject.Items.AddRange(OpenProjects.Select(i => i.ProjectName).ToArray()); GenGlobal.CurrentProject = GenGlobal.ProjectManager.GetCurrentProjectWithDialog(); cbbDesProject.Text = GenGlobal.CurrentProject.ProjectName; btnGenerate.Enabled = true; } else { btnGenerate.Enabled = false; WriteLine("Can not find any opned project in your workspace."); } }
public static void GenWindowScript() { if (Selection.activeTransform == null || Selection.activeGameObject == null) { Debug.LogError("未选中节点!"); return; } if (!Selection.activeGameObject.name.EndsWith("Window")) { Debug.LogError("后缀必须为Window!"); return; } var go = Selection.activeGameObject; if (go.GetComponent <RectTransform>() == null) { Debug.LogError("改功能仅支持UGUI!"); return; } var nodeName = go.name.Substring(0, go.name.IndexOf("Window")); GenGlobal.Log("开始生成!"); CodeGenerator.UGUIWindowInit(Selection.activeTransform); GenGlobal.Log("完成生成"); }
public static void WriteClsesToDirectory(List <GenClassInfo> clese, CodeBuilder codeBuilder, bool writeToDir = true) { if (clese == null && clese.Count == 0) { Debug.LogError("clese为空"); return; } //统一写入 foreach (var cls in clese) { string path = CodeSavePath + (cls.namespaceStr + "/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var sb = codeBuilder.Build(cls); if (writeToDir) { WriteSbToDirectory(path + cls.name + ".cs", sb); } GenGlobal.Log("\n" + sb.ToString()); //测试代码 } AssetDatabase.Refresh(); }
public GenRulesForm() { InitializeComponent(); if (!GenGlobal.GetSetting(GenGlobal.AutoTuneSettings.GEN_RULES)) { GenGlobal.GenerationRules = new GenerationRules(); GenGlobal.SaveSetting(GenGlobal.AutoTuneSettings.GEN_RULES); } GenerationRules = GenGlobal.GenerationRules; GenRulesProp.SelectedObject = GenerationRules; }
private void AutoTuneApp_FormClosing(object sender, FormClosingEventArgs e) { GenGlobal.SaveSetting(GenGlobal.AutoTuneSettings.OLD_GEN_CONFIG); }
private void GenRulesForm_FormClosing(object sender, FormClosingEventArgs e) { GenGlobal.SaveSetting(GenGlobal.AutoTuneSettings.GEN_RULES); }