2019-12-10 20:40:32 +00:00
|
|
|
# Class to manage low level communication with khaganat
|
|
|
|
#
|
|
|
|
# Copyright (C) 2019 AleaJactaEst
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
# https://godotengine.org/qa/20026/to-send-a-udp-packet-godot-3
|
|
|
|
|
|
|
|
extends Control
|
|
|
|
|
2020-01-05 15:16:07 +00:00
|
|
|
onready var BitStream = preload("res://bitstream.gdns")
|
|
|
|
onready var BitSet = preload("res://bitset.gdns")
|
2020-01-19 19:13:57 +00:00
|
|
|
onready var NetworkConnexion = preload("res://networkconnexion.gdns")
|
2020-01-05 15:16:07 +00:00
|
|
|
|
2020-01-19 19:13:57 +00:00
|
|
|
var _networkconnexion
|
2019-12-10 20:40:32 +00:00
|
|
|
|
2020-01-19 19:13:57 +00:00
|
|
|
func _ready():
|
|
|
|
_networkconnexion = NetworkConnexion.new()
|
2019-12-10 20:40:32 +00:00
|
|
|
|
2020-01-19 19:13:57 +00:00
|
|
|
func send_system_login(host, port, user_addr, user_key, user_id, lang):
|
|
|
|
_networkconnexion.send_system_login(host, port, user_addr, user_key, user_id, lang)
|
2019-12-11 21:27:49 +00:00
|
|
|
|
|
|
|
func send_system_quit():
|
2020-01-19 19:13:57 +00:00
|
|
|
_networkconnexion.send_system_quit()
|
2019-12-11 21:27:49 +00:00
|
|
|
|
2019-12-10 20:40:32 +00:00
|
|
|
func send_systemm_disconnect():
|
2020-01-19 19:13:57 +00:00
|
|
|
_networkconnexion.send_systemm_disconnect()
|
2019-12-10 20:40:32 +00:00
|
|
|
|
|
|
|
func disconnect_server():
|
2020-01-19 19:13:57 +00:00
|
|
|
_networkconnexion.disconnect_server()
|
2019-12-10 20:40:32 +00:00
|
|
|
|
2020-01-19 19:13:57 +00:00
|
|
|
func connect_to_server(host, port, user_addr, user_key, user_id, lang):
|
|
|
|
send_system_login(host, port, user_addr, user_key, user_id, lang)
|
2019-12-11 21:27:49 +00:00
|
|
|
|
2019-12-10 20:40:32 +00:00
|
|
|
func _process(delta):
|
2020-01-19 19:13:57 +00:00
|
|
|
_networkconnexion.process(delta)
|
2019-12-10 20:40:32 +00:00
|
|
|
|
|
|
|
func _exit_tree():
|
2020-01-05 15:16:07 +00:00
|
|
|
print("[net_low_level] End")
|
2019-12-10 20:40:32 +00:00
|
|
|
disconnect_server()
|