-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPPGUpdateListener.cpp
More file actions
43 lines (34 loc) · 1.41 KB
/
PPGUpdateListener.cpp
File metadata and controls
43 lines (34 loc) · 1.41 KB
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
#include "PPGUpdateListener.h"
Ref<PPGNodeRef> PPGUpdateListener::map_puzzlenode_to_noderef(PPG::Node& N) {
Ref<PPGNodeRef> ref;
ref.instance();
ref->set_object_name(String(N.getRelatedObject().getObjectName().c_str()));
ref->set_current_state(String(N.getRelatedObject().getCurrentState().getName().c_str()));
return ref;
}
PPGUpdateListener::PPGUpdateListener(Object *mgr) {
this->manager = mgr;
}
PPGUpdateListener::~PPGUpdateListener() {
}
void PPGUpdateListener::onPuzzleComplete() {
this->manager->emit_signal("ppg_puzzle_complete");
}
void PPGUpdateListener::onObjectStateChange(PPG::Object& Obj) {
this->manager->emit_signal("ppg_object_state_change", Obj.getObjectName().c_str(), Obj.getCurrentState().getName().c_str());
}
void PPGUpdateListener::onNodeActive(PPG::Node& N) {
Ref<PPGNodeRef> ref = this->map_puzzlenode_to_noderef(N);
this->manager->emit_signal("ppg_node_active", ref);
}
void PPGUpdateListener::onNodeComplete(PPG::Node& N) {
Ref<PPGNodeRef> ref = this->map_puzzlenode_to_noderef(N);
this->manager->emit_signal("ppg_node_complete", ref);
}
void PPGUpdateListener::onNodeIncomplete(PPG::Node& N) {
Ref<PPGNodeRef> ref = this->map_puzzlenode_to_noderef(N);
this->manager->emit_signal("ppg_node_incomplete", ref);
}
void PPGUpdateListener::onNoEffect(PPG::Object& Obj) {
this->manager->emit_signal("ppg_event_no_effect", Obj.getObjectName().c_str());
}