private void OnEscapeMenuToggled(bool isOpened)
 {
     if (isOpened)
     {
         if (!GameNetwork.IsMultiplayer)
         {
             MBCommon.PauseGameEngine();
         }
     }
     else
     {
         MBCommon.UnPauseGameEngine();
     }
     if (isOpened)
     {
         _dataSource    = new OptionsModOptionsViewModel(new OptionsVM(GameNetwork.IsMultiplayer, OnCloseOptions, OnKeybindRequest), new ModOptionsVM());
         _gauntletLayer = new GauntletLayer(ViewOrderPriorty, "GauntletLayer");
         _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
         _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory"));
         _movie = _gauntletLayer.LoadMovie("OptionsWithModOptionsView_v3", _dataSource);
         MissionScreen.AddLayer(_gauntletLayer);
         _gauntletLayer.IsFocusLayer = true;
         ScreenManager.TrySetFocus(_gauntletLayer);
         return;
     }
     _gauntletLayer.InputRestrictions.ResetInputRestrictions();
     _gauntletLayer.IsFocusLayer = false;
     ScreenManager.TryLoseFocus(_gauntletLayer);
     MissionScreen.RemoveLayer(_gauntletLayer);
     _keybindingPopup?.OnToggle(false);
     _gauntletLayer = null !;
     _dataSource?.OnFinalize();
     _dataSource    = null !;
     _gauntletLayer = null !;
 }
        private void UpdateMouseVisibility()
        {
            if (_orderUIHandler == null)
            {
                return;
            }

            bool mouseVisibility =
                (_orderUIHandler.IsDeployment || _orderUIHandler.DataSource.TroopController.IsTransferActive ||
                 _orderUIHandler.DataSource.IsToggleOrderShown && (Input.IsAltDown() || MissionScreen.LastFollowedAgent == null)) &&
                !_rightButtonDraggingMode && !_earlyDraggingMode;

            if (mouseVisibility != _orderUIHandler.GauntletLayer.InputRestrictions.MouseVisibility)
            {
                _orderUIHandler.GauntletLayer.InputRestrictions.SetInputRestrictions(mouseVisibility,
                                                                                     mouseVisibility ? InputUsageMask.All : InputUsageMask.Invalid);
            }

            if (MissionScreen.OrderFlag != null)
            {
                bool orderFlagVisibility = (_orderUIHandler.DataSource.IsToggleOrderShown || _orderUIHandler.IsDeployment) &&
                                           !_orderUIHandler.DataSource.TroopController.IsTransferActive &&
                                           !_rightButtonDraggingMode && !_earlyDraggingMode;
                if (orderFlagVisibility != MissionScreen.OrderFlag.IsVisible)
                {
                    MissionScreen.SetOrderFlagVisibility(orderFlagVisibility);
                }
            }
        }
Example #3
0
        protected override void OnAgentControllerChanged(Agent agent)
        {
            /*if (null == MissionScreen) {
             *  FocusOnAgent(agent);
             * }*/
            if (!enable)
            {
                return;
            }

            if (null == MissionScreen)
            {
                enable = false;
                return;
            }
            if (_showControlHintLayer != null && textHandler != null)
            {
                return;
            }
            _showControlHintLayer = new GauntletLayer(1);
            textHandler           = new KillInfoWriteHandler(true, GameLoadConfiguration.horizontalAlignment);
            _showControlHintLayer.LoadMovie("showControlHint", textHandler);
            MissionScreen.AddLayer(_showControlHintLayer);
            textHandler.SetShowText(true);
        }
Example #4
0
        public void CreateLayout()
        {
            SpriteData spriteData = UIResourceManager.SpriteData;
            TwoDimensionEngineResourceContext resourceContext = UIResourceManager.ResourceContext;
            ResourceDepot uiResourceDepot = UIResourceManager.UIResourceDepot;

            this._spriteCategory = spriteData.SpriteCategories["ui_crafting"];
            this._spriteCategory.Load((ITwoDimensionResourceContext)resourceContext, uiResourceDepot);

            this._gauntletLayer = new GauntletLayer(1, "GauntletLayer");
            this._gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
            this._gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericCampaignPanelsGameKeyCategory"));
            this._gauntletLayer.IsFocusLayer = true;
            //ScreenManager.TrySetFocus((ScreenLayer) this._gauntletLayer);
            MissionScreen.AddLayer((ScreenLayer)this._gauntletLayer);
            this._gauntletLayer.LoadMovie("ScrollGrid", new GameEntityVM());


            //this._testGlobalLayer = new testGlobalLayer();
            //this._testGlobalLayer.Initialize(); // screen where
            //MissionScreen.AddLayer(this._testGlobalLayer.Layer);
            //MissionScreen
            // ScreenManager.AddGlobalLayer(this._testGlobalLayer, true);
            //ScreenManager.TrySetFocus(this._testGlobalLayer.Layer);
        }
