Resource.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup Resources
  8. * @{
  9. */
  10. /// <summary>
  11. /// Base class for all resources. Resources can be persistently referenced by scene objects or other resources.
  12. /// </summary>
  13. public class Resource : ScriptObject
  14. {
  15. /// <summary>
  16. /// Name of the resource. Use primarily for easier identification and not important to the engine itself.
  17. /// </summary>
  18. public string Name
  19. {
  20. get { return Internal_GetName(mCachedPtr); }
  21. }
  22. /// <summary>
  23. /// Returns a universally unique identifier of this resource.
  24. /// </summary>
  25. public string UUID
  26. {
  27. get { return Internal_GetUUID(mCachedPtr); }
  28. }
  29. /// <summary>
  30. /// Releases an internal reference to the resource held by the resources system. <see cref="Resources.Release"/>
  31. /// </summary>
  32. public void Release()
  33. {
  34. Internal_Release(mCachedPtr);
  35. }
  36. [MethodImpl(MethodImplOptions.InternalCall)]
  37. private static extern string Internal_GetName(IntPtr nativeInstance);
  38. [MethodImpl(MethodImplOptions.InternalCall)]
  39. private static extern string Internal_GetUUID(IntPtr nativeInstance);
  40. [MethodImpl(MethodImplOptions.InternalCall)]
  41. private static extern void Internal_Release(IntPtr nativeInstance);
  42. }
  43. /** @} */
  44. }