public static void OnGUI(UMM.ModEntry modEntry) { GUILayout.BeginVertical("box"); GUILayout.Label("msbuild路径:"); Setting.msbuildPath = GUILayout.TextField(Setting.msbuildPath); GUILayout.Label("dlls路径: "); Setting.dllsPath = GUILayout.TextField(Setting.dllsPath); GUILayout.BeginHorizontal(); if (GUILayout.Button("打开代码路径", GUILayout.Width(100))) { var p = new System.Diagnostics.Process(); p.StartInfo.FileName = "explorer.exe"; p.StartInfo.UseShellExecute = true; p.StartInfo.CreateNoWindow = true; p.StartInfo.WorkingDirectory = rootPath; p.StartInfo.Arguments = "/e,/select,\"" + Path.Combine(rootPath, "Execute.cs.template") + "\""; p.Start(); } if (!running) { if (GUILayout.Button("运行代码", GUILayout.Width(100))) { Execute(); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public static bool OnToggle(UMM.ModEntry modEntry, bool value) { if (!value) { return(false); } Enabled = true; return(true); }
private static bool OnToggle(UMM.ModEntry mod, bool enable) { if (enable) { harmony.PatchAll(Assembly.GetExecutingAssembly()); } else { harmony.UnpatchAll(); } return(true); }
public static bool Load(UMM.ModEntry modEntry) { rootPath = modEntry.Path; Logger = modEntry.Logger; Func <UMM.ModEntry, string> convert = (mod) => $"\t\t<Reference Include=\"{mod.Info.AssemblyName.Replace(".dll", "")}\">\n" + "\t\t\t<ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n" + "\t\t\t<Private>false</Private>\n" + $"\t\t\t<HintPath>{Path.Combine(mod.Path, mod.Info.AssemblyName)}</HintPath>\n" + "\t\t</Reference>"; modsReference = string.Join("\n", UMM.modEntries.Where((mod) => mod.Enabled).Select(convert).ToArray()); Setting = Settings.Load <Settings>(modEntry); modEntry.OnToggle = OnToggle; modEntry.OnGUI = OnGUI; modEntry.OnSaveGUI = OnSaveGUI; HarmonyInstance.Create(modEntry.Info.Id).PatchAll(Assembly.GetExecutingAssembly()); return(true); }
public ModEntryCheck(string modId) { modEntry = UnityModManager.FindMod(modId); }
public override void Save(UnityModManager.ModEntry modEntry) { Save(this, modEntry); }
public override void Save(UMM.ModEntry modEntry) { Save(this, modEntry); }
public static void OnSaveGUI(UMM.ModEntry modEntry) { Setting.Save(modEntry); }
static bool Load(UMM.ModEntry mod) { harmony = HarmonyInstance.Create(mod.Info.Id); mod.OnToggle = OnToggle; return(true); }