Example #5
0
        public static MatrixFrame GetCameraFrameWhenLockedToAgent(MissionScreen missionScreen, Agent agentToFollow)
        {
            MatrixFrame result             = MatrixFrame.Identity;
            float       cameraBaseDistance = 0.6f;
            float       agentScale         = agentToFollow.AgentScale;

            if (missionScreen.IsViewingChar())
            {
                cameraBaseDistance += 0.5f;
            }
            result.rotation.RotateAboutSide(1.570796f);
            result.rotation.RotateAboutForward(missionScreen.CameraBearing);
            result.rotation.RotateAboutSide(missionScreen.CameraElevation);
            MatrixFrame matrixFrame = result;
            float       num8        = Math.Max(cameraBaseDistance + Mission.CameraAddedDistance, 0.48f) * agentScale;

            result.rotation.RotateAboutSide((float?)CameraAddedElevation?.GetValue(missionScreen) ?? 0);
            bool flag5 = agentToFollow.AgentVisuals != null && (uint)agentToFollow.AgentVisuals.GetSkeleton().GetCurrentRagdollState() > 0;
            var  agentVisualPosition = agentToFollow.VisualPosition;
            var  cameraTarget        = flag5 ? agentToFollow.AgentVisuals.GetFrame().origin : agentVisualPosition;

            if (agentToFollow.MountAgent != null)
            {
                var vec3_4 = agentToFollow.MountAgent.GetMovementDirection() * agentToFollow.MountAgent.Monster.RiderBodyCapsuleForwardAdder;
                cameraTarget += vec3_4;
            }
            cameraTarget.z += (float)CameraTargetAddedHeight.GetValue(missionScreen);
            cameraTarget   += matrixFrame.rotation.f * agentScale * (0.7f * MathF.Pow(MathF.Cos((float)(1.0 / ((num8 / (double)agentScale - 0.200000002980232) * 30.0 + 20.0))), 3500f));
            result.origin   = cameraTarget + matrixFrame.rotation.u * missionScreen.CameraResultDistanceToTarget;
            return(result);
        }
Example #6
0
        private static void Prefix(
            ref MissionScreen __instance,
            ref float ____cameraSpecialTargetFOV,
            ref float ____cameraSpecialTargetDistanceToAdd,
            ref float ____cameraSpecialTargetAddedBearing,
            ref float ____cameraSpecialTargetAddedElevation,
            ref Vec3 ____cameraSpecialTargetPositionToAdd
            )
        {
            if (!ShouldApplyCameraTransformation(__instance))
            {
                var isFreeLooking = __instance.InputManager.IsGameKeyDown(CombatHotKeyCategory.ViewCharacter);
                if (!isFreeLooking && __instance.Mission.Mode != MissionMode.Conversation)
                {
                    ____cameraSpecialTargetFOV            = 65;
                    ____cameraSpecialTargetDistanceToAdd  = 0;
                    ____cameraSpecialTargetAddedBearing   = 0;
                    ____cameraSpecialTargetAddedElevation = 0;
                    ____cameraSpecialTargetPositionToAdd  = Vec3.Zero;
                }
                return;
            }

            var mainAgent      = __instance.Mission.MainAgent;
            var camShakeVector = GetCamShakeVector();

            ____cameraSpecialTargetFOV            = SubModule.Config.ThirdPersonFieldOfView;
            ____cameraSpecialTargetDistanceToAdd  = mainAgent.MountAgent == null ? SubModule.Config.OnFootPositionYOffset : SubModule.Config.MountedPositionYOffset;
            ____cameraSpecialTargetAddedBearing   = SubModule.Config.BearingOffset + camShakeVector.z;
            ____cameraSpecialTargetAddedElevation = SubModule.Config.ElevationOffset + camShakeVector.x;
        }
