public void UpdateBackdropPosition(GameTime gameTime)
        {
            distance = Math.Abs(Vector2.Distance(preferredBackdropPosition, backdropPosition));

            backdropDirection.RotateTowardsPointSingleTurn(gameTime, backdropPosition, preferredBackdropPosition, 1f);
            backdropPosition += (backdropSpeed * backdropDirection.GetDirectionAsVector()) * gameTime.ElapsedGameTime.Milliseconds;

            if (distance > totalDistance / 2)
            {
                backdropSpeed += backdropAcc * gameTime.ElapsedGameTime.Milliseconds;
            }
            else if (distance <= totalDistance / 2)
            {
                backdropSpeed -= backdropAcc * gameTime.ElapsedGameTime.Milliseconds;
            }

            pressDelay--;

            if (pressDelay < 0 &&
                (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckPress(RebindableKeys.Action2) ||
                 ControlManager.CheckKeyPress(Keys.Enter) || ControlManager.IsLeftMouseButtonClicked()))
            {
                backdropSpeed    = 0;
                backdropPosition = preferredBackdropPosition;
                game.stateManager.ChangeState(nextGameState);
                moveBackdrop = false;
            }

            if (distance < 5)
            {
                backdropSpeed = 0;
                game.stateManager.ChangeState(nextGameState);
                moveBackdrop = false;
            }
        }
Esempio n. 2
0
        private void MouseControls()
        {
            for (int i = 0; i < buttons.Count; i++)
            {
                Rectangle buttonRect = new Rectangle(
                    (int)buttons[i].Position.X - buttons[i].Passive.SourceRectangle.Value.Width / 2,
                    (int)buttons[i].Position.Y - buttons[i].Passive.SourceRectangle.Value.Height / 2,
                    buttons[i].Passive.SourceRectangle.Value.Width,
                    buttons[i].Passive.SourceRectangle.Value.Height);

                if (ControlManager.IsMouseOverArea(buttonRect))
                {
                    if (ControlManager.IsMouseMoving())
                    {
                        if (buttonIndex != i)
                        {
                            PlayHoverSound();
                        }

                        buttonIndex = i;
                    }

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        ButtonActions();
                    }
                }
            }
        }
        protected void MouseControls()
        {
            if (baseState.IsOverlayDisplayed)
            {
                if (ControlManager.IsLeftMouseButtonClicked() &&
                    Game.IsActive)
                {
                    ActiveMenuState.ButtonActions();
                }
            }
            else
            {
                for (int i = 0; i < allButtons.Count; i++)
                {
                    if (ControlManager.IsMouseOverArea(allButtons[i].Bounds))
                    {
                        if (ControlManager.IsMouseMoving())
                        {
                            activeButtonIndexY = i;
                        }

                        if (ControlManager.IsLeftMouseButtonClicked())
                        {
                            ActiveMenuState.ButtonActions();
                        }
                    }
                }
            }
        }
        public override void Update(GameTime gameTime)
        {
            textBoxLeft.Update(gameTime);
            textBoxRight.Update(gameTime);

            if (ControlManager.CheckPress(RebindableKeys.Action1) ||
                ControlManager.CheckKeyPress(Keys.Enter) ||
                ControlManager.CheckPress(RebindableKeys.Action2) ||
                ControlManager.CheckKeyPress(Keys.Escape) ||
                ControlManager.IsLeftMouseButtonClicked())
            {
                Game.stateManager.ChangeState("MainMenuState");
            }
        }
Esempio n. 5
0
        private void CheckMouseCursorLevel1()
        {
            for (int i = 0; i < cursorManager.displayList.Count; i++)
            {
                if (ControlManager.IsMouseOverArea(cursorManager.displayList[i].Bounds))
                {
                    cursorLevel1Position = i;

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        OnPressCursorLevel1();
                    }
                }
            }
        }
        private void MouseControls()
        {
            for (int i = 0; i < options.Count; i++)
            {
                if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14),
                                                   options[i], new Vector2(10, 10 + (i * 20)), false))
                {
                    if (ControlManager.IsMouseMoving())
                    {
                        cursorIndex = i;
                    }

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        ButtonActions();
                    }
                }
            }
        }
