Exemple #1
0
        public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection)
        {
            return(IdProviderCreator.Create(() =>
            {
                var contourView = Mission.Current.GetMissionBehaviour <CommandSystemLogic>().FormationColorSubLogic;

                var optionClass = new OptionClass(CommandSystemSubModule.ModuleId,
                                                  GameTexts.FindText("str_rts_camera_command_system_option_class"), menuClassCollection);
                var commandOptionCategory = new OptionCategory("Command", GameTexts.FindText("str_rts_camera_command_system_command_system_options"));
                commandOptionCategory.AddOption(new BoolOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_command_system_click_to_select_formation"),
                                                    GameTexts.FindText("str_rts_camera_command_system_click_to_select_formation_hint"),
                                                    () => CommandSystemConfig.Get().ClickToSelectFormation, b =>
                {
                    CommandSystemConfig.Get().ClickToSelectFormation = b;
                    contourView?.SetEnableContourForSelectedFormation(b);
                }));
                commandOptionCategory.AddOption(new BoolOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_command_system_attack_specific_formation"),
                                                    GameTexts.FindText("str_rts_camera_command_system_attack_specific_formation_hint"),
                                                    () => CommandSystemConfig.Get().AttackSpecificFormation, b =>
                {
                    CommandSystemConfig.Get().AttackSpecificFormation = b;
                    if (b)
                    {
                        PatchChargeToFormation.Patch();
                    }
                }));
                optionClass.AddOptionCategory(0, commandOptionCategory);

                return optionClass;
            }, CommandSystemSubModule.ModuleId));
        }
Exemple #2
0
        public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection)
        {
            return(IdProviderCreator.Create(() =>
            {
                var optionClass = new OptionClass(ImprovedCombatAISubModule.ModuleId,
                                                  GameTexts.FindText("str_improved_combat_ai_option_class"), menuClassCollection);

                var optionCategory = new OptionCategory("CombatAI", GameTexts.FindText("str_improved_combat_ai_ai_options"));
                optionCategory.AddOption(new BoolOptionViewModel(
                                             GameTexts.FindText("str_improved_combat_ai_use_realistic_blocking"), null,
                                             () => ImprovedCombatAIConfig.Get().UseRealisticBlocking,
                                             b => ImprovedCombatAIConfig.Get().UseRealisticBlocking = b));
                optionCategory.AddOption(new NumericOptionViewModel(
                                             GameTexts.FindText("str_improved_combat_ai_melee_ai_difficulty"), null,
                                             () => ImprovedCombatAIConfig.Get().MeleeAIDifficulty,
                                             f => ImprovedCombatAIConfig.Get().MeleeAIDifficulty = (int)f, 0, 100, true, true));
                optionCategory.AddOption(new BoolOptionViewModel(
                                             GameTexts.FindText("str_improved_combat_ai_directly_set_melee_ai"), GameTexts.FindText("str_improved_combat_ai_directly_set_melee_ai_description"),
                                             () => ImprovedCombatAIConfig.Get().DirectlySetMeleeAI,
                                             b => ImprovedCombatAIConfig.Get().DirectlySetMeleeAI = b));
                optionCategory.AddOption(new NumericOptionViewModel(
                                             GameTexts.FindText("str_improved_combat_ai_ranged_ai_difficulty"), null,
                                             () => ImprovedCombatAIConfig.Get().RangedAIDifficulty,
                                             f => ImprovedCombatAIConfig.Get().RangedAIDifficulty = (int)f, 0, 100, true, true));
                optionCategory.AddOption(new BoolOptionViewModel(
                                             GameTexts.FindText("str_improved_combat_ai_directly_set_ranged_ai"), GameTexts.FindText("str_improved_combat_ai_directly_set_ranged_ai_description"),
                                             () => ImprovedCombatAIConfig.Get().DirectlySetRangedAI,
                                             b => ImprovedCombatAIConfig.Get().DirectlySetRangedAI = b));
                optionClass.AddOptionCategory(0, optionCategory);
                return optionClass;
            }, ImprovedCombatAISubModule.ModuleId));
        }
