fix: client node now updates new server on connect
This commit is contained in:
parent
237639459a
commit
b77604b28c
2 changed files with 18 additions and 2 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#include "client_node.h"
|
||||
#include "ydi_client.h"
|
||||
#include <core/config/engine.h>
|
||||
#include "core/config/engine.h"
|
||||
#include "you_done_it/clue_data.h"
|
||||
#include "you_done_it/clue_db.h"
|
||||
#include "you_done_it/ydi_client.h"
|
||||
|
||||
ClientNode *ClientNode::singleton_instance{ nullptr };
|
||||
String const ClientNode::sig_connection_changed{ "connection_changed" };
|
||||
|
|
@ -25,6 +27,9 @@ void ClientNode::process() {
|
|||
if (new_status != this->state) {
|
||||
this->state = new_status;
|
||||
emit_signal(sig_connection_changed, new_status);
|
||||
if (new_status == NetworkData::CONNECTION_AUTHENTICATED) {
|
||||
reveal_backlog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,6 +40,16 @@ void ClientNode::exit_tree() {
|
|||
}
|
||||
}
|
||||
|
||||
void ClientNode::reveal_backlog() {
|
||||
Ref<ClueDB> db{ ClueDB::get_singleton() };
|
||||
for (int i{ 0 }; i < NetworkData::CLUE_MAX; ++i) {
|
||||
Ref<ClueData> data{ db->get_clue((NetworkData::ClueID)i) };
|
||||
if (data.is_valid() && data->get_revealed()) {
|
||||
ydi::client::send::reveal_clue(data->get_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ClientNode::_notification(int what) {
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class ClientNode : Node {
|
|||
void enter_tree();
|
||||
void process();
|
||||
void exit_tree();
|
||||
void reveal_backlog();
|
||||
|
||||
protected:
|
||||
void _notification(int what);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue