Пример #1
0
        private void AddModFunctions()
        {
            var configMenu = this.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (configMenu != null)
            {
                // register mod
                configMenu.Register(
                    mod: this.ModManifest,
                    reset: () => this.Config = new ModConfig(),
                    save: () => this.Helper.WriteConfig(this.Config)
                    );

                MainSection(configMenu);
                DurationSection(configMenu);
                InterestSection(configMenu);
                LegacyMoneySection(configMenu);
                AdvancedSelection(configMenu);
            }

            mobileApi = this.Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
            if (mobileApi != null)
            {
                Texture2D appIcon = Helper.ModContent.Load <Texture2D>(Path.Combine("assets", "app_icon.png"));
                bool      success = mobileApi.AddApp(Helper.ModRegistry.ModID, "Loans", () => StartBorrow(1, "Key_Amount"), appIcon);
                Monitor.Log($"loaded phone app successfully: {success}", LogLevel.Debug);
            }
        }
Пример #2
0
        internal static void Initialize(IModHelper _helper, IMonitor _monitor, ModConfig _config, IMobilePhoneApi _api)
        {
            helper  = _helper;
            monitor = _monitor;
            config  = _config;
            api     = _api;
            Vector2 ps = api.GetScreenSize(false);
            Vector2 ls = api.GetScreenSize(true);

            backgroundTexture          = new Texture2D(Game1.graphics.GraphicsDevice, (int)ps.X, (int)ps.Y);
            backgroundLandscapeTexture = new Texture2D(Game1.graphics.GraphicsDevice, (int)ls.X, (int)ls.Y);
            Color[] data  = new Color[backgroundTexture.Width * backgroundTexture.Height];
            Color[] data2 = new Color[backgroundLandscapeTexture.Width * backgroundLandscapeTexture.Height];
            int     i     = 0;

            while (i < data.Length || i < data2.Length)
            {
                if (i < data.Length)
                {
                    data[i] = config.AppBackgroundColor;
                }
                if (i < data2.Length)
                {
                    data2[i] = config.AppBackgroundColor;
                }
                i++;
            }
            backgroundTexture.SetData(data);
            backgroundLandscapeTexture.SetData(data2);
        }
Пример #3
0
 internal static void OpenCatalogueApp()
 {
     api = ModEntry.api;
     Helper.Events.Input.ButtonPressed += HelperEvents.Input_ButtonPressed;
     api.SetAppRunning(true);
     api.SetRunningApp(Helper.ModRegistry.ModID);
     Helper.Events.Display.RenderedWorld += Visuals.Display_RenderedWorld;
     opening = true;
 }
Пример #4
0
 private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
 {
     api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
     if (api != null)
     {
         Texture2D appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon.png"));
         bool      success = api.AddApp(Helper.ModRegistry.ModID, "Random Quote", ShowRandomQuote, appIcon);
         Monitor.Log($"loaded phone app successfully: {success}", LogLevel.Debug);
     }
 }
Пример #5
0
        public static void HookToMobilePhoneMod(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
        {
            IMobilePhoneApi api = Data.Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");

            if (api != null)
            {
                Texture2D appIcon = Data.Helper.Content.Load <Texture2D>(System.IO.Path.Combine("assets", "mpmIcon.png"));
                bool      success = api.AddApp(Data.Helper.ModRegistry.ModID, "Recurring Reminders", ModEntry.ShowReminderMenu, appIcon);
                Data.Monitor.Log($"Loaded phone app successfully: {success}", LogLevel.Debug);
            }
        }
Пример #6
0
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
     if (api != null)
     {
         Texture2D appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon.png"));
         bool      success = api.AddApp(Helper.ModRegistry.ModID, "Audio Player", OpenAudioPlayer, appIcon);
         Monitor.Log($"loaded app successfully: {success}", LogLevel.Debug);
     }
     MakeTextures();
 }
