예제 #1
0
        // Depending on what menu we are in, we update what is currently displayed after we scroll on something
        private void UpdateMenuContext()
        {
            switch (currentState)
            {
            case MenuStates.ITEM:
                // We update the item description
                if (currentSubMenuState == SubMenuStates.HIDDEN)
                {
                    if (currentMenuIndex < playerInventory.GetItemInventorySize())
                    {
                        itemMenuObject.transform.GetChild(2).GetComponentInChildren <TextMeshProUGUI>().text = playerInventory.GetItemAtIndex(currentMenuIndex).SpecifiedItem.itemDescription;
                    }
                }
                else if (currentSubMenuState == SubMenuStates.SUB1)
                {
                    InventoryParty currParty = playerInventory.GetInventoryCharacterAtIndex(currentMenuIndex);
                    itemMenuObject.transform.GetChild(2).GetComponentInChildren <TextMeshProUGUI>().text = "Select a target to use this on.";
                    itemMenuObject.transform.GetChild(3).GetComponentInChildren <TextMeshProUGUI>().text = "HP: " + currParty.CurrentHealthPoints + "/" + currParty.ReturnModdedStat("MaxHP") +
                                                                                                           "\nSP: " + currParty.CurrentSkillPoints + "/" + currParty.ReturnModdedStat("MaxSP");
                }
                break;

            case MenuStates.PARTY:
                // We update the party description
                if (currentMenuIndex < playerInventory.GetPartyInvetorySize())
                {
                    partyMenuObject.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().text = playerInventory.GetInventoryCharacterAtIndex(currentMenuIndex).SpecifiedCharacter.characterName;
                }
                break;

            case MenuStates.GEAR:
                // We update the gear description
                if (currentMenuIndex < playerInventory.GetGearInventorySize())
                {
                    gearMenuObject.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().text = playerInventory.GetGearAtIndex(currentMenuIndex).SpecifiedGear.gearDescription;
                }
                break;

            case MenuStates.LINK:
                // We update the link description
                if (currentMenuIndex < playerInventory.GetLinkInventorySize())
                {
                    linkMenuObject.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().text = playerInventory.GetLinkAtIndex(currentMenuIndex).SpecifiedLink.linkDescription;
                }
                break;
            }
        }
예제 #2
0
        // We fill in all of the items in the sub menus
        // An overloaded method
        private void FillSubMenu()
        {
            int currIndex = 0;

            while (currIndex < playerInventory.GetItemInventorySize())
            {
                ItemData currItem = playerInventory.GetItemAtIndex(currIndex).SpecifiedItem;
                if (currItem.itemType != ItemType.KEY_ITEM)
                {
                    currentMenuParent.GetChild(currIndex).GetComponent <TextMeshProUGUI>().text = currItem.itemName;
                    currentMenuParent.GetChild(currIndex).gameObject.SetActive(true);
                    ++currIndex;
                }
            }
        }