using UnityEngine; using GadgetCore.API; using UnityEngine.SceneManagement; using System.Reflection; using GadgetCore.API.ConfigMenu; using System; namespace ShipDecorations { [Gadget("ShipDecorations")] public class ShipDecorations : Gadget { 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; } protected override void LoadConfig() { Config.Reset(); Config.Save(); } 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) { try { // GameObject obj = GadgetCoreAPI.CreateMarketStand(ItemRegistry.GetItem(Core.itemStoreList[0]), new Vector2(-138f - 2 * 4, -7.49f), 100); // // NetworkView network = obj.GetComponent(); // // network.viewID = NetworkViewID.unassigned; // // obj.GetComponent().Awake(); } catch (Exception e) { Core.logger.LogConsole(e.Message); } } } private void AddToList(int id, int price) { Core.itemStoreList.Add(id); Core.itemStorePriceList.Add(id, price); } } }