Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
annotate FrmNewArmy.cs @ 139:d4b726cec12c
Fixes #326: Make army names and sizes modifiable after creation
* Only invoke command on change
* Make use of new "generate default name" function for consistency
* Commit missed auto-generated code file
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 12 Oct 2011 20:36:02 +0100 |
parents | 7e77e79e5fdd |
children |
rev | line source |
---|---|
19 | 1 // This file (FrmNewArmy.cs) is a part of the IBBoard.WarFoundry.GTK project and is copyright 2008, 2009 IBBoard. |
0 | 2 // |
19 | 3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
0 | 4 |
5 using System; | |
6 using Gtk; | |
7 using IBBoard.Lang; | |
8 using IBBoard.WarFoundry.API; | |
9 using IBBoard.WarFoundry.API.Objects; | |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
10 using IBBoard.GtkSharp; |
0 | 11 using log4net; |
52
4bad8cb3f889
Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
12 using IBBoard.WarFoundry.GUI.GTK.Util; |
76
7055b24cfc79
Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents:
75
diff
changeset
|
13 using IBBoard.GtkSharp.Translatable; |
0 | 14 |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
15 namespace IBBoard.WarFoundry.GUI.GTK |
0 | 16 { |
76
7055b24cfc79
Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents:
75
diff
changeset
|
17 public partial class FrmNewArmy : TranslatableDialog, ITranslatable |
0 | 18 { |
19 private ILog logger = LogManager.GetLogger(typeof(FrmNewArmy)); | |
20 private Race race; | |
21 private string armyName; | |
22 private int pointsValue; | |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
23 private bool isDefaultArmyName = true; |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
24 |
0 | 25 public FrmNewArmy(GameSystem gameSystem) |
26 { | |
27 this.Build(); | |
28 | |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
29 GameSystem[] gameSystems = WarFoundryLoader.GetDefault().GetGameSystems(); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
30 ComboBoxUtils.FillCombo(systemCombo, gameSystems, delegate(GameSystem sys){return sys.Name;}); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
31 |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
32 lstRaces.Selection.Changed += new EventHandler(OnSelectionChanged); |
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
33 |
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
34 TreeViewColumn raceColumn = new TreeViewColumn(); |
84
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
35 raceColumn.Title = Translation.GetTranslation("frmNewArmyRaceColumn", "race"); |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
36 CellRendererText raceCell = new CellRendererText(); |
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
37 raceColumn.PackStart(raceCell, true); |
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
38 lstRaces.AppendColumn(raceColumn); |
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
39 raceColumn.SetCellDataFunc(raceCell, GtkWarFoundryUtil.RenderWarFoundryObjectName); |
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
40 |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
41 if (gameSystem != null) |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
42 { |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
43 ComboBoxUtils.SelectItem(systemCombo, gameSystem); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
44 } |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
45 else if (gameSystems.Length == 1) |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
46 { |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
47 ComboBoxUtils.SelectIndex(systemCombo, 0); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
48 } |
96
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
49 |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
50 Translation.TranslationChanged += Retranslate; |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
51 Translate(); |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
52 } |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
53 |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
54 private void Retranslate() |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
55 { |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
56 Translate(); |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
57 } |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
58 |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
59 public override void Dispose() |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
60 { |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
61 Translation.TranslationChanged -= Retranslate; |
b4416ca69153
Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents:
86
diff
changeset
|
62 base.Dispose(); |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
63 } |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
64 |
85
bfb29a60b802
Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
65 protected override void Translate() |
bfb29a60b802
Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
66 { |
bfb29a60b802
Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
67 base.Translate(); |
86
9515b57ba752
Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
68 ControlTranslator.TranslateButtons(bttnCreate, bttnCancel); |
85
bfb29a60b802
Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
69 } |
bfb29a60b802
Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
70 |
0 | 71 protected virtual void OnSelectionChanged(object o, EventArgs e) |
72 { | |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
73 logger.Debug("Race selection changed"); |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
74 SetArmyName(); |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
75 SetOkayButtonState(); |
0 | 76 } |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
77 |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
78 private void SetOkayButtonState() |
0 | 79 { |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
80 bttnCreate.Sensitive = (lstRaces.Selection.CountSelectedRows() == 1 && txtArmyName.Text != "" && sbPointsValue.Value > 0); |
0 | 81 } |
82 | |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
83 protected virtual void OnCreateClicked(object sender, System.EventArgs e) |
0 | 84 { |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
85 race = GetSelectedRace(); |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
86 armyName = txtArmyName.Text; |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
87 pointsValue = (int)sbPointsValue.Value; |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
88 Respond(ResponseType.Ok); |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
89 } |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
90 |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
91 private Race GetSelectedRace() |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
92 { |
0 | 93 TreeModel model; |
94 TreeIter iter; | |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
95 lstRaces.Selection.GetSelected(out model, out iter); |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
96 return (Race)model.GetValue(iter, 0); |
0 | 97 } |
98 | |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
99 protected virtual void OnCancelClicked(object sender, System.EventArgs e) |
0 | 100 { |
101 Respond(ResponseType.Cancel); | |
102 } | |
103 | |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
104 protected virtual void OnTextChanged(object sender, System.EventArgs e) |
0 | 105 { |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
106 SetOkayButtonState(); |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
107 isDefaultArmyName = false; |
0 | 108 } |
109 | |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
110 protected virtual void OnSpinChangeValue(object o, Gtk.ChangeValueArgs args) |
0 | 111 { |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
112 SetArmyName(); |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
113 SetOkayButtonState(); |
0 | 114 } |
115 | |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
116 protected virtual void OnSpinValueChanged(object sender, System.EventArgs e) |
0 | 117 { |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
118 SetArmyName(); |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
119 SetOkayButtonState(); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
120 } |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
121 |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
122 protected virtual void OnSystemComboChanged(object sender, System.EventArgs e) |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
123 { |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
124 GameSystem system = ComboBoxUtils.GetSelectedItem<GameSystem>(systemCombo); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
125 SetRaces(system); |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
126 sbPointsValue.Value = system.SystemArmyDefaultSize; |
84
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
127 ListStore model = (ListStore)lstRaces.Model; |
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
128 |
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
129 if (model.IterNChildren() == 1) |
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
130 { |
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
131 TreeIter iter; |
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
132 model.GetIterFirst(out iter); |
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
133 lstRaces.Selection.SelectIter(iter); |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
134 SetArmyName(); |
84
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
135 } |
9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
IBBoard <dev@ibboard.co.uk>
parents:
77
diff
changeset
|
136 |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
137 logger.Debug("System selection changed: " + (system == null ? "null" : system.Name)); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
138 SetOkayButtonState(); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
139 } |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
140 |
36
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
141 private void SetRaces(GameSystem system) |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
142 { |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
143 ListStore store = new ListStore(typeof(Race)); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
144 |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
145 if (system != null) |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
146 { |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
147 foreach (Race race in WarFoundryLoader.GetDefault().GetRaces(system)) |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
148 { |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
149 store.AppendValues(race); |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
150 } |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
151 } |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
152 |
d68992a831df
Fixes #182: Make GTK# more like WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
153 lstRaces.Model = store; |
0 | 154 } |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
155 |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
156 private void SetArmyName() |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
157 { |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
158 if (isDefaultArmyName || txtArmyName.Text == "") |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
159 { |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
160 if (lstRaces.Selection.CountSelectedRows() == 1) |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
161 { |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
162 GameSystem currSystem = SelectedGameSystem; |
139
d4b726cec12c
Fixes #326: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents:
134
diff
changeset
|
163 int points = (int)sbPointsValue.Value; |
d4b726cec12c
Fixes #326: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents:
134
diff
changeset
|
164 txtArmyName.Text = Army.GenerateDefaultName(GetSelectedRace(), points, currSystem.GetPointsAbbrev(points)); |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
165 } |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
166 else { |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
167 txtArmyName.Text = ""; |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
168 } |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
169 |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
170 isDefaultArmyName = true; |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
171 } |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
172 } |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
173 |
0 | 174 public Race SelectedRace |
175 { | |
176 get { return race; } | |
177 } | |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
178 |
0 | 179 public string ArmyName |
180 { | |
181 get { return armyName; } | |
182 } | |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
76
diff
changeset
|
183 |
75
2ceae5d685d8
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
184 public int ArmySize |
0 | 185 { |
186 get { return pointsValue; } | |
187 } | |
134
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
188 |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
189 private GameSystem SelectedGameSystem |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
190 { |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
191 get { return ComboBoxUtils.GetSelectedItem<GameSystem>(systemCombo); } |
7e77e79e5fdd
Fixes #325: Use default army size when creating armies
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
192 } |
0 | 193 } |
194 } |