114 lines
3.9 KiB
C++
114 lines
3.9 KiB
C++
/*
|
|
Library to present all functions of NetworkConnectionCore (network)
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
#include "network_connection.h"
|
|
#include "network_connection_core.h"
|
|
|
|
void NetworkConnection::_bind_methods()
|
|
{
|
|
ClassDB::bind_method(D_METHOD("define_checksum_msg_xml", "checksum_msg_xml"), &NetworkConnection::define_checksum_msg_xml);
|
|
ClassDB::bind_method(D_METHOD("define_server", "host", "port"), &NetworkConnection::define_server);
|
|
ClassDB::bind_method(D_METHOD("define_user", "user_addr", "user_key", "user_id"), &NetworkConnection::define_user);
|
|
ClassDB::bind_method(D_METHOD("define_lang", "lang"), &NetworkConnection::define_lang);
|
|
ClassDB::bind_method(D_METHOD("disconnect_server"), &NetworkConnection::disconnect_server);
|
|
ClassDB::bind_method(D_METHOD("process", "delta"), &NetworkConnection::process);
|
|
ClassDB::bind_method(D_METHOD("get_state"), &NetworkConnection::get_state);
|
|
ClassDB::bind_method(D_METHOD("connect_to_server"), &NetworkConnection::connect_to_server);
|
|
ClassDB::bind_method(D_METHOD("put_command"), &NetworkConnection::put_command);
|
|
ClassDB::bind_method(D_METHOD("get_server_messages"), &NetworkConnection::get_server_messages);
|
|
ClassDB::bind_method(D_METHOD("get_server_tick"), &NetworkConnection::get_server_tick);
|
|
ClassDB::bind_method(D_METHOD("terminate_network_connection"), &NetworkConnection::terminate_network_connection);
|
|
//ClassDB::bind_method(D_METHOD("get_master_message_description_node"), &NetworkConnection::get_master_message_description_node);
|
|
}
|
|
|
|
NetworkConnection::NetworkConnection()
|
|
{
|
|
}
|
|
|
|
NetworkConnection::~NetworkConnection()
|
|
{
|
|
}
|
|
|
|
int NetworkConnection::get_state()
|
|
{
|
|
return NetworkConnectionCore::get_singleton()->get_state();
|
|
}
|
|
|
|
void NetworkConnection::define_checksum_msg_xml(Array checksum_msg_xml)
|
|
{
|
|
NetworkConnectionCore::get_singleton()->define_checksum_msg_xml(checksum_msg_xml);
|
|
}
|
|
|
|
void NetworkConnection::define_server(String host, int64_t port)
|
|
{
|
|
NetworkConnectionCore::get_singleton()->define_server(host, port);
|
|
}
|
|
|
|
void NetworkConnection::define_user(String user_addr, String user_key, String user_id)
|
|
{
|
|
NetworkConnectionCore::get_singleton()->define_user(user_addr, user_key, user_id);
|
|
}
|
|
|
|
void NetworkConnection::define_lang(String lang)
|
|
{
|
|
NetworkConnectionCore::get_singleton()->define_lang(lang);
|
|
}
|
|
|
|
void NetworkConnection::connect_to_server()
|
|
{
|
|
NetworkConnectionCore::get_singleton()->connect_to_server();
|
|
}
|
|
|
|
void NetworkConnection::disconnect_server()
|
|
{
|
|
NetworkConnectionCore::get_singleton()->disconnect_server();
|
|
}
|
|
|
|
void NetworkConnection::process(int delta)
|
|
{
|
|
NetworkConnectionCore::get_singleton()->process(delta);
|
|
}
|
|
|
|
/*
|
|
MessageDescriptionNode & NetworkConnection::get_master_message_description_node()
|
|
{
|
|
return NetworkConnectionCore::get_singleton()->get_master_message_description_node();
|
|
}
|
|
*/
|
|
|
|
void NetworkConnection::put_command(Variant command)
|
|
{
|
|
NetworkConnectionCore::get_singleton()->put_command(command);
|
|
}
|
|
|
|
Variant NetworkConnection::get_server_messages()
|
|
{
|
|
return NetworkConnectionCore::get_singleton()->get_server_messages();
|
|
}
|
|
|
|
Variant NetworkConnection::get_server_tick()
|
|
{
|
|
return NetworkConnectionCore::get_singleton()->get_server_tick();
|
|
}
|
|
|
|
void NetworkConnection::terminate_network_connection()
|
|
{
|
|
NetworkConnectionCore::terminate_connexion();
|
|
}
|