class ScriptResourceWrapper

Provides a base class for all script object wrappers that wrap a Resource object that may be passed as a shared pointer.

Public

Methods

GetBaseNativeObjectAsShared

SPtr<Resource> GetBaseNativeObjectAsShared() const

Returns the root base class of the wrapped native object as a shared pointer.

GetBaseNativeObjectAsHandle

const HResource &GetBaseNativeObjectAsHandle() const

Returns the root base class of the wrapped native object as a handle.

IsNativeObjectValid

bool IsNativeObjectValid() const

Checks is the native object alive and valid.

staticGetOrCreateScriptObject

static MonoObject *GetOrCreateScriptObject(const HResource &nativeObject)

Attempts to retrieve an existing associated script object from the provided native object.

If one doesn't exist, a new script object and the associated script wrapper will be created.

Unlike GetOrCreateScriptObject implemented on TScriptResourceWrapper, this always accepts the object as a Resource, and needs to perform type lookup to get the exact script wrapper type.

staticGetScriptObjectWrapper

static ScriptResourceWrapper *GetScriptObjectWrapper(const ScriptTypeMetaData &wrapperMetaData, MonoObject *scriptObject)

Returns the script object wrapper associated with the provided script object, and wrapped by a wrapper that owns the provided meta-data.

staticGetOrCreateResourceReference

static MonoObject *GetOrCreateResourceReference(const HResource &resource, u32 rttiId)

Returns a resource reference script object, that is wrapping the provided resource.

resource
Handle to the resource to retrieve the reference for.
rttiId
Type ID for the resource type to create a reference for.

Returns: Script object representing the resource reference.

staticGetResourceScriptClass

static ::MonoClass *GetResourceScriptClass(u32 rttiId)

Maps a RTTI ID to a class representing the specified resource type in script code.

Returns null if the ID cannot be mapped to a script resource class.

staticGetResourceReferenceScriptClass

static ::MonoClass *GetResourceReferenceScriptClass(u32 rttiId)

Returns a RRef <T > type that can be used for wrapping a resource of the type represented by the provided RTTI ID.

Protected

Fields

mNativeObjectStrongHandle

HResource mNativeObjectStrongHandle