SerializableField.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.CompilerServices;
  5. using System.Text;
  6. namespace BansheeEditor
  7. {
  8. public class SerializableField
  9. {
  10. public enum FieldType
  11. {
  12. Int,
  13. Float,
  14. Bool,
  15. String,
  16. Color,
  17. Vector2,
  18. Vector3,
  19. Vector4,
  20. GameObjectRef,
  21. ResourceRef,
  22. Object,
  23. Array,
  24. List,
  25. Dictionary
  26. }
  27. private SerializableObject parent;
  28. private FieldType type;
  29. private int fieldId;
  30. private string name;
  31. internal SerializableField(SerializableObject parent, FieldType type, int fieldId)
  32. {
  33. this.parent = parent;
  34. this.type = type;
  35. this.fieldId = fieldId;
  36. }
  37. public FieldType Type
  38. {
  39. get { return type; }
  40. }
  41. public string Name
  42. {
  43. get { return name; }
  44. }
  45. public SerializableValue GetValue()
  46. {
  47. return null; // TODO - Return actual SerializableValue
  48. }
  49. // TODO - Add getters/setters for all fields
  50. [MethodImpl(MethodImplOptions.InternalCall)]
  51. private static extern void Internal_SetInt32(IntPtr nativeInstance, int fieldId, Int32 value);
  52. [MethodImpl(MethodImplOptions.InternalCall)]
  53. private static extern Int32 Internal_GetInt32(IntPtr nativeInstance, int fieldId);
  54. [MethodImpl(MethodImplOptions.InternalCall)]
  55. private static extern void Internal_SetObject(IntPtr nativeInstance, int fieldId, object value);
  56. [MethodImpl(MethodImplOptions.InternalCall)]
  57. private static extern object Internal_GetObject(IntPtr nativeInstance, int fieldId);
  58. }
  59. }