脚本显示模块.bas
资源名称:vbmcrisrc.rar [点击查看]
上传用户:pcw2004
上传日期:2022-02-02
资源大小:743k
文件大小:4k
源码类别:
DirextX编程
开发平台:
Visual Basic
- Attribute VB_Name = "脚本显示模块"
- Option Explicit
- Public Type TextInfo
- tRECT As RECT
- mStr As String
- FunctionName As String
- mColor As Long
- Type As Integer
- End Type
- Public StrCount As Integer
- ' Download by http://www.codefans.net
- Public StrInfo() As TextInfo
- Public Sub DrawScript()
- Dim i As Integer
- Dim j As Integer
- For i = 0 To StrCount
- mRECT.Left = 15
- mRECT.Top = 15
- mRECT.Right = 400
- mRECT.bottom = 200
- If StrInfo(i).Type = 0 Then
- D3DX.DrawText D3DFont2, D3DColorRGBA(255, 255, 255, 255), StrInfo(i).mStr, StrInfo(i).tRECT, DT_LEFT
- ElseIf StrInfo(i).Type = 1 Then
- If Mouse.Button1Down = True And Mouse.X > StrInfo(i).tRECT.Left And Mouse.X < StrInfo(i).tRECT.Right And _
- Mouse.Y > StrInfo(i).tRECT.Top And Mouse.Y < StrInfo(i).tRECT.bottom Then
- D3DX.DrawText D3DFont1, D3DColorRGBA(255, 0, 0, 255), StrInfo(i).mStr, StrInfo(i).tRECT, DT_LEFT
- Else
- D3DX.DrawText D3DFont1, D3DColorRGBA(255, 255, 0, 255), StrInfo(i).mStr, StrInfo(i).tRECT, DT_LEFT
- End If
- End If
- Next
- End Sub
- Public Sub GetText(Str As String)
- Dim SS As Variant, LenStr As Integer
- Dim Str1 As String
- Dim Work As Boolean, FunWork As Boolean
- Dim i As Integer, j As Integer
- Dim Len1 As Integer
- StrCount = 0
- ReDim StrInfo(StrCount)
- SS = Split(Str, vbCrLf)
- For i = 0 To UBound(SS)
- LenStr = 0
- Len1 = 15
- If SS(i) <> "" Then
- StrCount = StrCount + 1
- ReDim Preserve StrInfo(StrCount)
- StrInfo(StrCount).tRECT.Left = Len1
- StrInfo(StrCount).tRECT.Top = 15 + i * 15
- StrInfo(StrCount).tRECT.bottom = StrInfo(StrCount).tRECT.Top + 35
- End If
- Do While LenStr <= Len(SS(i))
- DoEvents
- LenStr = LenStr + 1
- Str1 = Mid(SS(i), LenStr, 1)
- If Str1 = "<" Then
- FrmMain.Label2.Caption = StrInfo(StrCount).mStr
- Len1 = Len1 + FrmMain.Label2.Width
- StrCount = StrCount + 1
- ReDim Preserve StrInfo(StrCount)
- StrInfo(StrCount).tRECT.Left = Len1
- StrInfo(StrCount).tRECT.Top = 15 + i * 15
- StrInfo(StrCount).tRECT.bottom = StrInfo(StrCount).tRECT.Top + 12
- StrInfo(StrCount).Type = 1
- Work = True
- ElseIf Str1 = "/" Then
- If Mid(SS(i), LenStr + 1, 1) <> "/" Then
- If Work = True Then FunWork = True
- End If
- ElseIf Str1 = "" Then
- ElseIf Str1 = ">" Then
- Work = False
- FunWork = False
- FrmMain.Label2.Caption = StrInfo(StrCount).mStr
- Len1 = Len1 + FrmMain.Label2.Width
- StrCount = StrCount + 1
- ReDim Preserve StrInfo(StrCount)
- StrInfo(StrCount).tRECT.Left = Len1
- StrInfo(StrCount).tRECT.Top = 15 + i * 15
- StrInfo(StrCount).tRECT.bottom = StrInfo(StrCount).tRECT.Top + 12
- Else
- If Work = True Then
- If FunWork = True Then
- StrInfo(StrCount).FunctionName = StrInfo(StrCount).FunctionName & Str1
- Else
- StrInfo(StrCount).mStr = StrInfo(StrCount).mStr & Str1
- FrmMain.Label2.Caption = StrInfo(StrCount).mStr
- StrInfo(StrCount).tRECT.Right = StrInfo(StrCount).tRECT.Left + FrmMain.Label2.Width
- End If
- Else
- StrInfo(StrCount).mStr = StrInfo(StrCount).mStr & Str1
- FrmMain.Label2.Caption = StrInfo(StrCount).mStr
- StrInfo(StrCount).tRECT.Right = StrInfo(StrCount).tRECT.Left + FrmMain.Label2.Width
- End If
- End If
- Loop
- Next
- End Sub
- 'Public Function GetFunNum(FunName As String) As Integer
- ' Dim i As Integer
- ' For i = 1 To NPCInfo(SelNpcNum).ScriptCount
- ' If NPCInfo(SelNpcNum).Script(i).ScriptName = FunName Then
- ' GetFunNum = i
- ' Exit For
- ' Exit Function
- ' End If
- ' Next
- 'End Function