Пример #1
0
    private void Start()
    {
        inventoryData = new InventorySystemData(playerStorageSize, uiInventory.HotbarElementsCount);
        inventoryData.updateHotbarCallback += UpdateHotbarHandler;
        ItemData artificialDataItem  = new ItemData(0, 20, "8c801dfe0159443d83d0de746c5df9f7", true, 100);
        ItemData artificialDataItem1 = new ItemData(0, 90, "8c801dfe0159443d83d0de746c5df9f7", true, 100);
        ItemData artificialDataItem2 = new ItemData(0, 1, "bdaf5b6d7e674d4890d0a8aa59b8b525", false, 1);

        AddToStorage(artificialDataItem);
        AddToStorage(artificialDataItem1);
        AddToStorage(artificialDataItem2);
        var hotbarUiElementsList = uiInventory.GetUiElementsForHotbar();

        for (int i = 0; i < hotbarUiElementsList.Count; i++)
        {
            inventoryData.AddHotbarUIElement(hotbarUiElementsList[i].GetInstanceID());
            hotbarUiElementsList[i].OnClickEvent         += UseHotbarItemHandler;
            hotbarUiElementsList[i].DragContinueCallBack += DraggingHandler;
            hotbarUiElementsList[i].DragStartCallBack    += DragStartHandler;
            hotbarUiElementsList[i].DragStopCallBack     += DragStopHandler;
            hotbarUiElementsList[i].DropCallBack         += DropHandler;
        }
    }