-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameForm.h
199 lines (189 loc) · 8.16 KB
/
GameForm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#pragma once
#include "GameMap.h"
#include "Gamer.h"
#include <Windows.h> //çà÷åì??
namespace Krestikinoliki {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Ñâîäêà äëÿ GameForm
/// </summary>
public ref class GameForm : public System::Windows::Forms::Form
{
public:
GameForm(void)
{
InitializeComponent();
//
//TODO: äîáàâüòå êîä êîíñòðóêòîðà
//
}
protected:
/// <summary>
/// Îñâîáîäèòü âñå èñïîëüçóåìûå ðåñóðñû.
/// </summary>
~GameForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::MenuStrip^ menuStrip1;
protected:
private: System::Windows::Forms::StatusStrip^ statusStrip1;
private: System::Windows::Forms::ToolStripStatusLabel^ status;
private: System::Windows::Forms::ToolStripMenuItem^ ìåíþToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ íîâàÿÈãðàToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ âåðíóòüñÿToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ âûõîäToolStripMenuItem;
private: System::Windows::Forms::DataGridView^ dataGridView;
private:
/// <summary>
/// Îáÿçàòåëüíàÿ ïåðåìåííàÿ êîíñòðóêòîðà.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Òðåáóåìûé ìåòîä äëÿ ïîääåðæêè êîíñòðóêòîðà — íå èçìåíÿéòå
/// ñîäåðæèìîå ýòîãî ìåòîäà ñ ïîìîùüþ ðåäàêòîðà êîäà.
/// </summary>
void InitializeComponent(void)
{
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->ìåíþToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->íîâàÿÈãðàToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->âåðíóòüñÿToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->âûõîäToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
this->status = (gcnew System::Windows::Forms::ToolStripStatusLabel());
this->dataGridView = (gcnew System::Windows::Forms::DataGridView());
this->menuStrip1->SuspendLayout();
this->statusStrip1->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridView))->BeginInit();
this->SuspendLayout();
//
// menuStrip1
//
this->menuStrip1->ImageScalingSize = System::Drawing::Size(20, 20);
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {
this->ìåíþToolStripMenuItem,
this->âûõîäToolStripMenuItem
});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(457, 28);
this->menuStrip1->TabIndex = 0;
this->menuStrip1->Text = L"menuStrip1";
//
// ìåíþToolStripMenuItem
//
this->ìåíþToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {
this->íîâàÿÈãðàToolStripMenuItem,
this->âåðíóòüñÿToolStripMenuItem
});
this->ìåíþToolStripMenuItem->Name = L"ìåíþToolStripMenuItem";
this->ìåíþToolStripMenuItem->Size = System::Drawing::Size(65, 24);
this->ìåíþToolStripMenuItem->Text = L"Ìåíþ";
this->ìåíþToolStripMenuItem->Click += gcnew System::EventHandler(this, &GameForm::ìåíþToolStripMenuItem_Click);
//
// íîâàÿÈãðàToolStripMenuItem
//
this->íîâàÿÈãðàToolStripMenuItem->Name = L"íîâàÿÈãðàToolStripMenuItem";
this->íîâàÿÈãðàToolStripMenuItem->Size = System::Drawing::Size(224, 26);
this->íîâàÿÈãðàToolStripMenuItem->Text = L"Íîâàÿ èãðà";
this->íîâàÿÈãðàToolStripMenuItem->Click += gcnew System::EventHandler(this, &GameForm::íîâàÿÈãðàToolStripMenuItem_Click);
//
// âåðíóòüñÿToolStripMenuItem
//
this->âåðíóòüñÿToolStripMenuItem->Name = L"âåðíóòüñÿToolStripMenuItem";
this->âåðíóòüñÿToolStripMenuItem->Size = System::Drawing::Size(224, 26);
this->âåðíóòüñÿToolStripMenuItem->Text = L"Âåðíóòüñÿ â ìåíþ";
this->âåðíóòüñÿToolStripMenuItem->Click += gcnew System::EventHandler(this, &GameForm::âåðíóòüñÿToolStripMenuItem_Click);
//
// âûõîäToolStripMenuItem
//
this->âûõîäToolStripMenuItem->Name = L"âûõîäToolStripMenuItem";
this->âûõîäToolStripMenuItem->Size = System::Drawing::Size(67, 24);
this->âûõîäToolStripMenuItem->Text = L"Âûõîä";
this->âûõîäToolStripMenuItem->Click += gcnew System::EventHandler(this, &GameForm::âûõîäToolStripMenuItem_Click);
//
// statusStrip1
//
this->statusStrip1->ImageScalingSize = System::Drawing::Size(20, 20);
this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) { this->status });
this->statusStrip1->Location = System::Drawing::Point(0, 375);
this->statusStrip1->Name = L"statusStrip1";
this->statusStrip1->Size = System::Drawing::Size(457, 26);
this->statusStrip1->TabIndex = 1;
this->statusStrip1->Text = L"statusStrip1";
//
// status
//
this->status->Name = L"status";
this->status->Size = System::Drawing::Size(87, 20);
this->status->Text = L"Õîä èãðîêà";
//
// dataGridView
//
this->dataGridView->AllowUserToAddRows = false;
this->dataGridView->AllowUserToDeleteRows = false;
this->dataGridView->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->dataGridView->Dock = System::Windows::Forms::DockStyle::Fill;
this->dataGridView->Location = System::Drawing::Point(0, 28);
this->dataGridView->Name = L"dataGridView";
this->dataGridView->RowHeadersWidth = 51;
this->dataGridView->RowTemplate->Height = 24;
this->dataGridView->Size = System::Drawing::Size(457, 347);
this->dataGridView->TabIndex = 2;
this->dataGridView->CellContentClick += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &GameForm::dataGridView_CellContentClick);
//
// GameForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(457, 401);
this->Controls->Add(this->dataGridView);
this->Controls->Add(this->statusStrip1);
this->Controls->Add(this->menuStrip1);
this->MainMenuStrip = this->menuStrip1;
this->Name = L"GameForm";
this->Text = L"Èãðà";
this->Load += gcnew System::EventHandler(this, &GameForm::GameForm_Load);
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->statusStrip1->ResumeLayout(false);
this->statusStrip1->PerformLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridView))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
// ïîëÿ èãðû
public: int rows;
int columns;
int length;
int selectedGameMode;
private: Random^ rand;
// ìåòîäû èãðû
private:
void GameLogic();//ëîãèêà èãðû
void Update();
void NewGame();//çàïóñê íîâîé èãðû
void StepAI(); //õîä êîìïþüþòåðà
void UpdateGameGrid();//îáíîâà èãðîâîé ñåòêè
void CreateGameGrid(Field2);//ñîçäàíèå èãðîâîé ñåòêè
System::Void SetPositionPlayer(Field2); //çàäàíèå ïîçèöèè èãðîêà íà ñåòêå
// ñîáûòèÿ èãðû - ìåòîäû, âîçíèêàþùèå â îïðåäåëåííûå ìîìåíòû â ïðîãå
private: System::Void GameForm_Load(System::Object^ sender, System::EventArgs^ e);
private: System::Void ìåíþToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void íîâàÿÈãðàToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void âåðíóòüñÿToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void âûõîäToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void dataGridView_CellContentClick(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e);
};
}