feat: implemented conclusion_received signal

This commit is contained in:
Sara Gerretsen 2025-11-04 13:30:31 +01:00
parent 40631f5be1
commit 534b527f61
4 changed files with 36 additions and 2 deletions

View file

@ -7,11 +7,16 @@
ClientNode *ClientNode::singleton_instance{ nullptr };
String const ClientNode::sig_connection_changed{ "connection_changed" };
String const ClientNode::sig_conclusion_received{ "conclusion_received" };
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")));
ADD_SIGNAL(MethodInfo(sig_conclusion_received,
PropertyInfo(Variant::INT, "method", PROPERTY_HINT_ENUM, NetworkData::ClueID_hint()),
PropertyInfo(Variant::INT, "motive", PROPERTY_HINT_ENUM, NetworkData::ClueID_hint()),
PropertyInfo(Variant::INT, "murderer", PROPERTY_HINT_ENUM, NetworkData::ClueID_hint())));
}
void ClientNode::enter_tree() {
@ -32,6 +37,11 @@ void ClientNode::process() {
reveal_backlog();
}
}
bool const new_has_conclusion{ ydi::client::receive::has_conclusion() };
if (new_has_conclusion != this->conclusion.is_full()) {
this->conclusion = ydi::client::receive::conclusion();
emit_signal(sig_conclusion_received, this->conclusion[0], this->conclusion[1], this->conclusion[2]);
}
}
void ClientNode::exit_tree() {