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

61 lines
2.1 KiB
GDScript

# 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/>.
extends Control
var _networkconnection = NetworkConnection.new()
var _referentialmessage = ReferentialMessage.new()
func _ready():
pass
#func send_system_login(host, port, user_addr, user_key, user_id, lang):
# _networkconnection.define_server(host, port)
# _networkconnection.define_user(user_addr, user_key, user_id)
# _networkconnection.define_lang(lang)
# _networkconnection.connect_to_server()
func send_system_quit():
_networkconnection.send_system_quit()
func send_systemm_disconnect():
_networkconnection.send_systemm_disconnect()
func disconnect_server():
_networkconnection.disconnect_server()
func connect_to_server(host, port, user_addr, user_key, user_id, lang):
_networkconnection.define_server(host, port)
_networkconnection.define_user(user_addr, user_key, user_id)
_networkconnection.define_lang(lang)
_networkconnection.connect_to_server()
#send_system_login(host, port, user_addr, user_key, user_id, lang)
func _process(delta):
#_networkconnection.process(delta)
#var data = _networkconnection.get_server_messages()
##print("******* data:", data.size(), data)
#if data.size() > 0:
# var ele = data.pop_front()
# print("*** ele:" , ele)
pass
func _exit_tree():
print("[net_low_level] End")
disconnect_server()
_networkconnection.terminate_network_connection()
_referentialmessage.clear_session()