Esempio n. 7
0
        private void CheckMouseCursorLevel2()
        {
            List <Mission> missions;

            switch (cursorLevel1Position)
            {
            case 0:
                missions = MissionManager.ReturnActiveMissions();
                break;

            case 1:
                missions = MissionManager.ReturnCompletedDeadMissions();
                break;

            case 2:
                missions = MissionManager.ReturnFailedDeadMissions();
                break;

            default:
                missions = new List <Mission>();
                break;
            }

            for (int i = 0; i < missions.Count + 1; i++)
            {
                string text = i < missions.Count ? missions[i].MissionName : "Back";

                if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14), text,
                                                   new Vector2(MissionScreenState.GetRightRectangle.X + Game1.ScreenSize.X / 16,
                                                               93 + i * 23) + Game.fontManager.FontOffset, Vector2.Zero, false))
                {
                    cursorLevel2Position = i;

                    if (ControlManager.IsLeftMouseButtonClicked() &&
                        i == missions.Count)
                    {
                        cursorLevel     = 1;
                        elapsedSinceKey = 0;
                    }
                }
            }
        }
Esempio n. 8
0
 private void ButtonControls()
 {
     if (ControlManager.CheckPress(RebindableKeys.Action1) ||
         ControlManager.CheckKeyPress(Keys.Enter))
     {
         OnPress(RebindableKeys.Action1);
     }
     else if (ControlManager.CheckPress(RebindableKeys.Action2))
     {
         OnPress(RebindableKeys.Action2);
     }
     else if (ControlManager.CheckPress(RebindableKeys.Pause) ||
              ControlManager.CheckKeyPress(Keys.Escape))
     {
         OnPress(RebindableKeys.Pause);
     }
     else if (ControlManager.CheckPress(RebindableKeys.Right))
     {
         OnPress(RebindableKeys.Right);
     }
     else if (ControlManager.CheckPress(RebindableKeys.Left))
     {
         OnPress(RebindableKeys.Left);
     }
     else if (ControlManager.CheckPress(RebindableKeys.Up))
     {
         OnPress(RebindableKeys.Up);
     }
     else if (ControlManager.CheckPress(RebindableKeys.Down))
     {
         OnPress(RebindableKeys.Down);
     }
     else if (ControlManager.IsLeftMouseButtonClicked())
     {
         OnPress(RebindableKeys.Action1);
     }
 }
        private void CheckMouseLevel1()
        {
            for (int i = 0; i < cursorManager.displayList.Count; i++)
            {
                if (ControlManager.IsMouseOverArea(cursorManager.displayList[i].Bounds))
                {
                    //if (cursorCoordLv1 != null)
                    //{

                    int xCoord = cursorManager.displayList[i].Coordinate.X;
                    int yCoord = cursorManager.displayList[i].Coordinate.Y;
                    cursorCoordLv1.SetCursor(xCoord, yCoord);

                    //cursorManager.CursorCoordLv1.X = cursorManager.displayList[i].Coordinate.X;
                    //cursorManager.CursorCoordLv1.Y = cursorManager.displayList[i].Coordinate.Y;

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        OnPressLevel1();
                    }
                    //}
                }
            }
        }
Esempio n. 10
0
        private void MouseControls()
        {
            for (int i = 0; i < options.Count; i++)
            {
                if (ControlManager.IsMouseOverText(font, options[i].Replace("Beacon", ""), new Vector2(game.camera.cameraPos.X + position.X + 120,
                                                                                                       game.camera.cameraPos.Y + position.Y - 100 + (i * 20)), game.camera.Position - game.ScreenCenter, false))
                {
                    if (ControlManager.IsMouseMoving())
                    {
                        cursorIndex = i;
                    }

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        if (cursorIndex < beacons.Count)
                        {
                            currentBeacon.StartJump(beacons[cursorIndex]);
                        }

                        Hide();
                    }
                }
            }
        }
