Skip to content
Snippets Groups Projects
Commit 2c6155f8 authored by Michael Alexander's avatar Michael Alexander
Browse files

move implemented

field partially implemented to do inventory
parent 32ab279b
Branches
No related merge requests found
......@@ -4,5 +4,7 @@
Public SERVER_PORT As Integer
Public NETWORK As NetIO
Public TIME As Long
Public X As Integer
Public Y As Integer
End Module
......@@ -66,6 +66,7 @@ Partial Class Login
Me.ServerIPInput.Name = "ServerIPInput"
Me.ServerIPInput.Size = New System.Drawing.Size(76, 20)
Me.ServerIPInput.TabIndex = 3
Me.ServerIPInput.Text = "167.205.32.46"
'
'UsernameInput
'
......@@ -73,6 +74,7 @@ Partial Class Login
Me.UsernameInput.Name = "UsernameInput"
Me.UsernameInput.Size = New System.Drawing.Size(125, 20)
Me.UsernameInput.TabIndex = 5
Me.UsernameInput.Text = "asd"
'
'PasswordInput
'
......@@ -80,6 +82,7 @@ Partial Class Login
Me.PasswordInput.Name = "PasswordInput"
Me.PasswordInput.Size = New System.Drawing.Size(125, 20)
Me.PasswordInput.TabIndex = 6
Me.PasswordInput.Text = "asd"
Me.PasswordInput.UseSystemPasswordChar = True
'
'LoginButton
......@@ -106,6 +109,7 @@ Partial Class Login
Me.PortInput.Name = "PortInput"
Me.PortInput.Size = New System.Drawing.Size(42, 20)
Me.PortInput.TabIndex = 4
Me.PortInput.Text = "8025"
'
'Login
'
......
......@@ -25,6 +25,8 @@ Public Class Login
If (recvjson.status = "ok") Then
GlobalVariables.TOKEN = recvjson.token
GlobalVariables.TIME = recvjson.time
GlobalVariables.X = recvjson.x
GlobalVariables.Y = recvjson.y
Map.Show()
Me.Close()
ElseIf (recvjson.status = "fail") Then
......
......@@ -22,17 +22,18 @@ Partial Class Map
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.Button4 = New System.Windows.Forms.Button()
Me.Button5 = New System.Windows.Forms.Button()
Me.Button6 = New System.Windows.Forms.Button()
Me.Button7 = New System.Windows.Forms.Button()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.components = New System.ComponentModel.Container()
Me.InventoryButton = New System.Windows.Forms.Button()
Me.MixItemButton = New System.Windows.Forms.Button()
Me.TradeboxButton = New System.Windows.Forms.Button()
Me.OfferButton = New System.Windows.Forms.Button()
Me.FindItemsButton = New System.Windows.Forms.Button()
Me.LogoutButton = New System.Windows.Forms.Button()
Me.MoveButton = New System.Windows.Forms.Button()
Me.NewX = New System.Windows.Forms.TextBox()
Me.NewY = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button8 = New System.Windows.Forms.Button()
Me.FieldButton = New System.Windows.Forms.Button()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
......@@ -53,84 +54,89 @@ Partial Class Map
Me.Panel14 = New System.Windows.Forms.Panel()
Me.Panel15 = New System.Windows.Forms.Panel()
Me.Panel16 = New System.Windows.Forms.Panel()
Me.MapLabel = New System.Windows.Forms.Label()
Me.PositionLabel = New System.Windows.Forms.Label()
Me.TimeLabel = New System.Windows.Forms.Label()
Me.CurrentTimeLabel = New System.Windows.Forms.Label()
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.SuspendLayout()
'
'Button1
'InventoryButton
'
Me.Button1.Location = New System.Drawing.Point(560, 264)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(171, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Inventory"
Me.Button1.UseVisualStyleBackColor = True
Me.InventoryButton.Location = New System.Drawing.Point(560, 264)
Me.InventoryButton.Name = "InventoryButton"
Me.InventoryButton.Size = New System.Drawing.Size(171, 23)
Me.InventoryButton.TabIndex = 0
Me.InventoryButton.Text = "Inventory"
Me.InventoryButton.UseVisualStyleBackColor = True
'
'Button2
'MixItemButton
'
Me.Button2.Location = New System.Drawing.Point(560, 293)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(171, 23)
Me.Button2.TabIndex = 1
Me.Button2.Text = "Mix Item"
Me.Button2.UseVisualStyleBackColor = True
Me.MixItemButton.Location = New System.Drawing.Point(560, 293)
Me.MixItemButton.Name = "MixItemButton"
Me.MixItemButton.Size = New System.Drawing.Size(171, 23)
Me.MixItemButton.TabIndex = 1
Me.MixItemButton.Text = "Mix Item"
Me.MixItemButton.UseVisualStyleBackColor = True
'
'Button3
'TradeboxButton
'
Me.Button3.Location = New System.Drawing.Point(560, 361)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(171, 23)
Me.Button3.TabIndex = 2
Me.Button3.Text = "Tradebox"
Me.Button3.UseVisualStyleBackColor = True
Me.TradeboxButton.Location = New System.Drawing.Point(560, 361)
Me.TradeboxButton.Name = "TradeboxButton"
Me.TradeboxButton.Size = New System.Drawing.Size(171, 23)
Me.TradeboxButton.TabIndex = 2
Me.TradeboxButton.Text = "Tradebox"
Me.TradeboxButton.UseVisualStyleBackColor = True
'
'Button4
'OfferButton
'
Me.Button4.Location = New System.Drawing.Point(560, 390)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(171, 23)
Me.Button4.TabIndex = 3
Me.Button4.Text = "Offer"
Me.Button4.UseVisualStyleBackColor = True
Me.OfferButton.Location = New System.Drawing.Point(560, 390)
Me.OfferButton.Name = "OfferButton"
Me.OfferButton.Size = New System.Drawing.Size(171, 23)
Me.OfferButton.TabIndex = 3
Me.OfferButton.Text = "Offer"
Me.OfferButton.UseVisualStyleBackColor = True
'
'Button5
'FindItemsButton
'
Me.Button5.Location = New System.Drawing.Point(560, 419)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(171, 23)
Me.Button5.TabIndex = 4
Me.Button5.Text = "Find Items"
Me.Button5.UseVisualStyleBackColor = True
Me.FindItemsButton.Location = New System.Drawing.Point(560, 419)
Me.FindItemsButton.Name = "FindItemsButton"
Me.FindItemsButton.Size = New System.Drawing.Size(171, 23)
Me.FindItemsButton.TabIndex = 4
Me.FindItemsButton.Text = "Find Items"
Me.FindItemsButton.UseVisualStyleBackColor = True
'
'Button6
'LogoutButton
'
Me.Button6.Location = New System.Drawing.Point(560, 476)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(171, 23)
Me.Button6.TabIndex = 5
Me.Button6.Text = "Logout"
Me.Button6.UseVisualStyleBackColor = True
Me.LogoutButton.Location = New System.Drawing.Point(560, 476)
Me.LogoutButton.Name = "LogoutButton"
Me.LogoutButton.Size = New System.Drawing.Size(171, 23)
Me.LogoutButton.TabIndex = 5
Me.LogoutButton.Text = "Logout"
Me.LogoutButton.UseVisualStyleBackColor = True
'
'Button7
'MoveButton
'
Me.Button7.Location = New System.Drawing.Point(653, 174)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(78, 23)
Me.Button7.TabIndex = 6
Me.Button7.Text = "Move"
Me.Button7.UseVisualStyleBackColor = True
Me.MoveButton.Location = New System.Drawing.Point(653, 174)
Me.MoveButton.Name = "MoveButton"
Me.MoveButton.Size = New System.Drawing.Size(78, 23)
Me.MoveButton.TabIndex = 6
Me.MoveButton.Text = "Move"
Me.MoveButton.UseVisualStyleBackColor = True
'
'TextBox1
'NewX
'
Me.TextBox1.Location = New System.Drawing.Point(560, 176)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(38, 20)
Me.TextBox1.TabIndex = 7
Me.NewX.Location = New System.Drawing.Point(560, 176)
Me.NewX.Name = "NewX"
Me.NewX.Size = New System.Drawing.Size(38, 20)
Me.NewX.TabIndex = 7
'
'TextBox2
'NewY
'
Me.TextBox2.Location = New System.Drawing.Point(610, 176)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(38, 20)
Me.TextBox2.TabIndex = 8
Me.NewY.Location = New System.Drawing.Point(610, 176)
Me.NewY.Name = "NewY"
Me.NewY.Size = New System.Drawing.Size(38, 20)
Me.NewY.TabIndex = 8
'
'Label1
'
......@@ -141,14 +147,14 @@ Partial Class Map
Me.Label1.TabIndex = 9
Me.Label1.Text = ","
'
'Button8
'FieldButton
'
Me.Button8.Location = New System.Drawing.Point(560, 203)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(171, 23)
Me.Button8.TabIndex = 10
Me.Button8.Text = "Field"
Me.Button8.UseVisualStyleBackColor = True
Me.FieldButton.Location = New System.Drawing.Point(560, 203)
Me.FieldButton.Name = "FieldButton"
Me.FieldButton.Size = New System.Drawing.Size(171, 23)
Me.FieldButton.TabIndex = 10
Me.FieldButton.Text = "Field"
Me.FieldButton.UseVisualStyleBackColor = True
'
'Label2
'
......@@ -330,11 +336,51 @@ Partial Class Map
Me.Panel16.Size = New System.Drawing.Size(96, 92)
Me.Panel16.TabIndex = 27
'
'MapLabel
'
Me.MapLabel.AutoSize = True
Me.MapLabel.Location = New System.Drawing.Point(602, 17)
Me.MapLabel.Name = "MapLabel"
Me.MapLabel.Size = New System.Drawing.Size(0, 13)
Me.MapLabel.TabIndex = 31
'
'PositionLabel
'
Me.PositionLabel.AutoSize = True
Me.PositionLabel.Location = New System.Drawing.Point(602, 50)
Me.PositionLabel.Name = "PositionLabel"
Me.PositionLabel.Size = New System.Drawing.Size(0, 13)
Me.PositionLabel.TabIndex = 32
'
'TimeLabel
'
Me.TimeLabel.AutoSize = True
Me.TimeLabel.Location = New System.Drawing.Point(602, 84)
Me.TimeLabel.Name = "TimeLabel"
Me.TimeLabel.Size = New System.Drawing.Size(0, 13)
Me.TimeLabel.TabIndex = 33
'
'CurrentTimeLabel
'
Me.CurrentTimeLabel.AutoSize = True
Me.CurrentTimeLabel.Location = New System.Drawing.Point(602, 124)
Me.CurrentTimeLabel.Name = "CurrentTimeLabel"
Me.CurrentTimeLabel.Size = New System.Drawing.Size(0, 13)
Me.CurrentTimeLabel.TabIndex = 34
'
'Timer1
'
Me.Timer1.Enabled = True
'
'Map
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(784, 524)
Me.Controls.Add(Me.CurrentTimeLabel)
Me.Controls.Add(Me.TimeLabel)
Me.Controls.Add(Me.PositionLabel)
Me.Controls.Add(Me.MapLabel)
Me.Controls.Add(Me.Panel13)
Me.Controls.Add(Me.Panel14)
Me.Controls.Add(Me.Panel15)
......@@ -355,34 +401,34 @@ Partial Class Map
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.FieldButton)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.NewY)
Me.Controls.Add(Me.NewX)
Me.Controls.Add(Me.MoveButton)
Me.Controls.Add(Me.LogoutButton)
Me.Controls.Add(Me.FindItemsButton)
Me.Controls.Add(Me.OfferButton)
Me.Controls.Add(Me.TradeboxButton)
Me.Controls.Add(Me.MixItemButton)
Me.Controls.Add(Me.InventoryButton)
Me.Name = "Map"
Me.Text = "Map, poi!"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents InventoryButton As System.Windows.Forms.Button
Friend WithEvents MixItemButton As System.Windows.Forms.Button
Friend WithEvents TradeboxButton As System.Windows.Forms.Button
Friend WithEvents OfferButton As System.Windows.Forms.Button
Friend WithEvents FindItemsButton As System.Windows.Forms.Button
Friend WithEvents LogoutButton As System.Windows.Forms.Button
Friend WithEvents MoveButton As System.Windows.Forms.Button
Friend WithEvents NewX As System.Windows.Forms.TextBox
Friend WithEvents NewY As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents FieldButton As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
......@@ -403,4 +449,9 @@ Partial Class Map
Friend WithEvents Panel14 As System.Windows.Forms.Panel
Friend WithEvents Panel15 As System.Windows.Forms.Panel
Friend WithEvents Panel16 As System.Windows.Forms.Panel
Friend WithEvents MapLabel As System.Windows.Forms.Label
Friend WithEvents PositionLabel As System.Windows.Forms.Label
Friend WithEvents TimeLabel As System.Windows.Forms.Label
Friend WithEvents CurrentTimeLabel As System.Windows.Forms.Label
Friend WithEvents Timer1 As System.Windows.Forms.Timer
End Class
......@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -2,10 +2,11 @@
Public Class Map
Private x As Integer
Private y As Integer
Private time As DateTime
Private currentTime As DateTime
Private Sub Map_Load(sender As Object, e As EventArgs) Handles MyBase.Load
time = New DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(CDbl(GlobalVariables.TIME)).ToLocalTime()
GlobalVariables.NETWORK = New NetIO
Dim request As New MapJSONSend
Dim recv As String
......@@ -16,7 +17,9 @@ Public Class Map
recvjson = JsonConvert.DeserializeObject(Of MapJSONRecv)(recv)
If (recvjson.status = "ok") Then
MsgBox("Welcome!")
MapLabel.Text = recvjson.name
PositionLabel.Text = GlobalVariables.X & " , " & GlobalVariables.Y
TimeLabel.Text = time.ToString
Else
MsgBox("Unknown error occured!")
End If
......@@ -24,23 +27,81 @@ Public Class Map
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles InventoryButton.Click
Inventory.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles MixItemButton.Click
MixItem.Show()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles TradeboxButton.Click
Tradebox.Show()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles OfferButton.Click
Offer.Show()
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles FindItemsButton.Click
SendFind.Show()
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles LogoutButton.Click
Login.Show()
Me.Close()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
CurrentTimeLabel.Text = Now
End Sub
Private Sub MoveButton_Click(sender As Object, e As EventArgs) Handles MoveButton.Click
GlobalVariables.NETWORK = New NetIO
Dim request As New MoveJSONSend
Dim recv As String
request.x = NewX.Text
request.y = NewY.Text
recv = NETWORK.SendRecv(request)
Dim recvjson As New MoveJSONRecv
recvjson = JsonConvert.DeserializeObject(Of MoveJSONRecv)(recv)
If (recvjson.status = "ok") Then
GlobalVariables.X = request.x
GlobalVariables.Y = request.y
GlobalVariables.TIME = recvjson.time
time = New DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(CDbl(GlobalVariables.TIME)).ToLocalTime()
PositionLabel.Text = GlobalVariables.X & " , " & GlobalVariables.Y
TimeLabel.Text = time.ToString
ElseIf (recvjson.status = "fail") Then
MsgBox(recvjson.description)
Else
MsgBox("Unknown error occured!")
End If
End Sub
Private Sub FieldButton_Click(sender As Object, e As EventArgs) Handles FieldButton.Click
GlobalVariables.NETWORK = New NetIO
Dim request As New FieldJSONSend
Dim recv As String
recv = NETWORK.SendRecv(request)
Dim recvjson As New FieldJSONRecv
recvjson = JsonConvert.DeserializeObject(Of FieldJSONRecv)(recv)
If (recvjson.status = "ok") Then
'TBD disini masukin ke inventory how to dunno yet maybe the dirty hack global class?
MsgBox(recvjson.item)
ElseIf (recvjson.status = "fail") Then
MsgBox(recvjson.description)
Else
MsgBox("Unknown error occured!")
End If
End Sub
End Class
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment