예제 #1
0
        private void SetText(KeyValuePair <BuildingType, BuyButtonData> buttonData, AbstractBuildingTile tile)
        {
            BuildingData[] data = tile.GetBuildingData(buttonData.Key);

            // Type
            if (typeTextWriter == null)
            {
                typeTextWriter = new StringVariableWriter(buttonData.Value.Text.Type.text);
            }

            string type = LanguageUtil.GetJsonString(buttonData.Key.ToString().ToUpper());

            buttonData.Value.Text.Type.text = typeTextWriter.UpdateText(type);

            // Price
            buttonData.Value.Text.Price.text = string.Format(GetString(priceKey), data[0].Price);

            // Health
            buttonData.Value.Text.Health.text = string.Format(GetString(healthKey), data[0].MaxHealth);

            // Rent
            float rentPerMinute          = 60.0f / data[0].SecondsPerRent;
            float rentcollectionsPerHour = rentPerMinute * 60.0f;

            buttonData.Value.Text.Rent.text = string.Format(GetString(rentKey), data[0].Rent * rentcollectionsPerHour);

            // Upgrades
            buttonData.Value.Text.Upgrades.text = string.Format(GetString(upgradeKey), data.Length);
        }