📄 records.cls
字号:
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
'方块布局记录集公共调用区
Public height_number As Integer, width_number As Integer '用于确定高,宽最大方格数
Private records(-4 To 24, -4 To 14) As record
Private mds As New module_describe
'对象启动时为布局记录赋值
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
'换游戏标志,重新标志输入时,将布局记录清空
Public Sub clear()
Class_Initialize
End Sub
' 清空屏幕之后重新刷新屏幕,用于全屏和方块移动时候使用
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
'游戏有消行标志传来,修改布局记录
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
'方块一达到终点就应刷新布局记录,无论是否消行
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -