This commit is contained in:
JeroenV26 2025-11-03 14:38:03 +01:00
commit 7b045fb95e
24 changed files with 30 additions and 14 deletions

View file

@ -3,7 +3,7 @@
#include "scene/main/node.h"
#include "you_done_it/ydi_networking.h"
class ClientNode : Node {
class ClientNode : public Node {
GDCLASS(ClientNode, Node);
static ClientNode *singleton_instance;
static void _bind_methods();

View file

@ -27,14 +27,6 @@ void PhotoInbox::unhandled_input(Ref<InputEvent> const &event) {
switch (key->get_key_label()) {
default:
break;
case Key::KEY_1:
on_clue_revealed(NetworkData::CLUE_FIRST);
get_viewport()->set_input_as_handled();
break;
case Key::KEY_2:
on_clue_revealed(NetworkData::CLUE_SECOND);
get_viewport()->set_input_as_handled();
break;
}
}
}

View file

@ -6,11 +6,16 @@ ServerNode *ServerNode::singleton_instance{ nullptr };
String const ServerNode::sig_clue_revealed{ "clue_revealed" };
String const ServerNode::sig_connection_established{ "connection_established" };
String const ServerNode::sig_connection_lost{ "connection_lost" };
String const ServerNode::sig_conclusion_sent{ "conclusion_sent" };
void ServerNode::_bind_methods() {
ADD_SIGNAL(MethodInfo(sig_clue_revealed, PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo(sig_connection_established));
ADD_SIGNAL(MethodInfo(sig_connection_lost));
ADD_SIGNAL(MethodInfo(sig_conclusion_sent,
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())));
ClassDB::bind_method(D_METHOD("open"), &self_type::open);
ClassDB::bind_method(D_METHOD("close"), &self_type::close);

View file

@ -25,6 +25,7 @@ public:
static String const sig_clue_revealed;
static String const sig_connection_established;
static String const sig_connection_lost;
static String const sig_conclusion_sent;
private:
bool is_connected{ false };

View file

@ -4,8 +4,17 @@
#include "core/string/print_string.h"
void NetworkData::_bind_methods() {
BIND_ENUM_CONSTANT(CLUE_FIRST);
BIND_ENUM_CONSTANT(CLUE_SECOND);
BIND_ENUM_CONSTANT(CLUE_STAPLER);
BIND_ENUM_CONSTANT(CLUE_VICTIM_BLOOD);
BIND_ENUM_CONSTANT(CLUE_MURDERER_BLOOD);
BIND_ENUM_CONSTANT(CLUE_KNIFE);
BIND_ENUM_CONSTANT(CLUE_APPLE);
BIND_ENUM_CONSTANT(CLUE_FOLDER);
BIND_ENUM_CONSTANT(CLUE_FOOT_PRINTS);
BIND_ENUM_CONSTANT(CLUE_BUSINESS_CARD);
BIND_ENUM_CONSTANT(CLUE_SIGNED_DOCUMENT);
BIND_ENUM_CONSTANT(CLUE_FINGERPRINT);
BIND_ENUM_CONSTANT(CLUE_HAIR);
BIND_ENUM_CONSTANT(CLUE_MAX);
BIND_ENUM_CONSTANT(CONNECTION_DISCONNECTED);

View file

@ -8,7 +8,7 @@
#include <string>
#include <string_view>
class NetworkData : Object {
class NetworkData : public Object {
GDCLASS(NetworkData, Object);
static void _bind_methods();
@ -28,8 +28,17 @@ public:
MSG_INVALID);
GDENUM(ClueID,
CLUE_FIRST,
CLUE_SECOND,
CLUE_STAPLER,
CLUE_VICTIM_BLOOD,
CLUE_MURDERER_BLOOD,
CLUE_KNIFE,
CLUE_APPLE,
CLUE_FOLDER,
CLUE_FOOT_PRINTS,
CLUE_BUSINESS_CARD,
CLUE_SIGNED_DOCUMENT,
CLUE_FINGERPRINT,
CLUE_HAIR,
CLUE_MAX);
GDENUM(ConnectionStatus,

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB