ShipDecorations.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using UnityEngine;
  2. using GadgetCore.API;
  3. using UnityEngine.SceneManagement;
  4. using System.Reflection;
  5. using GadgetCore.API.ConfigMenu;
  6. using System;
  7. namespace ShipDecorations
  8. {
  9. [Gadget("ShipDecorations")]
  10. public class ShipDecorations : Gadget<ShipDecorations>
  11. {
  12. public const string MOD_VERSION = "1.0"; // Set this to the version of your mod.
  13. public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
  14. public override IGadgetConfigMenu GetConfigMenu() { return null; }
  15. protected override void LoadConfig() { Config.Reset(); Config.Save(); }
  16. public override string GetModDescription()
  17. {
  18. return "A mod that adds some more ship decorations.";
  19. }
  20. protected override void Initialize()
  21. {
  22. Logger.Log("Ship Decorations v" + Info.Mod.Version);
  23. Core.logger = Logger;
  24. AddToList(ItemUtil.CreatePlacableDecoItem("cBed.png", "iBed.png", "Bed"), 1000);
  25. AddToList(ItemUtil.CreatePlacableDecoItem("cTree5Plant.png", "iTree5Plant.png", "Tree Plant"), 2000);
  26. AddToList(ItemUtil.CreatePlacableDecoItem("cPlant0Plant.png", "iPlant0Plant.png", "Bush Plant"), 2000);
  27. AddToList(ItemUtil.CreatePlacableDecoItem("cTreantHeadPlant.png", "iTreantHeadPlant.png", "Treant Plant"), 10000);
  28. AddToList(ItemUtil.CreatePlacableSlideDoorItem("cDoor.png", "cDoorOpen.png", "iDoor.png", "Door"), 5000);
  29. // SceneManager.sceneLoaded += OnSceneLoaded;
  30. }
  31. internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
  32. {
  33. if (scene.buildIndex == 1)
  34. {
  35. try
  36. {
  37. // GameObject obj = GadgetCoreAPI.CreateMarketStand(ItemRegistry.GetItem(Core.itemStoreList[0]), new Vector2(-138f - 2 * 4, -7.49f), 100);
  38. // // NetworkView network = obj.GetComponent<NetworkView>();
  39. // // network.viewID = NetworkViewID.unassigned;
  40. // // obj.GetComponent<KylockeStand>().Awake();
  41. }
  42. catch (Exception e) { Core.logger.LogConsole(e.Message); }
  43. }
  44. }
  45. private void AddToList(int id, int price)
  46. {
  47. Core.itemStoreList.Add(id);
  48. Core.itemStorePriceList.Add(id, price);
  49. }
  50. }
  51. }