Exemple #1
0
    private void OnAbilityClick(Ability ab)
    {
        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default);
        if (ab != null)
        {
            abilityInfoImage.sprite         = Resources.Load <Sprite>(ab.image);
            abilityInfoNameText.text        = AbilitySystem.GetAbilityName(ab.id);
            abilityInfoDescriptionText.text = AbilitySystem.GetAbilityDescription(ab.powerType, (ab.power * ab.level));


            abilityInfoNameText.enabled        = true;
            abilityInfoDescriptionText.enabled = true;

            if (abilityInfoImage.GetComponentInParent <AiryUIAnimatedElement>() != null)
            {
                abilityInfoImage.GetComponentInParent <AiryUIAnimatedElement>().ShowElement();
            }


            if (abilityTotalStatText != null)
            {
                AbilitySystem.SetAbilityStats();
                abilityTotalStatText.text = AbilitySystem.GetAllAbilityStatToString();
            }
        }
    }
Exemple #2
0
    private void Start()
    {
        if (abilitySlotPrefab != null)
        {
            foreach (var ab in AbilitySystem.GetAllAbilities())
            {
                GameObject abObj = Instantiate(abilitySlotPrefab, PanelAbilitys[ab.id % 3].transform);
                if (AbilitySystem.isAbleAbility(ab.id))
                {
                    Ability userAbility = AbilitySystem.GetUserAbility(ab.id);
                    abObj.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>(userAbility.image);
                    abObj.transform.GetComponentInChildren <Text>().text      = userAbility.level.ToString();
                    abObj.transform.GetComponentInChildren <Text>().enabled   = true;
                    abObj.GetComponent <Button>().onClick.RemoveAllListeners();
                    abObj.GetComponent <Button>().onClick.AddListener(delegate
                    {
                        OnAbilityClick(userAbility);
                    });
                    abilityList.Add(userAbility);
                }
                else
                {
                    abObj.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("UI/ui_ability_lock");
                    abObj.transform.GetComponentInChildren <Text>().enabled   = false;
                    abilityList.Add(ab);
                }
                abilitySlotList.Add(abObj);
            }

            if (abilityTotalStatText != null)
            {
                AbilitySystem.SetAbilityStats();
                abilityTotalStatText.text = AbilitySystem.GetAllAbilityStatToString();
            }

            if (scrollCountText != null)
            {
                scrollCountText.text = Common.GetThousandCommaText(ItemSystem.GetUserScrollCount());
            }
        }
    }
Exemple #3
0
    private void RefreshUI()
    {
        abilityList.Clear();
        foreach (var ab in AbilitySystem.GetAllAbilities())
        {
            abilityList.Add(ab);
        }
        if (abilitySlotList != null)
        {
            for (var i = 0; i < abilitySlotList.Count; i++)
            {
                if (AbilitySystem.isAbleAbility(abilityList[i].id))
                {
                    Ability userAb = AbilitySystem.GetUserAbility(abilityList[i].id);
                    abilitySlotList[i].transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>(userAb.image);
                    abilitySlotList[i].GetComponent <Button>().onClick.RemoveAllListeners();
                    int abIndex = i;
                    userAb = AbilitySystem.GetUserAbility(abilityList[abIndex].id);
                    abilitySlotList[i].transform.GetComponentInChildren <Text>().text = userAb.level.ToString();

                    abilitySlotList[i].transform.GetComponentInChildren <Text>().enabled = true;
                    abilitySlotList[i].GetComponent <Button>().onClick.RemoveAllListeners();
                    abilitySlotList[i].GetComponent <Button>().onClick.AddListener(delegate
                    {
                        OnAbilityClick(abilityList[abIndex]);
                    });
                }
            }
        }

        if (abilityTotalStatText != null)
        {
            AbilitySystem.SetAbilityStats();
            abilityTotalStatText.text = AbilitySystem.GetAllAbilityStatToString();
        }

        if (scrollCountText != null)
        {
            scrollCountText.text = Common.GetThousandCommaText(ItemSystem.GetUserScrollCount());
        }
    }