Ingen beskrivning
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.

GridPaintTargetsDropdown.cs 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. namespace UnityEditor.Tilemaps
  3. {
  4. internal class GridPaintTargetsDropdown : FlexibleMenu
  5. {
  6. public GridPaintTargetsDropdown(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 GridPaintingState.validTargets != null ? GridPaintingState.validTargets.Length : 0;
  16. }
  17. public object GetItem(int index)
  18. {
  19. return GridPaintingState.validTargets != null ? GridPaintingState.validTargets[index] : GridPaintingState.scenePaintTarget;
  20. }
  21. public int Add(object obj)
  22. {
  23. throw new NotImplementedException();
  24. }
  25. public void Replace(int index, object newPresetObject)
  26. {
  27. throw new NotImplementedException();
  28. }
  29. public void Remove(int index)
  30. {
  31. throw new NotImplementedException();
  32. }
  33. public object Create()
  34. {
  35. throw new NotImplementedException();
  36. }
  37. public void Move(int index, int destIndex, bool insertAfterDestIndex)
  38. {
  39. throw new NotImplementedException();
  40. }
  41. public string GetName(int index)
  42. {
  43. return GridPaintingState.validTargets != null ? GridPaintingState.validTargets[index].name : GridPaintingState.scenePaintTarget.name;
  44. }
  45. public bool IsModificationAllowed(int index)
  46. {
  47. return false;
  48. }
  49. public int[] GetSeperatorIndices()
  50. {
  51. return new int[0];
  52. }
  53. }
  54. }
  55. }