-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathplayer_message.h
51 lines (37 loc) · 1.41 KB
/
player_message.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "util.h"
#include "unique_entity.h"
#include "position.h"
#include "t_string.h"
class GuiFactory;
class View;
RICH_ENUM(MessagePriority, NORMAL, HIGH, CRITICAL);
class PlayerMessage : public UniqueEntity<PlayerMessage> {
public:
PlayerMessage(const TString&, MessagePriority = MessagePriority::NORMAL);
PlayerMessage(const TSentence&, MessagePriority = MessagePriority::NORMAL);
PlayerMessage(const TStringId&, MessagePriority = MessagePriority::NORMAL);
PlayerMessage(const char*, MessagePriority = MessagePriority::NORMAL) = delete;
static void presentMessages(View*, const vector<PlayerMessage>&);
PlayerMessage& setPosition(Position);
optional<Position> getPosition() const;
PlayerMessage& setCreature(UniqueEntity<Creature>::Id);
optional<UniqueEntity<Creature>::Id> getCreature() const;
bool isClickable() const;
const TString& getText() const;
string getTranslatedText(View*) const;
string getTranslatedText(GuiFactory*) const;
MessagePriority getPriority() const;
double getFreshness() const;
void setFreshness(double);
int getHash() const;
SERIALIZATION_DECL(PlayerMessage);
TString SERIAL(text);
private:
MessagePriority SERIAL(priority);
double SERIAL(freshness);
optional<string> SERIAL(announcementTitle);
optional<Position> SERIAL(position);
optional<UniqueEntity<Creature>::Id> SERIAL(creature);
};
CEREAL_CLASS_VERSION(PlayerMessage, 1);