Files
OpenRA/OpenRa.TechTreeTest/Form1.cs
beedee 3f052e425f Buildings now aware of what race they are owned by
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1134 993157c7-ee19-0410-b2c4-bb4e9862e678
2007-07-07 07:57:07 +00:00

47 lines
879 B
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace OpenRa.TechTreeTest
{
public partial class Form1 : Form
{
TechTree techTree = new TechTree();
public Form1()
{
InitializeComponent();
RefreshList();
}
void RefreshList()
{
buildableItems.Controls.Clear();
foreach (Building b in techTree.BuildableItems)
{
PictureBox box = new PictureBox();
box.SizeMode = PictureBoxSizeMode.AutoSize;
box.Image = b.Icon;
toolTip1.SetToolTip(box, b.Tag + "\n" + b.Owner.ToString());
buildableItems.Controls.Add(box);
Building k = b;
box.Click += delegate { Build(k); };
}
}
void Build(Building b)
{
techTree.Build(b.Tag);
RefreshList();
}
}
}