| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using UnityEngine;
- using GadgetCore.API;
- using UnityEngine.SceneManagement;
- using System.Reflection;
- using GadgetCore.API.ConfigMenu;
- namespace ShipDecorations
- {
- [Gadget("ShipDecorations")]
- public class ShipDecorations : Gadget<ShipDecorations>
- {
- public const string MOD_VERSION = "1.0"; // Set this to the version of your mod.
- public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
- public override IGadgetConfigMenu GetConfigMenu() { return null; }
- public override string GetModDescription()
- {
- return "A mod that adds some more ship decorations.";
- }
- protected override void Initialize()
- {
- Logger.Log("Ship Decorations v" + Info.Mod.Version);
- Core.logger = Logger;
- AddToList(ItemUtil.CreatePlacableDecoItem("cBed.png", "iBed.png", "Bed"), 1000);
- AddToList(ItemUtil.CreatePlacableDecoItem("cTree5Plant.png", "iTree5Plant.png", "Tree Plant"), 2000);
- AddToList(ItemUtil.CreatePlacableDecoItem("cPlant0Plant.png", "iPlant0Plant.png", "Bush Plant"), 2000);
- AddToList(ItemUtil.CreatePlacableDecoItem("cTreantHeadPlant.png", "iTreantHeadPlant.png", "Treant Plant"), 10000);
- AddToList(ItemUtil.CreatePlacableSlideDoorItem("cDoor.png", "cDoorOpen.png", "iDoor.png", "Door"), 5000);
- SceneManager.sceneLoaded += OnSceneLoaded;
- }
- internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
- {
- if (scene.buildIndex == 1)
- {
- var i = GadgetCoreAPI.CreateMarketStand(ItemRegistry.GetItem(Core.itemStoreList[0]), new Vector2(-138f - 2 * 4, -7.49f), 1000);
- call(i.GetComponent<KylockeStand>(), "Awake");
- }
- }
- private static object call<T>(T __instance, string meth, object[] o = null)
- {
- MethodInfo dynMethod = __instance.GetType().GetMethod(meth, BindingFlags.NonPublic | BindingFlags.Instance);
- return dynMethod.Invoke(__instance, o ?? new object[0]);
- }
- private void AddToList(int id, int price)
- {
- Core.itemStoreList.Add(id);
- Core.itemStorePriceList.Add(id, price);
- }
- }
- }
|