Exemplo n.º 1
0
 private void MouseControls()
 {
     for (int i = 0; i < menuOptions.Count; i++)
     {
         if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14), menuOptions[i],
                                            new Vector2(menuOptionOrigin.X + i * menuOptionXDistance,
                                                        menuOptionOrigin.Y + i * menuOptionYDistance) + FontManager.FontOffsetStatic,
                                            screenPosition, this is SelectionMenu))
         {
             if (ControlManager.IsMouseMoving())
             {
                 cursorIndex = i;
             }
         }
     }
 }
        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();
                    }
                }
            }
        }
Exemplo n.º 3
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;
                    }
                }
            }
        }
Exemplo n.º 4
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();
                    }
                }
            }
        }
        public override void Update(GameTime gameTime)
        {
            if (BaseState.GetBase() != null)
            {
                availableMissions = MissionManager.ReturnAvailableMissions(BaseState.GetBase().name);
            }

            if (BaseStateManager.ButtonControl.Equals(ButtonControl.Mission) ||
                BaseStateManager.ButtonControl.Equals(ButtonControl.Response))
            {
                missionCursor.isActive  = true;
                missionCursor.isVisible = true;
            }

            else
            {
                missionCursor.isActive  = false;
                missionCursor.isVisible = false;
            }


            if (BaseStateManager.ButtonControl == ButtonControl.Mission)
            {
                //Moves button cursor right when pressing up.
                if (ControlManager.CheckPress(RebindableKeys.Up))
                {
                    missionCursorIndex--;
                }

                //Moves button cursor left when pressing down
                else if (ControlManager.CheckPress(RebindableKeys.Down))
                {
                    missionCursorIndex++;
                }

                if (MissionCursorIndex > availableMissions.Count)
                {
                    missionCursorIndex = 0;
                }

                else if (MissionCursorIndex < 0)
                {
                    missionCursorIndex = availableMissions.Count;
                }

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

                    if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14), text,
                                                       new Vector2(Game1.ScreenSize.X / 2,
                                                                   Game1.ScreenSize.Y / 2 - 40 + (20 * (i + (i == availableMissions.Count ? 1 : 0)))
                                                                   + FindTextBoxWithText(text).TextBoxRect.Height)))
                    {
                        if (ControlManager.IsMouseMoving())
                        {
                            missionCursorIndex = i;
                        }
                    }
                }

                if (availableMissions.Count > 0 && missionCursorIndex != availableMissions.Count)
                {
                    selectedMission = availableMissions[MissionCursorIndex];
                }
            }

            else if (BaseStateManager.ButtonControl == ButtonControl.Response)
            {
                //Moves button cursor right when pressing up.
                if (ControlManager.CheckPress(RebindableKeys.Up))
                {
                    responseCursorIndex--;
                }

                //Moves button cursor left when pressing down
                else if (ControlManager.CheckPress(RebindableKeys.Down))
                {
                    responseCursorIndex++;
                }

                if (MissionManager.MissionResponseBuffer.Count <= 0)
                {
                    if (ControlManager.IsMouseOverArea(new Rectangle(
                                                           BaseStateManager.ResponseRectangles[0].X - (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).X / 2,
                                                           BaseStateManager.ResponseRectangles[0].Y + BaseStateManager.ResponseRectangles[0].Height / 2,
                                                           (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).X,
                                                           (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).Y)))
                    {
                        responseCursorIndex = 0;
                    }

                    else if (ControlManager.IsMouseOverArea(new Rectangle(
                                                                BaseStateManager.ResponseRectangles[1].X - (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).X / 2,
                                                                BaseStateManager.ResponseRectangles[1].Y + BaseStateManager.ResponseRectangles[1].Height / 2,
                                                                (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).X,
                                                                (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).Y)))
                    {
                        responseCursorIndex = 1;
                    }

                    if (responseCursorIndex > 1)
                    {
                        responseCursorIndex = 0;
                    }

                    else if (responseCursorIndex < 0)
                    {
                        responseCursorIndex = 1;
                    }
                }

                else
                {
                    for (int i = 0; i < MissionManager.MissionResponseBuffer.Count; i++)
                    {
                        if (ControlManager.IsMouseOverArea(new Rectangle(
                                                               BaseStateManager.ResponseRectangles[i].X - (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).X / 2,
                                                               BaseStateManager.ResponseRectangles[i].Y + BaseStateManager.ResponseRectangles[i].Height / 2,
                                                               (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).X,
                                                               (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).Y)))
                        {
                            responseCursorIndex = i;
                        }
                    }

                    if (responseCursorIndex > MissionManager.MissionResponseBuffer.Count - 1)
                    {
                        responseCursorIndex = 0;
                    }

                    else if (responseCursorIndex < 0)
                    {
                        responseCursorIndex = MissionManager.MissionResponseBuffer.Count - 1;
                    }
                }
            }

            if (BaseStateManager.ButtonControl != ButtonControl.Response &&
                ControlManager.CheckPress(RebindableKeys.Pause))
            {
                SkipMissionText();
            }
            else
            {
                base.Update(gameTime);
            }
        }
        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;
                        }
                    }
                }
            }
        }
Exemplo n.º 7
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);
                }
            }
        }