Пример #1
0
 /// <summary>
 /// Performs initial mod registrations
 /// </summary>
 /// <param name="sender">The sender of the DayEndingEvent event</param>
 /// <param name="args">Event arguments for the DayEndingEvent event</param>
 public void OnGameLaunched(object sender, GameLaunchedEventArgs args)
 {
     EventSubscriber.Instance.AddRequiredSubscriptions();
 }
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     helper.Events.GameLoop.UpdateTicked += GameLoop_UpdateTicked;
 }
Пример #3
0
 private void GameLaunched(object sender, GameLaunchedEventArgs e)
 {
 }
Пример #4
0
 /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     EntoaroxFrameworkAPI.Ready();
 }
Пример #5
0
 private void OnLaunched(object sender, GameLaunchedEventArgs e)
 {
     SetupGMCM();
 }
Пример #6
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method invoked on the first game update tick.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     // init mod integrations
     this.Mods = new ModIntegrations(this.Monitor, this.Helper.ModRegistry, this.Helper.Reflection);
 }
Пример #7
0
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     LoadJsonAssetsObjects();
 }
Пример #8
0
        private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // get Generic Mod Config Menu's API (if it's installed)
            var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (configMenu is null)
            {
                return;
            }

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

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => "Mod Enabled",
                getValue: () => Config.EnableMod,
                setValue: value => Config.EnableMod = value
                );


            configMenu.AddTextOption(
                mod: ModManifest,
                name: () => "Jump Sound",
                getValue: () => Config.JumpSound,
                setValue: value => Config.JumpSound = value
                );

            configMenu.AddKeybind(
                mod: ModManifest,
                name: () => "Convert Key",
                getValue: () => Config.ConvertKey,
                setValue: value => Config.ConvertKey = value
                );
            configMenu.AddKeybind(
                mod: ModManifest,
                name: () => "Higher Key",
                getValue: () => Config.HigherKey,
                setValue: value => Config.HigherKey = value
                );
            configMenu.AddKeybind(
                mod: ModManifest,
                name: () => "Lower Key",
                getValue: () => Config.LowerKey,
                setValue: value => Config.LowerKey = value
                );
            configMenu.AddKeybind(
                mod: ModManifest,
                name: () => "Faster Key",
                getValue: () => Config.FasterKey,
                setValue: value => Config.FasterKey = value
                );
            configMenu.AddKeybind(
                mod: ModManifest,
                name: () => "Slower Key",
                getValue: () => Config.SlowerKey,
                setValue: value => Config.SlowerKey = value
                );
        }
        /// <summary>Raised after the game is launched, right before the first update tick.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            IAutomateAPI automate = this.Helper.ModRegistry.GetApi <IAutomateAPI>("Pathoschild.Automate");

            automate.AddFactory(new CustomFarmingAutomationFactory());
        }
Пример #10
0
        /*********
        ** Private methods
        *********/
        /// <inheritdoc cref="IGameLoopEvents.GameLaunched"/>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            var sc = this.Helper.ModRegistry.GetApi <ISpaceCoreApi>("spacechase0.SpaceCore");

            sc.RegisterSerializerType(typeof(Mannequin));
        }
