No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GridPalettesDropdown.cs 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. namespace UnityEditor.Tilemaps
  3. {
  4. internal class GridPalettesDropdown : FlexibleMenu
  5. {
  6. public GridPalettesDropdown(IFlexibleMenuItemProvider itemProvider, int selectionIndex, FlexibleMenuModifyItemUI modifyItemUi, Action<int, object> itemClickedCallback, float minWidth)
  7. : base(itemProvider, selectionIndex, modifyItemUi, itemClickedCallback)
  8. {
  9. minTextWidth = minWidth;
  10. }
  11. internal class MenuItemProvider : IFlexibleMenuItemProvider
  12. {
  13. public int Count()
  14. {
  15. return GridPalettes.palettes.Count + 1;
  16. }
  17. public object GetItem(int index)
  18. {
  19. if (index < GridPalettes.palettes.Count)
  20. return GridPalettes.palettes[index];
  21. return null;
  22. }
  23. public int Add(object obj)
  24. {
  25. throw new NotImplementedException();
  26. }
  27. public void Replace(int index, object newPresetObject)
  28. {
  29. throw new NotImplementedException();
  30. }
  31. public void Remove(int index)
  32. {
  33. throw new NotImplementedException();
  34. }
  35. public object Create()
  36. {
  37. throw new NotImplementedException();
  38. }
  39. public void Move(int index, int destIndex, bool insertAfterDestIndex)
  40. {
  41. throw new NotImplementedException();
  42. }
  43. public string GetName(int index)
  44. {
  45. if (index < GridPalettes.palettes.Count)
  46. return GridPalettes.palettes[index].name;
  47. else if (index == GridPalettes.palettes.Count)
  48. return "Create New Palette";
  49. else
  50. return "";
  51. }
  52. public bool IsModificationAllowed(int index)
  53. {
  54. return false;
  55. }
  56. public int[] GetSeperatorIndices()
  57. {
  58. return new int[] { GridPalettes.palettes.Count - 1 };
  59. }
  60. }
  61. }
  62. }