Advertisement
Guest User

asdf

a guest
Feb 10th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 13.02 KB | None | 0 0
  1.     Public Sub MainMenu_MouseUp()
  2.         Dim i As Long, X As Long, Y As Long, e As Long, n As Long
  3.  
  4.         mouseState2 = 0
  5.  
  6.         Select Case MenuGUIs
  7.  
  8.             Case RenderState.Register
  9.                 i = 8
  10.                 X = 480
  11.                 Y = 390
  12.                 ' check if we're on the button
  13.                 If (GlobalX >= X And GlobalX <= X + Buttons(i).Width) And (GlobalY >= Y And GlobalY <= Y + Buttons(i).Height) Then
  14.                     If Buttons(i).state = 2 Then
  15.                         ' do stuffs
  16.                         Select Case i
  17.                             Case 8
  18.                                 ' prevent password
  19.                                 If RegisterStr(4) <> RegisterStr(3) Then
  20.                                     GameNotify = "Please make sure your password match!"
  21.                                     Exit Sub
  22.                                 End If
  23.  
  24.                                 ' Prevent fake letters
  25.                                 For i = 1 To Len(RegisterStr(1))
  26.                                     n = AscW(Mid$(RegisterStr(1), i, 1))
  27.                                     If Not isNameLegal(n) Then
  28.                                         GameNotify = "Invalid username, only letters, numbers, spaces, and _ allowed in usernames."
  29.                                         resetClickedButtons()
  30.                                         Exit Sub
  31.                                     End If
  32.                                 Next
  33.  
  34.                                 If Not RegisterStr(5) = Captcha.ToUpper Then
  35.                                     GameNotify = "Captcha Incorrecto"
  36.                                     Captcha = CreateCaptcha() ' Reset the Captcha
  37.                                     resetClickedButtons()
  38.                                     Exit Sub
  39.                                 End If
  40.  
  41.                                 ' Email check
  42.                                 If InStr(RegisterStr(2), ".") > 0 Then
  43.                                     If Not InStr(RegisterStr(2), "@") > 0 Then
  44.                                         GameNotify = "Email Invalido"
  45.                                         resetClickedButtons()
  46.                                         Exit Sub
  47.                                     End If
  48.                                 Else
  49.                                     GameNotify = "Necesitas usar un . en una dirección de correo electronico."
  50.                                     resetClickedButtons()
  51.                                     Exit Sub
  52.                                 End If
  53.  
  54.                                 MenuState(RenderState.Register)
  55.                         End Select
  56.                         ' play sound
  57.                         PlaySound(Sound_ButtonClick)
  58.                     End If
  59.                 End If
  60.  
  61.  
  62.             Case RenderState.NewChar
  63.  
  64.                 For i = 17 To 22
  65.                     ' check if we're on the button
  66.                     If (GlobalX >= Buttons(i).X And GlobalX <= Buttons(i).X + Buttons(i).Width) And (GlobalY >= Buttons(i).Y And GlobalY <= Buttons(i).Y + Buttons(i).Height) Then
  67.                         If Buttons(i).state = 2 Then
  68.  
  69.                             Select Case i
  70.                                 Case 17 ' Caballero
  71.                                     createChar.ClassSelect = 1
  72.                                     LoadCharClass(createChar.ClassSelect)
  73.                                 Case 18
  74.                                     createChar.ClassSelect = 3 ' Mago
  75.                                     LoadCharClass(createChar.ClassSelect)
  76.                                 Case 19
  77.                                     'createChar.ClassSelect = 2 ' Acechador
  78.                                     'LoadCharClass(createChar.ClassSelect)
  79.                                 Case 20
  80.                                     'createChar.ClassSelect = 5 ' Nigromante
  81.                                     'LoadCharClass(createChar.ClassSelect)
  82.                                 Case 21
  83.                                     'createChar.ClassSelect = 4 ' Cazador
  84.                                    ' LoadCharClass(createChar.ClassSelect)
  85.                                 Case 22
  86.                                     ' createChar.ClassSelect = 6 ' Druida
  87.                                     ' LoadCharClass(createChar.ClassSelect)
  88.                             End Select
  89.  
  90.                             ' play sound
  91.                             PlaySound(Sound_ButtonClick)
  92.                         End If
  93.                     End If
  94.                 Next
  95.  
  96.                 'Clases
  97.                 For i = 33 To 34
  98.                     ' check if we're on the button
  99.                     If (GlobalX >= Buttons(i).X And GlobalX <= Buttons(i).X + Buttons(i).Width) And (GlobalY >= Buttons(i).Y And GlobalY <= Buttons(i).Y + Buttons(i).Height) Then
  100.                         If Buttons(i).state = 2 Then
  101.                             ' do stuffs
  102.                             Select Case i
  103.                                 Case 33
  104.                                     createChar.SexSelect = SEX_MALE
  105.                                     createChar.HairSelect = 1
  106.                                     createChar.SpriteSelect = 1
  107.  
  108.                                     Buttons(34).state = 0
  109.                                 Case 34
  110.  
  111.                                     createChar.SexSelect = SEX_FEMALE
  112.                                     createChar.HairSelect = 1
  113.                                     createChar.SpriteSelect = 1
  114.  
  115.                                     Buttons(33).state = 0
  116.                             End Select
  117.                             ' play sound
  118.                             PlaySound(Sound_ButtonClick)
  119.                         End If
  120.                     End If
  121.                 Next
  122.  
  123.                 'CODIGO DE LOS COLORES RGB
  124.  
  125.                 For i = 23 To 32
  126.                     ' check if we're on the button
  127.                     If (GlobalX >= Buttons(i).X And GlobalX <= Buttons(i).X + Buttons(i).Width) And (GlobalY >= Buttons(i).Y And GlobalY <= Buttons(i).Y + Buttons(i).Height) Then
  128.                         If Buttons(i).state = 2 Then
  129.  
  130.                             ' do stuffs
  131.                             For z = 1 To UBound(createChar.HairTint)
  132.                                 If i = (z + 22) Then
  133.                                     createChar.HairTintSelect = z : Exit For
  134.                                 End If
  135.                             Next
  136.  
  137.                             ' play sound
  138.                             PlaySound(Sound_ButtonClick)
  139.                         End If
  140.                     End If
  141.                 Next
  142.  
  143.                 For i = 37 To 38
  144.                     ' check if we're on the button
  145.                     If (GlobalX >= Buttons(i).X And GlobalX <= Buttons(i).X + Buttons(i).Width) And (GlobalY >= Buttons(i).Y And GlobalY <= Buttons(i).Y + Buttons(i).Height) Then
  146.                         If Buttons(i).state = 2 Then
  147.                             ' do stuffs
  148.                             Select Case i
  149.                                 Case 37
  150.                                     createChar.SpriteSelect += 1
  151.                                     If createChar.SpriteSelect > UBound(createChar.Sprite) Then
  152.                                         createChar.SpriteSelect = 1
  153.                                     End If
  154.                                 Case 38
  155.                                     createChar.HairSelect += 1
  156.                                     If createChar.HairSelect > UBound(createChar.Hair) Then
  157.                                         createChar.HairSelect = 1
  158.                                     End If
  159.                             End Select
  160.  
  161.                             PlaySound(Sound_ButtonClick)
  162.                         End If
  163.                     End If
  164.                 Next
  165.  
  166.                 For i = 39 To 40
  167.                     ' check if we're on the button
  168.                     If (GlobalX >= Buttons(i).X And GlobalX <= Buttons(i).X + Buttons(i).Width) And (GlobalY >= Buttons(i).Y And GlobalY <= Buttons(i).Y + Buttons(i).Height) Then
  169.                         If Buttons(i).state = 2 Then
  170.                             ' do stuffs
  171.                             Select Case i
  172.                                 Case 39
  173.                                     Call MenuState(RenderState.AddChar)
  174.                                 Case 40
  175.                                     Select Case MenuGUIs
  176.                                         Case RenderState.NewChar
  177.                                             'MenuState(MENU_STATE_CHARACTERS)
  178.                                             MenuGUIs = RenderState.Characters
  179.                                         Case Else
  180.                                             If Not PlayerSocket Is Nothing Then
  181.                                                 PlayerSocket.Close()
  182.                                                 PlayerSocket = Nothing
  183.                                             End If
  184.                                             'DestroyTCP()
  185.                                             ' clear the textbox
  186.                                             'curTextbox = 1
  187.                                     End Select
  188.                                     PlaySound(Sound_ButtonClick)
  189.                             End Select
  190.                         End If
  191.                     End If
  192.                 Next
  193.  
  194.                 'Select Case MenuGUIs
  195.             Case RenderState.Menu
  196.                 ' find out which button we're clicking
  197.                 For i = 7 To 8
  198.                     ' check if we're on the button
  199.                     If (GlobalX >= Buttons(i).X And GlobalX <= Buttons(i).X + Buttons(i).Width) And (GlobalY >= Buttons(i).Y And GlobalY <= Buttons(i).Y + Buttons(i).Height) Then
  200.                         If Buttons(i).state = 2 Then
  201.                             ' do stuffs
  202.                             Select Case i
  203.                                 Case 7
  204.                                     'If faderState = 4 Then
  205.                                     ' login
  206.                                     If isLoginLegal(idDialogue, passCorrect) Then
  207.                                         MenuState(RenderState.Login)
  208.                                     End If
  209.  
  210.                                 Case 8
  211.                                     pnlCreditsVisible = False
  212.                                     MenuGUIs = RenderState.Register
  213.                                     'If faderState = 4 Then
  214.                                     ' register
  215.                                     'PlayerSocket.Close()
  216.                                     ' = MENU_REGISTER
  217.  
  218.                                     'frmMenu.picRegister.Visible = True
  219.                                     'frmMenu.picCharacters.Visible = False
  220.                                     ' clear the textbox
  221.                                     'sUser = vbNullString
  222.                                     'sPass = vbNullString
  223.                                     'sPass2 = vbNullString
  224.                                     'curTextbox = 1
  225.                                     'End If
  226.                             End Select
  227.                             ' play sound
  228.                             PlaySound(Sound_ButtonClick)
  229.                         End If
  230.                     End If
  231.                 Next
  232.  
  233.             Case RenderState.Characters
  234.  
  235.                 For e = 41 To 43
  236.                     ' check if we're on the button
  237.                     If (GlobalX >= Buttons(e).X And GlobalX <= Buttons(e).X + Buttons(e).Width) And (GlobalY >= Buttons(e).Y And GlobalY <= Buttons(e).Y + Buttons(e).Height) Then
  238.                         If Buttons(e).state = 2 Then
  239.                             ' do stuffs
  240.                             Select Case e
  241.                                 Case 41
  242.                                     If SelectedChar <= 0 Then Exit Sub 'Fix
  243.  
  244.                                     If Len(Trim(CharData(SelectedChar).Name)) = 0 Then Call MenuState(RenderState.NewChar)
  245.                                 Case 42
  246.                                     If SelectedChar <= 0 Then Exit Sub 'fix
  247.                                     If Len(Trim(CharData(SelectedChar).Name)) > 0 Then Call MenuState(RenderState.UseChar)
  248.                                 Case 43
  249.                                     If SelectedChar <= 0 Then Exit Sub ' fix
  250.  
  251.                                     If Len(Trim(CharData(SelectedChar).Name)) > 0 Or CharData(SelectedChar).Name = "" Then
  252.                                         If MsgBox("Are you sure you want to delete this character?", vbYesNo) = vbYes Then Call MenuState(RenderState.DelChar)
  253.                                     End If
  254.                             End Select
  255.                             ' play sound
  256.                             PlaySound(Sound_ButtonClick)
  257.                         End If
  258.                     End If
  259.                 Next
  260.  
  261.         End Select
  262.  
  263.  
  264.  
  265.         ' reset buttons
  266.         resetClickedButtons()
  267.  
  268.         'MainMenuButtonState(1) = 0
  269.         'MainMenuButtonState(2) = 0
  270.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement