Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public static bool OnToggle(UMM.ModEntry modEntry, bool value)
 {
     if (!value)
     {
         return(false);
     }
     Enabled = true;
     return(true);
 }
Esempio n. 3
0
 private static bool OnToggle(UMM.ModEntry mod, bool enable)
 {
     if (enable)
     {
         harmony.PatchAll(Assembly.GetExecutingAssembly());
     }
     else
     {
         harmony.UnpatchAll();
     }
     return(true);
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public ModEntryCheck(string modId)
 {
     modEntry = UnityModManager.FindMod(modId);
 }
Esempio n. 6
0
 public override void Save(UnityModManager.ModEntry modEntry)
 {
     Save(this, modEntry);
 }
Esempio n. 7
0
 public override void Save(UMM.ModEntry modEntry)
 {
     Save(this, modEntry);
 }
Esempio n. 8
0
 public static void OnSaveGUI(UMM.ModEntry modEntry)
 {
     Setting.Save(modEntry);
 }
Esempio n. 9
0
 static bool Load(UMM.ModEntry mod)
 {
     harmony      = HarmonyInstance.Create(mod.Info.Id);
     mod.OnToggle = OnToggle;
     return(true);
 }