protected ModPrefab_Craftable( string techTypeName, string friendlyName, string description, TechType template, TechType requiredAnalysis, TechGroup groupForPDA, TechCategory categoryForPDA, EquipmentType equipmentType, QuickSlotType quickSlotType, CraftData.BackgroundType backgroundType, Vector2int itemSize, ModPrefab_Fragment fragment ) : base(techTypeName, $"{techTypeName}.Prefab") { TechTypeName = techTypeName; FriendlyName = friendlyName; Description = description; PrefabTemplate = template; RequiredForUnlock = requiredAnalysis; GroupForPDA = groupForPDA; CategoryForPDA = categoryForPDA; TypeForEquipment = equipmentType; TypeForQuickslot = quickSlotType; BackgroundType = backgroundType; ItemSize = itemSize; _Fragment = fragment; IngameMenuHandler.Main.RegisterOnQuitEvent(OnQuitEvent); }
private static bool PatchBackgrounds(CraftData.BackgroundType backgroundType, ref Sprite __result) { if (BackgroundTypeHandler.BackgroundSprites.TryGetValue(backgroundType, out Sprite value)) { __result = value; return(false); } return(true); }
internal static CraftData.BackgroundType AddBackgroundType(string name) { EnumTypeCache cache = cacheManager.RequestCacheForTypeName(name) ?? new EnumTypeCache() { Name = name, Index = cacheManager.GetNextAvailableIndex() }; CraftData.BackgroundType backgroundType = (CraftData.BackgroundType)cache.Index; cacheManager.Add(backgroundType, cache.Index, cache.Name); Logger.Log($"Successfully added Backgroundtype: '{name}' to Index: '{cache.Index}'", LogLevel.Debug); return(backgroundType); }
protected ModPrefab_Craftable( string nameID, string iconFilePath, TechType iconTechType, string friendlyName, string description, TechType template, TabNode newTabNode, CraftTree.Type[] fabricatorTypes, string[][] fabricatorTabs, TechType requiredAnalysis, TechGroup groupForPDA, TechCategory categoryForPDA, EquipmentType equipmentType, QuickSlotType quickSlotType, CraftData.BackgroundType backgroundType, Vector2int itemSize, string gamerResourceFileName, ModPrefab_Fragment fragment ) : base(nameID, $"{nameID}:Prefab") { NameID = nameID; IconFilePath = iconFilePath; IconTechType = iconTechType; FriendlyName = friendlyName; Description = description; PrefabTemplate = template; NewTabNode = newTabNode; FabricatorTypes = fabricatorTypes; FabricatorTabs = fabricatorTabs; RequiredForUnlock = requiredAnalysis; GroupForPDA = groupForPDA; CategoryForPDA = categoryForPDA; TypeForEquipment = equipmentType; TypeForQuickslot = quickSlotType; BackgroundType = backgroundType; ItemSize = itemSize; GameResourceFileName = gamerResourceFileName; _Fragment = fragment; //IngameMenuHandler.Main.RegisterOnQuitEvent(OnQuitEvent); }
protected CraftableModItem( string nameID, string iconFileName, TechType iconTechType, string friendlyName, string description, TechType template, CraftTree.Type fabricatorType, string[] fabricatorTab, TechType requiredAnalysis, TechGroup groupForPDA, TechCategory categoryForPDA, EquipmentType equipmentType, QuickSlotType quickSlotType, CraftData.BackgroundType backgroundType, Vector2int itemSize, string gamerResourceFileName ) : base(nameID, $"{nameID}Prefab") { NameID = nameID; IconFilename = iconFileName; IconTechType = iconTechType; FriendlyName = friendlyName; Description = description; PrefabTemplate = template; FabricatorType = fabricatorType; FabricatorTab = fabricatorTab; RequiredForUnlock = requiredAnalysis; GroupForPDA = groupForPDA; CategoryForPDA = categoryForPDA; TypeForEquipment = equipmentType; TypeForQuickslot = quickSlotType; BackgroundType = backgroundType; ItemSize = itemSize; GameResourceFileName = gamerResourceFileName; }
/// <summary> /// <para>Allows you to edit inventory background colors for TechTypes.</para> /// </summary> /// <param name="techType">The TechType whose BackgroundType you want to edit.</param> /// <param name="backgroundColor">The background color for that TechType.</param> /// <seealso cref="CraftData.BackgroundType"/> public static void SetBackgroundType(TechType techType, CraftData.BackgroundType backgroundColor) { Main.SetBackgroundType(techType, backgroundColor); }
protected void setBackgroundType(CraftData.BackgroundType backgroundType) => CraftDataHandler.SetBackgroundType(TechType, backgroundType);
/// <summary> /// <para>Allows you to edit inventory background colors for TechTypes.</para> /// </summary> /// <param name="techType">The TechType whose BackgroundType you want to edit.</param> /// <param name="backgroundColor">The background color for that TechType.</param> /// <seealso cref="CraftData.BackgroundType"/> void ICraftDataHandler.SetBackgroundType(TechType techType, CraftData.BackgroundType backgroundColor) { CraftDataPatcher.CustomBackgroundTypes[techType] = backgroundColor; }
/// <summary> /// <para>Allows you to edit inventory background colors for TechTypes.</para> /// </summary> /// <param name="techType">The TechType whose BackgroundType you want to edit.</param> /// <param name="backgroundColor">The background color for that TechType.</param> /// <seealso cref="CraftData.BackgroundType"/> void ICraftDataHandler.SetBackgroundType(TechType techType, CraftData.BackgroundType backgroundColor) { AddJsonProperty(techType, "backgroundType", new JsonValue((int)backgroundColor)); }
/// <summary> /// Safely looks for a modded Background Type from another mod in the SMLHelper BackgroundTypeCache and outputs its <see cref="CraftData.BackgroundType" /> value when found. /// </summary> /// <param name="backgroundTypeString">The string used to define the BackgroundType</param> /// <param name="modBackgroundType">The BackgroundType enum value of the modded. Defaults to <see cref="CraftData.BackgroundType.Normal" /> when the item was not found.</param> /// <returns><see langword="true"/> if the item was found; otherwise <see langword="false"/>.</returns> bool IBackgroundTypeHandler.TryGetModdedBackgroundType(string backgroundTypeString, out CraftData.BackgroundType modBackgroundType) { EnumTypeCache cache = BackgroundTypePatcher.cacheManager.RequestCacheForTypeName(backgroundTypeString, false); if (cache != null) // Item Found { modBackgroundType = (CraftData.BackgroundType)cache.Index; return(true); } else // Mod not present or not yet loaded { modBackgroundType = CraftData.BackgroundType.Normal; return(false); } }
/// <summary> /// Safely looks for a modded Background Type from another mod in the SMLHelper BackgroundTypeCache and outputs its <see cref="CraftData.BackgroundType" /> value when found. /// </summary> /// <param name="backgroundTypeString">The string used to define the BackgroundType</param> /// <param name="modBackgroundType">The BackgroundType enum value of the modded. Defaults to <see cref="CraftData.BackgroundType.Normal" /> when the item was not found.</param> /// <returns><see langword="true"/> if the item was found; otherwise <see langword="false"/>.</returns> public static bool TryGetModdedBackgroundType(string backgroundTypeString, out CraftData.BackgroundType modBackgroundType) { return(Main.TryGetModdedBackgroundType(backgroundTypeString, out modBackgroundType)); }