Пример #7
0
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
     if (api != null)
     {
         Texture2D appIcon;
         bool      success;
         appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon.png"));
         success = api.AddApp(Helper.ModRegistry.ModID, Helper.Translation.Get("television"), OpenTelevision, appIcon);
         Monitor.Log($"loaded app successfully: {success}", LogLevel.Debug);
     }
 }
Пример #8
0
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
     if (api != null)
     {
         Texture2D appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon_prairie.png"));
         bool      success = api.AddApp(Helper.ModRegistry.ModID + "Prairie", "Prairie King", OpenPrairieKing, appIcon);
         Monitor.Log($"loaded Prairie King app successfully: {success}", LogLevel.Debug);
         appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon_junimo.png"));
         success = api.AddApp(Helper.ModRegistry.ModID + "Junimo", "Junimo Kart", OpenJunimoKart, appIcon);
         Monitor.Log($"loaded Junimo Kart app successfully: {success}", LogLevel.Debug);
     }
 }
Пример #9
0
 /// <summary>Constructs a SMKMenu with an IModHelper and a ModConfig object</summary>
 /// <param name="helper">The IModHelper.</param>
 /// <param name="Config">The mod's ModConfig object.</param>
 public SMKMenu(IModHelper helper, ModConfig Config, bool onMobile = false)
     : base(Game1.viewport.Width / 2 - (UIWidth + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (UIHeight + IClickableMenu.borderWidth * 2) / 2 - Game1.tileSize, UIWidth + IClickableMenu.borderWidth * 2, UIHeight + IClickableMenu.borderWidth * 2 + Game1.tileSize)
 {
     this.onMobile = onMobile;
     if (onMobile)
     {
         this.api     = helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
         exitFunction = () => this.onExitFunc();
     }
     LBTexture   = helper.Content.Load <Texture2D>("assets/LBTexture.png", ContentSource.ModFolder);
     this.Config = Config;
     this.initializeUpperRightCloseButton();
     this.setUpMenu();
 }
Пример #10
0
        public static void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
        {
            ModEntry.api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
            if (ModEntry.api != null)
            {
                api = ModEntry.api;
                Texture2D appIcon;
                bool      success;

                appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon.png"));
                success = ModEntry.api.AddApp(Helper.ModRegistry.ModID + "Catalogues", Helper.Translation.Get("catalogues"), CataloguesApp.OpenCatalogueApp, appIcon);
                Monitor.Log($"loaded catalogues app successfully: {success}", LogLevel.Debug);

                Visuals.MakeTextures();
            }
        }
Пример #11
0
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     if (Config.EnableMobileApp)
     {
         api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
         if (api != null)
         {
             Texture2D appIcon;
             bool      success;
             appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon.png"));
             success = api.AddApp(Helper.ModRegistry.ModID, Helper.Translation.Get("app-name"), OpenApp, appIcon);
             Monitor.Log($"loaded app successfully: {success}", LogLevel.Debug);
             JoJa84PlusApp.Initialize(Helper, Monitor, Config, api);
         }
     }
 }
Пример #12
0
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");
     if (api != null)
     {
         Texture2D appIcon;
         bool      success;
         if (Config.EnableCatalogue)
         {
             appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon_catalogue.png"));
             success = api.AddApp(Helper.ModRegistry.ModID + "Catalogue", Helper.Translation.Get("catalogue"), OpenCatalogue, appIcon);
             Monitor.Log($"loaded catalogue app successfully: {success}", LogLevel.Debug);
         }
         if (Config.EnableFurnitureCatalogue)
         {
             appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon_furniture_catalogue.png"));
             success = api.AddApp(Helper.ModRegistry.ModID + "FurnitureCatalogue", Helper.Translation.Get("furniture-catalogue"), OpenFurnitureCatalogue, appIcon);
             Monitor.Log($"loaded furniture catalogue app successfully: {success}", LogLevel.Debug);
         }
     }
 }
Пример #13
0
        public static void MakeTextures()
        {
            api = ModEntry.api;
            Vector2   screenSize = api.GetScreenSize();
            Texture2D texture    = new Texture2D(Game1.graphics.GraphicsDevice, (int)screenSize.X, (int)screenSize.Y);

            Color[] data = new Color[texture.Width * texture.Height];
            for (int pixel = 0; pixel < data.Length; pixel++)
            {
                data[pixel] = Config.BackgroundColor;
            }
            texture.SetData(data);
            backgroundTexture = texture;
            texture           = new Texture2D(Game1.graphics.GraphicsDevice, (int)screenSize.X, Config.AppRowHeight);
            Texture2D texture2 = new Texture2D(Game1.graphics.GraphicsDevice, (int)screenSize.X, Config.AppRowHeight);

            data = new Color[texture.Width * texture.Height];
            Color[] data2 = new Color[texture.Width * texture.Height];
            for (int pixel = 0; pixel < data.Length; pixel++)
            {
                data[pixel]  = Config.HighlightColor;
                data2[pixel] = Config.GreyedColor;
            }
            texture.SetData(data);
            texture2.SetData(data2);
            hightlightTexture = texture;
            greyedTexture     = texture2;

            texture = new Texture2D(Game1.graphics.GraphicsDevice, (int)screenSize.X, Config.AppHeaderHeight);
            data    = new Color[texture.Width * texture.Height];
            for (int pixel = 0; pixel < data.Length; pixel++)
            {
                data[pixel] = Config.HeaderColor;
            }
            texture.SetData(data);
            headerTexture = texture;
            coinTexture   = Helper.Content.Load <Texture2D>(Path.Combine("assets", "coin.png"));
        }
Пример #14
0
        /* code used from
         *      https://github.com/spacechase0/StardewValleyMods/tree/develop/GenericModConfigMenu#for-c-mod-authors
         *      https://www.nexusmods.com/stardewvalley/articles/467
         */
        /// <summary>Sets up the mod config menu on launch</summary>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // Generic Mod Config Menu stuff here
            // get Generic Mod Config Menu's API (if it's installed)
            var configMenu = this.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (configMenu is null)
            {
                return;
            }

            // register mod
            configMenu.Register(
                mod: this.ModManifest,
                reset: () => this.Config = new ModConfig(),
                save: () => this.Helper.WriteConfig(this.Config)
                );

            // add boolean option
            configMenu.AddBoolOption(
                mod: this.ModManifest,
                name: () => "Blue title instead of default",
                tooltip: () => "The title in the pop up menu will be blue if true and default text color if false",
                getValue: () => this.Config.BlueNotDefaultTitle,
                setValue: value => this.Config.BlueNotDefaultTitle = value
                );

            // add KeyBindList option
            configMenu.AddKeybindList(
                mod: this.ModManifest,
                name: () => "Menu Keybind",
                tooltip: () => "The keybind to click to open up the menu",
                getValue: () => this.Config.ToggleKey,
                setValue: value => this.Config.ToggleKey = value
                );

            // add boolean option
            configMenu.AddBoolOption(
                mod: this.ModManifest,
                name: () => "Only usable with Mobile Phone",
                tooltip: () => "If this is true, the keybind hotkey is disabled, making it only openable via the Mobile Phone mod. Essentially, this just disables the keybind activation. Restart your game for this to take effect.",
                getValue: () => this.Config.OnlyUsableWithPhone,
                setValue: value => this.Config.OnlyUsableWithPhone = value
                );

            // Mobile Phone app stuff here
            IMobilePhoneApi api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone");

            if (api != null)
            {
                void setSMKAsMenu()
                {
                    api.SetAppRunning(true);
                    Game1.activeClickableMenu = new SMKMenu(this.helper, this.Config, true);
                }

                Texture2D appIcon = Helper.Content.Load <Texture2D>(System.IO.Path.Combine("assets", "SMKApp.png"));
                bool      success = api.AddApp(Helper.ModRegistry.ModID, "Stardew Media Keys", setSMKAsMenu, appIcon);
                Monitor.Log($"loaded phone app successfully: {success}", LogLevel.Debug);
            }
        }