示例#1
0
    public Vault()
    {
        Title = string.Format(TITLE_FORMAT, level);

        (label = Add <TextLabel>())
        .SetText(LABEL_FORMAT, coinModifier)
        .SetSize(88, 8)
        ;

        (upgradeButton = Add <BuyButton>())
        .SetCost(upgradeCost)
        .SetSize(88, 12)
        .Add <TextLabel>().SetText(UPGRADE_FORMAT, upgradeCost).Center();
        ;

        Pack();

        upgradeButton.OnPressed += () =>
        {
            if (Computer.Coin.Pay(upgradeCost))
            {
                level++;
                Title = string.Format(TITLE_FORMAT, level);

                Computer.Coin.ModifyMax(coinModifier);
                coinModifier *= 2;
                label.SetText(LABEL_FORMAT, coinModifier);

                upgradeCost *= 2;
                upgradeButton.SetCost(upgradeCost);
                upgradeButton.Get <TextLabel>().SetText(UPGRADE_FORMAT, upgradeCost);
            }
        };
    }
示例#2
0
文件: Mine.cs 项目: jlauener/BitCrypt
    private void Upgrade()
    {
        if (Computer.Coin.Pay(upgradeCost))
        {
            level++;
            Title = string.Format(TITLE_FORMAT, level);

            Coin.ModifyMax(Coin.Max);
            CoinPerSec *= 1.5f;
            coinPerSecLabel.SetText(COIN_PER_SEC_FORMAT, CoinPerSec);

            upgradeCost *= 2;
            upgradeButton.SetCost(upgradeCost);
            upgradeButton.Get <TextLabel>().SetText(UPGRADE_FORMAT, upgradeCost);
        }
    }