ScriptCode.cs 2.1 KB

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