Esempio n. 11
0
        private void MouseControls()
        {
            for (int i = 0; i < menuOptions.Length / 2; i++)
            {
                if (ControlManager.IsMouseOverText(menuOptionFont, menuOptions[i, 0],
                                                   new Vector2((Game1.ScreenSize.X / 9) * 4 + game.fontManager.GetFont(14).MeasureString(menuOptions[i, 0]).X / 2,
                                                               Game1.ScreenSize.Y / 3 + (i * 23) + yOffset) + fontOffset))
                {
                    if (cursorIndex != i)
                    {
                        PlayHoverSound();
                    }

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        ButtonActions();
                    }

                    if (ControlManager.IsMouseMoving())
                    {
                        cursorIndex = i;
                    }

                    continue;
                }

                if (!menuOptions[i, 1].Equals(""))
                {
                    if (ControlManager.IsMouseOverText(menuOptionFont, menuOptions[i, 1],
                                                       new Vector2(Game1.ScreenSize.X - 150 + game.fontManager.GetFont(14).MeasureString(menuOptions[i, 1]).X / 2,
                                                                   Game1.ScreenSize.Y / 3 + (i * 23) + yOffset) + fontOffset))
                    {
                        if (cursorIndex != i)
                        {
                            PlayHoverSound();
                        }

                        if (ControlManager.IsLeftMouseButtonClicked())
                        {
                            ButtonActions();
                        }
                        if (ControlManager.IsMouseMoving())
                        {
                            cursorIndex = i;
                        }
                    }
                }
            }

            for (int i = 0; i < directionalButtons.Count; i++)
            {
                Rectangle dirButtonRect = new Rectangle(
                    (int)directionalButtons[i].Position.X - directionalButtons[i].Passive.SourceRectangle.Value.Width / 2,
                    (int)directionalButtons[i].Position.Y - directionalButtons[i].Passive.SourceRectangle.Value.Height / 2,
                    directionalButtons[i].Passive.SourceRectangle.Value.Width + 10,
                    directionalButtons[i].Passive.SourceRectangle.Value.Height);

                if (ControlManager.IsMouseOverArea(dirButtonRect) &&
                    ControlManager.IsLeftMouseButtonClicked())
                {
                    DirectionalButtonActions(directionalButtons[i].name);
                }
            }
        }
        private void CheckMouseLevel2()
        {
            int    listLength;
            string text = "";

            if (cursorCoordLv1.Position != 5)
            {
                listLength = ShipInventoryManager.ownCounts[cursorCoordLv1.Position - 1];
            }

            else
            {
                if (cursorCoordLv1.Y == 0)
                {
                    listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(1).Count;
                }
                else
                {
                    listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(2).Count;
                }
            }

            for (int i = 0; i < listLength + 1; i++)
            {
                if (i < listLength)
                {
                    if (cursorCoordLv1.Position != 5)
                    {
                        if (cursorCoordLv1.Position == 1)
                        {
                            text = ShipInventoryManager.ownedEnergyCells[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 2)
                        {
                            text = ShipInventoryManager.ownedPlatings[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 3)
                        {
                            text = ShipInventoryManager.ownedShields[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 4)
                        {
                            text = ShipInventoryManager.OwnedSecondary[i].Name;
                        }
                    }

                    else
                    {
                        if (cursorCoordLv1.Y == 0)
                        {
                            text = ShipInventoryManager.GetAvailablePrimaryWeapons(1)[i].Name;
                        }
                        else
                        {
                            text = ShipInventoryManager.GetAvailablePrimaryWeapons(2)[i].Name;
                        }
                    }
                }
                else
                {
                    text = "Back";
                }

                if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(16), text,
                                                   new Vector2(Game1.ScreenSize.X / 2 + 50, 93 + i * 23), Vector2.Zero, false))
                {
                    cursorLevel2Position = i;

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        if (cursorLevel2Position < listLength)
                        {
                            OnPressLevel2();
                        }
                        else
                        {
                            cursorLevel     = 1;
                            elapsedSinceKey = 0;
                        }
                    }
                }
            }
        }