コード例 #1
0
    void SetUpgradeCost()
    {
        UpgradeInfo dinoInfo = DinoInfo.Instance.GetDinoInfo(ShopInfo.shopDino);

        if (dinoInfo.IsMaxedOut(buttonMode))
        {
            this.Hide();
        }

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

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

        string goldPic = "[img=<40>]res://assets/icons/coins.png[/img]";
        string genePic = "[img=<25>]res://assets/icons/dna.png[/img]";

        string goldText = goldCost.ToString();
        string geneText = geneCost.ToString();

        if (goldCost > PlayerStats.gold)
        {
            goldText = String.Format("[color=#ff0000] {0} [/color]", goldText);
        }
        if (geneCost > PlayerStats.genes)
        {
            geneText = String.Format("[color=#ff0000] {0} [/color]", geneText);
        }

        BbcodeText = String.Format("{0}{1}  {2}{3}", new string[] { goldPic, goldText, genePic, geneText });
    }
コード例 #2
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];
    }