⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mouse input.vb.svn-base

📁 MirUnleashed vb.net Module modMainServer Public WithEvents Socket As New WinsockServer Pub
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
'### Visual Basic.NET and Direct X9 Legend of MiR Project ###'
'### Mir Unleashed Client Keyboard Input Module ###'
'### http://www.lomcn.co.uk ###' '### Credits to TrueADM and DeathWish ###'

'Basically to handle mouse inputs from the user.
'This also handles player movement (for left and right mouse clicks). Button clicks what todo if the button has been clicked.

Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D

Module MouseInput

    Public Sub CheckMouseClick()

        If Scene = SceneType.LOGIN Then
            CheckClickTextbox()
            CheckClickButton()
        ElseIf Scene = SceneType.GAME Then
            CheckClickTextbox()
            CheckClickButton()

            'Lets pickup the item!
            If Window(6).Show = True Then
                If IsMouseDown = True And HoldingItem = False And InventoryItem(InventoryX, InventoryY).Exist = True And InventorySelect = True Then
                    HoldingItemX = InventoryX
                    HoldingItemY = InventoryY
                    HoldingItem = True
                    HoldingItemImage = InventoryItem(InventoryX, InventoryY).Look
                    HoldingItemType = 1
                    'Lets drop the item back into the same spot if nothing was done.
                ElseIf IsMouseDown = True And HoldingItem = True And HoldingItemX = InventoryX And HoldingItemY = InventoryY And InventorySelect = True And HoldingItemType = 1 Then
                    HoldingItem = False
                    'drop item to  slot in inventory from inventory
                ElseIf MouseButtonDown = True And HoldingItem = True And InventorySelect = True And HoldingItemType = 1 Then
                    HoldingItem = False
                    SwopInventoryItemToInventorySlot(HoldingItemX, HoldingItemY, InventoryX, InventoryY)
                End If
            End If
        End If

    End Sub

    Public Function ButtonCheck(ByVal Index As Integer)
        If Index = 1 Then
            If Not (Connected = True And LoginStage = LoginStageType.LOGIN) Then Return False
        End If

        If Index = 2 Then
            If Not (Connected = True And LoginStage = LoginStageType.LOGIN) Then Return False
        End If

        If Index = 3 Then
            If Not (Connected = True And LoginStage = LoginStageType.LOGIN) Then Return False
        End If

        If Index = 4 Then
            If Not (Connected = True And LoginStage = LoginStageType.LOGIN And Window(2).Show = True) Then Return False
        End If

        If Index = 5 Then
            If Not (Connected = True And LoginStage = LoginStageType.LOGIN And Window(2).Show = True) Then Return False
        End If

        If Index = 6 Then
            If Not (Connected = True And Window(1).Show = True) Then Return False
        End If

        If Index = 7 Then
            If Not (LoginStage = LoginStageType.CHAR_SEL) Then Return False
        End If

        If Index = 8 Then
            If Not (LoginStage = LoginStageType.CHAR_SEL And Window(4).Show = True) Then Return False
        End If

        Return True
    End Function

    Public Sub CheckClickButton()

        If ButtonSelect = True Then

            If ButtonCheck(ButtonSelectIndex) = True Then
                If MouseEvents.Button = MouseButtons.Left Then
                    ButtonClick(ButtonSelectIndex)
                End If
            End If

        End If

    End Sub

    Public Sub ButtonClick(ByVal Index As Integer)

        Select Case Index

            Case 0 'Exit Game
                Running = False

            Case 1 'Open Account Creation
                If Window(2).Show = False Then
                    Window(2).Show = True
                    ShowMessage("Welcome To The Legend of Mir Account Creation!" & vbCrLf & "Please insure you use correct details whilst registering with us!" _
                    & vbCrLf & "This is incase you forget any of your details or you are contacted by staff.", "Game Account Creation!")
                Else
                    Window(2).Show = False
                    Window(1).Show = False
                End If

            Case 2 ' Change Password

            Case 3 'Login to account
                Username = Textbox(0).Text
                Password = Textbox(1).Text
                Packets.SendLogin(Username, Password)

            Case 4 'Close Account Creation
                Window(2).Show = False
                Window(1).Show = False

            Case 5 'Create New Account
                If Textbox(2).Text = "" Then 'No Account Name entered.
                    ShowMessage("Please input your desired account name!" & vbCrLf & "Your account name can be anything you desire.", "Enter an Account Name!")
                ElseIf Textbox(2).Text.Contains(" ") Then 'Account name contains space(s).
                    ShowMessage("Your Account Name cannot contain spaces!", "Account Name Contains Space(s)!")
                ElseIf Not Textbox(2).Text.Length > 5 Then 'Account Name Too Short
                    ShowMessage("Your Account Name must be longer than six characters!" & vbCrLf & "Please enter an Account Name that is six characters or more!", "Account Name too short!")
                ElseIf Not Textbox(3).Text = Textbox(4).Text Then 'Passwords do not match.
                    ShowMessage("The passwords you entered do not match!" & vbCrLf & "Please re-type your passwords.", "Your passwords do not match!")
                ElseIf Not Textbox(3).Text.Length > 5 Then 'Password too short.
                    ShowMessage("Your password must be longer than six characters!" & vbCrLf & "Please enter a password that is six characters or more!", "Password too short!")
                ElseIf Not Textbox(8).Text.Length > 7 Then 'Secret number too short.
                    ShowMessage("Your secret number must be longer than eight characters!" & vbCrLf & "Please enter a secret number that is eight characters or more!", "Secret Number Needs Eight Characters!")
                ElseIf Not IsNumeric(Textbox(8).Text) = True Then 'Secret number isnt numeric.
                    ShowMessage("Your secret number must only contain numeric values!" & vbCrLf & "Please enter a secret number that only contains numbers!", "Secret Number Needs numeric values only!")
                ElseIf Textbox(6).Text = "" Or Textbox(7).Text = "" Then 'No secret answer or question.
                    ShowMessage("Please enter a secret answer and secret question." & vbCrLf & "This is used to retrive information about your account!", "Please enter Secret Answer and Question!")
                ElseIf Not Textbox(9).Text.Contains("@") And Textbox(9).Text.Contains(".") Then 'Not a valid email address.
                    ShowMessage("Please enter a valid E-Mail address." & vbCrLf & "This may be used for when developers need to contact you!", "Please enter a valid E-Mail address!")
                Else
                    Textbox(5).Text = Replace(Textbox(5).Text, "/", "-")
                    Textbox(5).Text = Replace(Textbox(5).Text, "\", "-")
                    Textbox(5).Text = Replace(Textbox(5).Text, ".", "-")

                    Packets.SendCreateAccount(Textbox(2).Text, Textbox(3).Text, Username, Textbox(8).Text, Textbox(6).Text, Textbox(7).Text, Textbox(9).Text, Textbox(5).Text)
                End If

            Case 6
                Window(1).Show = False

            Case 7 'Create New Character Window Open/Close
                Select Case Button(7).Image
                    Case 25 'Create New Character Window Open/Close
                        If Window(4).Show = False Then
                            Window(4).Show = True
                            Window(3).Show = False
                        Else
                            Window(4).Show = False
                            Window(3).Show = True
                        End If
                    Case 30 'Create Character
                        Dim Job, Gender As Integer
                        Select Case ClassText
                            Case "Warrior"
                                Job = 0
                            Case "Wizard"
                                Job = 1
                            Case "Taoist"
                                Job = 2
                        End Select
                        Select Case GenderText
                            Case "Male"
                                Gender = 0
                            Case "Female"
                                Gender = 1
                        End Select

                        If Textbox(10).Text = "" Then
                            ShowMessage("Please enter a name for your character")
                            Exit Sub
                        End If

                        Select Case Nothing
                            Case ClassText
                                ShowMessage("Please select a class for your character")
                                Exit Sub
                            Case GenderText
                                ShowMessage("Please select a gender for your character")
                                Exit Sub
                        End Select
                        Packets.SendCreateChar(Username, Textbox(10).Text, 0, Job, Gender)
                        ClassText = ""
                        GenderText = ""
                        Textbox(10).Text = ""
                        Window(4).Show = False
                End Select

            Case 8 'Warrior
                If Window(4).Show = True Then
                    WarriorTicked = True
                    WizardTicked = False
                    TaoistTicked = False
                End If
                ClassText = "Warrior"

            Case 9 'Wizard
                If Window(4).Show = True Then
                    WarriorTicked = False
                    WizardTicked = True
                    TaoistTicked = False
                End If
                ClassText = "Wizard"

            Case 10 'Taoist
                If Window(4).Show = True Then
                    WarriorTicked = False
                    WizardTicked = False
                    TaoistTicked = True
                End If
                ClassText = "Taoist"

            Case 11 'Male
                If Window(4).Show = True Then
                    MaleTicked = True
                    FemaleTicked = False
                End If

                GenderText = "Male"

            Case 12 'Female
                If Window(4).Show = True Then
                    MaleTicked = False
                    FemaleTicked = True
                End If

                GenderText = "Female"

            Case 13
                Actor.Name = Character(0).Name
                Packets.SendStartPlay()

            Case 25
                Packets.SendGoGame()

            Case 26
                'Mini map
                If Map.MiniMapOption = 0 Then
                    Map.MiniMapOption = 1
                ElseIf Map.MiniMapOption = 1 Then
                    Map.MiniMapOption = 2
                ElseIf Map.MiniMapOption = 2 Then
                    Map.MiniMapOption = 0
                End If

            Case 27

            Case 28
                If Not Actor.Guild = "" Then
                    If Window(7).Show = False Then
                        Window(7).Show = True
                    Else
                        Window(7).Show = False
                    End If
                Else
                    ShowGameMessage("You do not currently reside in any guilds." & vbCrLf & "You must be invited into a guild by either its leaders or its council." & vbCrLf & "Once in a guild you may access its guild options.", "No Current Guild!", MessageStyle.OkOnly)
                End If


            Case 33
                ShowGameMessage("Do you wish to exit The Legend of MiR?" & vbCrLf & "Your character's details are saved upon logging out or exiting the game." & vbCrLf & "Thank you for playing and we hope to see you again soon!", "Exit Legend of Mir?", MessageStyle.OkOnly)
                'Running = False
                'Exit game button
                ShowMessage("Are you sure you want to exit the game?")
                Running = False

            Case 35
                If Window(6).Show = False Then
                    Window(6).Show = True
                Else
                    Window(6).Show = False
                End If


        End Select

    End Sub

    Public Sub CheckClickTextbox()
        Dim I As Short
        TextboxSelect = False

        For I = 0 To 100
            If CursorX > Textbox(I).X And CursorX < Textbox(I).X + Textbox(I).Width And CursorY > Textbox(I).Y And CursorY < Textbox(I).Y + Textbox(I).Height And Textbox(I).Show = True And Scene = Textbox(I).Scene Then

                If (I = 1 Or I = 2) And Connected = True And Not (LoginStage = LoginStageType.LOGIN) Then Exit Sub

                TextboxSelect = True
                TextboxSelectIndex = I
                Exit For
            End If
        Next I
    End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -