-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathKent_forever.cpp
More file actions
311 lines (283 loc) · 10.6 KB
/
Kent_forever.cpp
File metadata and controls
311 lines (283 loc) · 10.6 KB
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
// Kent_forever.cpp : implementation file
//
#include "stdafx.h"
#include "Kent_forever.h"
#include "afxdialogex.h"
#define WM_SHOWTASK_EVER (WM_USER+1001)
// Kent_forever dialog
IMPLEMENT_DYNAMIC(Kent_forever, CDialogEx)
Kent_forever::Kent_forever(CWnd* pParent /*=NULL*/)
: CDialogEx(Kent_forever::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDI_EVER);
}
Kent_forever::~Kent_forever()
{
}
void Kent_forever::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TAB_REG, m_EverReg);
DDX_Control(pDX, IDC_EDIT_QQ_NUM_EVER, kent_reconnect_qq_num);
DDX_Control(pDX, IDC_EDIT_QQ_KEY_EVER, kent_reconnect_qq_password);
DDX_Control(pDX, IDC_COMBO_QQ_AREA_EVER, kent_reconnect_qq_area);
DDX_Control(pDX, IDC_CHECK_RECONNECT_EVER, kent_reconnect_normal);
DDX_Control(pDX, IDC_EDIT_HERO_SELECT_EVER1, kent_hero_select1);
DDX_Control(pDX, IDC_EDIT_HERO_SELECT_EVER2, kent_hero_select2);
DDX_Control(pDX, IDC_EDIT_HERO_SELECT_EVER3, kent_hero_select3);
DDX_Control(pDX, IDC_HERO_RND_EVER, kent_hero_rand);
DDX_Control(pDX, IDC_HERO_RUIZI_EVER, kent_hero_ruizi);
DDX_Control(pDX, IDC_COMBOIDC_MATCH_MODE_EVER, kent_game_match_mode);
}
BEGIN_MESSAGE_MAP(Kent_forever, CDialogEx)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_DESTROY()
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_REG, &Kent_forever::OnTcnSelchangeTabReg)
ON_BN_CLICKED(IDC_BUTTON_HELP, &Kent_forever::OnBnClickedButtonHelp)
ON_BN_CLICKED(IDC_BUTTON_STORE_EVER, &Kent_forever::OnBnClickedButtonStoreEver)
ON_BN_CLICKED(IDC_BUTTON_CANCEL_EVER, &Kent_forever::OnBnClickedButtonCancelEver)
ON_WM_CLOSE()
END_MESSAGE_MAP()
// Kent_forever message handlers
BOOL Kent_forever::OnInitDialog()
{
CDialog::OnInitDialog();
/*****************图标设置*****************/
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
/*****************标题设置*****************/
CString Text;
GetPrivateProfileString(_T("MAIN"),_T("Text"),_T(""),Text.GetBuffer(200),200,Kent_log_instance->kent_root_path+_T("\\config.ini"));
Text.ReleaseBuffer();
SetWindowText(Text+Kent_log_instance->kent_version);
m_EverReg.InsertItem(0, _T("用户登录"));
m_EverReg.InsertItem(1, _T("用户注册"));
m_EverReg.InsertItem(2, _T("密码修改"));
pDialog.push_back(& kent_reg_login_ever);
pDialog.push_back(& kent_reg_reg_everDlg);
//pDialog.push_back(& kent_reg_recharge_everDlg);
pDialog.push_back(& kent_reg_modify_everDlg);
pDialog.at(0)->Create(IDD_REGISTER_LOGIN_EVER, &m_EverReg);
pDialog.at(1)->Create(IDD_REGISTER_REG_EVER, &m_EverReg);
//pDialog.at(2)->Create(IDD_REGISTER_RECHARGE_EVER, &m_EverReg);
pDialog.at(2)->Create(IDD_REGISTER_MODIFY_EVER, &m_EverReg);
//设定在Tab内显示的范围
CRect rc;
m_EverReg.GetClientRect(rc);
rc.top += 20;
rc.bottom -= 0;
rc.left += 0;
rc.right -= 0;
pDialog.at(0)->MoveWindow(&rc);
pDialog.at(1)->MoveWindow(&rc);
pDialog.at(2)->MoveWindow(&rc);
//显示初始页面
pDialog.at(0)->ShowWindow(SW_SHOW);
pDialog.at(1)->ShowWindow(SW_HIDE);
pDialog.at(2)->ShowWindow(SW_HIDE);
//保存当前选择
m_CurSelTab = 0;
kent_game_match_mode.AddString(_T("统治战场匹配(0-7级召唤师峡谷)"));
#ifdef Distort_forever
kent_game_match_mode.AddString(_T("扭曲丛林(0-7级召唤师峡谷)"));
#elif defined Dominate_forever
#else
kent_game_match_mode.AddString(_T("召唤师峡谷简单人机"));
kent_game_match_mode.AddString(_T("召唤师峡谷一般人机"));
kent_game_match_mode.AddString(_T("扭曲丛林匹配"));
kent_game_match_mode.AddString(_T("极地大乱斗匹配"));
kent_game_match_mode.AddString(_T("随机选择(不包括大乱斗)"));
#endif
kent_reconnect_qq_area.AddString(_T("上次登录大区"));
kent_reconnect_qq_area.AddString(_T("艾欧尼亚"));
kent_reconnect_qq_area.AddString(_T("祖安"));
kent_reconnect_qq_area.AddString(_T("诺克萨斯"));
kent_reconnect_qq_area.AddString(_T("班德尔城"));
kent_reconnect_qq_area.AddString(_T("皮尔特若夫"));
kent_reconnect_qq_area.AddString(_T("战争学院"));
kent_reconnect_qq_area.AddString(_T("巨神峰"));
kent_reconnect_qq_area.AddString(_T("雷瑟守备"));
kent_reconnect_qq_area.AddString(_T("钢铁烈阳"));
kent_reconnect_qq_area.AddString(_T("裁决之地"));
kent_reconnect_qq_area.AddString(_T("黑色玫瑰"));
kent_reconnect_qq_area.AddString(_T("暗影岛"));
kent_reconnect_qq_area.AddString(_T("均衡教派"));
kent_reconnect_qq_area.AddString(_T("水晶之痕"));
kent_reconnect_qq_area.AddString(_T("影流"));
kent_reconnect_qq_area.AddString(_T("守望之海"));
kent_reconnect_qq_area.AddString(_T("征服之海"));
kent_reconnect_qq_area.AddString(_T("卡拉曼达"));
kent_reconnect_qq_area.AddString(_T("皮城戒备"));
kent_reconnect_qq_area.AddString(_T("皮尔特若夫"));
kent_reconnect_qq_area.AddString(_T("比尔吉沃特"));
kent_reconnect_qq_area.AddString(_T("德玛西亚"));
kent_reconnect_qq_area.AddString(_T("弗雷尔卓德"));
kent_reconnect_qq_area.AddString(_T("无畏先锋"));
kent_reconnect_qq_area.AddString(_T("恕瑞玛"));
kent_reconnect_qq_area.AddString(_T("扭曲丛林"));
kent_reconnect_qq_area.AddString(_T("巨龙之巢"));
kent_reconnect_qq_area.AddString(_T("教育网专区"));
kent_reconnect_qq_area.SetCurSel(0);
kent_option_update();//显示设置
return TRUE; // return TRUE unless you set the focus to a control
}
void Kent_forever::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
HCURSOR Kent_forever::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void Kent_forever::OnDestroy()
{
CDialog::OnDestroy();
}
void Kent_forever::OnTcnSelchangeTabReg(NMHDR *pNMHDR, LRESULT *pResult)
{
//把当前的页面隐藏起来
pDialog.at(m_CurSelTab)->ShowWindow(SW_HIDE);
//得到新的页面索引
m_CurSelTab = m_EverReg.GetCurSel();
//把新的页面显示出来
pDialog.at(m_CurSelTab)->ShowWindow(SW_SHOW);
*pResult = 0;
}
void Kent_forever::kent_store_config()
{
Kent_log_instance->kent_writeini(_T("kent_game_match_mode"),match_mode_EverToNormal(kent_game_match_mode.GetCurSel()));
Kent_log_instance->kent_writeini(_T("kent_hero_rand"),&kent_hero_rand);
Kent_log_instance->kent_writeini(_T("kent_hero_ruizi"),&kent_hero_ruizi);
Kent_log_instance->kent_writeini(_T("kent_hero_select1"),&kent_hero_select1);
Kent_log_instance->kent_writeini(_T("kent_hero_select2"),&kent_hero_select2);
Kent_log_instance->kent_writeini(_T("kent_hero_select3"),&kent_hero_select3);
Kent_log_instance->kent_writeini(_T("kent_reconnect_normal"),&kent_reconnect_normal);
Kent_log_instance->kent_writeini(_T("kent_reconnect_qq_num"),&kent_reconnect_qq_num);
Kent_log_instance->kent_writeini(_T("kent_reconnect_qq_password"),&kent_reconnect_qq_password);
CString tmp;
kent_reconnect_qq_area.GetWindowText(tmp);
Kent_log_instance->kent_writeini(_T("kent_reconnect_qq_area"),tmp);
}
void Kent_forever::kent_return_config()
{
CString tmp;
Kent_log_instance->kent_game_match_mode = (d_match_mode)abs(match_mode_EverToNormal(kent_game_match_mode.GetCurSel()));
Kent_log_instance->kent_hero_rand = (0 == kent_hero_rand.GetCheck())?false:true;
Kent_log_instance->kent_hero_ruizi = (0 == kent_hero_ruizi.GetCheck())?false:true;
kent_hero_select1.GetWindowText(tmp);
Kent_log_instance->kent_hero_select.at(0) = tmp;
kent_hero_select2.GetWindowText(tmp);
Kent_log_instance->kent_hero_select.at(1) = tmp;
kent_hero_select3.GetWindowText(tmp);
Kent_log_instance->kent_hero_select.at(2) = tmp;
Kent_log_instance->kent_reconnect_normal = (0 == kent_reconnect_normal.GetCheck())?false:true;
kent_reconnect_qq_num.GetWindowText(tmp);
Kent_log_instance->kent_reconnect_qq_num = tmp;
kent_reconnect_qq_password.GetWindowText(tmp);
Kent_log_instance->kent_reconnect_qq_password = tmp;
kent_reconnect_qq_area.GetWindowText(tmp);
Kent_log_instance->kent_reconnect_qq_area = tmp;
}
void Kent_forever::kent_option_update()
{
kent_game_match_mode.SetCurSel(match_mode_NormalToEver(Kent_log_instance->kent_game_match_mode));
//随机英雄
kent_hero_rand.SetCheck(Kent_log_instance->kent_hero_rand);
//瑞兹
kent_hero_ruizi.SetCheck(Kent_log_instance->kent_hero_ruizi);
//英雄设置
kent_hero_select1.SetWindowText(Kent_log_instance->kent_hero_select.at(0));
kent_hero_select2.SetWindowText(Kent_log_instance->kent_hero_select.at(1));
kent_hero_select3.SetWindowText(Kent_log_instance->kent_hero_select.at(2));
kent_reconnect_normal.SetCheck(Kent_log_instance->kent_reconnect_normal);
kent_reconnect_qq_num.SetWindowText(Kent_log_instance->kent_reconnect_qq_num);
kent_reconnect_qq_password.SetWindowText(Kent_log_instance->kent_reconnect_qq_password);
kent_reconnect_qq_area.SetWindowText(Kent_log_instance->kent_reconnect_qq_area);
kent_reg_login_ever.kent_reg_login_user.SetWindowText(Kent_log_instance->kent_reg_login_user);
kent_reg_login_ever.kent_reg_login_key.SetWindowText(Kent_log_instance->kent_reg_login_key);
}
d_match_mode Kent_forever::match_mode_EverToNormal(int Ever)
{
#ifdef Distort_forever
switch(Ever){
case 0:return match_mode_common;//
case 1:return match_mode_Distort;//
default:return match_mode_Distort;
}
#elif defined Dominate_forever
return match_mode_common;//
#else
switch(Ever){
case 0:return match_mode_common;//
case 1:return match_mode_normal_machine;//
case 2:return match_mode_normal_machine_hard;//
case 3:return match_mode_Distort;//
case 4:return match_mode_Colosseum;//
case 5:return match_mode_Random;//
default:return match_mode_Random;
}
#endif
}
int Kent_forever::match_mode_NormalToEver(d_match_mode Normal)
{
#ifdef Distort_forever
switch(Normal){
case match_mode_common:return 0;//
case match_mode_Distort:return 1;//
default:return 1;
}
#elif defined Dominate_forever
return 0;//
#else
switch(Normal){
case match_mode_common:return 0;//
case match_mode_normal_machine:return 1;//
case match_mode_normal_machine_hard:return 2;//
case match_mode_Distort:return 3;//
case match_mode_Colosseum:return 4;//
case match_mode_Random:return 5;//
default:return 5;
}
#endif
}
void Kent_forever::OnBnClickedButtonHelp()
{
ShellExecute(NULL,_T("open"),_T("使用前必读.txt"),NULL,NULL,SW_SHOWNORMAL);
}
void Kent_forever::OnBnClickedButtonStoreEver()
{
// TODO: Add your control notification handler code here
kent_store_config();
kent_return_config();
CDialogEx::OnOK();
}
void Kent_forever::OnBnClickedButtonCancelEver()
{
// TODO: Add your control notification handler code here
CDialogEx::OnCancel();
}
void Kent_forever::OnClose()
{
// TODO: Add your message handler code here and/or call default
kent_store_config();
kent_return_config();
CDialogEx::OnClose();
}