Example #1
0
        private static void SpecificEquipPageControls(Actions.ActionKey key)
        {
            if (key.actionIndentifierString.Equals(Game1.cameraMoveDownString) && ((float)((float)-GameMenuHandler.verticalModifier / (float)GameMenuHandler.maxVertical)) <= 1)
            {
                GameMenuHandler.verticalModifier -= 4;
            }

            if (key.actionIndentifierString.Equals(Game1.cameraMoveUpString) && ((float)((float)-GameMenuHandler.verticalModifier / (float)GameMenuHandler.maxVertical)) >= 0)
            {
                GameMenuHandler.verticalModifier += 4;
            }

            if (KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.cancelString) && !KeyboardMouseUtility.AnyButtonsPressed())
            {
                GameMenuHandler.EquipmentTabRightClick();
                KeyboardMouseUtility.bPressed = true;
            }

            if (KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed())
            {
                GameMenuHandler.EquipmentTabLeftClick();
            }

            if (!GameMenuHandler.bDisplayOptions && GameMenuHandler.selectedEquipmentPieceCharacterPanel == null)
            {
                int  index   = PlayerSaveData.heroParty.IndexOf(GameMenuHandler.selectedCharacterEquipment);
                bool bChange = false;

                if (key.actionIndentifierString.Equals(Game1.moveUpString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    index  -= 1;
                    bChange = true;
                }

                if (key.actionIndentifierString.Equals(Game1.moveDownString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    index  += 1;
                    bChange = true;
                }


                if (key.actionIndentifierString.Equals(Game1.cancelString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.selectedCharacterEquipment = null;
                    KeyboardMouseUtility.bPressed = true;
                }



                if (bChange)
                {
                    if (index <= -1)
                    {
                        GameMenuHandler.selectedCharacterEquipment = PlayerSaveData.heroParty[PlayerSaveData.heroParty.Count - 1];
                        GameMenuHandler.verticalModifier           = (-GameMenuHandler.maxVertical / PlayerSaveData.heroParty.Count) * (PlayerSaveData.heroParty.Count - 1);
                    }
                    else if (index >= PlayerSaveData.heroParty.Count)
                    {
                        GameMenuHandler.selectedCharacterEquipment = null;
                    }
                    else
                    {
                        GameMenuHandler.selectedCharacterEquipment = PlayerSaveData.heroParty[index];
                        GameMenuHandler.verticalModifier           = (-GameMenuHandler.maxVertical / PlayerSaveData.heroParty.Count) * index;
                    }
                }
            }

            if (!GameMenuHandler.bDisplayOptions && GameMenuHandler.selectedCharacterEquipment != null && GameMenuHandler.selectedEquipmentPiece == null)
            {
                if (!KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.tabKeyString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    if (GameMenuHandler.selectedCharacterEquipment.weapon != GameMenuHandler.selectedEquipmentPieceCharacterPanel)
                    {
                        GameMenuHandler.selectedEquipmentPieceCharacterPanel = GameMenuHandler.selectedCharacterEquipment.weapon;
                        GameMenuHandler.bWeaponTab                    = true;
                        GameMenuHandler.EquipmentCurrentPage          = 1;
                        GameMenuHandler.bDisplayOptions               = false;
                        GameMenuHandler.equipmentOptionSelectionIndex = 0;
                        GameMenuHandler.selectedEquipmentPiece        = null;
                        GameMenuHandler.RegenerateEquipList();
                    }
                    else
                    {
                        GameMenuHandler.selectedEquipmentPieceCharacterPanel = GameMenuHandler.selectedCharacterEquipment.armour;
                        GameMenuHandler.bWeaponTab                    = false;
                        GameMenuHandler.EquipmentCurrentPage          = 1;
                        GameMenuHandler.bDisplayOptions               = false;
                        GameMenuHandler.equipmentOptionSelectionIndex = 0;
                        GameMenuHandler.selectedEquipmentPiece        = null;
                        GameMenuHandler.RegenerateEquipList();
                    }
                }

                if (key.actionIndentifierString.Equals(Game1.cancelString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.selectedEquipmentPieceCharacterPanel = null;
                    KeyboardMouseUtility.bPressed = true;
                }
            }

            if (!GameMenuHandler.bDisplayOptions && GameMenuHandler.selectedCharacterEquipment != null && GameMenuHandler.selectedEquipmentPieceCharacterPanel != null ||
                (!GameMenuHandler.bDisplayOptions && GameMenuHandler.selectedCharacterEquipment != null && GameMenuHandler.bWeaponTab && GameMenuHandler.selectedCharacterEquipment.weapon == null) ||
                (!GameMenuHandler.bDisplayOptions && GameMenuHandler.selectedCharacterEquipment != null && !GameMenuHandler.bWeaponTab && GameMenuHandler.selectedCharacterEquipment.armour == null))
            {
                if (key.actionIndentifierString.Equals(Game1.cancelString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.selectedEquipmentPiece = null;
                    KeyboardMouseUtility.bPressed          = true;
                }

                if (!KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.EquipmentShowChoices(GameMenuHandler.equipmentItems.IndexOf(GameMenuHandler.selectedEquipmentPiece));
                    KeyboardMouseUtility.bPressed = true;
                }

                int  index   = GameMenuHandler.equipmentItems.IndexOf(GameMenuHandler.selectedEquipmentPiece);
                bool bChange = false;

                if (key.actionIndentifierString.Equals(Game1.moveUpString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    index  -= 6;
                    bChange = true;
                }

                if (key.actionIndentifierString.Equals(Game1.moveDownString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    index  += 6;
                    bChange = true;
                }

                if (key.actionIndentifierString.Equals(Game1.moveLeftString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    index--;
                    bChange = true;
                }

                if (key.actionIndentifierString.Equals(Game1.moveRightString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    index++;
                    bChange = true;
                }

                if (bChange)
                {
                    if (index < 0)
                    {
                        if (GameMenuHandler.EquipmentMaxPage != 0 && GameMenuHandler.EquipmentCurrentPage >= 0)
                        {
                            GameMenuHandler.EquipmentCurrentPage--;
                            index = GameMenuHandler.equipmentItems.Count - 1;
                            if (GameMenuHandler.EquipmentCurrentPage == 0 - 1)
                            {
                                GameMenuHandler.EquipmentCurrentPage = GameMenuHandler.EquipmentMaxPage;
                                GameMenuHandler.RegenerateItemList();
                                index = GameMenuHandler.equipmentItems.Count - 1;
                            }
                        }
                        else
                        {
                            GameMenuHandler.EquipmentCurrentPage = 0;
                            GameMenuHandler.RegenerateItemList();
                            index = GameMenuHandler.equipmentItems.Count - 1;
                        }
                    }
                    else if (index >= GameMenuHandler.equipmentItems.Count)
                    {
                        if (GameMenuHandler.EquipmentMaxPage != 0 && GameMenuHandler.EquipmentCurrentPage != GameMenuHandler.EquipmentMaxPage)
                        {
                            GameMenuHandler.EquipmentCurrentPage++;
                            GameMenuHandler.RegenerateItemList();
                            index = 0;
                        }
                        else
                        {
                            GameMenuHandler.EquipmentCurrentPage = 0;
                            GameMenuHandler.RegenerateItemList();

                            index = 0;
                        }
                    }

                    if (bChange && GameMenuHandler.equipmentItems.Count != 0)
                    {
                        GameMenuHandler.selectedEquipmentPiece = GameMenuHandler.equipmentItems[index];
                        GameMenuHandler.selectedItemHighlighterPosition.Location = GameMenuHandler.equipmentItemBoxes[index].Location;
                        GameMenuHandler.equipmentDisplay.Generate(index);
                        //GameMenuHandler.SelectItemViaKeyboard(GameMenuHandler.itemPageSelectedItem, index);
                    }
                }
            }

            if (GameMenuHandler.bDisplayOptions && GameMenuHandler.selectedCharacterEquipment != null && GameMenuHandler.selectedEquipmentPiece != null)
            {
                if (key.actionIndentifierString.Equals(Game1.moveUpString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.equipmentOptionSelectionIndex--;
                }

                if (key.actionIndentifierString.Equals(Game1.moveDownString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.equipmentOptionSelectionIndex++;
                }


                if (GameMenuHandler.equipmentOptionSelectionIndex == EquipmentOptionDisplay.choiceBoxes.Count)
                {
                    GameMenuHandler.equipmentOptionSelectionIndex = 0;
                }

                if (GameMenuHandler.equipmentOptionSelectionIndex < 0)
                {
                    GameMenuHandler.equipmentOptionSelectionIndex = EquipmentOptionDisplay.choiceBoxes.Count - 1;
                }

                if (!KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.cancelString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.bDisplayOptions = false;
                    KeyboardMouseUtility.bPressed   = true;
                }

                if (!KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.EquipChoiceConfirm();
                }
            }

            if (GameMenuHandler.selectedCharacterEquipment == null && GameMenuHandler.selectedCharacterEquipment == null)
            {
                if (key.actionIndentifierString.Equals(Game1.tabKeyString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.TabClick();
                }
            }
        }