Ejemplo n.º 1
0
        /// <summary>
        /// Load a Mod.
        /// </summary>
        /// <param name="mod">The instance of the Mod to load.</param>
        /// <param name="isInternal">If the Mod is internal or not.</param>
        private static void LoadMod(Mod mod, bool isInternal = false)
        {
            // Check if mod already exists
            if (!LoadedMods.Contains(mod))
            {
                // Generate config files
                if (!Directory.Exists(ConfigFolder + mod.ID))
                {
                    Directory.CreateDirectory(ConfigFolder + mod.ID);
                }

                // Load
                mod.OnLoad();
                LoadedMods.Add(mod);

                if (!isInternal)
                {
                    ModConsole.Print(string.Format("<color=lime><b>Mod Loaded:</b></color><color=orange><b>{0}</b></color>", mod.ID));
                }
                else
                {
                    //ModConsole.Print("Loaded internal mod: " + mod.ID); //debug
                }
            }
            else
            {
                ModConsole.Print(string.Format("<color=orange><b>Mod already loaded (or duplicated ID):</b></color><color=red><b>{0}</b></color>", mod.ID));
            }
        }
Ejemplo n.º 2
0
 private static void LoadMod(Mod mod, string msver)
 {
     // Check if mod already exists
     if (!LoadedMods.Contains(mod))
     {
         // Create config folder
         if (!Directory.Exists(ConfigFolder + mod.ID))
         {
             Directory.CreateDirectory(ConfigFolder + mod.ID);
         }
         if (mod.UseAssetsFolder)
         {
             if (!Directory.Exists(AssetsFolder + mod.ID))
             {
                 Directory.CreateDirectory(AssetsFolder + mod.ID);
             }
         }
         if (mod.LoadInMenu)
         {
             mod.OnLoad();
             ModSettings.LoadBinds();
             //  ModConsole.Print(string.Format("<color=lime><b>Mod Loaded:</b></color><color=orange><b>{0}</b> ({1}ms)</color>", mod.ID, s.ElapsedMilliseconds));
         }
         mod.compiledVersion = msver;
         LoadedMods.Add(mod);
     }
     else
     {
         ModConsole.Print(string.Format("<color=orange><b>Mod already loaded (or duplicated ID):</b></color><color=red><b>{0}</b></color>", mod.ID));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Load a Mod.
        /// </summary>
        /// <param name="mod">The instance of the Mod to load.</param>
        /// <param name="isInternal">If the Mod is internal or not.</param>
        private static void LoadMod(Mod mod, bool isInternal = false)
        {
            // Check if mod already exists
            if (!LoadedMods.Contains(mod))
            {
                // Generate config files
                if (!Directory.Exists(ConfigFolder + mod.ID))
                {
                    Directory.CreateDirectory(ConfigFolder + mod.ID);
                }

                // Load
                mod.OnLoad();
                LoadedMods.Add(mod);

                if (!isInternal)
                {
                    ModConsole.Print("Loaded mod: " + mod.ID);
                }
                else
                {
                    ModConsole.Print("Loaded internal mod: " + mod.ID);
                }
            }
            else
            {
                ModConsole.Print("Mod already loaded: " + mod.ID);
            }
        }