Exemplo n.º 1
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)
        {
            var api = this.Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");

            if (api == null)
            {
                Log.Error("No Json Assets API???");
                return;
            }
            this.Ja = api;

            api.LoadAssets(Path.Combine(this.Helper.DirectoryPath, "assets"));

            this.MoreRings = this.Helper.ModRegistry.GetApi <IMoreRingsApi>("bcmpinc.WearMoreRings");
        }
Exemplo n.º 2
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)
        {
            // get Wear More Rings API if present
            this.WearMoreRings = this.Helper.ModRegistry.GetApi <IMoreRingsApi>("bcmpinc.WearMoreRings");

            // register rings with Json Assets
            this.JsonAssets = this.Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
            if (this.JsonAssets != null)
            {
                this.JsonAssets.LoadAssets(Path.Combine(this.Helper.DirectoryPath, "assets", "json-assets"), this.Helper.Translation);
            }
            else
            {
                Log.Error("Couldn't get the Json Assets API, so the new rings won't be available.");
            }

            // register with Generic Mod Config Menu
            var configMenu = this.Helper.ModRegistry.GetGenericModConfigMenuApi(this.Monitor);

            if (configMenu != null)
            {
                configMenu.Register(
                    mod: this.ModManifest,
                    reset: () => this.Config = new ModConfig(),
                    save: () => this.Helper.WriteConfig(this.Config)
                    );
                configMenu.AddNumberOption(
                    mod: this.ModManifest,
                    name: I18n.Config_QualityRingChance_Name,
                    tooltip: I18n.Config_QualityRingChance_Description,
                    getValue: () => this.Config.QualityRing_ChancePerRing,
                    setValue: value => this.Config.QualityRing_ChancePerRing = value,
                    min: 0.05f,
                    max: 1,
                    interval: 0.05f
                    );
                configMenu.AddNumberOption(
                    mod: this.ModManifest,
                    name: I18n.Config_RingOfWideNetsMultiplier_Name,
                    tooltip: I18n.Config_RingOfWideNetsMultiplier_Description,
                    getValue: () => this.Config.RingOfWideNets_BarSizeMultiplier,
                    setValue: value => this.Config.RingOfWideNets_BarSizeMultiplier = value,
                    min: 1,
                    max: 3,
                    interval: 0.05f
                    );
                configMenu.AddNumberOption(
                    mod: this.ModManifest,
                    name: I18n.Config_RingOfRegenerationRate_Name,
                    tooltip: I18n.Config_RingOfRegenerationRate_Description,
                    getValue: () => this.Config.RingOfRegeneration_RegenPerSecond,
                    setValue: value => this.Config.RingOfRegeneration_RegenPerSecond = value,
                    min: 0.05f,
                    max: 200,
                    interval: 0.05f
                    );
                configMenu.AddNumberOption(
                    mod: this.ModManifest,
                    name: I18n.Config_RingOfRegenerationRate_Name,
                    tooltip: I18n.Config_RingOfRegenerationRate_Description,
                    getValue: () => this.Config.RefreshingRing_RegenPerSecond,
                    setValue: value => this.Config.RefreshingRing_RegenPerSecond = value,
                    min: 0.05f,
                    max: 200,
                    interval: 0.05f
                    );
                configMenu.AddNumberOption(
                    mod: this.ModManifest,
                    name: I18n.Config_RingOfFarReachingDistance_Name,
                    tooltip: I18n.Config_RingOfFarReachingDistance_Description,
                    getValue: () => this.Config.RingOfFarReaching_TileDistance,
                    setValue: value => this.Config.RingOfFarReaching_TileDistance = value,
                    min: 1,
                    max: 200
                    );
            }
        }