FieldSelectionWindow.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using BansheeEngine;
  5. namespace BansheeEditor
  6. {
  7. /** @addtogroup Library
  8. * @{
  9. */
  10. [DefaultSize(250, 350)]
  11. internal class FieldSelectionWindow : DropDownWindow
  12. {
  13. private GUIFieldSelector guiFieldSelector;
  14. public Action<string, SerializableProperty.FieldType> OnFieldSelected;
  15. /// <summary>
  16. /// Constructs the drop down window.
  17. /// </summary>
  18. public FieldSelectionWindow()
  19. {
  20. GUILayout layoutY = GUI.AddLayoutY();
  21. layoutY.AddSpace(5);
  22. GUILayout layoutX = layoutY.AddLayoutX();
  23. layoutY.AddSpace(5);
  24. layoutX.AddSpace(5);
  25. GUILayout selectorLayout = layoutX.AddLayoutY();
  26. layoutX.AddSpace(5);
  27. guiFieldSelector = new GUIFieldSelector(selectorLayout, Selection.SceneObject);
  28. guiFieldSelector.OnElementSelected += (so, comp, path, type) =>
  29. {
  30. OnFieldSelected?.Invoke(path, type);
  31. };
  32. }
  33. }
  34. /** @} */
  35. }