?? records.cls
字號(hào):
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "records"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'方塊布局記錄集公共調(diào)用區(qū)
Public height_number As Integer, width_number As Integer '用于確定高,寬最大方格數(shù)
Private records(-4 To 24, -4 To 14) As record
Private mds As New module_describe
'對(duì)象啟動(dòng)時(shí)為布局記錄賦值
Private Sub Class_Initialize()
Dim i As Integer, j As Integer
For i = 0 To 19
For j = 0 To 9
records(i, j).value = 0 '代表該布局記錄為空,即無方格
Next j
Next i
height_number = 20 'picture 最高為多少方格
width_number = 10 'picture最寬為多少方格
End Sub
'得到記錄集的value 值
Public Function get_records_value(i As Integer, j As Integer) As Integer
get_records_value = records(i, j).value
End Function
'得到記錄集的color_type 值
Public Function get_records_color(i As Integer, j As Integer) As Integer
get_records_color = records(i, j).color_type
End Function
'用來改變記錄集的value 值,color_type 值
Public Sub records_change(i As Integer, j As Integer, value As Integer, color_type As Integer)
records(i, j).value = value
records(i, j).color_type = color_type
End Sub
'換游戲標(biāo)志,重新標(biāo)志輸入時(shí),將布局記錄清空
Public Sub clear()
Class_Initialize
End Sub
' 清空屏幕之后重新刷新屏幕,用于全屏和方塊移動(dòng)時(shí)候使用
Public Sub refresh(picture As PictureBox)
Dim i As Integer, j As Integer
For i = 0 To height_number - 1
For j = 0 To width_number - 1
If records(i, j).value = 1 Then
mds.module_describe picture, i, j, 20, records(i, j).color_type
End If
Next j
Next i
End Sub
'游戲有消行標(biāo)志傳來,修改布局記錄
Public Sub line_clear(line As Integer) 'line+1為要消去的行
Dim i As Integer, j As Integer
For i = line To 0 Step -1
For j = 0 To width_number - 1
records(i, j).value = 0
Next j
'將第 i+1 行清空
If i <> 0 Then
For j = 0 To width_number - 1
records(i, j).value = records(i - 1, j).value
records(i, j).color_type = records(i - 1, j).color_type
Next j
'將第i行記錄賦于第i+1行記錄
End If
Next i
End Sub
'方塊一達(dá)到終點(diǎn)就應(yīng)刷新布局記錄,無論是否消行
Public Sub records_write(x As Integer, y As Integer, type1 As Integer, color_type As Integer)
Select Case type1
Case 1:
records_change x, y, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 1, y + 1, 1, color_type
records_change x + 2, y, 1, color_type
Case 2:
records_change x, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x, y + 2, 1, color_type
records_change x + 1, y + 1, 1, color_type
Case 3:
records_change x, y, 1, color_type
records_change x + 1, y - 1, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 2, y, 1, color_type
Case 4:
records_change x, y, 1, color_type
records_change x + 1, y - 1, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 1, y + 1, 1, color_type
Case 5:
records_change x, y, 1, color_type
records_change x + 1, y - 1, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 2, y - 1, 1, color_type
Case 6:
records_change x, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x + 1, y + 1, 1, color_type
records_change x + 1, y + 2, 1, color_type
Case 7:
records_change x, y, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 1, y + 1, 1, color_type
records_change x + 2, y + 1, 1, color_type
Case 8:
records_change x, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 1, y - 1, 1, color_type
Case 9:
records_change x, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 2, y, 1, color_type
Case 10:
records_change x, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x, y + 2, 1, color_type
records_change x + 1, y + 2, 1, color_type
Case 11:
records_change x, y, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 2, y, 1, color_type
records_change x + 2, y - 1, 1, color_type
Case 12:
records_change x, y, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 1, y + 1, 1, color_type
records_change x + 1, y + 2, 1, color_type
Case 13:
records_change x, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x + 1, y + 1, 1, color_type
records_change x + 2, y + 1, 1, color_type
Case 14:
records_change x, y, 1, color_type
records_change x + 1, y - 2, 1, color_type
records_change x + 1, y - 1, 1, color_type
records_change x + 1, y, 1, color_type
Case 15:
records_change x, y, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 2, y, 1, color_type
records_change x + 2, y + 1, 1, color_type
Case 16:
records_change x, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x, y + 2, 1, color_type
records_change x + 1, y, 1, color_type
Case 17:
records_change x, y, 1, color_type
records_change x + 1, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x + 1, y + 1, 1, color_type
Case 18:
records_change x, y, 1, color_type
records_change x + 1, y, 1, color_type
records_change x + 2, y, 1, color_type
records_change x + 3, y, 1, color_type
Case 19:
records_change x, y, 1, color_type
records_change x, y + 1, 1, color_type
records_change x, y + 2, 1, color_type
records_change x, y + 3, 1, color_type
Case 20:
records_change x, y, 1, color_type
End Select
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -