Inventory.updatePadding C# (CSharp) Method

updatePadding() public method

public updatePadding ( ) : void
return void
    public void updatePadding()
    {
        SlotGridLayout.spacing = new Vector2(paddingBetweenX, paddingBetweenY);
        SlotGridLayout.padding.bottom = paddingBottom;
        SlotGridLayout.padding.right = paddingRight;
        SlotGridLayout.padding.left = paddingLeft;
        SlotGridLayout.padding.top = paddingTop;
    }

Same methods

Inventory::updatePadding ( int spacingBetweenX, int spacingBetweenY ) : void

Usage Example

Example #1
0
    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--;
    }