Inventory.stackableSettings C# (CSharp) Method

stackableSettings() public method

public stackableSettings ( ) : void
return void
    public void stackableSettings()
    {
        for (int i = 0; i < SlotContainer.transform.childCount; i++)
        {
            if (SlotContainer.transform.GetChild(i).childCount > 0)
            {
                ItemOnObject item = SlotContainer.transform.GetChild(i).GetChild(0).GetComponent<ItemOnObject>();
                if (item.item.maxStack > 1)
                {
                    RectTransform textRectTransform = SlotContainer.transform.GetChild(i).GetChild(0).GetChild(1).GetComponent<RectTransform>();
                    Text text = SlotContainer.transform.GetChild(i).GetChild(0).GetChild(1).GetComponent<Text>();
                    text.text = "" + item.item.itemValue;
                    text.enabled = stackable;
                    textRectTransform.localPosition = new Vector3(positionNumberX, positionNumberY, 0);
                }
                else
                {
                    Text text = SlotContainer.transform.GetChild(i).GetChild(0).GetChild(1).GetComponent<Text>();
                    text.enabled = false;
                }
            }
        }
    }

Same methods

Inventory::stackableSettings ( bool stackable, Vector3 posi ) : void

Usage Example

コード例 #1
0
 void stackableItemsSettings()
 {
     EditorGUILayout.PropertyField(inventoryStackable, new GUIContent("Splitting/Stacking"));
     if (inventoryStackable.boolValue)
     {
         EditorGUI.indentLevel++;
         showStackableItems = EditorGUILayout.Foldout(showStackableItems, "StackNumberPosition");
         if (showStackableItems)
         {
             inventoryStackable.boolValue = true;
             EditorGUI.BeginChangeCheck();
             EditorGUI.indentLevel++;
             positionNumberX.intValue = EditorGUILayout.IntSlider("Position X:", positionNumberX.intValue, -(inventorySlotSize.intValue / 2), inventorySlotSize.intValue / 2);
             positionNumberY.intValue = EditorGUILayout.IntSlider("Position Y:", positionNumberY.intValue, -(inventorySlotSize.intValue / 2), inventorySlotSize.intValue / 2);
             EditorGUI.indentLevel--;
             if (EditorGUI.EndChangeCheck())
             {
                 inv.stackableSettings();
             }
         }
         else
         {
             inv.stackableSettings();
         }
         EditorGUI.indentLevel--;
     }
     else
     {
         inv.stackableSettings();
     }
 }
All Usage Examples Of Inventory::stackableSettings