ScriptCode.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 Utility
  8. * @{
  9. */
  10. /// <summary>
  11. /// A resource containing compileable script code.
  12. /// </summary>
  13. public class ScriptCode : Resource
  14. {
  15. /// <summary>
  16. /// Constructor for internal use by the runtime.
  17. /// </summary>
  18. private ScriptCode()
  19. { }
  20. /// <summary>
  21. /// Script code text.
  22. /// </summary>
  23. public string Text
  24. {
  25. get { return Internal_GetText(mCachedPtr); }
  26. set { Internal_SetText(mCachedPtr, value); }
  27. }
  28. /// <summary>
  29. /// Determines should the script code be compiled with editor assemblies.
  30. /// </summary>
  31. public bool EditorScript
  32. {
  33. get { return Internal_IsEditorScript(mCachedPtr); }
  34. set { Internal_SetEditorScript(mCachedPtr, value); }
  35. }
  36. /// <summary>
  37. /// Returns all script types that have been created when this script code resource was compiled.
  38. /// </summary>
  39. public Type[] Types
  40. {
  41. get { return Internal_GetTypes(mCachedPtr); }
  42. }
  43. [MethodImpl(MethodImplOptions.InternalCall)]
  44. private static extern string Internal_GetText(IntPtr thisPtr);
  45. [MethodImpl(MethodImplOptions.InternalCall)]
  46. private static extern void Internal_SetText(IntPtr thisPtr, string value);
  47. [MethodImpl(MethodImplOptions.InternalCall)]
  48. private static extern bool Internal_IsEditorScript(IntPtr thisPtr);
  49. [MethodImpl(MethodImplOptions.InternalCall)]
  50. private static extern void Internal_SetEditorScript(IntPtr thisPtr, bool value);
  51. [MethodImpl(MethodImplOptions.InternalCall)]
  52. private static extern Type[] Internal_GetTypes(IntPtr thisPtr);
  53. }
  54. /** @} */
  55. }