private static Sprite LoadProjectileSprite(MonoBehaviour projectile) { IModProjectile modProj = (IModProjectile)projectile; string projID = Lizard.GetID(projectile); return(LoadObjectSprite(projectile, projID, "Projectile", modProj.ProjectileImage)); }
internal void LoadProjectiles() { if (projectileTypes.Count == 0) { Logger.Log("No projectiles to load\n\n"); return; } Logger.Log($"Loading {projectileTypes.Count} projectile type(s)\n"); foreach (Type projectileType in projectileTypes) { Logger.Log($"Loading projectile {projectileType.FullName}"); GameObject dummy = new GameObject(); dummy.SetActive(false); MonoBehaviour proj = (MonoBehaviour)dummy.AddComponent(projectileType); Sprite sprite = LoadProjectileSprite(proj); ModManager.AddModProjectile(Lizard.GetID(projectileType), sprite); UnityEngine.Object.Destroy(dummy); } Logger.Log(""); }
internal void InitModSkillInfos() { foreach (Type skillType in skillTypes) { ModManager.ModSkillDescriptions.Add(Lizard.GetID(skillType), ModManager.CreateSkillInfo()); } }
private List <Type> Load <IT>(Type objectType, bool includeAbstract) { List <Type> result = new List <Type>(); Type interfaceType = typeof(IT); foreach (Type type in types) { if (includeAbstract || !type.IsAbstract) { if (Lizard.IsInterface(interfaceType, type) && type.IsSubclassOf(objectType)) { result.Add(type); } } } return(result); }
internal static void Reset() { foreach (KeyValuePair <string, IModItem> kvp in ModItems) { LootManager.completeItemDict.Remove(kvp.Key); } Mods.Clear(); ModItems.Clear(); ModItemImages.Clear(); ModSkills.Clear(); ModSkillImages.Clear(); ModProjectileImages.Clear(); ModItemDescriptions.Clear(); ModSkillDescriptions.Clear(); Lizard.Reset(); LizardTitleScreen.Reset(); }
public static void AwakeEnd(TitleScreen titleScreen) { FieldInfo fi = Lizard.GetFieldInfo <TitleScreen>("menuTextOpts", false, false); Text[] texts = (Text[])fi.GetValue(titleScreen); InitNullMenuOption("Single Player", texts[0]); InitNullMenuOption("Two Players", texts[1]); InitNullMenuOption("Versus", texts[2]); InitNullMenuOption("Options", texts[3]); InitNullMenuOption("Credits", texts[4]); InitNullMenuOption("Exit", texts[5]); fi.SetValue(titleScreen, CreateTextsArray()); titleScreen.multiplayerOptIndex = IndexOfMenuOption("Two Players"); titleScreen.versusOptIndex = IndexOfMenuOption("Versus"); SortMenuOptions(); }
internal void LoadItems() { if (itemTypes.Count == 0) { Logger.Log("No items to load\n"); return; } Logger.Log($"Loading {itemTypes.Count} item type(s)\n"); foreach (Type itemType in itemTypes) { Logger.Log($"Loading item {itemType.FullName}"); Item item = (Item)Activator.CreateInstance(itemType); item.ID = Lizard.GetID(itemType); Sprite sprite = LoadItemSprite(item); ModManager.AddModItem(item, sprite); } Logger.Log(""); }