Пример #1
0
    public void PutItemBackBeforeSave()
    {
        PartyMember member = partyPanel.LookUpSelectedPartyMember();

        if (IsAnItemSelected())
        {
            GiveItem(selectedItem.item);

            if (member != null)
            {
                int i = 0;
                foreach (Item item in member.GetEquipment())
                {
                    if (item != null && item == selectedItem.item)
                    {
                        member.equipment[i] = null;
                        break;
                    }
                    i++;
                }
            }
        }
        selectedItem.DirectlyNullifyItem();
    }
    public void Populate()
    {
        partyMember = partyPanel.LookUpSelectedPartyMember();
        buttonList.ForEach(button => {
            Destroy(button.gameObject);
        });
        buttonList.Clear();

        foreach (var multiplier in partyMember.upgradePointsDictionary)
        {
            Button button = Instantiate <Button>(upgradePointButton, this.transform);
            buttonList.Add(button);
            UpdateButtonLabel(button, multiplier.Key.ToString(), multiplier.Value.ToString());
            button.GetComponent <Button>().onClick.AddListener(() => {
                string key = multiplier.Key.ToString();
                partyMember.upgradePointsDictionary[key]++;
                UpdateButtonLabel(button, key, partyMember.upgradePointsDictionary[key].ToString());
                partyMember.SpendUpgradePoint();

                characterController.ApplyUpgradePoint(key, (BattleCharacter)partyMember);
                playerInfoPanel.Populate(partyMember.characterName);
            });
        }
    }