-
Notifications
You must be signed in to change notification settings - Fork 1
/
frmTableInfo.frm
430 lines (395 loc) · 13.1 KB
/
frmTableInfo.frm
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
VERSION 5.00
Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
Begin VB.Form frmTableInfo
AutoRedraw = -1 'True
BorderStyle = 1 'Fixed Single
Caption = "棋局信息"
ClientHeight = 3840
ClientLeft = 45
ClientTop = 330
ClientWidth = 5535
Icon = "frmTableInfo.frx":0000
LockControls = -1 'True
MaxButton = 0 'False
NegotiateMenus = 0 'False
ScaleHeight = 3840
ScaleWidth = 5535
Begin InetCtlsObjects.Inet ietTableInfo
Left = 4770
Top = 1800
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
URL = "http://"
RequestTimeout = 30
End
Begin VB.TextBox txtTime
BackColor = &H8000000F&
Height = 315
Left = 1245
Locked = -1 'True
TabIndex = 11
Top = 2820
Width = 2940
End
Begin VB.ComboBox cboType
Height = 300
ItemData = "frmTableInfo.frx":030A
Left = 1245
List = "frmTableInfo.frx":0314
Style = 2 'Dropdown List
TabIndex = 7
Top = 1815
Width = 2940
End
Begin VB.CheckBox chkUpLevel
Caption = "晋级游戏(&U)"
Height = 315
Left = 1245
TabIndex = 12
Top = 3300
Width = 1380
End
Begin VB.ComboBox cboGameTimer
Height = 300
ItemData = "frmTableInfo.frx":0324
Left = 1245
List = "frmTableInfo.frx":033A
Style = 2 'Dropdown List
TabIndex = 9
Top = 2325
Width = 2940
End
Begin VB.TextBox txtVisitor
BackColor = &H8000000F&
Height = 315
Left = 1245
Locked = -1 'True
TabIndex = 5
Top = 1305
Width = 2940
End
Begin VB.TextBox txtCreator
BackColor = &H8000000F&
Height = 315
Left = 1245
Locked = -1 'True
TabIndex = 3
Top = 780
Width = 2940
End
Begin VB.TextBox txtTableName
BackColor = &H8000000F&
Height = 315
Left = 1245
Locked = -1 'True
TabIndex = 1
Top = 270
Width = 2940
End
Begin Othello.FlatButton fltbtnClose
Cancel = -1 'True
Height = 345
Left = 4335
TabIndex = 15
Top = 1125
Width = 1050
_ExtentX = 1852
_ExtentY = 609
Caption = "关闭"
MousePointer = 99
Style = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EnableHot = -1 'True
ForeColor = 0
End
Begin Othello.FlatButton fltbtnReload
Height = 345
Left = 4335
TabIndex = 13
Top = 270
Width = 1050
_ExtentX = 1852
_ExtentY = 609
Caption = "刷新"
MousePointer = 99
Style = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EnableHot = -1 'True
ForeColor = 0
End
Begin Othello.FlatButton fltbtnEdit
Height = 345
Left = 4335
TabIndex = 14
Top = 690
Width = 1050
_ExtentX = 1852
_ExtentY = 609
Caption = "修改"
MousePointer = 99
Style = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EnableHot = -1 'True
ForeColor = 0
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "时间(&M):"
Height = 180
Left = 270
TabIndex = 10
Top = 2880
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "类型(&Y):"
Height = 180
Left = 270
TabIndex = 6
Top = 1860
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "计时器(&T):"
Height = 180
Left = 270
TabIndex = 8
Top = 2370
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "访问者(&V):"
Height = 180
Left = 270
TabIndex = 4
Top = 1350
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "创建人(&C):"
Height = 180
Left = 270
TabIndex = 2
Top = 840
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "棋局名(&N):"
Height = 180
Left = 270
TabIndex = 0
Top = 330
Width = 900
End
End
Attribute VB_Name = "frmTableInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mblnServerOK As Boolean
Dim mstrTableName As String
Dim FormVisible As Boolean
Public Sub ShowEx(ByVal TableName As String, ByVal IsEdit As Boolean)
On Error Resume Next
mstrTableName = TableName
FormVisible = True
Call Show(vbModeless)
If Me.WindowState <> vbNormal Then
Me.WindowState = vbNormal
End If
If IsEdit Then
Me.Caption = LoadString(253) & TableName
cboType.Enabled = True
cboGameTimer.Enabled = True
chkUpLevel.Enabled = True
fltbtnEdit.Enabled = True
Else
Me.Caption = LoadString(254) & TableName
cboType.Enabled = False
cboGameTimer.Enabled = False
chkUpLevel.Enabled = False
fltbtnEdit.Enabled = False
End If
Call Clear
Call Me.Refresh
Call ReloadInfo(TableName)
End Sub
Public Sub FormMinimize()
If Me.Visible Then
Call Me.Hide
End If
End Sub
Public Sub FormNormal()
If FormVisible Then
Call Me.Show(vbModeless)
End If
End Sub
Private Function ReloadInfo(ByVal TableName As String) As Boolean
Dim strUrl As String
Dim strStatus As String
Dim strData As String
strUrl = gstrSave_ServerUrl & SERVER_ACTION_TABLE_VIEW & _
"?username=" & ToUrlString(gMyUserInfo.UserName) & _
"&password=" & MD5(gMyUserInfo.Password) & _
"&name=" & ToUrlString(TableName) & _
"&" & MakeServerPassword() & _
"&" & MakeVersion()
If ServerCommand(ietTableInfo, mblnServerOK, strUrl, strStatus, strData) Then
If strStatus = STATUS_OK Then
Call SetInfo(strData)
ReloadInfo = True
Exit Function
End If
End If
ReloadInfo = False
End Function
Private Sub SetInfo(ByVal strData As String)
Dim TempTableInfo As tagTableInfo
On Error Resume Next
Call LoadTableInfo(TempTableInfo, strData)
txtTableName.Text = TempTableInfo.TableName
txtCreator.Text = GetDisplayName(TempTableInfo.Creator, TempTableInfo.CreatorName)
txtVisitor.Text = GetDisplayName(TempTableInfo.Visitor, TempTableInfo.VisitorName)
txtTime.Text = Format(TempTableInfo.LastTime, "yyyy年m月d日 hh:mm:ss")
cboType.ListIndex = TempTableInfo.TableType - 1
cboGameTimer.ListIndex = TempTableInfo.Timer
chkUpLevel.Value = Abs(TempTableInfo.UpLevel)
End Sub
Private Function SaveInfo() As Boolean
Dim strUrl As String
Dim strStatus As String
Dim strData As String
strUrl = gstrSave_ServerUrl & SERVER_ACTION_TABLE_EDIT & _
"?username=" & ToUrlString(gMyUserInfo.UserName) & _
"&password=" & MD5(gMyUserInfo.Password) & _
"&creator=" & ToUrlString(gMainTableInfo.Creator) & _
"&nickname=" & ToUrlString(gMyUserInfo.Name) & _
"&name=" & ToUrlString(txtTableName.Text) & _
"&type=" & CStr(cboType.ItemData(cboType.ListIndex)) & _
"&timer=" & CStr(cboGameTimer.ItemData(cboGameTimer.ListIndex)) & _
"&level=" & CStr(chkUpLevel.Value) & _
"&port=" & CStr(glngSave_GamePort) & _
"&" & MakeServerPassword() & _
"&" & MakeVersion()
Me.MousePointer = vbHourglass
Me.Caption = LoadString(258)
If ServerCommand(ietTableInfo, mblnServerOK, strUrl, strStatus, strData) Then
Me.MousePointer = vbDefault
If strStatus = STATUS_OK Then
Call LoadTableInfo(gMainTableInfo, strData)
Call SetInfo(strData)
SaveInfo = True
Exit Function
End If
End If
Me.MousePointer = vbDefault
Me.Caption = LoadString(253) & gMainTableInfo.TableName
SaveInfo = False
End Function
Private Sub fltbtnClose_Click(Button As Integer)
FormVisible = False
Call Me.Hide
End Sub
Private Sub fltbtnEdit_Click(Button As Integer)
On Error Resume Next
If (Not gblnLogin) Or (Not gblnCreator) Or gblnGameStart Then
Call Me.Hide
Exit Sub
End If
If Len(txtTableName.Text) < 2 Or Len(txtTableName.Text) > 15 Or Not CheckString(txtTableName.Text) Then
Call MessageBox(Me.hWnd, LoadString(172), vbCritical, LoadString(181))
Call SetControlFocus(txtTableName)
Call SendKeys("{Home}+{End}")
Exit Sub
End If
If SaveInfo() Then
Me.Caption = LoadString(253) & gMainTableInfo.TableName
If gblnConnect Then
Call MainForm.SendCommand(CMD_TableChanged & gMainTableInfo.TableType & "|" & gMainTableInfo.Timer & "|" & Abs(gMainTableInfo.UpLevel))
End If
' 更新棋局显示
If gMainTableInfo.Timer < 1 Then
MainForm.lblTime.Caption = "--:--"
Else
MainForm.lblTime.Caption = GetTime(gMainTableInfo.Timer * 60)
End If
Call frmTable.ReloadTable(True)
Call frmOnline.ReloadOnline
Call MessageBox(hWnd, LoadString(173), vbInformation, LoadString(180))
Else
Call MessageBox(hWnd, LoadString(174), vbCritical, LoadString(181))
End If
End Sub
Private Sub fltbtnReload_Click(Button As Integer)
Call ReloadInfo(mstrTableName)
End Sub
Private Sub Form_Load()
On Error Resume Next
Call Me.Move(gptsSave_TableInfo.X, gptsSave_TableInfo.Y)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormControlMenu Then
Cancel = True
FormVisible = False
Call Me.Hide
End If
End Sub
Private Sub ietTableInfo_StateChanged(ByVal State As Integer)
'Dim strMess As String '消息变量。
Select Case State
Case icResponseReceived
mblnServerOK = True
Case icError '11
mblnServerOK = False
'得到错误文本。
'strMess = "ErrorCode: " & ietRegister.ResponseCode & " : " & ietRegister.ResponseInfo
End Select
End Sub
Private Sub Clear()
Dim i As Long
Dim j As Object
On Error Resume Next
For i = 0 To Me.Controls.Count - 1
Set j = Me.Controls(i)
If TypeName(j) = "TextBox" Then
j.Text = ""
End If
Next i
End Sub