Exemple #1
0
        private static void SpecificItemPageControls(ActionKey key)
        {
            if (!GameMenuHandler.bChooseCharacterToUseOn)
            {
                if (key.actionIndentifierString.Equals(Game1.tabKeyString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.TabClick();
                }

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


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

                if (GameMenuHandler.bDisplayOptions)
                {
                    if (key.actionIndentifierString.Equals(Game1.moveUpString) && !KeyboardMouseUtility.AnyButtonsPressed())
                    {
                        GameMenuHandler.itemOptionSelectionIndex--;
                    }

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

                    if (GameMenuHandler.itemOptionSelectionIndex == ItemOptionDisplay.choiceBoxes.Count)
                    {
                        GameMenuHandler.itemOptionSelectionIndex = 0;
                    }

                    if (GameMenuHandler.itemOptionSelectionIndex < 0)
                    {
                        GameMenuHandler.itemOptionSelectionIndex = ItemOptionDisplay.choiceBoxes.Count - 1;
                    }

                    if (!KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed())
                    {
                        GameMenuHandler.SelectItemOptionViaKeyboardDisplay();
                    }
                }
                else if (!GameMenuHandler.bDisplayOptions)
                {
                    int  index   = GameMenuHandler.onlyTheseItemsToConsider.IndexOf(GameMenuHandler.itemPageSelectedItem);
                    bool bChange = false;

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

                    if (key.actionIndentifierString.Equals(Game1.moveDownString) && !KeyboardMouseUtility.AnyButtonsPressed())
                    {
                        index  += 10;
                        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 (!KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed())
                    {
                        GameMenuHandler.SelectItemViaKeyboardDisplayOptions();
                    }


                    if (bChange)
                    {
                        if (index < 0)
                        {
                            if (GameMenuHandler.maxUpperPage != 0 && GameMenuHandler.upperCurrentIndex >= 0)
                            {
                                GameMenuHandler.upperCurrentIndex--;
                                GameMenuHandler.RegenerateItemList();
                                index = GameMenuHandler.onlyTheseItemsToConsider.Count - 1;
                                if (GameMenuHandler.upperCurrentIndex == 0 - 1)
                                {
                                    GameMenuHandler.upperCurrentIndex = GameMenuHandler.maxUpperPage;
                                    GameMenuHandler.RegenerateItemList();
                                    index = GameMenuHandler.onlyTheseItemsToConsider.Count - 1;
                                }
                            }
                            else
                            {
                                GameMenuHandler.upperCurrentIndex = 0;
                                GameMenuHandler.RegenerateItemList();
                                index = GameMenuHandler.onlyTheseItemsToConsider.Count - 1;
                            }
                        }
                        else if (index >= GameMenuHandler.onlyTheseItemsToConsider.Count)
                        {
                            if (GameMenuHandler.maxUpperPage != 0 && GameMenuHandler.upperCurrentIndex != GameMenuHandler.maxUpperPage)
                            {
                                GameMenuHandler.upperCurrentIndex++;
                                GameMenuHandler.RegenerateItemList();
                                index = 0;
                            }
                            else
                            {
                                GameMenuHandler.upperCurrentIndex = 0;
                                GameMenuHandler.RegenerateItemList();
                                index = 0;
                            }
                        }

                        if (bChange && GameMenuHandler.onlyTheseItemsToConsider.Count != 0)
                        {
                            GameMenuHandler.itemPageSelectedItem = GameMenuHandler.onlyTheseItemsToConsider[index];
                            GameMenuHandler.SelectItemViaKeyboard(GameMenuHandler.itemPageSelectedItem, index);
                        }
                    }
                }
            }
            else if (GameMenuHandler.bChooseCharacterToUseOn)
            {
                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 && KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    GameMenuHandler.itemsTabLeftClickCharacter();
                }

                if (key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed())
                {
                    if (GameMenuHandler.selectedCharacterItems != null)
                    {
                        GameMenuHandler.UseItemOnViaKeyboard();
                    }
                }

                int  index   = PlayerSaveData.heroParty.IndexOf(GameMenuHandler.selectedCharacterItems);
                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 (bChange)
                {
                    if (index <= -1)
                    {
                        GameMenuHandler.selectedCharacterItems = null;
                    }
                    else if (index >= PlayerSaveData.heroParty.Count)
                    {
                        GameMenuHandler.selectedCharacterItems = null;
                    }
                    else
                    {
                        GameMenuHandler.selectedCharacterItems = PlayerSaveData.heroParty[index];
                        GameMenuHandler.verticalModifier       = (-GameMenuHandler.maxVertical / PlayerSaveData.heroParty.Count) * index;
                    }
                }
            }
        }