public override void OnInspectorGUI() { if (_target == null || inventoryManager == null) { OnEnable(); return; } EditorGUILayout.LabelField("Stored Inventory items", EditorStyles.boldLabel); if (_target.items.Count > 0) { EditorGUILayout.BeginVertical("Button"); for (int i = 0; i < _target.items.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Item name:", GUILayout.Width(80f)); if (inventoryManager.CanCarryMultiple(_target.items[i].linkedID)) { EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel, GUILayout.Width(135f)); EditorGUILayout.LabelField("Count:", GUILayout.Width(50f)); _target.items[i].count = EditorGUILayout.IntField(_target.items[i].count, GUILayout.Width(44f)); } else { EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel); _target.items[i].count = 1; } if (GUILayout.Button(Resource.CogIcon, GUILayout.Width(20f), GUILayout.Height(15f))) { SideMenu(_target.items[i]); } EditorGUILayout.EndHorizontal(); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); } EditorGUILayout.EndVertical(); } else { EditorGUILayout.HelpBox("This Container has no items", MessageType.Info); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Item to create:", GUILayout.MaxWidth(130f)); itemNumber = EditorGUILayout.Popup(itemNumber, CreateItemList()); if (GUILayout.Button("Add new item")) { ContainerItem newItem = new ContainerItem(CreateItemID(itemNumber), _target.GetIDArray()); _target.items.Add(newItem); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); UnityVersionHandler.CustomSetDirty(_target); }
public override void OnInspectorGUI() { if (_target == null || inventoryManager == null) { OnEnable(); return; } ShowCategoriesUI(_target); EditorGUILayout.Space(); EditorGUILayout.LabelField("Stored Inventory items", EditorStyles.boldLabel); if (_target.items.Count > 0) { EditorGUILayout.BeginVertical("Button"); for (int i = 0; i < _target.items.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Item name:", GUILayout.Width(80f)); if (inventoryManager.CanCarryMultiple(_target.items[i].linkedID)) { EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel, GUILayout.Width(135f)); EditorGUILayout.LabelField("Count:", GUILayout.Width(50f)); _target.items[i].count = EditorGUILayout.IntField(_target.items[i].count, GUILayout.Width(44f)); } else { EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel); _target.items[i].count = 1; } if (GUILayout.Button("", CustomStyles.IconCog)) { SideMenu(_target.items[i]); } EditorGUILayout.EndHorizontal(); if (_target.limitToCategory && _target.categoryIDs != null && _target.categoryIDs.Count > 0) { InvItem listedItem = inventoryManager.GetItem(_target.items[i].linkedID); if (listedItem != null && !_target.categoryIDs.Contains(listedItem.binID)) { EditorGUILayout.HelpBox("This item is not in the categories checked above and will not be displayed.", MessageType.Warning); } } GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); } EditorGUILayout.EndVertical(); } else { EditorGUILayout.HelpBox("This Container has no items", MessageType.Info); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("New item to store:", GUILayout.MaxWidth(130f)); itemNumber = EditorGUILayout.Popup(itemNumber, CreateItemList()); if (GUILayout.Button("Add new item")) { ContainerItem newItem = new ContainerItem(CreateItemID(itemNumber), _target.GetIDArray()); _target.items.Add(newItem); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); UnityVersionHandler.CustomSetDirty(_target); }
public override void OnInspectorGUI() { if (_target == null || inventoryManager == null) { OnEnable(); return; } if (!sideIcon) { sideIcon = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof(Texture2D)); } EditorGUILayout.LabelField("Stored Inventory items", EditorStyles.boldLabel); if (_target.items.Count > 0) { EditorGUILayout.BeginVertical("Button"); for (int i = 0; i < _target.items.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Item name:", GUILayout.Width(80f)); if (inventoryManager.CanCarryMultiple(_target.items[i].linkedID)) { EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel, GUILayout.Width(135f)); EditorGUILayout.LabelField("Count:", GUILayout.Width(50f)); _target.items[i].count = EditorGUILayout.IntField(_target.items[i].count, GUILayout.Width(44f)); } else { EditorGUILayout.LabelField(inventoryManager.GetLabel(_target.items[i].linkedID), EditorStyles.boldLabel); _target.items[i].count = 1; } if (GUILayout.Button(sideIcon, GUILayout.Width(20f), GUILayout.Height(15f))) { SideMenu(_target.items[i]); } EditorGUILayout.EndHorizontal(); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); } EditorGUILayout.EndVertical(); } else { EditorGUILayout.HelpBox("This Container has no items", MessageType.Info); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Item to create:", GUILayout.MaxWidth(130f)); itemNumber = EditorGUILayout.Popup(itemNumber, CreateItemList()); if (GUILayout.Button("Add new item")) { ContainerItem newItem = new ContainerItem(CreateItemID(itemNumber), _target.GetIDArray()); _target.items.Add(newItem); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (GUI.changed) { EditorUtility.SetDirty(_target); } }