public static void addItemWindow(StackPanel sp) { if (addItem == null) { addItem = new AddItemWindows(sp); addItem.Closed += (sender, args) => addItem = null; addItem.Show(); } else { addItem.Activate(); } }
public override void OnInspectorGUI() { base.DrawDefaultInspector(); if (database) { EditorGUILayout.BeginVertical("Box"); GUILayout.Label("Items in DataBase: " + database.ItemsCount); if (database.ItemsCount > 0) { EditorGUILayout.BeginHorizontal("Box"); GUILayout.Label("Search: "); searchString = GUILayout.TextField(searchString); EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Add new Item")) { AddItemWindows.ShowWindow(database); } /*if (GUILayout.Button("Add new Content")) * AddContentWindows.ShowWindow(database);*/ EditorGUILayout.EndVertical(); shouldSearch = !string.IsNullOrEmpty(searchString); foreach (var item in database.inventory.items) { if (shouldSearch) { if (item.name.ToLower() == searchString.ToLower() || item.name.ToLower().Contains(searchString.ToLower())) { DisplayItem(item); } } else { DisplayItem(item); } } } }