1 |
cycrow |
1 |
#pragma once
|
|
|
2 |
|
|
|
3 |
using namespace System;
|
|
|
4 |
using namespace System::ComponentModel;
|
|
|
5 |
using namespace System::Collections;
|
|
|
6 |
using namespace System::Windows::Forms;
|
|
|
7 |
using namespace System::Data;
|
|
|
8 |
using namespace System::Drawing;
|
|
|
9 |
|
|
|
10 |
typedef struct SWeaponMasks {
|
|
|
11 |
int iGame;
|
|
|
12 |
int iLaserMask;
|
|
|
13 |
int iMissileMask;
|
|
|
14 |
} SWeaponMasks;
|
|
|
15 |
|
|
|
16 |
namespace Creator {
|
|
|
17 |
|
|
|
18 |
/// <summary>
|
|
|
19 |
/// Summary for CustomiseWeapons
|
|
|
20 |
/// </summary>
|
|
|
21 |
public ref class CustomiseWeapons : public System::Windows::Forms::UserControl
|
|
|
22 |
{
|
|
|
23 |
public:
|
|
|
24 |
CustomiseWeapons(Windows::Forms::Form ^parent, CLinkList<SWeaponMasks> *weapons, CShipData *shipData)
|
|
|
25 |
{
|
|
|
26 |
InitializeComponent();
|
|
|
27 |
|
|
|
28 |
m_pShipData = shipData;
|
|
|
29 |
m_pWeapons = weapons;
|
|
|
30 |
m_pParent = parent;
|
|
|
31 |
m_bUpdating = false;
|
|
|
32 |
|
|
|
33 |
this->SetupControls();
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
void AddGameEntry(String ^game) { this->ComboGameLaser->Items->Add(game); }
|
|
|
37 |
void SetupControlsEnd() { this->ComboGameLaser->SelectedIndex = 0; }
|
|
|
38 |
|
|
|
39 |
protected:
|
|
|
40 |
/// <summary>
|
|
|
41 |
/// Clean up any resources being used.
|
|
|
42 |
/// </summary>
|
|
|
43 |
void SetupControls();
|
|
|
44 |
void UpdateWeaponsList();
|
|
|
45 |
void SaveWeaponsList();
|
|
|
46 |
|
|
|
47 |
~CustomiseWeapons()
|
|
|
48 |
{
|
|
|
49 |
if (components)
|
|
|
50 |
{
|
|
|
51 |
delete components;
|
|
|
52 |
}
|
|
|
53 |
}
|
|
|
54 |
private: System::Windows::Forms::ListView^ ListWeapons;
|
|
|
55 |
protected:
|
|
|
56 |
private: System::Windows::Forms::ColumnHeader^ columnHeader1;
|
|
|
57 |
private: System::Windows::Forms::ColumnHeader^ columnHeader2;
|
|
|
58 |
private: System::Windows::Forms::FlowLayoutPanel^ flowLayoutPanel1;
|
|
|
59 |
private: System::Windows::Forms::RadioButton^ RadioLasers;
|
|
|
60 |
private: System::Windows::Forms::RadioButton^ RadioMissiles;
|
|
|
61 |
private: System::Windows::Forms::CheckBox^ CheckWeaponDefault;
|
|
|
62 |
private: System::Windows::Forms::Button^ ButCopyDefault;
|
|
|
63 |
private: System::Windows::Forms::Panel^ panel34;
|
|
|
64 |
private: System::Windows::Forms::ComboBox^ ComboGameLaser;
|
|
|
65 |
private: System::Windows::Forms::Label^ label51;
|
|
|
66 |
|
|
|
67 |
private:
|
|
|
68 |
Windows::Forms::Form ^m_pParent;
|
|
|
69 |
bool m_bUpdating;
|
|
|
70 |
CLinkList<SWeaponMasks> *m_pWeapons;
|
|
|
71 |
CShipData *m_pShipData;
|
|
|
72 |
/// <summary>
|
|
|
73 |
/// Required designer variable.
|
|
|
74 |
/// </summary>
|
|
|
75 |
System::ComponentModel::Container ^components;
|
|
|
76 |
|
|
|
77 |
#pragma region Windows Form Designer generated code
|
|
|
78 |
/// <summary>
|
|
|
79 |
/// Required method for Designer support - do not modify
|
|
|
80 |
/// the contents of this method with the code editor.
|
|
|
81 |
/// </summary>
|
|
|
82 |
void InitializeComponent(void)
|
|
|
83 |
{
|
|
|
84 |
this->ListWeapons = (gcnew System::Windows::Forms::ListView());
|
|
|
85 |
this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
|
|
|
86 |
this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
|
|
|
87 |
this->flowLayoutPanel1 = (gcnew System::Windows::Forms::FlowLayoutPanel());
|
|
|
88 |
this->RadioLasers = (gcnew System::Windows::Forms::RadioButton());
|
|
|
89 |
this->RadioMissiles = (gcnew System::Windows::Forms::RadioButton());
|
|
|
90 |
this->CheckWeaponDefault = (gcnew System::Windows::Forms::CheckBox());
|
|
|
91 |
this->ButCopyDefault = (gcnew System::Windows::Forms::Button());
|
|
|
92 |
this->panel34 = (gcnew System::Windows::Forms::Panel());
|
|
|
93 |
this->ComboGameLaser = (gcnew System::Windows::Forms::ComboBox());
|
|
|
94 |
this->label51 = (gcnew System::Windows::Forms::Label());
|
|
|
95 |
this->flowLayoutPanel1->SuspendLayout();
|
|
|
96 |
this->panel34->SuspendLayout();
|
|
|
97 |
this->SuspendLayout();
|
|
|
98 |
//
|
|
|
99 |
// ListWeapons
|
|
|
100 |
//
|
|
|
101 |
this->ListWeapons->CheckBoxes = true;
|
238 |
cycrow |
102 |
this->ListWeapons->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^ >(2) {
|
|
|
103 |
this->columnHeader1,
|
|
|
104 |
this->columnHeader2
|
|
|
105 |
});
|
1 |
cycrow |
106 |
this->ListWeapons->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
107 |
this->ListWeapons->FullRowSelect = true;
|
238 |
cycrow |
108 |
this->ListWeapons->HideSelection = false;
|
1 |
cycrow |
109 |
this->ListWeapons->Location = System::Drawing::Point(0, 48);
|
|
|
110 |
this->ListWeapons->Name = L"ListWeapons";
|
|
|
111 |
this->ListWeapons->Size = System::Drawing::Size(552, 588);
|
|
|
112 |
this->ListWeapons->TabIndex = 5;
|
|
|
113 |
this->ListWeapons->UseCompatibleStateImageBehavior = false;
|
|
|
114 |
this->ListWeapons->View = System::Windows::Forms::View::Details;
|
238 |
cycrow |
115 |
this->ListWeapons->ItemCheck += gcnew System::Windows::Forms::ItemCheckEventHandler(this, &CustomiseWeapons::ListWeapons_ItemCheck);
|
1 |
cycrow |
116 |
this->ListWeapons->ItemChecked += gcnew System::Windows::Forms::ItemCheckedEventHandler(this, &CustomiseWeapons::ListWeapons_ItemChecked);
|
|
|
117 |
//
|
|
|
118 |
// columnHeader1
|
|
|
119 |
//
|
|
|
120 |
this->columnHeader1->Text = L"Group";
|
|
|
121 |
//
|
|
|
122 |
// columnHeader2
|
|
|
123 |
//
|
|
|
124 |
this->columnHeader2->Text = L"Weapons";
|
|
|
125 |
//
|
|
|
126 |
// flowLayoutPanel1
|
|
|
127 |
//
|
|
|
128 |
this->flowLayoutPanel1->Controls->Add(this->RadioLasers);
|
|
|
129 |
this->flowLayoutPanel1->Controls->Add(this->RadioMissiles);
|
|
|
130 |
this->flowLayoutPanel1->Controls->Add(this->CheckWeaponDefault);
|
|
|
131 |
this->flowLayoutPanel1->Controls->Add(this->ButCopyDefault);
|
|
|
132 |
this->flowLayoutPanel1->Dock = System::Windows::Forms::DockStyle::Top;
|
|
|
133 |
this->flowLayoutPanel1->Location = System::Drawing::Point(0, 22);
|
|
|
134 |
this->flowLayoutPanel1->Name = L"flowLayoutPanel1";
|
|
|
135 |
this->flowLayoutPanel1->Size = System::Drawing::Size(552, 26);
|
|
|
136 |
this->flowLayoutPanel1->TabIndex = 4;
|
|
|
137 |
//
|
|
|
138 |
// RadioLasers
|
|
|
139 |
//
|
|
|
140 |
this->RadioLasers->AutoSize = true;
|
|
|
141 |
this->RadioLasers->Checked = true;
|
|
|
142 |
this->RadioLasers->Location = System::Drawing::Point(3, 3);
|
|
|
143 |
this->RadioLasers->Name = L"RadioLasers";
|
|
|
144 |
this->RadioLasers->Size = System::Drawing::Size(116, 17);
|
|
|
145 |
this->RadioLasers->TabIndex = 0;
|
|
|
146 |
this->RadioLasers->TabStop = true;
|
|
|
147 |
this->RadioLasers->Text = L"Laser Compatability";
|
|
|
148 |
this->RadioLasers->UseVisualStyleBackColor = true;
|
|
|
149 |
this->RadioLasers->CheckedChanged += gcnew System::EventHandler(this, &CustomiseWeapons::RadioLasers_CheckedChanged);
|
|
|
150 |
//
|
|
|
151 |
// RadioMissiles
|
|
|
152 |
//
|
|
|
153 |
this->RadioMissiles->AutoSize = true;
|
|
|
154 |
this->RadioMissiles->Location = System::Drawing::Point(125, 3);
|
|
|
155 |
this->RadioMissiles->Name = L"RadioMissiles";
|
|
|
156 |
this->RadioMissiles->Size = System::Drawing::Size(121, 17);
|
|
|
157 |
this->RadioMissiles->TabIndex = 1;
|
|
|
158 |
this->RadioMissiles->Text = L"Missile Compatability";
|
|
|
159 |
this->RadioMissiles->UseVisualStyleBackColor = true;
|
|
|
160 |
this->RadioMissiles->CheckedChanged += gcnew System::EventHandler(this, &CustomiseWeapons::RadioMissiles_CheckedChanged);
|
|
|
161 |
//
|
|
|
162 |
// CheckWeaponDefault
|
|
|
163 |
//
|
|
|
164 |
this->CheckWeaponDefault->AutoSize = true;
|
|
|
165 |
this->CheckWeaponDefault->Location = System::Drawing::Point(252, 3);
|
|
|
166 |
this->CheckWeaponDefault->Name = L"CheckWeaponDefault";
|
|
|
167 |
this->CheckWeaponDefault->Size = System::Drawing::Size(82, 17);
|
|
|
168 |
this->CheckWeaponDefault->TabIndex = 2;
|
|
|
169 |
this->CheckWeaponDefault->Text = L"Use Default";
|
|
|
170 |
this->CheckWeaponDefault->UseVisualStyleBackColor = true;
|
|
|
171 |
this->CheckWeaponDefault->CheckedChanged += gcnew System::EventHandler(this, &CustomiseWeapons::CheckWeaponDefault_CheckedChanged);
|
|
|
172 |
//
|
|
|
173 |
// ButCopyDefault
|
|
|
174 |
//
|
|
|
175 |
this->ButCopyDefault->AutoSize = true;
|
|
|
176 |
this->ButCopyDefault->Location = System::Drawing::Point(340, 3);
|
|
|
177 |
this->ButCopyDefault->Name = L"ButCopyDefault";
|
|
|
178 |
this->ButCopyDefault->Size = System::Drawing::Size(83, 23);
|
|
|
179 |
this->ButCopyDefault->TabIndex = 2;
|
|
|
180 |
this->ButCopyDefault->Text = L"Copy Defaults";
|
|
|
181 |
this->ButCopyDefault->UseVisualStyleBackColor = true;
|
|
|
182 |
this->ButCopyDefault->Click += gcnew System::EventHandler(this, &CustomiseWeapons::ButCopyDefault_Click);
|
|
|
183 |
//
|
|
|
184 |
// panel34
|
|
|
185 |
//
|
|
|
186 |
this->panel34->Controls->Add(this->ComboGameLaser);
|
|
|
187 |
this->panel34->Controls->Add(this->label51);
|
|
|
188 |
this->panel34->Dock = System::Windows::Forms::DockStyle::Top;
|
|
|
189 |
this->panel34->Location = System::Drawing::Point(0, 0);
|
|
|
190 |
this->panel34->Name = L"panel34";
|
|
|
191 |
this->panel34->Size = System::Drawing::Size(552, 22);
|
|
|
192 |
this->panel34->TabIndex = 3;
|
|
|
193 |
//
|
|
|
194 |
// ComboGameLaser
|
|
|
195 |
//
|
|
|
196 |
this->ComboGameLaser->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
197 |
this->ComboGameLaser->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
|
|
|
198 |
this->ComboGameLaser->FormattingEnabled = true;
|
|
|
199 |
this->ComboGameLaser->Location = System::Drawing::Point(188, 0);
|
|
|
200 |
this->ComboGameLaser->Name = L"ComboGameLaser";
|
|
|
201 |
this->ComboGameLaser->Size = System::Drawing::Size(364, 21);
|
|
|
202 |
this->ComboGameLaser->TabIndex = 0;
|
|
|
203 |
this->ComboGameLaser->SelectedIndexChanged += gcnew System::EventHandler(this, &CustomiseWeapons::ComboGameLaser_SelectedIndexChanged);
|
|
|
204 |
//
|
|
|
205 |
// label51
|
|
|
206 |
//
|
|
|
207 |
this->label51->Dock = System::Windows::Forms::DockStyle::Left;
|
238 |
cycrow |
208 |
this->label51->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
|
1 |
cycrow |
209 |
static_cast<System::Byte>(0)));
|
|
|
210 |
this->label51->Location = System::Drawing::Point(0, 0);
|
|
|
211 |
this->label51->Name = L"label51";
|
|
|
212 |
this->label51->Size = System::Drawing::Size(188, 22);
|
|
|
213 |
this->label51->TabIndex = 1;
|
|
|
214 |
this->label51->Text = L"X-Universe Game:";
|
|
|
215 |
this->label51->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
|
|
|
216 |
//
|
|
|
217 |
// CustomiseWeapons
|
|
|
218 |
//
|
|
|
219 |
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
|
|
|
220 |
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
|
|
|
221 |
this->Controls->Add(this->ListWeapons);
|
|
|
222 |
this->Controls->Add(this->flowLayoutPanel1);
|
|
|
223 |
this->Controls->Add(this->panel34);
|
|
|
224 |
this->Name = L"CustomiseWeapons";
|
|
|
225 |
this->Size = System::Drawing::Size(552, 636);
|
|
|
226 |
this->flowLayoutPanel1->ResumeLayout(false);
|
|
|
227 |
this->flowLayoutPanel1->PerformLayout();
|
|
|
228 |
this->panel34->ResumeLayout(false);
|
|
|
229 |
this->ResumeLayout(false);
|
|
|
230 |
|
|
|
231 |
}
|
|
|
232 |
#pragma endregion
|
|
|
233 |
private: System::Void ListWeapons_ItemChecked(System::Object^ sender, System::Windows::Forms::ItemCheckedEventArgs^ e) {
|
|
|
234 |
this->SaveWeaponsList();
|
|
|
235 |
}
|
|
|
236 |
private: System::Void RadioLasers_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
|
|
|
237 |
this->UpdateWeaponsList();
|
|
|
238 |
}
|
|
|
239 |
private: System::Void RadioMissiles_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
|
|
|
240 |
this->UpdateWeaponsList();
|
|
|
241 |
}
|
|
|
242 |
private: System::Void ComboGameLaser_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
|
|
|
243 |
this->UpdateWeaponsList();
|
|
|
244 |
}
|
|
|
245 |
private: System::Void CheckWeaponDefault_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
|
103 |
cycrow |
246 |
if ( this->CheckWeaponDefault->Checked ) {
|
|
|
247 |
this->ListWeapons->BackColor = Color::Gainsboro;
|
|
|
248 |
}
|
|
|
249 |
else {
|
|
|
250 |
this->ListWeapons->BackColor = Color::White;
|
|
|
251 |
}
|
1 |
cycrow |
252 |
this->ButCopyDefault->Visible = !this->CheckWeaponDefault->Checked;
|
|
|
253 |
if ( m_bUpdating ) return;
|
|
|
254 |
int value = (this->CheckWeaponDefault->Checked) ? -1 : 0;
|
|
|
255 |
|
|
|
256 |
for ( SWeaponMasks *m = m_pWeapons->First(); m; m = m_pWeapons->Next() )
|
|
|
257 |
{
|
|
|
258 |
if ( m->iGame == this->ComboGameLaser->SelectedIndex )
|
|
|
259 |
{
|
|
|
260 |
if ( this->RadioMissiles->Checked )
|
|
|
261 |
m->iMissileMask = value;
|
|
|
262 |
else
|
|
|
263 |
m->iLaserMask = value;
|
|
|
264 |
break;
|
|
|
265 |
}
|
|
|
266 |
}
|
|
|
267 |
this->UpdateWeaponsList();
|
|
|
268 |
}
|
|
|
269 |
private: System::Void ButCopyDefault_Click(System::Object^ sender, System::EventArgs^ e) {
|
|
|
270 |
for ( SWeaponMasks *m = m_pWeapons->First(); m; m = m_pWeapons->Next() )
|
|
|
271 |
{
|
|
|
272 |
if ( m->iGame == this->ComboGameLaser->SelectedIndex )
|
|
|
273 |
{
|
|
|
274 |
if ( this->RadioMissiles->Checked )
|
|
|
275 |
m->iMissileMask = m_pShipData->iMissileMask;
|
|
|
276 |
else
|
|
|
277 |
m->iLaserMask = m_pShipData->iLaserMask;
|
|
|
278 |
break;
|
|
|
279 |
}
|
|
|
280 |
}
|
|
|
281 |
this->UpdateWeaponsList();
|
|
|
282 |
}
|
103 |
cycrow |
283 |
private: System::Void ListWeapons_ItemCheck(System::Object^ sender, System::Windows::Forms::ItemCheckEventArgs^ e) {
|
|
|
284 |
if ( this->CheckWeaponDefault->Checked && !m_bUpdating ) {
|
|
|
285 |
e->NewValue = e->CurrentValue;
|
|
|
286 |
}
|
|
|
287 |
}
|
1 |
cycrow |
288 |
};
|
|
|
289 |
}
|