InspectableField.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.CompilerServices;
  5. using System.Text;
  6. namespace BansheeEngine
  7. {
  8. public class InspectableField
  9. {
  10. public enum Type
  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 EditorField guiField; // TODO - This will likely be a specific EditorField type, not a generic base one
  28. private InspectableObjectBase parent;
  29. private Type type;
  30. // TODO - Add getters/setters for all fields
  31. // TODO - Make sure "guiField" is created properly
  32. public void Refresh()
  33. {
  34. // TODO - Update "guiField" from the field value by calling "Internal_Get*" method
  35. }
  36. public void Destroy()
  37. {
  38. // TODO - Called by the parent
  39. // Release "guiField"
  40. }
  41. private void OnValueChangedInt32(Int32 newValue)
  42. {
  43. // TODO - Callback from "guiField"
  44. // Need separate methods for all types
  45. // Call "Internal_Set*" method to update the actual field
  46. // Register an "Undo" action
  47. }
  48. // TODO - I need a set of these methods for all possible "Type"s
  49. // Internally they should use SerializableField methods for setting/getting values
  50. [MethodImpl(MethodImplOptions.InternalCall)]
  51. private static extern void Internal_SetInt32(IntPtr nativeInstance, Int32 value);
  52. [MethodImpl(MethodImplOptions.InternalCall)]
  53. private static extern Int32 Internal_GetInt32(IntPtr nativeInstance);
  54. }
  55. }