A game about forced loneliness, made by TACStudios
at master 2.8 kB view raw
1using System; 2 3namespace UnityEditor.Tilemaps 4{ 5 internal class GridPaintCreateTargetsDropdown : FlexibleMenu 6 { 7 public static bool IsOpen = false; 8 9 public GridPaintCreateTargetsDropdown(IFlexibleMenuItemProvider itemProvider, int selectionIndex, FlexibleMenuModifyItemUI modifyItemUi, Action<int, object> itemClickedCallback, float minWidth) 10 : base(itemProvider, selectionIndex, modifyItemUi, itemClickedCallback) 11 { 12 minTextWidth = minWidth; 13 } 14 15 public override void OnOpen() 16 { 17 base.OnOpen(); 18 IsOpen = true; 19 } 20 21 public override void OnClose() 22 { 23 IsOpen = false; 24 base.OnClose(); 25 } 26 27 internal class MenuItemProvider : IFlexibleMenuItemProvider 28 { 29 private bool m_HasTilePalette; 30 31 public MenuItemProvider(bool hasTilePalette) 32 { 33 m_HasTilePalette = hasTilePalette; 34 } 35 36 public int Count() 37 { 38 return GameObjectCreation.CreateTilemapTargetsNames.Length - (m_HasTilePalette ? 0 : 1); 39 } 40 41 public object GetItem(int index) 42 { 43 if (!m_HasTilePalette) 44 index += 1; 45 if (index < GameObjectCreation.CreateTilemapTargetsNames.Length) 46 return GameObjectCreation.CreateTilemapTargetsNames[index]; 47 return null; 48 } 49 50 public int Add(object obj) 51 { 52 throw new NotImplementedException(); 53 } 54 55 public void Replace(int index, object newPresetObject) 56 { 57 throw new NotImplementedException(); 58 } 59 60 public void Remove(int index) 61 { 62 throw new NotImplementedException(); 63 } 64 65 public object Create() 66 { 67 throw new NotImplementedException(); 68 } 69 70 public void Move(int index, int destIndex, bool insertAfterDestIndex) 71 { 72 throw new NotImplementedException(); 73 } 74 75 public string GetName(int index) 76 { 77 if (!m_HasTilePalette) 78 index += 1; 79 if (index < GameObjectCreation.CreateTilemapTargetsNames.Length) 80 return GameObjectCreation.CreateTilemapTargetsNames[index]; 81 return ""; 82 } 83 84 public bool IsModificationAllowed(int index) 85 { 86 return false; 87 } 88 89 public int[] GetSeperatorIndices() 90 { 91 return Array.Empty<int>(); 92 } 93 } 94 } 95}