Пример #11
0
 /*********
 ** Private methods
 *********/
 /****
 ** Event handlers
 ****/
 /// <summary>The method invoked on the first update tick, once all mods are initialised.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     // initialise functionality
     this.Parser = new DataParser();
 }
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     DataLoader.load(Helper, Helper.ModRegistry.IsLoaded("Platonymous.CustomMusic"));
 }
        /// <summary>A SMAPI GameLaunched event that enables GMCM support if that mod is available.</summary>
        public void EnableGMCM(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                GenericModConfigMenuAPI api = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); //attempt to get GMCM's API instance

                if (api == null)                                                                                                       //if the API is not available
                {
                    return;
                }

                api.RegisterModConfig(ModManifest, () => Config = new ModConfig(), () => Helper.WriteConfig(Config)); //register "revert to default" and "write" methods for this mod's config

                //register an option for each of this mod's config settings
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "All bushes are destroyable",
                    "Check this box to make bushes destroyable everywhere.\nUncheck this box to make bushes destroyable at locations in the list below.",
                    () => Config.AllBushesAreDestroyable,
                    (bool val) => Config.AllBushesAreDestroyable = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Destroyable bush locations",
                    "A list of locations where bushes should be destroyable.\nSeparate each name with a comma.\nExample: \"Farm, BusStop, Forest, Woods\"",
                    () => GMCMLocationList,
                    (string val) => GMCMLocationList = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "When bushes regrow",
                    "The amount of time before destroyed bushes will regrow.\nType a number and then a unit of time (Days, Seasons, Years).\nLeave this blank to never respawn bushes.\nExamples: \"3 days\" \"1 season\" \"1 year\"",
                    () => Config.WhenBushesRegrow ?? "null", //return the string "null" if the setting is null
                    (string val) => Config.WhenBushesRegrow = val
                );

                api.RegisterLabel
                (
                    ModManifest,
                    "Amount of wood dropped",
                    "The number of wood pieces dropped when each type of bush is destroyed."
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Small bushes",
                    "The number of wood pieces dropped when a small bush is destroyed.",
                    () => Config.AmountOfWoodDropped.SmallBushes,
                    (int val) => Config.AmountOfWoodDropped.SmallBushes = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Medium bushes",
                    "The number of wood pieces dropped when a medium bush is destroyed.",
                    () => Config.AmountOfWoodDropped.MediumBushes,
                    (int val) => Config.AmountOfWoodDropped.MediumBushes = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Large bushes",
                    "The number of wood pieces dropped when a large bush is destroyed.",
                    () => Config.AmountOfWoodDropped.LargeBushes,
                    (int val) => Config.AmountOfWoodDropped.LargeBushes = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Green tea bushes",
                    "The number of wood pieces dropped when a green tea bush is destroyed.",
                    () => Config.AmountOfWoodDropped.GreenTeaBushes,
                    (int val) => Config.AmountOfWoodDropped.GreenTeaBushes = val
                );
            }
            catch (Exception ex)
            {
                Monitor.Log($"An error happened while loading this mod's GMCM options menu. Its menu might be missing or fail to work. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Monitor.Log($"----------", LogLevel.Trace);
                Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }
Пример #14
0
 /// <summary> Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations. </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     ApplyHarmonyPatches();
 }
Пример #15
0
 /// <summary>Raised after the save file is loaded.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     // Move this to OnDayStart and only register what is needed
     Helper.Events.GameLoop.DayStarted      += OnDayStarted;
     Helper.Events.GameLoop.ReturnedToTitle += OnReturnedToTitle;
 }
Пример #16
0
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     this.SetupStartingItems();
 }
Пример #17
0
 private void SetupMenu(object sender, GameLaunchedEventArgs e)
 {
     GenericMenuRegistry.InitializeMenu(ModManifest, ModConfig.Instance);
 }
Пример #18
0
 private void onLaunched(object sender, GameLaunchedEventArgs e)
 {
     ModConfig.RegisterGMCM(this);
 }
Пример #19
0
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (configMenu == null)
            {
                return;
            }

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

            configMenu.AddSectionTitle(
                mod: ModManifest,
                text: () => Helper.Translation.Get("config.section.general.name"));

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.bitefaster.name"),
                tooltip: () => Helper.Translation.Get("config.bitefaster.description"),
                getValue: () => Config.BiteFaster,
                setValue: value => Config.BiteFaster = value);

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.hitautomatically.name"),
                tooltip: () => Helper.Translation.Get("config.hitautomatically.description"),
                getValue: () => Config.HitAutomatically,
                setValue: value => Config.HitAutomatically = value);

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.skipminigame.name"),
                tooltip: () => Helper.Translation.Get("config.skipminigame.description"),
                getValue: () => Config.SkipMinigame,
                setValue: value => Config.SkipMinigame = value);

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.fisheasycaught.name"),
                tooltip: () => Helper.Translation.Get("config.fisheasycaught.description"),
                getValue: () => Config.FishEasyCaught,
                setValue: value => Config.FishEasyCaught = value);

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.treasurealwaysbefound.name"),
                tooltip: () => Helper.Translation.Get("config.treasurealwaysbefound.description"),
                getValue: () => Config.TreasureAlwaysBeFound,
                setValue: value => Config.TreasureAlwaysBeFound = value);

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.treasureeasycaught.name"),
                tooltip: () => Helper.Translation.Get("config.treasureeasycaught.description"),
                getValue: () => Config.TreasureEasyCaught,
                setValue: value => Config.TreasureEasyCaught = value);

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.alwayscaughtdoublefish.name"),
                tooltip: () => Helper.Translation.Get("config.alwayscaughtdoublefish.description"),
                getValue: () => Config.AlwaysCaughtDoubleFish,
                setValue: value => Config.AlwaysCaughtDoubleFish = value);

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.caughtdoublefishonanybait.name"),
                tooltip: () => Helper.Translation.Get("config.caughtdoublefishonanybait.description"),
                getValue: () => Config.CaughtDoubleFishOnAnyBait,
                setValue: value => Config.CaughtDoubleFishOnAnyBait = value);

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => Helper.Translation.Get("config.alwaysmaxcastpower.name"),
                tooltip: () => Helper.Translation.Get("config.alwaysmaxcastpower.description"),
                getValue: () => Config.AlwaysMaxCastPower,
                setValue: value => Config.AlwaysMaxCastPower = value);
        }
