void sizeOfInventoryGUI() { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.IntSlider(inventoryHeight, 1, 10, new GUIContent("Height")); EditorGUILayout.IntSlider(inventoryWidth, 1, 10, new GUIContent("Width")); if (EditorGUI.EndChangeCheck()) { inv.setImportantVariables(); inv.updateSlotAmount(); inv.adjustInventorySize(); inv.updatePadding(slotsPaddingBetweenX.intValue, slotsPaddingBetweenY.intValue); inv.updateSlotSize(inventorySlotSize.intValue); inv.stackableSettings(); } EditorGUI.BeginChangeCheck(); EditorGUILayout.IntSlider(inventorySlotSize, 20, 100, new GUIContent("Slot Size")); //intfield for the slotsize if (EditorGUI.EndChangeCheck()) //if intfield got changed { inv.setImportantVariables(); inv.adjustInventorySize(); inv.updateSlotSize(inventorySlotSize.intValue); } EditorGUI.BeginChangeCheck(); EditorGUILayout.IntSlider(inventoryIconSize, 20, 100, new GUIContent("Icon Size")); //intfield for the slotsize if (EditorGUI.EndChangeCheck()) //if intfield got changed { inv.updateIconSize(inventoryIconSize.intValue); } GUILayout.BeginVertical("Box"); showInventoryPadding = EditorGUILayout.Foldout(showInventoryPadding, "Padding"); if (showInventoryPadding) { EditorGUI.BeginChangeCheck(); EditorGUI.indentLevel++; slotsPaddingLeft.intValue = EditorGUILayout.IntField("Left:", slotsPaddingLeft.intValue); slotsPaddingRight.intValue = EditorGUILayout.IntField("Right:", slotsPaddingRight.intValue); slotsPaddingBetweenX.intValue = EditorGUILayout.IntField("Spacing X:", slotsPaddingBetweenX.intValue); slotsPaddingBetweenY.intValue = EditorGUILayout.IntField("Spacing Y:", slotsPaddingBetweenY.intValue); slotsPaddingTop.intValue = EditorGUILayout.IntField("Top:", slotsPaddingTop.intValue); slotsPaddingBottom.intValue = EditorGUILayout.IntField("Bottom:", slotsPaddingBottom.intValue); EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { inv.adjustInventorySize(); inv.updatePadding(slotsPaddingBetweenX.intValue, slotsPaddingBetweenY.intValue); } } GUILayout.EndVertical(); EditorGUI.indentLevel--; }
public override void Interact() { base.Interact(); bool check = _inventory.checkIfItemAllreadyExist(item.itemID, item.itemValue); if (check) { Destroy(this.gameObject); } else if (_inventory.ItemsInInventory.Count < (_inventory.width * _inventory.height)) { _inventory.addItemToInventory(item.itemID, item.itemValue); _inventory.updateIconSize(); _inventory.updateItemList(); _inventory.stackableSettings(); Destroy(this.gameObject); GameManager.NotifyPickedUpItem(item); } }