-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathEventBase.cpp
More file actions
35 lines (30 loc) · 923 Bytes
/
EventBase.cpp
File metadata and controls
35 lines (30 loc) · 923 Bytes
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
#include <BNM/EventBase.hpp>
#include <BNM/DebugMessages.hpp>
using namespace BNM;
EventBase::EventBase(const IL2CPP::EventInfo *info) {
if (!info) return;
_data = (decltype(_data))info;
_hasAdd = _hasRemove = _hasRaise = false;
if (info->add && info->add->methodPointer) {
_hasAdd = true;
_add = info->add;
}
if (info->remove && info->remove->methodPointer) {
_hasRemove = true;
_remove = info->remove;
}
if (info->raise && info->raise->methodPointer) {
_hasRaise = true;
_raise = info->raise;
}
}
EventBase &EventBase::SetInstance(IL2CPP::Il2CppObject *instance) {
if (_hasAdd) _add.SetInstance(instance);
if (_hasRemove) _remove.SetInstance(instance);
if (_hasRaise) _raise.SetInstance(instance);
return *this;
}
BNM::Class EventBase::GetParentClass() const {
if (!_data) return {};
return _data->parent;
}