diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-02-19 22:36:27 +0100 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-02-19 22:38:22 +0100 |
commit | 9421da57ad552e9004e9ca3d739d75b0c1efee03 (patch) | |
tree | 9ff25829822164180c2edfcf847394ecbfa19c22 /modules/mono/mono_gd/gd_mono_class.cpp | |
parent | aa5b99821b23d74eafb49f4b0d2d86fe693a903c (diff) |
C#: Add 'Singleton' property to singleton wrapper class
This property returns an instance of the singleton.
The purpose of this is to allow using methods from the base class like 'Connect'.
Since all Godot singletons inherit Object, the type of the returned instance is Godot.Object.
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_class.cpp')
-rw-r--r-- | modules/mono/mono_gd/gd_mono_class.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp index bf2a84c708..92324d73f9 100644 --- a/modules/mono/mono_gd/gd_mono_class.cpp +++ b/modules/mono/mono_gd/gd_mono_class.cpp @@ -59,8 +59,16 @@ MonoType *GDMonoClass::get_mono_type() { return get_mono_type(mono_class); } -bool GDMonoClass::is_assignable_from(GDMonoClass *p_from) const { +uint32_t GDMonoClass::get_flags() const { + return mono_class_get_flags(mono_class); +} +bool GDMonoClass::is_static() const { + uint32_t static_class_flags = MONO_TYPE_ATTR_ABSTRACT | MONO_TYPE_ATTR_SEALED; + return (get_flags() & static_class_flags) == static_class_flags; +} + +bool GDMonoClass::is_assignable_from(GDMonoClass *p_from) const { return mono_class_is_assignable_from(mono_class, p_from->mono_class); } |