Example #7
0
        public static string SpawnProp(List <string> strings)
        {
            if (Campaign.Current == null)
            {
                return("Campaign was not started.");
            }
            if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings))
            {
                return("Format is \"mission.spawn_prop [PropId]\".");
            }
            if (Mission.Current == null)
            {
                return("You are not in a mission.");
            }
            GameEntity gameEntity;

            if (Agent.Main == null)
            {
                MissionScreen missionScreen = ScreenManager.TopScreen as MissionScreen;
                if (missionScreen != null && missionScreen.CombatCamera != null)
                {
                    gameEntity = GameEntity.Instantiate(Mission.Current.Scene, strings[0], missionScreen.CombatCamera.Frame);
                    goto IL_99;
                }
            }
            gameEntity = GameEntity.Instantiate(Mission.Current.Scene, strings[0], Agent.Main.Frame);
IL_99:
            if (gameEntity == null)
            {
                return("Failed to spawn prop with id \"" + strings[0] + "\"");
            }
            return("Spawned " + gameEntity.Name + ".");
        }
Example #8
0
        private static void Postfix(
            ref MissionScreen __instance,
            ref Vec3 ____cameraSpecialTargetPositionToAdd
            )
        {
            if (!ShouldApplyCameraTransformation(__instance))
            {
                ____cameraSpecialTargetPositionToAdd = Vec3.Zero;
                return;
            }

            var mainAgent = __instance.Mission.MainAgent;

            UpdateFocusedShoulderPosition(__instance, mainAgent);
            var directionBoneIndex = mainAgent.Monster.HeadLookDirectionBoneIndex;
            var boneEntitialFrame  = mainAgent.AgentVisuals.GetSkeleton().GetBoneEntitialFrame(directionBoneIndex);

            boneEntitialFrame.origin    = boneEntitialFrame.TransformToParent(mainAgent.Monster.FirstPersonCameraOffsetWrtHead);
            boneEntitialFrame.origin.x += (mainAgent.MountAgent == null ? SubModule.Config.OnFootPositionXOffset : SubModule.Config.MountedPositionXOffset) * _focusedShoulderPosition.GetOffsetValue();
            var frame  = mainAgent.AgentVisuals.GetFrame();
            var parent = frame.TransformToParent(boneEntitialFrame);

            ____cameraSpecialTargetPositionToAdd = new Vec3(
                parent.origin.x - mainAgent.Position.x,
                parent.origin.y - mainAgent.Position.y,
                mainAgent.MountAgent == null ? SubModule.Config.OnFootPositionZOffset : SubModule.Config.MountedPositionZOffset
                );
        }
Example #9
0
        private static bool ShouldRevertCameraForRangedMode(this Agent agent, MissionScreen missionScreen)
        {
            if (SubModule.Config.ShoulderCamRangedMode == ShoulderCamRangedMode.NoRevert)
            {
                return(false);
            }
            if (SubModule.Config.ShoulderCamRangedMode == ShoulderCamRangedMode.RevertWhenAiming && !missionScreen.InputManager.IsGameKeyDown(CombatHotKeyCategory.Attack))
            {
                return(false);
            }
            var wieldedItemIndex = agent.GetWieldedItemIndex(Agent.HandIndex.MainHand);

            if (wieldedItemIndex == EquipmentIndex.None)
            {
                return(false);
            }
            var equippedItem = agent.Equipment[wieldedItemIndex];

            foreach (var weaponComponentData in equippedItem.Weapons)
            {
                if (weaponComponentData != null && weaponComponentData.IsRangedWeapon)
                {
                    return(true);
                }
            }
            return(false);
        }
        internal static bool UpdateCameraPrefix(ref MissionScreen __instance, ref float ____cameraSpecialTargetAddedBearing, ref Vec3 ____cameraSpecialTargetPositionToAdd, ref float ____cameraSpecialTargetDistanceToAdd, ref float ____cameraSpecialTargetAddedElevation, ref float dt)
        {
            var cameraLogic = __instance.Mission.GetMissionBehaviour <CameraLogic>();

            if (cameraLogic != null)
            {
                if (cameraLogic.ShouldOccur())
                {
                    if (__instance.OrderFlag != null && __instance.OrderFlag.IsVisible)
                    {
                        cameraLogic.ApplyCamDistance(ref ____cameraSpecialTargetDistanceToAdd, __instance.CameraResultDistanceToTarget);
                        cameraLogic.ApplyCamHeight(ref __instance, ref ____cameraSpecialTargetPositionToAdd);

                        MissionScreenReversePatches.UpdateCamera(__instance, dt);

                        return(false);
                    }
                    else if (!CompatibilityCheck.XorbShoulderCamDetected)
                    {
                        cameraLogic.ApplyCamReturnSpeed(ref ____cameraSpecialTargetPositionToAdd,
                                                        ref ____cameraSpecialTargetDistanceToAdd,
                                                        ref ____cameraSpecialTargetAddedElevation);
                    }
                }
            }


            return(true);
        }
Example #11
0
        private static bool ShouldReturnFocusToOriginalShoulder(MissionScreen missionScreen)
        {
            var returnFocusTimestamp = _alternateShoulderSwitchTimestamp + SubModule.Config.TemporaryShoulderSwitchDuration;

            return
                (SubModule.Config.ShoulderSwitchMode == ShoulderSwitchMode.TemporarilyMatchAttackAndBlockDirection &&
                 missionScreen.Mission.Time > returnFocusTimestamp);
        }
 public void Deactivate()
 {
     _gauntletLayer.InputRestrictions.ResetInputRestrictions();
     MissionScreen.RemoveLayer(_gauntletLayer);
     _gauntletLayer = null;
     _dataSource.OnFinalize();
     _dataSource = null;
 }
Example #13
0
 public static void AfterSetMainAgent(bool shouldSmoothMoveToAgent, MissionScreen missionScreen, bool rotateCamera = true)
 {
     if (shouldSmoothMoveToAgent)
     {
         ShouldSmoothMoveToAgent = true;
         SmoothMoveToAgent(missionScreen, false, rotateCamera);
     }
 }
Example #14
0
 public static void SetIsPlayerAgentAdded(MissionScreen missionScreen, bool value)
 {
     IsPlayerAgentAdded?.SetValue(missionScreen, value);
     if (value)
     {
         CameraSpecialCurrentPositionToAdd?.SetValue(missionScreen, Vec3.Zero);
     }
 }
Example #15
0
        public override void OnMissionScreenInitialize()
        {
            base.OnMissionScreenInitialize();

            _layer = new GauntletLayer(20);
            _layer.LoadMovie(nameof(BattleMiniMapView), _dataSource);
            MissionScreen.AddLayer(_layer);
            _timer = new MissionTimer(0.05f);
        }
        public static bool OnMissionModeChange_Prefix(MissionScreen __instance, MissionMode oldMissionMode, bool atStart)
        {
            if (__instance.Mission.Mode == MissionMode.Battle && oldMissionMode == MissionMode.Deployment)
            {
                Utility.SmoothMoveToAgent(__instance, true);
                return(false);
            }

            return(true);
        }
Example #17
0
        public override void OnMissionScreenFinalize()
        {
            base.OnMissionScreenFinalize();

            MissionScreen.RemoveLayer(_layer);
            _dataSource.OnFinalize();
            _layer = null;
            Mission.Current.Boundaries.CollectionChanged -= BoundariesOnCollectionChanged;
            Game.Current.EventManager.UnregisterEvent <MissionPlayerToggledOrderViewEvent>(OnOrderViewToggled);
        }
Example #18
0
 public override void OnMissionScreenFinalize()
 {
     base.OnMissionScreenFinalize();
     if (null != _showControlHintLayer)
     {
         MissionScreen.RemoveLayer(_showControlHintLayer);
     }
     _showControlHintLayer = null;
     textHandler           = null;
 }
Example #19
0
 protected void OnCloseMenu()
 {
     IsActivated = false;
     _dataSource.OnFinalize();
     _dataSource = null;
     GauntletLayer.InputRestrictions.ResetInputRestrictions();
     MissionScreen.RemoveLayer(GauntletLayer);
     _movie        = null;
     GauntletLayer = null;
     UnpauseGame();
 }
Example #20
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            UI.LoadContent(Content, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            UIClass.LoadContent(Content);
            UpgradeSystem.LoadContent(Content, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            WeaponList.LoadContent(Content);
            ChopperList.LoadContent(Content);
            EffectsList.LoadContent(Content);

            EnemyMaker.LoadContent(Content);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Level level = new Level(500, 500);


            Player player = new Player(ChopperList.GetChopper(ChopperType.Training), new Vector2(500, 2000));

            //Player player = new Player(ChopperList.GetChopper(0), new Vector2(0, 0));
            hud    = new Hud(Content.Load <SpriteFont>("hudFont"));
            camera = new Camera();
            //camera.Position = player.PlayerSpriteCenter;
            camera.Position = player.PlayerCenter;
            gameManager     = new GameManager(level, player);

            List <Sprite> listOfEnemies = new List <Sprite>();

            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.MGun, new Vector2(0, 0), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.MGun, new Vector2(0, 700), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.MGun, new Vector2(700, 700), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.MGun, new Vector2(700, 0), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.Rocket, new Vector2(350, 350), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.RocketHoming, new Vector2(800, 800), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.ShotGun, new Vector2(500, 500), 3, 1));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.ShotGun, new Vector2(250, 450), 5, 0.5f));

            level.AddEntity(listOfEnemies, true, true, true);

            listOfEnemies.Clear();
            listOfEnemies.Add(new Building(Content.Load <Texture2D>("building"), new Vector2(1000, 1000)));
            List <Helipad> listOfHelipads = new List <Helipad>();

            listOfHelipads.Add(new Helipad(Content.Load <Texture2D>("Allies\\helipad"), new Vector2(500, 2000)));
            level.AddLandingPad(listOfHelipads);

            level.AddEntity(listOfEnemies, true, true, false);

            missionScreen      = new MissionScreen(1, "GameTest", "Yarrr mission is to blow up\nevery turret. Then return\nto the base\n\nWASD - Move \nLeft\\Right arrow - rotate\nSpace - fire \nX and L - land\\lift \nU - upgrade (on helipad)\nP- developer stats\n+ and - - zoom ", graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, Color.SaddleBrown);
            GameData.menuState = MenuState.MissionMenu;
            // TODO: use this.Content to load your game content here
        }
Example #21
0
        public WatchAgentSelectionData(MissionScreen missionScreen)
        {
            var agents = Mission.Current.PlayerTeam.ActiveAgents.Where(agent => agent.IsHero).ToList();

            SelectionOptionData = new SelectionOptionData(i =>
            {
                if (i >= 0 && i < agents.Count)
                {
                    WatchAgent(agents[i]);
                }
            }, () => agents.IndexOf(missionScreen.LastFollowedAgent), agents.Count,
                                                          agents.Select(agent => new SelectionItem(false, agent.Name)));
        }
Example #22
0
        public WatchAgentSelectionData(MissionScreen missionScreen)
        {
            var agents = (Mission.Current.PlayerTeam?.ActiveAgents ?? Mission.Current.Agents).Where(agent => agent.IsHero).ToList();

            SelectionOptionData = new MissionSharedLibrary.View.ViewModelCollection.Options.Selection.SelectionOptionData(i =>
            {
                if (i >= 0 && i < agents.Count)
                {
                    WatchAgent(agents[i]);
                }
            }, () => agents.IndexOf(missionScreen.LastFollowedAgent), agents.Count,
                                                                                                                          agents.Select(agent => new MissionSharedLibrary.View.ViewModelCollection.Options.Selection.SelectionItem(false, agent.Name)));
        }
 public void Activate()
 {
     _dataSource    = new RTSCameraGameKeyConfigVM(AGameKeyCategoryManager.Get(), OnKeyBindRequest, Deactivate);
     _gauntletLayer = new GauntletLayer(ViewOrderPriorty)
     {
         IsFocusLayer = true
     };
     _gauntletLayer.LoadMovie("RTSCameraOptionsGameKeyPage", _dataSource);
     _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory"));
     _gauntletLayer.InputRestrictions.SetInputRestrictions();
     _gauntletLayer.IsFocusLayer = true;
     MissionScreen.AddLayer(_gauntletLayer);
     ScreenManager.TrySetFocus(_gauntletLayer);
 }
Example #24
0
        private static bool DisableSpectatorControlsPrefix(MissionScreen __instance)
        {
            if (__instance?.Mission == null)
            {
                return(true);
            }

            if (__instance.Mission.IsOrderMenuOpen)
            {
                return(false);
            }

            return(true);
        }
Example #25
0
        private static bool ShouldApplyCameraTransformation(MissionScreen missionScreen)
        {
            var mainAgent               = missionScreen.Mission.MainAgent;
            var missionMode             = missionScreen.Mission.Mode;
            var isFirstPerson           = missionScreen.Mission.CameraIsFirstPerson;
            var isMainAgentPresent      = mainAgent != null;
            var isCompatibleMissionMode = missionMode != MissionMode.Conversation;
            var isFreeLooking           = missionScreen.InputManager.IsGameKeyDown(CombatHotKeyCategory.ViewCharacter);

            return(isMainAgentPresent &&
                   isCompatibleMissionMode &&
                   !isFreeLooking &&
                   !isFirstPerson &&
                   !mainAgent.ShouldRevertCameraForRangedMode(missionScreen) &&
                   !mainAgent.ShouldRevertCameraForMountMode());
        }
