コード例 #1
0
    public virtual void SetButtonInfo()
    {
        switch (exportedButtonMode)
        {
        case b.Dmg:
            name.Text      = "Damage";
            stat.Text      = "DPS";
            image.Texture  = GD.Load <Texture>("res://assets/abilities/fire.png");
            statButtonMode = Enums.Stats.Dmg;
            break;

        case b.Def:
            name.Text      = "Defense";
            stat.Text      = "x";
            image.Texture  = GD.Load <Texture>("res://assets/abilities/health.png");
            statButtonMode = Enums.Stats.Def;
            break;

        case b.Speed:
            name.Text      = "Speed";
            stat.Text      = "KM/h";
            image.Texture  = GD.Load <Texture>("res://assets/abilities/speed.png");
            statButtonMode = Enums.Stats.Speed;
            break;

        case b.Special:
            statButtonMode = Enums.Stats.Special;

            if (!dinoInfo.HasSpecial())
            {
                Hide();
                break;
            }

            name.Text    = "Special";
            stat.Text    = "";
            statNum.Text = "";

            // get the current special ability type using the info about the current dino screen we're on (shopinfo.shopdino)
            // then get the icon using that special ability type
            var ability = DinoInfo.Instance.dinoTypesAndAbilities[ShopInfo.shopDino];
            image.Texture = DinoInfo.Instance.specialAbilityIcons[ability];

            break;
        }
        infoSet = true;

        if (statButtonMode == Enums.Stats.Special)
        {
            statNum.Text = dinoInfo.GetSpecial();
        }
        else
        {
            statNum.Text = dinoInfo.GetStat(statButtonMode).ToString();
        }


        List <int> cost = dinoInfo.GetNextUpgradeCost(statButtonMode);

        goldCost = cost[0];
        geneCost = cost[1];
    }