feat: defined clue data resource
This commit is contained in:
parent
dbcd580b4b
commit
7d1ae226bc
2 changed files with 72 additions and 0 deletions
46
modules/you_done_it/clue_data.cpp
Normal file
46
modules/you_done_it/clue_data.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include "clue_data.h"
|
||||
#include "you_done_it/macros.h"
|
||||
#include "you_done_it/ydi_client.h"
|
||||
#include <core/config/engine.h>
|
||||
|
||||
void ClueData::_bind_methods() {
|
||||
BIND_HPROPERTY(Variant::INT, id, PROPERTY_HINT_ENUM, NetworkData::ClueID_hint());
|
||||
}
|
||||
|
||||
void ClueData::set_revealed(bool value) {
|
||||
this->revealed = value;
|
||||
}
|
||||
|
||||
void ClueData::set_id(NetworkData::ClueID id) {
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
NetworkData::ClueID ClueData::get_id() const {
|
||||
return this->id;
|
||||
}
|
||||
|
||||
void ClueData::reveal() {
|
||||
if (this->id == NetworkData::CLUE_MAX) {
|
||||
print_error("Attempt to reveal CLUE_MAX, invalid state, aborting");
|
||||
abort();
|
||||
}
|
||||
if (this->revealed) {
|
||||
print_error("Attempt to reveal clue that's already revealed, returning without action");
|
||||
return;
|
||||
}
|
||||
this->revealed = true;
|
||||
ydi::client::send::reveal_clue(this->id);
|
||||
}
|
||||
|
||||
bool ClueData::get_revealed() const {
|
||||
return this->revealed;
|
||||
}
|
||||
|
||||
void ClueData::set_image(Ref<Image> image) {
|
||||
this->image = image;
|
||||
// TODO: Sync to server
|
||||
}
|
||||
|
||||
Ref<Image> ClueData::get_image() const {
|
||||
return this->image;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue