annotate Widgets/UnitDisplayWidget.cs @ 0:1bb28f84d567

Initial commit of WarFoundry code
author IBBoard <dev@ibboard.co.uk>
date Fri, 19 Dec 2008 15:57:51 +0000
parents
children 65279b85446f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // UnitDisplayWidget.cs
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // Copyright (C) 2008 IBBoard
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 //
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 // This library is free software; you can redistribute it and/or
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 // modify it under the terms of the GNU Lesser General Public
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 // License version 2.1 of the License as published by the Free
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 // Software Foundation.
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 //
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 // This library is distributed in the hope that it will be useful,
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 // Lesser General Public License for more details.
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 //
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 // You should have received a copy of the GNU Lesser General Public
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 // License along with this library; if not, write to the Free Software
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 //
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 //
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 using System;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 using Gtk;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 using IBBoard.Commands;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 using IBBoard.Lang;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 using IBBoard.WarFoundry.API;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 using IBBoard.WarFoundry.API.Objects;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 using IBBoard.WarFoundry.API.Commands;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 namespace IBBoard.WarFoundry.Widgets
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 public partial class UnitDisplayWidget : Gtk.Bin
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 private IBBoard.WarFoundry.API.Objects.Unit unit;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 private CommandStack stack;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 public UnitDisplayWidget(IBBoard.WarFoundry.API.Objects.Unit sourceUnit, CommandStack commandStack)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 this.Build();
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 stack = commandStack;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 unit = sourceUnit;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 unitName.Text = unit.Name;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 unitSize.Value = unit.Size;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 double max = unit.UnitType.MaxSize;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 if (max == -1)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 max = double.MaxValue;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 unitSize.SetRange(unit.UnitType.MinSize, max);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 unit.NameChanged+= new StringValChangedDelegate(UnitNameChanged);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52 unit.UnitSizeChanged+= new IntValChangedDelegate(UnitSizeChanged);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 SetStats();
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56 private void SetStats()
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
58 //GameSystem system = unit.Army.GameSystem;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
59 //SystemStats stats = system.StandardSystemStats;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
60 Stats stats = unit.UnitType.UnitStats;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
61 CellRendererText renderer = new CellRendererText();
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
62 unitStats.AppendColumn(Translation.GetTranslation("UnitNameColumn", "Unit Type", null), renderer, new TreeCellDataFunc(RenderUnitName));
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
63
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
64 TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66 int length = stats.StatCount;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68 for (int i = 0; i < length; i++)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
70 unitStats.AppendColumn(stats[i].ParentSlot.Name, renderer, statFunc);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
71 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
72
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
73 TreeStore model = new TreeStore(typeof(IBBoard.WarFoundry.API.Objects.Unit));
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
74 model.AppendValues(unit);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
75 unitStats.Model = model;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
76 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
77
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
78 private void RenderUnitName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
79 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
80 object o = model.GetValue(iter, 0);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
81
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
82 if (o is IBBoard.WarFoundry.API.Objects.Unit)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
83 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
84 IBBoard.WarFoundry.API.Objects.Unit u = (IBBoard.WarFoundry.API.Objects.Unit)o;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
85 (cell as CellRendererText).Text = u.UnitType.Name;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
86 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
87 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
88
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
89 private void RenderUnitStat(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
90 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
91 object o = model.GetValue(iter, 0);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
92
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
93 if (o is IBBoard.WarFoundry.API.Objects.Unit)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
94 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
95 IBBoard.WarFoundry.API.Objects.Unit u = (IBBoard.WarFoundry.API.Objects.Unit)o;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
96 //TODO Check for correct value based on the column
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
97 (cell as CellRendererText).Text = u.UnitStats[column.Title].SlotValueString;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
98 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
99 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
100
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
101 private void UnitNameChanged(WarFoundryObject obj, string oldValue, string newValue)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
102 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
103 unitName.Text = newValue;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
104 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
105
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
106 private void UnitSizeChanged(WarFoundryObject obj, int oldValue, int newValue)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
107 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
108 unitSize.Value = newValue;
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
109 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
110
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
111 protected virtual void OnUnitSizeFocusOut (object o, Gtk.FocusOutEventArgs args)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
112 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
113 SetNewUnitSize();
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
114 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
115
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
116 [GLib.ConnectBefore ()]
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
117 protected virtual void OnUnitSizeKeyPress (object o, Gtk.KeyPressEventArgs args)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
118 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
119 if (args.Event.Key == Gdk.Key.Return)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
120 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
121 SetNewUnitSize();
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
122 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
123 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
124
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
125 private void SetNewUnitSize()
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
126 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
127 if (unitSize.Value!=unit.Size)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
128 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
129 SetUnitSizeCommand cmd = new SetUnitSizeCommand(unit, (int)Math.Round(unitSize.Value));
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
130 stack.Execute(cmd);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
131 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
132 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
133
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
134 protected virtual void OnUnitNameFocusOut (object o, Gtk.FocusOutEventArgs args)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
135 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
136 SetNewUnitName();
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
137 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
138
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
139 [GLib.ConnectBefore ()]
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
140 protected virtual void OnUnitNameKeyPress (object o, Gtk.KeyPressEventArgs args)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
141 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
142 if (args.Event.Key == Gdk.Key.Return)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
143 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
144 SetNewUnitName();
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
145 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
146 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
147
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
148 private void SetNewUnitName()
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
149 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
150 if (unitName.Text!=unit.Name)
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
151 {
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
152 SetNameCommand cmd = new SetNameCommand(unit, unitName.Text);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
153 stack.Execute(cmd);
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
154 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
155 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
156 }
1bb28f84d567 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
157 }