Exemple #3
0
        public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection)
        {
            return(IdProviderCreator.Create(() =>
            {
                var optionClass = new OptionClass(CinematicCameraSubModule.ModuleId,
                                                  GameTexts.FindText("str_cinematic_camera_cinematic_camera"), menuClassCollection);
                var cameraOptionCategory =
                    new OptionCategory("Camera", GameTexts.FindText("str_cinematic_camera_cinematic_camera"));

                cameraOptionCategory.AddOption(new ActionOptionViewModel(GameTexts.FindText("str_cinematic_camera_open_menu"), null,
                                                                         () =>
                {
                    Mission.Current.GetMissionBehaviour <CinematicCameraMenuView>()?.ActivateMenu();
                }));
                optionClass.AddOptionCategory(0, cameraOptionCategory);

                return optionClass;
            }, CinematicCameraSubModule.ModuleId));
        }
        public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection)
        {
            return(IdProviderCreator.Create(() =>
            {
                var optionClass = new OptionClass(RTSCameraSubModule.ModuleId,
                                                  GameTexts.FindText("str_rts_camera_option_class"), menuClassCollection);
                var rtsCameraLogic = Mission.Current.GetMissionBehaviour <RTSCameraLogic>();
                var selectCharacterView = Mission.Current.GetMissionBehaviour <RTSCameraSelectCharacterView>();
                var hideHudView = Mission.Current.GetMissionBehaviour <HideHUDView>();
                var missionScreen = selectCharacterView.MissionScreen;
                var menuManager = AMenuManager.Get();

                var cameraOptionCategory = new OptionCategory("Camera", GameTexts.FindText("str_rts_camera_camera_options"));
                cameraOptionCategory.AddOption(new ActionOptionViewModel(
                                                   GameTexts.FindText("str_rts_camera_switch_free_camera"),
                                                   GameTexts.FindText("str_rts_camera_switch_free_camera_hint"),
                                                   () =>
                {
                    rtsCameraLogic.SwitchFreeCameraLogic.SwitchCamera();
                    menuManager.RequestToCloseMenu();
                }));
                cameraOptionCategory.AddOption(new BoolOptionViewModel(
                                                   GameTexts.FindText("str_rts_camera_use_free_camera_by_default"),
                                                   GameTexts.FindText("str_rts_camera_use_free_camera_by_default_hint"),
                                                   () => RTSCameraConfig.Get().UseFreeCameraByDefault,
                                                   b => RTSCameraConfig.Get().UseFreeCameraByDefault = b));
                cameraOptionCategory.AddOption(new NumericOptionViewModel(
                                                   GameTexts.FindText("str_rts_camera_raised_height_after_switching_to_free_camera"),
                                                   GameTexts.FindText("str_rts_camera_raised_height_hint"), () =>
                {
                    return RTSCameraConfig.Get().RaisedHeight;
                },
                                                   f =>
                {
                    RTSCameraConfig.Get().RaisedHeight = f;
                }, 0, 50, true, true));
                cameraOptionCategory.AddOption(new BoolOptionViewModel(
                                                   GameTexts.FindText("str_rts_camera_constant_speed"),
                                                   GameTexts.FindText("str_rts_camera_constant_speed_hint"), () => RTSCameraConfig.Get().ConstantSpeed,
                                                   b =>
                {
                    RTSCameraConfig.Get().ConstantSpeed = b;
                    var view = Mission.Current.GetMissionBehaviour <FlyCameraMissionView>();
                    if (view != null)
                    {
                        view.ConstantSpeed = b;
                    }
                }));
                cameraOptionCategory.AddOption(new BoolOptionViewModel(
                                                   GameTexts.FindText("str_rts_camera_ignore_terrain"),
                                                   GameTexts.FindText("str_rts_camera_ignore_terrain_hint"), () => RTSCameraConfig.Get().IgnoreTerrain,
                                                   b =>
                {
                    RTSCameraConfig.Get().IgnoreTerrain = b;
                    var view = Mission.Current.GetMissionBehaviour <FlyCameraMissionView>();
                    if (view != null)
                    {
                        view.IgnoreTerrain = b;
                    }
                }));
                cameraOptionCategory.AddOption(new BoolOptionViewModel(
                                                   GameTexts.FindText("str_rts_camera_ignore_boundaries"),
                                                   GameTexts.FindText("str_rts_camera_ignore_boundaries_hint"),
                                                   () => RTSCameraConfig.Get().IgnoreBoundaries,
                                                   b =>
                {
                    RTSCameraConfig.Get().IgnoreBoundaries = b;
                    var view = Mission.Current.GetMissionBehaviour <FlyCameraMissionView>();
                    if (view != null)
                    {
                        view.IgnoreBoundaries = b;
                    }
                }));
                optionClass.AddOptionCategory(0, cameraOptionCategory);

                var controlOptionCategory = new OptionCategory("Control",
                                                               GameTexts.FindText("str_rts_camera_control_options"));
                controlOptionCategory.AddOption(new SelectionOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_player_formation"),
                                                    GameTexts.FindText("str_rts_camera_player_formation_hint"), new SelectionOptionData(
                                                        i =>
                {
                    var config = RTSCameraConfig.Get();
                    if ((i != config.PlayerFormation || config.AlwaysSetPlayerFormation) &&
                        i >= 0 && i < (int)FormationClass.NumberOfAllFormations)
                    {
                        config.PlayerFormation = i;
                        rtsCameraLogic.SwitchFreeCameraLogic.CurrentPlayerFormation = (FormationClass)i;
                        if (WatchBattleBehavior.WatchMode)
                        {
                            return;
                        }
                        Utility.SetPlayerFormation((FormationClass)i);
                    }
                }, () => RTSCameraConfig.Get().PlayerFormation,
                                                        (int)FormationClass.NumberOfRegularFormations, new[]
                {
                    new SelectionItem(true, "str_troop_group_name", "0"),
                    new SelectionItem(true, "str_troop_group_name", "1"),
                    new SelectionItem(true, "str_troop_group_name", "2"),
                    new SelectionItem(true, "str_troop_group_name", "3"),
                    new SelectionItem(true, "str_troop_group_name", "4"),
                    new SelectionItem(true, "str_troop_group_name", "5"),
                    new SelectionItem(true, "str_troop_group_name", "6"),
                    new SelectionItem(true, "str_troop_group_name", "7")
                }), true));
                controlOptionCategory.AddOption(new BoolOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_always_set_player_formation"),
                                                    GameTexts.FindText("str_rts_camera_always_set_player_formation_hint"),
                                                    () => RTSCameraConfig.Get().AlwaysSetPlayerFormation,
                                                    b =>
                {
                    var config = RTSCameraConfig.Get();
                    config.AlwaysSetPlayerFormation = b;
                    if (config.AlwaysSetPlayerFormation)
                    {
                        var formationClass = (FormationClass)config.PlayerFormation;
                        rtsCameraLogic.SwitchFreeCameraLogic.CurrentPlayerFormation = formationClass;
                        if (WatchBattleBehavior.WatchMode)
                        {
                            return;
                        }
                        Utility.SetPlayerFormation(formationClass);
                    }
                }));
                controlOptionCategory.AddOption(new SelectionOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_watch_another_hero"),
                                                    GameTexts.FindText("str_rts_camera_watch_another_hero_hint"),
                                                    new WatchAgentSelectionData(missionScreen).SelectionOptionData, true));
                controlOptionCategory.AddOption(new ActionOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_select_character"),
                                                    GameTexts.FindText("str_rts_camera_select_character_hint"),
                                                    () =>
                {
                    selectCharacterView.IsSelectingCharacter = true;
                    menuManager.RequestToCloseMenu();
                }));
                controlOptionCategory.AddOption(new BoolOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_control_ally_after_death"),
                                                    GameTexts.FindText("str_rts_camera_control_ally_after_death_hint"),
                                                    () => RTSCameraConfig.Get().ControlAllyAfterDeath,
                                                    b => RTSCameraConfig.Get().ControlAllyAfterDeath = b));
                controlOptionCategory.AddOption(new BoolOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_prefer_to_control_companions"),
                                                    GameTexts.FindText("str_rts_camera_prefer_to_control_companions_hint"),
                                                    () => RTSCameraConfig.Get().PreferToControlCompanions,
                                                    b => RTSCameraConfig.Get().PreferToControlCompanions = b));
                controlOptionCategory.AddOption(new BoolOptionViewModel(
                                                    GameTexts.FindText("str_rts_camera_control_troops_in_player_party_only"),
                                                    GameTexts.FindText("str_rts_camera_control_troops_in_player_party_only_hint"),
                                                    () => RTSCameraConfig.Get().ControlTroopsInPlayerPartyOnly,
                                                    b => RTSCameraConfig.Get().ControlTroopsInPlayerPartyOnly = b));
                optionClass.AddOptionCategory(0, controlOptionCategory);

                var miscellaneousOptionCategory = new OptionCategory("Miscellaneous",
                                                                     GameTexts.FindText("str_rts_camera_miscellaneous_options"));
                miscellaneousOptionCategory.AddOption(new ActionOptionViewModel(GameTexts.FindText("str_rts_camera_toggle_pause"), GameTexts.FindText("str_rts_camera_toggle_pause_hint"),
                                                                                () =>
                {
                    rtsCameraLogic.MissionSpeedLogic?.TogglePause();
                    menuManager.RequestToCloseMenu();
                }));
                miscellaneousOptionCategory.AddOption(new BoolOptionViewModel(
                                                          GameTexts.FindText("str_rts_camera_slow_motion_mode"),
                                                          GameTexts.FindText("str_rts_camera_slow_motion_hint"), () => Mission.Current.Scene.SlowMotionMode,
                                                          b => rtsCameraLogic.MissionSpeedLogic.SetSlowMotionMode(b)));
                miscellaneousOptionCategory.AddOption(new NumericOptionViewModel(
                                                          GameTexts.FindText("str_rts_camera_slow_motion_factor"),
                                                          GameTexts.FindText("str_rts_camera_slow_motion_factor_hint"),
                                                          () => Mission.Current.Scene.SlowMotionFactor,
                                                          f => rtsCameraLogic.MissionSpeedLogic.SetSlowMotionFactor(f), 0, 3, false, true));
                miscellaneousOptionCategory.AddOption(new BoolOptionViewModel(
                                                          GameTexts.FindText("str_rts_camera_display_mod_message"),
                                                          GameTexts.FindText("str_rts_camera_display_message_hint"),
                                                          () => RTSCameraConfig.Get().DisplayMessage, b =>
                {
                    RTSCameraConfig.Get().DisplayMessage = b;
                    Utility.ShouldDisplayMessage = b;
                }));
                miscellaneousOptionCategory.AddOption(new ActionOptionViewModel(GameTexts.FindText("str_rts_camera_toggle_ui"), GameTexts.FindText("str_rts_camera_toggle_ui_hint"),
                                                                                () =>
                {
                    hideHudView?.ToggleUI();
                    menuManager.RequestToCloseMenu();
                }));
                optionClass.AddOptionCategory(1, miscellaneousOptionCategory);

                if (NativeConfig.CheatMode)
                {
                    var cheatOptionCategory = new OptionCategory("Cheat",
                                                                 GameTexts.FindText("str_rts_camera_unbalanced_options_description"));
                    cheatOptionCategory.AddOption(new BoolOptionViewModel(
                                                      GameTexts.FindText("str_rts_camera_all_invulnerable"),
                                                      GameTexts.FindText("str_rts_camera_all_invulnerable_hint"),
                                                      () => RTSCameraConfig.Get().DisableDeath,
                                                      b =>
                    {
                        RTSCameraConfig.Get().DisableDeath = b;
                        rtsCameraLogic.DisableDeathLogic.SetDisableDeath(b);
                    }));
                    cheatOptionCategory.AddOption(new BoolOptionViewModel(
                                                      GameTexts.FindText("str_rts_camera_enable_all_invulnerable_hotkey"), null,
                                                      () => RTSCameraConfig.Get().DisableDeathHotkeyEnabled,
                                                      b => RTSCameraConfig.Get().DisableDeathHotkeyEnabled = b));
                    cheatOptionCategory.AddOption(new ActionOptionViewModel(GameTexts.FindText("str_rts_camera_switch_team"), GameTexts.FindText("str_rts_camera_switch_team_hint"),
                                                                            () =>
                    {
                        rtsCameraLogic.SwitchTeamLogic.SwapTeam();
                        menuManager.RequestToCloseMenu();
                    }));
                    cheatOptionCategory.AddOption(new BoolOptionViewModel(
                                                      GameTexts.FindText("str_rts_camera_enable_switch_team_hotkey"), null,
                                                      () => RTSCameraConfig.Get().SwitchTeamHotkeyEnabled,
                                                      b => RTSCameraConfig.Get().SwitchTeamHotkeyEnabled = b));
                    optionClass.AddOptionCategory(1, cheatOptionCategory);
                }

                return optionClass;
            }, RTSCameraSubModule.ModuleId));
        }
        public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection)
        {
            return(IdProviderCreator.Create(() =>
            {
                var optionClass = new OptionClass(BattleMiniMapSubModule.ModuleId,
                                                  GameTexts.FindText("str_battle_mini_map_option_class"), menuClassCollection);

                var optionCategory = new OptionCategory("Map", GameTexts.FindText("str_battle_mini_map_map_options"));
                optionCategory.AddOption(new BoolOptionViewModel(GameTexts.FindText("str_battle_mini_map_show_map"),
                                                                 null, () => BattleMiniMapConfig.Get().ShowMap, b => BattleMiniMapConfig.Get().ShowMap = b));
                optionCategory.AddOption(new BoolOptionViewModel(GameTexts.FindText("str_battle_mini_map_enable_toggle_map_long_press_key"),
                                                                 null, () => BattleMiniMapConfig.Get().EnableToggleMapLongPressKey, b => BattleMiniMapConfig.Get().EnableToggleMapLongPressKey = b));
                optionCategory.AddOption(new BoolOptionViewModel(
                                             GameTexts.FindText("str_battle_mini_map_show_map_when_commanding"), null,
                                             () => BattleMiniMapConfig.Get().ShowMapWhenCommanding,
                                             b => BattleMiniMapConfig.Get().ShowMapWhenCommanding = b));
                optionCategory.AddOption(new NumericOptionViewModel(GameTexts.FindText("str_battle_mini_map_map_width"),
                                                                    null,
                                                                    () =>
                                                                    BattleMiniMapConfig.Get().WidgetWidth, f => { BattleMiniMapConfig.Get().WidgetWidth = (int)f; }, 50,
                                                                    2000, true, true));

                optionCategory.AddOption(new SelectionOptionViewModel(
                                             GameTexts.FindText("str_battle_mini_map_horizontal_alignment"), null, new SelectionOptionData(
                                                 i => BattleMiniMapConfig.Get().HorizontalAlignment = (HorizontalAlignment)i,
                                                 () => (int)BattleMiniMapConfig.Get().HorizontalAlignment, 3, new SelectionItem[]
                {
                    new SelectionItem(true, "str_battle_min_map_left"),
                    new SelectionItem(true, "str_battle_min_map_center"),
                    new SelectionItem(true, "str_battle_min_map_right")
                }), false));
                optionCategory.AddOption(new SelectionOptionViewModel(
                                             GameTexts.FindText("str_battle_mini_map_vertical_alignment"), null, new SelectionOptionData(
                                                 i => BattleMiniMapConfig.Get().VerticalAlignment = (VerticalAlignment)i,
                                                 () => (int)BattleMiniMapConfig.Get().VerticalAlignment, 3, new SelectionItem[]
                {
                    new SelectionItem(true, "str_battle_min_map_top"),
                    new SelectionItem(true, "str_battle_min_map_center"),
                    new SelectionItem(true, "str_battle_min_map_bottom")
                }), false));
                optionCategory.AddOption(new NumericOptionViewModel(
                                             GameTexts.FindText("str_battle_mini_map_position_x"), null,
                                             () => BattleMiniMapConfig.Get().PositionX, f => BattleMiniMapConfig.Get().PositionX = (int)f, 0,
                                             1000, true, true));
                optionCategory.AddOption(new NumericOptionViewModel(
                                             GameTexts.FindText("str_battle_mini_map_position_y"), null,
                                             () => BattleMiniMapConfig.Get().PositionY, f => BattleMiniMapConfig.Get().PositionY = (int)f, 0,
                                             1000, true, true));
                optionCategory.AddOption(new NumericOptionViewModel(
                                             GameTexts.FindText("str_battle_mini_map_map_resolution"), null,
                                             () => BattleMiniMapConfig.Get().Resolution,
                                             f => { BattleMiniMapConfig.Get().Resolution = f; }, 0.5f, 50, false, true));
                optionCategory.AddOption(new NumericOptionViewModel(
                                             GameTexts.FindText("str_battle_mini_map_agent_marker_scale"), null,
                                             () => BattleMiniMapConfig.Get().AgentMarkerScale,
                                             f => BattleMiniMapConfig.Get().AgentMarkerScale = f, 0.2f, 5f, false, true));
                optionCategory.AddOption(new NumericOptionViewModel(GameTexts.FindText("str_battle_mini_map_edge_opacity_factor"),
                                                                    null, () => BattleMiniMapConfig.Get().EdgeOpacityFactor, f => BattleMiniMapConfig.Get().EdgeOpacityFactor = f,
                                                                    0, 1, false, true));
                optionCategory.AddOption(new NumericOptionViewModel(GameTexts.FindText("str_battle_mini_map_background_opacity"),
                                                                    null, () => BattleMiniMapConfig.Get().BackgroundOpacity, f => BattleMiniMapConfig.Get().BackgroundOpacity = f,
                                                                    0, 1, false, true));
                optionCategory.AddOption(new NumericOptionViewModel(GameTexts.FindText("str_battle_mini_map_foreground_opacity"),
                                                                    null, () => BattleMiniMapConfig.Get().ForegroundOpacity, f => BattleMiniMapConfig.Get().ForegroundOpacity = f,
                                                                    0, 1, false, true));
                optionCategory.AddOption(new BoolOptionViewModel(
                                             GameTexts.FindText("str_battle_mini_map_exclude_unwalkable_terrain"), null,
                                             () => BattleMiniMapConfig.Get().ExcludeUnwalkableTerrain,
                                             b =>
                {
                    BattleMiniMapConfig.Get().ExcludeUnwalkableTerrain = b;
                }));
                optionClass.AddOptionCategory(0, optionCategory);
                return optionClass;
            }, BattleMiniMapSubModule.ModuleId));
        }