feat: implemented ClueDB, ClueData and ClueID

This commit is contained in:
Sara Gerretsen 2025-10-21 22:57:28 +02:00
parent 3ff4935e02
commit 46d8749c2c
10 changed files with 165 additions and 27 deletions

View file

@ -1,11 +1,13 @@
#include "client_node.h"
#include "ydi_client.h"
#include <core/config/engine.h>
ClientNode *ClientNode::singleton_instance{ nullptr };
String const ClientNode::sig_connection_changed{ "connection_changed" };
void ClientNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("connect_to_server", "server_url"), &self_type::connect_to_server);
ADD_SIGNAL(MethodInfo(sig_connection_changed, PropertyInfo(Variant::INT, "connected", PROPERTY_HINT_ENUM, "Disconnected,Connected,Authenticated")));
}
@ -37,25 +39,12 @@ void ClientNode::_notification(int what) {
if (Engine::get_singleton()->is_editor_hint()) {
return;
}
switch (what) {
case NOTIFICATION_ENTER_TREE:
set_process(true);
return;
case NOTIFICATION_PROCESS:
process();
return;
case NOTIFICATION_EXIT_TREE:
exit_tree();
return;
default:
return;
}
}
ClientNode *ClientNode::get_singleton() {
return singleton_instance;
}
void ClientNode::connect_to_server(String const &server) {
ydi::client::connect(server);
void ClientNode::connect_to_server(String const &url) {
ydi::client::connect(url);
}