/// <inheritdoc />
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            Instance = this;
            Config   = helper.ReadConfig <Config>();
            // Assets
            var fridgeSelected =
                helper.Content.Load <Texture2D>(Config.FlipImage ? "assets/fridge-flipped.png" : "assets/fridge.png");
            var fridgeDeselected =
                helper.Content.Load <Texture2D>(Config.FlipImage ? "assets/fridge2-flipped.png" : "assets/fridge2.png");

            // Compatibility checks
            _cookingSkillLoaded = helper.ModRegistry.IsLoaded("spacechase0.CookingSkill");
            var categorizeChestsLoaded = helper.ModRegistry.IsLoaded("CategorizeChests");
            var convenientChestsLoaded = helper.ModRegistry.IsLoaded("aEnigma.ConvenientChests");
            var megaStorageLoaded      = helper.ModRegistry.IsLoaded("Alek.MegaStorage");

            if (categorizeChestsLoaded)
            {
                Monitor.Log("Categorize chests detected, moving icon location.", LogLevel.Info);
            }
            if (convenientChestsLoaded)
            {
                Monitor.Log("Convenient chests detected, moving icon location.", LogLevel.Info);
            }
            if (megaStorageLoaded)
            {
                Monitor.Log("Mega Storage detected, moving icon location.", LogLevel.Info);
            }

            var offsetIcon = categorizeChestsLoaded || convenientChestsLoaded || megaStorageLoaded;

            _handler = new FridgeHandler(fridgeSelected, fridgeDeselected, offsetIcon, Config);
            AddEvents(helper);
        }
Esempio n. 2
0
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            Instance = this;
            Harmony();

            var fridgeSelected   = helper.Content.Load <Texture2D>("assets/fridge.png");
            var fridgeDeselected = helper.Content.Load <Texture2D>("assets/fridge2.png");

            var categorizeChestsLoaded = helper.ModRegistry.IsLoaded("CategorizeChests") ||
                                         helper.ModRegistry.IsLoaded("aEnigma.ConvenientChests");

            cookingSkillLoaded = helper.ModRegistry.IsLoaded("spacechase0.CookingSkill");
            if (cookingSkillLoaded)
            {
                Monitor.Log("Cooking skill is loaded on game start try to hook into the api");
            }
            _handler = new FridgeHandler(fridgeSelected, fridgeDeselected, categorizeChestsLoaded, cookingSkillLoaded);

            MenuEvents.MenuChanged              += MenuChanged_Event;
            InputEvents.ButtonPressed           += Button_Pressed_Event;
            GameEvents.FirstUpdateTick          += Game_FirstTick;
            GraphicsEvents.OnPostRenderGuiEvent += Draw;

            SaveEvents.AfterLoad  += AfterLoad;
            SaveEvents.BeforeSave += BeforeSave;
            SaveEvents.AfterSave  += AfterSave;
            GameEvents.UpdateTick += Game_Update;
        }
Esempio n. 3
0
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            Instance = this;
            Harmony();

            var fridgeSelected   = helper.Content.Load <Texture2D>("assets/fridge.png");
            var fridgeDeselected = helper.Content.Load <Texture2D>("assets/fridge2.png");

            var categorizeChestsLoaded = helper.ModRegistry.IsLoaded("CategorizeChests") ||
                                         helper.ModRegistry.IsLoaded("aEnigma.ConvenientChests");

            cookingSkillLoaded = helper.ModRegistry.IsLoaded("spacechase0.CookingSkill");
            if (cookingSkillLoaded)
            {
                Monitor.Log("Cooking skill is loaded on game start try to hook into the api");
            }
            _handler = new FridgeHandler(fridgeSelected, fridgeDeselected, categorizeChestsLoaded, cookingSkillLoaded);

            helper.Events.Display.MenuChanged        += OnMenuChanged;
            helper.Events.Display.RenderedActiveMenu += OnRenderedActiveMenu;
            helper.Events.GameLoop.GameLaunched      += OnGameLaunched;
            helper.Events.Input.ButtonPressed        += OnButtonPressed;

            helper.Events.GameLoop.SaveLoaded   += OnSaveLoaded;
            helper.Events.GameLoop.Saving       += OnSaving;
            helper.Events.GameLoop.Saved        += OnSaved;
            helper.Events.GameLoop.UpdateTicked += OnUpdateTicked;
        }
Esempio n. 4
0
        private static List <Chest> ToList(FridgeHandler fridgeHandler)
        {
            var chests = fridgeHandler.Chests.ToList();

            if (Game1.getLocationFromName("farmHouse") is FarmHouse farm)
            {
                chests.Add(farm.fridge.Value);
            }
            return(chests);
        }
 public RemoteFridgeCraftingPage(IClickableMenu page, FridgeHandler fridgeHandler) :
     base(page.xPositionOnScreen, page.yPositionOnScreen, page.width, page.height, true)
 {
     _fridgeHandler = fridgeHandler;
 }
Esempio n. 6
0
 public FridgeVirtualList(FridgeHandler fridgeHandler) : base(ToList(fridgeHandler),
                                                              chest => chest.items)
 {
 }