예제 #1
0
 private void AddMissionLibraryMissionBehaviors(MissionView entranceView)
 {
     //MissionStartingManager.AddMissionBehaviour(entranceView,
     //    Global.GetProvider<AInputControllerFactory>().CreateInputController(entranceView.Mission));
     MissionStartingManager.AddMissionBehaviour(entranceView, AMenuManager.Get().CreateMenuView());
     MissionStartingManager.AddMissionBehaviour(entranceView, AMenuManager.Get().CreateGameKeyConfigView());
 }
        private bool SecondInitialize()
        {
            if (!Initializer.SecondInitialize())
            {
                return(false);
            }

            var menuClassCollection = AMenuManager.Get().MenuClassCollection;

            AMenuManager.Get().OnMenuClosedEvent += ImprovedCombatAIConfig.OnMenuClosed;
            menuClassCollection.AddOptionClass(
                ImprovedCombatAIOptionClassFactory.CreateOptionClassProvider(menuClassCollection));
            return(true);
        }
예제 #3
0
        private bool SecondInitialize()
        {
            if (!Initializer.SecondInitialize())
            {
                return(false);
            }

            RTSCameraGameKeyCategory.RegisterGameKeyCategory();
            Global.GetProvider <AMissionStartingManager>().AddHandler(new MissionStartingHandler());
            var menuClassCollection = AMenuManager.Get().MenuClassCollection;

            AMenuManager.Get().OnMenuClosedEvent += RTSCameraConfig.OnMenuClosed;
            menuClassCollection.AddOptionClass(RTSCameraOptionClassFactory.CreateOptionClassProvider(menuClassCollection));
            return(true);
        }
        private bool SecondInitialize()
        {
            if (!Initializer.SecondInitialize())
            {
                return(false);
            }

            Global.GetProvider <AMissionStartingManager>().AddHandler(new MissionStartingHandler());
            var menuClassCollection = AMenuManager.Get().MenuClassCollection;

            menuClassCollection.AddOptionClass(CinematicCameraOptionClassFactory.CreateOptionClassProvider(menuClassCollection));
            AMenuManager.Get().OnMenuClosedEvent += ModifyCameraHelper.UpdateDepthOfFieldParameters;
            AMenuManager.Get().OnMenuClosedEvent += ModifyCameraHelper.UpdateDepthOfFieldDistance;
            return(true);
        }
        protected override void OnBeforeInitialModuleScreenSetAsRoot()
        {
            base.OnBeforeInitialModuleScreenSetAsRoot();

            if (_isInitialized)
            {
                return;
            }

            _isInitialized = true;
            CommandSystemGameKeyCategory.RegisterGameKeyCategory();
            AMenuManager.Get().OnMenuClosedEvent += CommandSystemConfig.OnMenuClosed;
            var menuClassCollection = AMenuManager.Get().MenuClassCollection;

            menuClassCollection.AddOptionClass(CommandSystemOptionClassFactory.CreateOptionClassProvider(menuClassCollection));
            Global.GetProvider <AMissionStartingManager>().AddHandler(new CommandSystemMissionStartingHandler());
        }
예제 #6
0
 protected override MissionMenuVMBase GetDataSource()
 {
     return(new OptionVM(AMenuManager.Get().MenuClassCollection, OnCloseMenu));
 }
예제 #7
0
        public override void OnMissionScreenFinalize()
        {
            base.OnMissionScreenFinalize();

            AMenuManager.Get().MenuClassCollection.Clear();
        }
예제 #8
0
 public virtual void CloseMenu()
 {
     AMenuManager.Get().OnMenuClosed();
     _closeMenu?.Invoke();
 }
        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));
        }