mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-19 02:16:51 +01:00
Make UserManagers register themselves.
This commit is contained in:
parent
a349dbd762
commit
d025937074
@ -1,5 +1,8 @@
|
||||
#include "user_manager.h"
|
||||
|
||||
#include "core/engine.h"
|
||||
|
||||
#include "../singleton/user_db.h"
|
||||
#include "../users/user.h"
|
||||
|
||||
Ref<User> UserManager::get_user(const int id) {
|
||||
@ -52,6 +55,14 @@ UserManager::UserManager() {
|
||||
UserManager::~UserManager() {
|
||||
}
|
||||
|
||||
void UserManager::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_POST_ENTER_TREE) {
|
||||
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||
UserDB::get_singleton()->set_user_manager(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UserManager::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "User"), "_get_user", PropertyInfo(Variant::INT, "id")));
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "User"), "_get_user_name", PropertyInfo(Variant::STRING, "user_name")));
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
~UserManager();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user