Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="towerName">tower name</param>
        public TowerEditor(string towerName)
        {
            InitializeComponent();

            // Draw the tower
            TowerManager tower = new TowerManager(this);
            tower.Draw(towerName, 0);

            // Set fields
            this.tower = TowerData.GetTower(towerName);
            this.tower.name = towerName;

            // Set labels' text
            costBox.Text = this.tower.buildCost.ToString();
            valueBox.Text = this.tower.sellValue.ToString();
            damageBox.Text = this.tower.damage.ToString();
            rangeBox.Text = this.tower.range.ToString();
            delayBox.Text = this.tower.delay.ToString();
            aoeRadiusBox.Text = this.tower.aoeRadius.ToString();
            aoeDamageBox.Text = this.tower.aoeDamage.ToString();
            aoeStatusComboBox.SelectedIndex = this.tower.aoeStatus ? 0 : 1;
            moneyPerAttackBox.Text = this.tower.moneyPerAttack.ToString();
            moneyPerKillBox.Text = this.tower.moneyPerKill.ToString();
            moneyPerTickBox.Text = this.tower.moneyPerTick.ToString();
            moneyPerWaveBox.Text = this.tower.moneyPerWave.ToString();

            // Setup the status combo box
            statusComboBox.Items.Add("None");
            statusComboBox.SelectedIndex = 0;
            string[] statusNames = StatusData.GetStatusNames();
            foreach (string s in statusNames)
            {
                statusComboBox.Items.Add(s);
                if (this.tower.status.Equals(s))
                    statusComboBox.SelectedItem = s;
            }

            // Setup the upgrade combo box
            upgradeComboBox.Items.Add("<None>");
            upgradeComboBox.SelectedIndex = 0;
            foreach (string s in TowerData.GetTowerNames())
                if (!s.Equals(this.tower.name))
                {
                    upgradeComboBox.Items.Add(s);
                    if (this.tower.baseTower.Equals(s))
                        upgradeComboBox.SelectedItem = s;
                }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public TowerSelection()
        {
            InitializeComponent();

            cursor = ControlManager.CreateCanvas(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\TowerHaven\\Marker", 8, 4, 8);
            grid1.Children.Add(cursor);
            string[] towerNames = TowerData.GetTowerNames();
            int index = 0;
            TowerManager tower = new TowerManager(this);

            // Add tower labels
            foreach (string s in towerNames)
            {
                tower.Draw(s, index);
                Label label = ControlManager.CreateLabel(s, 50, 20 * index - 5);
                label.MouseLeftButtonDown += TowerName_Click;
                grid1.Children.Add(label);
                index++;
            }
        }