| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #pragma once
- #include "BsScriptEnginePrerequisites.h"
- #include "CmModule.h"
- #include <mono/jit/jit.h>
- namespace BansheeEngine
- {
- class BS_SCR_BE_EXPORT ScriptResourceManager : public Module<ScriptResourceManager>
- {
- public:
- ScriptResourceManager();
- /**
- * @note Throws an exception if resource for the handle already exists.
- * Creates a new managed instance of the object.
- */
- ScriptTexture2D* createScriptTexture(const HTexture& resourceHandle);
- /**
- * @note Throws an exception if resource for the handle already exists.
- * Initializes the ScriptResource with an existing managed instance.
- */
- ScriptTexture2D* createScriptTexture(MonoObject* existingInstance, const HTexture& resourceHandle);
- /**
- * @note Throws an exception if resource for the handle already exists.
- * Creates a new managed instance of the object.
- */
- ScriptSpriteTexture* createScriptSpriteTexture(const HSpriteTexture& resourceHandle);
- /**
- * @note Throws an exception if resource for the handle already exists.
- * Initializes the ScriptResource with an existing managed instance.
- */
- ScriptSpriteTexture* createScriptSpriteTexture(MonoObject* existingInstance, const HSpriteTexture& resourceHandle);
- /**
- * @note Returns nullptr if script resource doesn't exist.
- */
- ScriptTexture2D* getScriptTexture(const HTexture& resourceHandle);
- /**
- * @note Returns nullptr if script resource doesn't exist.
- */
- ScriptSpriteTexture* getScriptSpriteTexture(const HSpriteTexture& resourceHandle);
- /**
- * @note Returns nullptr if script resource doesn't exist.
- */
- ScriptResource* getScriptResource(const HResource& resourceHandle);
- void destroyScriptResource(ScriptResource* resource);
- private:
- UnorderedMap<String, ScriptResource*>::type mScriptResources;
- MonoClass* mTextureClass;
- MonoClass* mSpriteTextureClass;
- void throwExceptionIfInvalidOrDuplicate(const String& uuid) const;
- };
- }
|