Example #26
0
        private static void UpdateFocusedShoulderPosition(MissionScreen missionScreen, Agent mainAgent)
        {
            var isShoulderSwitchModeDynamic =
                SubModule.Config.ShoulderSwitchMode == ShoulderSwitchMode.MatchAttackAndBlockDirection ||
                SubModule.Config.ShoulderSwitchMode == ShoulderSwitchMode.TemporarilyMatchAttackAndBlockDirection;

            if (!isShoulderSwitchModeDynamic)
            {
                return;
            }

            var actionDirection = mainAgent.GetCurrentActionDirection(1);

            if (missionScreen.InputManager.IsGameKeyDown(CombatHotKeyCategory.Attack))
            {
                switch (actionDirection)
                {
                case Agent.UsageDirection.AttackLeft:
                    _focusedShoulderPosition          = ShoulderPosition.Left;
                    _alternateShoulderSwitchTimestamp = missionScreen.Mission.Time;
                    return;

                case Agent.UsageDirection.AttackRight:
                    _focusedShoulderPosition = ShoulderPosition.Right;
                    return;
                }
            }
            else if (missionScreen.InputManager.IsGameKeyDown(CombatHotKeyCategory.Defend))
            {
                switch (actionDirection)
                {
                case Agent.UsageDirection.DefendLeft:
                    _focusedShoulderPosition          = ShoulderPosition.Left;
                    _alternateShoulderSwitchTimestamp = missionScreen.Mission.Time;
                    return;

                case Agent.UsageDirection.DefendRight:
                    _focusedShoulderPosition = ShoulderPosition.Right;
                    return;
                }
            }
            else if (ShouldReturnFocusToOriginalShoulder(missionScreen))
            {
                _focusedShoulderPosition = ShoulderPosition.Right;
            }
        }
Example #27
0
 public void ActivateMenu()
 {
     IsActivated = true;
     _dataSource = GetDataSource();
     if (_dataSource == null)
     {
         return;
     }
     GauntletLayer = new GauntletLayer(ViewOrderPriorty)
     {
         IsFocusLayer = true
     };
     GauntletLayer.InputRestrictions.SetInputRestrictions();
     GauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory"));
     _movie = GauntletLayer.LoadMovie(_movieName, _dataSource);
     MissionScreen.AddLayer(GauntletLayer);
     ScreenManager.TrySetFocus(GauntletLayer);
     PauseGame();
 }
Example #28
0
        public static void SmoothMoveToAgent(MissionScreen missionScreen, bool forceMove = false, bool changeCameraRotation = true)
        {
            try
            {
                var spectatingData = missionScreen.GetSpectatingData(missionScreen.CombatCamera.Position);
                if (spectatingData.AgentToFollow != null)
                {
                    CameraAddSpecialMovement?.SetValue(missionScreen, true);
                    CameraApplySpecialMovementsInstantly?.SetValue(missionScreen, false);
                    if (missionScreen.LastFollowedAgent != spectatingData.AgentToFollow || forceMove)
                    {
                        var targetFrame =
                            GetCameraFrameWhenLockedToAgent(missionScreen, spectatingData.AgentToFollow);
                        CameraSpecialCurrentPositionToAdd?.SetValue(missionScreen,
                                                                    missionScreen.CombatCamera.Position - targetFrame.origin);
                    }
                    if (changeCameraRotation)
                    {
                        CameraSpecialCurrentAddedElevation?.SetValue(missionScreen, missionScreen.CameraElevation);
                        CameraSpecialCurrentAddedBearing?.SetValue(missionScreen,
                                                                   MBMath.WrapAngle(missionScreen.CameraBearing - spectatingData.AgentToFollow.LookDirectionAsAngle));
                        SetCameraElevation?.Invoke(missionScreen, new object[] { 0.0f });
                        SetCameraBearing?.Invoke(missionScreen,
                                                 new object[] { spectatingData.AgentToFollow.LookDirectionAsAngle });
                    }

                    SetLastFollowedAgent.Invoke(missionScreen, new object[] { spectatingData.AgentToFollow });
                }
                // Avoid MissionScreen._cameraSpecialCurrentAddedBearing reset to 0.
                SetIsPlayerAgentAdded(missionScreen, false);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #29
0
 internal static void UpdateCamera(this MissionScreen Mission, float dt)
 {
     throw new NotImplementedException("Need to patch first");
 }
 internal void ApplyCamHeight(ref MissionScreen __instance, ref Vec3 cameraSpecialTargetPositionToAdd)
 {
     cameraSpecialTargetPositionToAdd = new Vec3 {
         z = _maxHeight
     };
 }