/// <summary> /// Clears the current list of Mods then updates it with an up to date version /// </summary> /// <param name="modLocation">The file path to the Mods root folder</param> private void RefreshModInfo(string modLocation) { // Clear the current list of mods to avoid conflicts Mods.Clear(); // Get Mod folders then iterate them var modFolders = Directory.GetDirectories(modLocation); foreach (var modFolder in modFolders) { // Check for Mod Info json var modInfoPath = modFolder + "/ModInfo.json"; if (!File.Exists(modInfoPath)) { continue; } // Read the text from the ModInfo then create a Mod object from it and add it to the list var modInfoContent = File.ReadAllText(modInfoPath); Mod newMod = JsonUtility.FromJson <Mod>(modInfoContent); newMod.ModPath = modFolder; Mods.Add(newMod); Modigine.print("Loaded " + newMod.ModName + " by " + newMod.ModAuthor, "green"); } }
/// <summary> /// Add a new register /// </summary> /// <param name="register">The register that you would like to add to cache</param> public void AddRegister(FileRegister register) { if (registers.Contains(register)) { return; } // This adds the register to the list registers.Add(register); Modigine.print("Added " + register.ToString()); }
private IEnumerator TextureLoad(string filePath) { Texture2D texture; texture = new Texture2D(4, 4, TextureFormat.DXT1, false); using (WWW www = new WWW(filePath)) { if (www != null) { yield return(www); www.LoadImageIntoTexture(texture); Modigine.resourceManager.AddResource(filePath, texture); Modigine.print("Added new texture " + filePath); } } }