Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

GridPaletteWhiteboxPalettesDropdown.cs 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using UnityEngine;
  3. namespace UnityEditor.Tilemaps
  4. {
  5. internal class GridPaletteWhiteboxPalettesDropdown : FlexibleMenu
  6. {
  7. public static bool IsOpen = false;
  8. public GridPaletteWhiteboxPalettesDropdown(IFlexibleMenuItemProvider itemProvider, int selectionIndex, FlexibleMenuModifyItemUI modifyItemUi, Action<int, object> itemClickedCallback, float minWidth)
  9. : base(itemProvider, selectionIndex, modifyItemUi, itemClickedCallback)
  10. {
  11. minTextWidth = minWidth;
  12. }
  13. public override void OnOpen()
  14. {
  15. base.OnOpen();
  16. IsOpen = true;
  17. }
  18. public override void OnClose()
  19. {
  20. IsOpen = false;
  21. base.OnClose();
  22. }
  23. internal class MenuItemProvider : IFlexibleMenuItemProvider
  24. {
  25. public int Count()
  26. {
  27. return TilePaletteWhiteboxSamplesUtility.whiteboxSampleNames.Count;
  28. }
  29. public object GetItem(int index)
  30. {
  31. if (index < TilePaletteWhiteboxSamplesUtility.whiteboxSampleNames.Count)
  32. return TilePaletteWhiteboxSamplesUtility.whiteboxSampleNames[index];
  33. return null;
  34. }
  35. public int Add(object obj)
  36. {
  37. throw new NotImplementedException();
  38. }
  39. public void Replace(int index, object newPresetObject)
  40. {
  41. throw new NotImplementedException();
  42. }
  43. public void Remove(int index)
  44. {
  45. throw new NotImplementedException();
  46. }
  47. public object Create()
  48. {
  49. throw new NotImplementedException();
  50. }
  51. public void Move(int index, int destIndex, bool insertAfterDestIndex)
  52. {
  53. throw new NotImplementedException();
  54. }
  55. public string GetName(int index)
  56. {
  57. if (index < TilePaletteWhiteboxSamplesUtility.whiteboxSampleNames.Count)
  58. return TilePaletteWhiteboxSamplesUtility.whiteboxSampleNames[index];
  59. return "";
  60. }
  61. public bool IsModificationAllowed(int index)
  62. {
  63. return false;
  64. }
  65. public int[] GetSeperatorIndices()
  66. {
  67. return Array.Empty<int>();
  68. }
  69. }
  70. }
  71. }