12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- extends Control
- const IntPoint = preload("IntPoint.gd")
- const IntPointClient = preload("Client_IntPointService.gd")
- const IntPointService = preload("Loader_proto_gorm.gd")
- onready var intPointClient = IntPointClient.new()
- onready var intPointService = IntPointService.new()
- # Declare member variables here. Examples:
- # var a = 2
- # var b = "text"
- # Called when the node enters the scene tree for the first time.
- func _ready():
- Messaging.subscribe("/websocket/closed", self, "_on_disconnected")
- Messaging.subscribe("/websocket/connected", self, "_on_connected")
- Messaging.subscribe("/IntPointService/Read", self, "_on_read")
- # Called every frame. 'delta' is the elapsed time since the previous frame.
- #func _process(delta):
- # pass
- func _on_read(Out):
- print("response to read: ", Out)
- func _on_connected(proto = ""):
- print("main connected")
- get_node("VBoxContainer/HSplitContainer/Reconnect").text = "~"
-
- func _on_disconnected(proto = ""):
- print("main disconnected")
- get_node("VBoxContainer/HSplitContainer/Reconnect").text = "x"
- func _on_Reconnect_pressed():
- Websocket.reconnect()
- func _on_GetIntPoint_pressed():
- var readRequest = intPointService.ReadIntPointRequest.new()
- readRequest.Id = 2
- intPointClient.Read(readRequest)
- func _on_CreateIntPoint_pressed():
- var createIntPointRequest = intPointService.CreateIntPointRequest.new()
- createIntPointRequest.Payload = intPointService.IntPoint.new()
- createIntPointRequest.Payload.Id = 2
- createIntPointRequest.Payload.X = 20
- createIntPointRequest.Payload.Y = 30
- intPointClient.Create(createIntPointRequest)
- func _on_UpdateIntPoint_pressed():
- var updateIntPointRequest = intPointService.UpdateIntPointRequest.new()
- updateIntPointRequest.Payload = intPointService.IntPoint.new()
- updateIntPointRequest.Payload.Id = 2
- updateIntPointRequest.Payload.X = 50
- updateIntPointRequest.Payload.Y = 80
- intPointClient.Update(updateIntPointRequest)
- func _on_DeleteIntPoint2_pressed():
- var deleteIntPointRequest = intPointService.DeleteIntPointRequest.new()
- deleteIntPointRequest.Id = 2
- intPointClient.Delete(deleteIntPointRequest)
|