Пример #20
0
        public void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
        {
            if (!Config.EnableMod)
            {
                return;
            }
            //Integrations.LoadModApis();

            if (Config.CustomKissSound.Length > 0)
            {
                string filePath = Path.Combine(Helper.DirectoryPath, "assets", $"{Config.CustomKissSound}");
                Monitor.Log("Kissing audio path: " + filePath);
                if (File.Exists(filePath))
                {
                    try
                    {
                        Kissing.kissEffect = SoundEffect.FromStream(new FileStream(filePath, FileMode.Open));
                    }
                    catch (Exception ex)
                    {
                        Monitor.Log("Error loading kissing audio: " + ex, LogLevel.Error);
                    }
                }
                else
                {
                    Monitor.Log("Kissing audio not found at path: " + filePath);
                }
            }
            if (Config.CustomHugSound.Length > 0)
            {
                string filePath = Path.Combine(Helper.DirectoryPath, "assets", $"{Config.CustomKissSound}.wav");
                Monitor.Log("Hug audio path: " + filePath);
                if (File.Exists(filePath))
                {
                    try
                    {
                        Kissing.hugEffect = SoundEffect.FromStream(new FileStream(filePath, FileMode.Open));
                    }
                    catch (Exception ex)
                    {
                        Monitor.Log("Error loading hug audio: " + ex, LogLevel.Error);
                    }
                }
                else
                {
                    Monitor.Log("Hug audio not found at path: " + filePath);
                }
            }

            // get Generic Mod Config Menu's API (if it's installed)
            var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (configMenu != null)
            {
                // register mod
                configMenu.Register(
                    mod: ModManifest,
                    reset: () => Config = new ModConfig(),
                    save: () => Helper.WriteConfig(Config)
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Mod Enabled",
                    getValue: () => Config.EnableMod,
                    setValue: value => Config.EnableMod = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Roommate kisses",
                    getValue: () => Config.RoommateKisses,
                    setValue: value => Config.RoommateKisses = value
                    );
                configMenu.AddNumberOption(
                    mod: ModManifest,
                    name: () => "Min Hearts For Marriage Kiss",
                    getValue: () => Config.MinHeartsForMarriageKiss,
                    setValue: value => Config.MinHeartsForMarriageKiss = value
                    );
                configMenu.AddNumberOption(
                    mod: ModManifest,
                    name: () => "Hearts For Friendship",
                    getValue: () => Config.HeartsForFriendship,
                    setValue: value => Config.HeartsForFriendship = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Unlimited Kisses",
                    getValue: () => Config.UnlimitedDailyKisses,
                    setValue: value => Config.UnlimitedDailyKisses = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Unlimited Kisses",
                    getValue: () => Config.UnlimitedDailyKisses,
                    setValue: value => Config.UnlimitedDailyKisses = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Dating Kisses",
                    getValue: () => Config.DatingKisses,
                    setValue: value => Config.DatingKisses = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Friend Hugs",
                    getValue: () => Config.FriendHugs,
                    setValue: value => Config.FriendHugs = value
                    );
                configMenu.AddNumberOption(
                    mod: ModManifest,
                    name: () => "NPC Kiss Chance",
                    getValue: () => (int)Config.SpouseKissChance0to1 * 100,
                    setValue: value => Config.SpouseKissChance0to1 = value / 100f,
                    min: 0,
                    max: 100
                    );
                configMenu.AddTextOption(
                    mod: ModManifest,
                    name: () => "Custom Kiss Sound",
                    getValue: () => Config.CustomKissSound,
                    setValue: value => Config.CustomKissSound = value
                    );
                configMenu.AddTextOption(
                    mod: ModManifest,
                    name: () => "Custom Hug Sound",
                    getValue: () => Config.CustomHugSound,
                    setValue: value => Config.CustomHugSound = value
                    );
                configMenu.AddTextOption(
                    mod: ModManifest,
                    name: () => "Custom Kiss Frames",
                    getValue: () => Config.CustomKissFrames,
                    setValue: value => Config.CustomKissFrames = value
                    );
                configMenu.AddNumberOption(
                    mod: ModManifest,
                    name: () => "Max NPC Kiss Distance",
                    getValue: () => (int)Config.MaxDistanceToKiss,
                    setValue: value => Config.MaxDistanceToKiss = value
                    );
                configMenu.AddNumberOption(
                    mod: ModManifest,
                    name: () => "Min Spouse Kiss Interval (s)",
                    getValue: () => (int)Config.MinSpouseKissIntervalSeconds,
                    setValue: value => Config.MinSpouseKissIntervalSeconds = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Multiple Spouses Kiss",
                    getValue: () => Config.AllowPlayerSpousesToKiss,
                    setValue: value => Config.AllowPlayerSpousesToKiss = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Allow Relatives To Hug",
                    getValue: () => Config.AllowNPCRelativesToHug,
                    setValue: value => Config.AllowNPCRelativesToHug = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Allow NPC Spouses To Kiss",
                    getValue: () => Config.AllowNPCSpousesToKiss,
                    setValue: value => Config.AllowNPCSpousesToKiss = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Allow Relatives To Kiss",
                    getValue: () => Config.AllowRelativesToKiss,
                    setValue: value => Config.AllowRelativesToKiss = value
                    );
                configMenu.AddBoolOption(
                    mod: ModManifest,
                    name: () => "Allow Non-datable",
                    getValue: () => Config.AllowNonDateableNPCsToHugAndKiss,
                    setValue: value => Config.AllowNonDateableNPCsToHugAndKiss = value
                    );
            }
        }
Пример #21
0
 /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     this.ContentPackManager.DynamicTokenManager.CheckTokens();
 }
Пример #22
0
        public void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            Monitor.Log("Game Launched");

            applyPatch();
        }
Пример #23
0
        // from https://github.com/spacechase0/StardewValleyMods/tree/develop/GenericModConfigMenu#readme
        private void OnGameLaunched(object Sender, GameLaunchedEventArgs e)
        {
            // get Generic Mod Config Menu API (if it's installed)
            var api = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api is null)
            {
                return;
            }

            // register mod configuration
            api.RegisterModConfig(
                mod: ModManifest,
                revertToDefault: () => config = new ModConfig(),
                saveToFile: () => Helper.WriteConfig(config)
                );

            // do not let players configure your mod in-game (instead of just from the title screen)
            api.SetDefaultIngameOptinValue(ModManifest, false);

            // add some config options
            api.RegisterSimpleOption(
                mod: ModManifest,
                optionName: Helper.Translation.Get("GlobalConfigSettings:ChangeOnEveryLoad"),
                optionDesc: Helper.Translation.Get("GlobalConfigSettings:ChangeOnEveryLoadDescription"),
                optionGet: () => config.ChangeOnEveryLoad,
                optionSet: value => config.ChangeOnEveryLoad = value
                );

            string[] choices;
            // General
            {
                api.RegisterLabel(
                    mod: ModManifest,
                    labelName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11233"),
                    labelDesc: ""
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11234"),
                    optionDesc: "",
                    optionGet: () => config.AutoRun,
                    optionSet: value => config.AutoRun = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11235"),
                    optionDesc: "",
                    optionGet: () => config.ShowPortraits,
                    optionSet: value => config.ShowPortraits = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11236"),
                    optionDesc: "",
                    optionGet: () => config.ShowMerchantPortraits,
                    optionSet: value => config.ShowMerchantPortraits = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11237"),
                    optionDesc: "",
                    optionGet: () => config.AlwaysShowToolLocation,
                    optionSet: value => config.AlwaysShowToolLocation = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11238"),
                    optionDesc: "",
                    optionGet: () => config.HideToolHitLocationWhenMoving,
                    optionSet: value => config.HideToolHitLocationWhenMoving = value
                    );

                choices = new string[3] {
                    "auto", "force_on", "force_off"
                };
                api.RegisterChoiceOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\UI:Options_GamepadMode"),
                    optionDesc: "",
                    optionGet: () => config.GamepadMode,
                    optionSet: value => config.GamepadMode = value,
                    choices: choices
                    );
                choices = new string[3] {
                    "off", "gamepad", "both"
                };
                api.RegisterChoiceOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\UI:Options_StowingMode"),
                    optionDesc: "",
                    optionGet: () => config.ItemStowing,
                    optionSet: value => config.ItemStowing = value,
                    choices: choices
                    );
                choices = new string[2] {
                    "hold", "legacy"
                };
                api.RegisterChoiceOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\UI:Options_SlingshotMode"),
                    optionDesc: "",
                    optionGet: () => config.SlingshotFireMode,
                    optionSet: value => config.SlingshotFireMode = value,
                    choices: choices
                    );

                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11239"),
                    optionDesc: "",
                    optionGet: () => config.ControllerPlacementTileIndicator,
                    optionSet: value => config.ControllerPlacementTileIndicator = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11240"),
                    optionDesc: "",
                    optionGet: () => config.PauseWhenGameWindowIsInactive,
                    optionSet: value => config.PauseWhenGameWindowIsInactive = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\UI:Options_GamepadStyleMenus"),
                    optionDesc: "",
                    optionGet: () => config.UseControllerStyleMenus,
                    optionSet: value => config.UseControllerStyleMenus = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\UI:Options_ShowAdvancedCraftingInformation"),
                    optionDesc: "",
                    optionGet: () => config.ShowAdvancedCraftingInformation,
                    optionSet: value => config.ShowAdvancedCraftingInformation = value
                    );
            }

            // Sound
            {
                api.RegisterLabel(
                    mod: ModManifest,
                    labelName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11241"),
                    labelDesc: ""
                    );
                api.RegisterClampedOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11242"),
                    optionDesc: "",
                    optionGet: () => config.MusicVolume,
                    optionSet: value => config.MusicVolume = value,
                    min: 0,
                    max: 100
                    );
                api.RegisterClampedOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11243"),
                    optionDesc: "",
                    optionGet: () => config.SoundVolume,
                    optionSet: value => config.SoundVolume = value,
                    min: 0,
                    max: 100
                    );
                api.RegisterClampedOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11244"),
                    optionDesc: "",
                    optionGet: () => config.AmbientVolume,
                    optionSet: value => config.AmbientVolume = value,
                    min: 0,
                    max: 100
                    );
                api.RegisterClampedOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11245"),
                    optionDesc: "",
                    optionGet: () => config.FootstepVolume,
                    optionSet: value => config.FootstepVolume = value,
                    min: 0,
                    max: 100
                    );

                choices = new string[5] {
                    "-1", "0", "1", "2", "3"
                };
                api.RegisterChoiceOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:BiteChime"),
                    optionDesc: "",
                    optionGet: () => config.FishingBiteSound,
                    optionSet: value => config.FishingBiteSound = value,
                    choices: choices
                    );

                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11246"),
                    optionDesc: "",
                    optionGet: () => config.DialogueTypingSound,
                    optionSet: value => config.DialogueTypingSound = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:Options_ToggleAnimalSounds"),
                    optionDesc: "",
                    optionGet: () => config.MuteAnimalSounds,
                    optionSet: value => config.MuteAnimalSounds = value
                    );
            }

            // Graphics
            {
                api.RegisterLabel(
                    mod: ModManifest,
                    labelName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11247"),
                    labelDesc: ""
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\UI:Options_Vsync"),
                    optionDesc: "",
                    optionGet: () => config.VSync,
                    optionSet: value => config.VSync = value
                    );

                // like most of this: from OptionsPage.cs
                List <string> zoom_options = new List <string>();
                for (int zoom2 = 75; zoom2 <= 150; zoom2 += 5)
                {
                    zoom_options.Add(zoom2 + "%");
                }
                api.RegisterChoiceOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage_UIScale"),
                    optionDesc: "",
                    optionGet: () => config.UiScale,
                    optionSet: value => config.UiScale = value,
                    choices: zoom_options.ToArray()
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11252"),
                    optionDesc: "",
                    optionGet: () => config.MenuBackgrounds,
                    optionSet: value => config.MenuBackgrounds = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11253"),
                    optionDesc: "",
                    optionGet: () => config.LockToolbar,
                    optionSet: value => config.LockToolbar = value
                    );

                zoom_options = new List <string>();
                for (int zoom = 75; zoom <= 200; zoom += 5)
                {
                    zoom_options.Add(zoom + "%");
                }
                api.RegisterChoiceOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11254"),
                    optionDesc: "",
                    optionGet: () => config.ZoomLevel,
                    optionSet: value => config.ZoomLevel = value,
                    choices: zoom_options.ToArray()
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11266"),
                    optionDesc: "",
                    optionGet: () => config.ZoomButtons,
                    optionSet: value => config.ZoomButtons = value
                    );

                choices = new string[3] {
                    "Low", "Med.", "High"
                };
                api.RegisterChoiceOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11267"),
                    optionDesc: "",
                    optionGet: () => config.LightingQuality,
                    optionSet: value => config.LightingQuality = value,
                    choices: choices
                    );
                api.RegisterClampedOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11271"),
                    optionDesc: "",
                    optionGet: () => config.SnowTransparency,
                    optionSet: value => config.SnowTransparency = value,
                    min: 0,
                    max: 100
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11272"),
                    optionDesc: "",
                    optionGet: () => config.ShowFlashEffects,
                    optionSet: value => config.ShowFlashEffects = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11273"),
                    optionDesc: "",
                    optionGet: () => config.UseHardwareCursor,
                    optionSet: value => config.UseHardwareCursor = value
                    );
            }

            // Controls
            {
                api.RegisterLabel(
                    mod: ModManifest,
                    labelName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11274"),
                    labelDesc: ""
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11275"),
                    optionDesc: "",
                    optionGet: () => config.ControllerRumble,
                    optionSet: value => config.ControllerRumble = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11276"),
                    optionDesc: "",
                    optionGet: () => config.InvertToolbarScrollDirection,
                    optionSet: value => config.InvertToolbarScrollDirection = value
                    );

                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11278"),
                    optionDesc: "",
                    optionGet: () => config.CheckDoAction,
                    optionSet: value => config.CheckDoAction = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11279"),
                    optionDesc: "",
                    optionGet: () => config.UseTool,
                    optionSet: value => config.UseTool = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11280"),
                    optionDesc: "",
                    optionGet: () => config.AccessMenu,
                    optionSet: value => config.AccessMenu = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11281"),
                    optionDesc: "",
                    optionGet: () => config.AccessJournal,
                    optionSet: value => config.AccessJournal = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11282"),
                    optionDesc: "",
                    optionGet: () => config.AccessMap,
                    optionSet: value => config.AccessMap = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11283"),
                    optionDesc: "",
                    optionGet: () => config.MoveUp,
                    optionSet: value => config.MoveUp = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11284"),
                    optionDesc: "",
                    optionGet: () => config.MoveLeft,
                    optionSet: value => config.MoveLeft = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11285"),
                    optionDesc: "",
                    optionGet: () => config.MoveDown,
                    optionSet: value => config.MoveDown = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11286"),
                    optionDesc: "",
                    optionGet: () => config.MoveRight,
                    optionSet: value => config.MoveRight = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11287"),
                    optionDesc: "",
                    optionGet: () => config.ChatBox,
                    optionSet: value => config.ChatBox = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\UI:Input_EmoteButton"),
                    optionDesc: "",
                    optionGet: () => config.EmoteMenu,
                    optionSet: value => config.EmoteMenu = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11288"),
                    optionDesc: "",
                    optionGet: () => config.Run,
                    optionSet: value => config.Run = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.toolbarSwap"),
                    optionDesc: "",
                    optionGet: () => config.ShiftToolbar,
                    optionSet: value => config.ShiftToolbar = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11289"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot1,
                    optionSet: value => config.InventorySlot1 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11290"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot2,
                    optionSet: value => config.InventorySlot2 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11291"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot3,
                    optionSet: value => config.InventorySlot3 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11292"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot4,
                    optionSet: value => config.InventorySlot4 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11293"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot5,
                    optionSet: value => config.InventorySlot5 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11294"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot6,
                    optionSet: value => config.InventorySlot6 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11295"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot7,
                    optionSet: value => config.InventorySlot7 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11296"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot8,
                    optionSet: value => config.InventorySlot8 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11297"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot9,
                    optionSet: value => config.InventorySlot9 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11298"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot10,
                    optionSet: value => config.InventorySlot10 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11299"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot11,
                    optionSet: value => config.InventorySlot11 = value
                    );
                api.RegisterSimpleOption(
                    mod: ModManifest,
                    optionName: Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11300"),
                    optionDesc: "",
                    optionGet: () => config.InventorySlot12,
                    optionSet: value => config.InventorySlot12 = value
                    );
            }
        }
