test-client-godot/assets/Scripts/Network/net_low_level.gd

52 lines
1.7 KiB
GDScript3
Raw Normal View History

# 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
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-19 19:13:57 +00:00
var _networkconnexion
2020-01-19 19:13:57 +00:00
func _ready():
_networkconnexion = NetworkConnexion.new()
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
func send_systemm_disconnect():
2020-01-19 19:13:57 +00:00
_networkconnexion.send_systemm_disconnect()
func disconnect_server():
2020-01-19 19:13:57 +00:00
_networkconnexion.disconnect_server()
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
func _process(delta):
2020-01-19 19:13:57 +00:00
_networkconnexion.process(delta)
func _exit_tree():
print("[net_low_level] End")
disconnect_server()