Пример #24
0
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     Helper.Content.AssetEditors.Add(_mailHandler);
 }
 /// <summary>
 /// Called when the game has been launched. Adds compatibility for external mods.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     AddModCompatibility();
 }
Пример #26
0
 private void onGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     ja = Helper.ModRegistry.GetApi <JsonAssetsAPI>("spacechase0.JsonAssets");
 }
Пример #27
0
        private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
        {
            var api = Helper.ModRegistry.GetApi <PlatoTK.APIs.IContentPatcher>("Pathoschild.ContentPatcher");

            api.RegisterToken(ModManifest, "Channel", new CustomTVChannelToken());
            api.RegisterToken(ModManifest, "Screen", new CustomTVScreenToken());

            PlatoHelper.Events.QuestionRaised += (q, p) =>
            {
                if (p.IsTV)
                {
                    bool added = false;

                    foreach (string channel in CustomTVChannelToken.Channels.Keys.ToList())
                    {
                        Dictionary <string, string> channelData = Helper.Content.Load <Dictionary <string, string> >($"{CustomTVChannelToken.ChannelDataPrefix}{channel}", ContentSource.GameContent);

                        if (channelData.ContainsKey("@Active") && channelData["@Active"].ToLower() == "false")
                        {
                            continue;
                        }

                        if (CustomTVChannelToken.Channels[channel] == null)
                        {
                            added = true;
                            CustomTVChannelToken.Channels[channel] = new TVChannel()
                            {
                                Id    = channel,
                                Name  = channelData.ContainsKey("@Name") ? channelData["@Name"] : "Missing Name",
                                Intro = "Missing Intro",
                            };


                            if (channelData.ContainsKey("@Intro"))
                            {
                                GetShowData(channelData["@Intro"], out string text, out string screen, out string overlay, out string music);

                                CustomTVChannelToken.Channels[channel].Intro      = text;
                                CustomTVChannelToken.Channels[channel].IntroMusic = music;

                                if (!string.IsNullOrEmpty(screen) && CustomTVChannelToken.GetScreenId(channel, screen) is string screenId &&
                                    CustomTVChannelToken.Screens.ContainsKey(screenId) &&
                                    CustomTVChannelToken.Screens[screenId] is TVScreen tvs)
                                {
                                    CustomTVChannelToken.Channels[channel].IntroScreen =
                                        new TemporaryAnimatedSprite(
                                            tvs.Path,
                                            new Rectangle(tvs.SourceBounds[0], tvs.SourceBounds[1], tvs.SourceBounds[2], tvs.SourceBounds[3]),
                                            tvs.FrameDuration, tvs.Frames, int.MaxValue, Vector2.Zero, false, false, 0f, 0.0f, Color.White, 1f,
                                            0.0f, 0.0f, 0.0f, false);
                                }

                                if (!string.IsNullOrEmpty(overlay) && CustomTVChannelToken.GetScreenId(channel, overlay) is string overlayId &&
                                    CustomTVChannelToken.Screens.ContainsKey(overlayId) &&
                                    CustomTVChannelToken.Screens[overlayId] is TVScreen os)
                                {
                                    CustomTVChannelToken.Channels[channel].IntroOverlay =
                                        new TemporaryAnimatedSprite(
                                            os.Path,
                                            new Rectangle(os.SourceBounds[0], os.SourceBounds[1], os.SourceBounds[2], os.SourceBounds[3]),
                                            os.FrameDuration, os.Frames, int.MaxValue, Vector2.Zero, false, false, 0f, 0.0f, Color.White, 1f,
                                            0.0f, 0.0f, 0.0f, false);
                                }
                            }


                            if (channelData.ContainsKey("@Seasons"))
                            {
                                CustomTVChannelToken.Channels[channel].Seasons = channelData["@Seasons"].Split(' ');
                            }

                            if (channelData.ContainsKey("@Days"))
                            {
                                CustomTVChannelToken.Channels[channel].Days = channelData["@Days"].Split(' ');
                            }

                            if (channelData.ContainsKey("@Order"))
                            {
                                CustomTVChannelToken.Channels[channel].Random = channelData["@Order"].ToLower() == "random";
                            }
                        }

                        if (CustomTVChannelToken.Channels[channel] is TVChannel tvc && tvc.Seasons.Any(s => s.ToLower() == Game1.currentSeason.ToLower()) &&
                            tvc.Days.Any(d => d.ToLower() == Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth).ToLower()))
                        {
                            p.AddResponse(new Response(channel, CustomTVChannelToken.Channels[channel].Name));
                        }
                    }

                    if (added)
                    {
                        p.PaginateResponses();
                    }
                }
            };

            PlatoHelper.Events.TVChannelSelected += (s, p) =>
            {
                if (CustomTVChannelToken.Channels.ContainsKey(p.ChannelName) &&
                    CustomTVChannelToken.Channels[p.ChannelName] is TVChannel channel &&
                    Helper.Content.Load <Dictionary <string, string> >($"{CustomTVChannelToken.ChannelDataPrefix}{p.ChannelName}", ContentSource.GameContent) is Dictionary <string, string> channelData
                    )
                {
                    if (TryPickShow(channelData, p.ChannelName, out string text, out string screen, out string overlay, out string music, channel.Random))
                    {
                        if (channel.IntroScreen != null)
                        {
                            channel.IntroScreen.Position = new Vector2(
                                p.ScreenPosition.X + (channel.IntroScreenOffset[0] * p.Scale),
                                p.ScreenPosition.Y + (channel.IntroScreenOffset[1] * p.Scale));
                            channel.IntroScreen.layerDepth = p.ScreenLayerDepth;
                            channel.IntroScreen.scale      = p.Scale;
                        }

                        if (channel.IntroOverlay != null)
                        {
                            channel.IntroOverlay.Position = new Vector2(
                                p.ScreenPosition.X + (channel.IntroOverlayOffset[0] * p.Scale),
                                p.ScreenPosition.Y + (channel.IntroOverlayOffset[1] * p.Scale));
                            channel.IntroOverlay.layerDepth = p.OverlayLayerDepth;
                            channel.IntroOverlay.scale      = p.Scale;
                        }

                        string cMusic      = Game1.getMusicTrackName();
                        bool   changeMusic = false;
                        if (!string.IsNullOrEmpty(channel.IntroMusic) && channel.IntroMusic != "none")
                        {
                            changeMusic = true;
                            try
                            {
                                Game1.changeMusicTrack(channel.IntroMusic);
                            }
                            catch
                            {
                            }
                        }

                        p.ShowScene(channel.IntroScreen, channel.IntroOverlay, channel.Intro, () =>
                        {
                            TemporaryAnimatedSprite screenSprite  = channel.IntroScreen;
                            TemporaryAnimatedSprite overlaySprite = null;

                            if (!string.IsNullOrEmpty(screen) && CustomTVChannelToken.GetScreenId(p.ChannelName, screen) is string screenId &&
                                CustomTVChannelToken.Screens.ContainsKey(screenId) &&
                                CustomTVChannelToken.Screens[screenId] is TVScreen tvs)
                            {
                                screenSprite =
                                    new TemporaryAnimatedSprite(
                                        tvs.Path,
                                        new Rectangle(tvs.SourceBounds[0], tvs.SourceBounds[1], tvs.SourceBounds[2], tvs.SourceBounds[3]),
                                        tvs.FrameDuration, tvs.Frames, int.MaxValue,
                                        new Vector2(p.ScreenPosition.X + (tvs.Offset[0] * p.Scale), p.ScreenPosition.Y + (tvs.Offset[1] * p.Scale))
                                        , false, false, p.ScreenLayerDepth, 0.0f, Color.White, p.Scale,
                                        0.0f, 0.0f, 0.0f, false);
                            }

                            if (!string.IsNullOrEmpty(overlay) && CustomTVChannelToken.GetScreenId(p.ChannelName, overlay) is string overlayId &&
                                CustomTVChannelToken.Screens.ContainsKey(overlayId) &&
                                CustomTVChannelToken.Screens[overlayId] is TVScreen os)
                            {
                                overlaySprite =
                                    new TemporaryAnimatedSprite(
                                        os.Path,
                                        new Rectangle(os.SourceBounds[0], os.SourceBounds[1], os.SourceBounds[2], os.SourceBounds[3]),
                                        os.FrameDuration, os.Frames, int.MaxValue,
                                        new Vector2(p.ScreenPosition.X + (os.Offset[0] * p.Scale), p.ScreenPosition.Y + (os.Offset[1] * p.Scale))
                                        , false, false, p.OverlayLayerDepth, 0.0f, Color.White, p.Scale,
                                        0.0f, 0.0f, 0.0f, false);
                            }

                            if (!string.IsNullOrEmpty(music) && music != "none")
                            {
                                changeMusic = true;
                                try
                                {
                                    Game1.changeMusicTrack(music);
                                }
                                catch
                                {
                                }
                            }

                            p.ShowScene(screenSprite, overlaySprite, text, () => {
                                try
                                {
                                    if (changeMusic)
                                    {
                                        Game1.changeMusicTrack(cMusic);
                                    }
                                }
                                catch
                                {
                                }
                                p.TurnOffTV();
                            });
                        });
                    }
Пример #28
0
 public static void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     FileIO.LoadKissAudio();
 }
Пример #29
0
 private void GameLoopOnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     this.ApplyHarmonyPatches();
     this.UpdateEnabledOptions();
     this.RegisterGenericModConfigMenuPage();
 }
Пример #30
0
 /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     Patch.PatchAll(HarmonyInstance.Create("me.ilyaki.StackToNearbyChests"));
 }