Exemplo n.º 1
0
    public void UISwitchTo(UIClass type)
    {
        UICloseAll();

        currentUIEnabled = type;

        switch (type)
        {
        case UIClass.hotbarUI:
            hotbarUI.baseGo.SetActive(true);
            break;

        case UIClass.inventoryUI:
            inventoryUI.baseGo.SetActive(true);
            break;

        case UIClass.mechanismUI:
            mechanismUI.baseGo.SetActive(true);
            break;

        default:
            Debug.Log("None set for " + type.ToString());
            break;
        }
    }
Exemplo n.º 2
0
    public void InitializeUI(UIClass type)
    {
        for (int i = 0; i < hotbar.Count; i++)
        {
            Item bar = hotbar[i];

            switch (type)
            {
            case UIClass.hotbarUI:
                UI.SetSlotFor(UISlotType.hotbar, UITypes.hotbarUI_hotslots, i);
                break;

            case UIClass.inventoryUI:
                UI.SetSlotFor(UISlotType.hotbar, UITypes.inventoryUI_hotSlots, i);
                break;

            case UIClass.mechanismUI:
                UI.SetSlotFor(UISlotType.hotbar, UITypes.mechanismUI_hotSlots, i);
                break;
            }
        }

        for (int i = 0; i < inventory.Count; i++)
        {
            Item inv = inventory[i];

            switch (type)
            {
            case UIClass.inventoryUI:
                UI.SetSlotFor(UISlotType.inventory, UITypes.inventoryUI_invSlots, i);
                break;

            case UIClass.mechanismUI:
                UI.SetSlotFor(UISlotType.inventory, UITypes.mechanismUI_invSlots, i);
                break;
            }
        }

        switch (type)
        {
        case UIClass.hotbarUI:
            UI.hotbarUI.initialized = true;
            break;

        case UIClass.inventoryUI:
            UI.inventoryUI.initialized = true;
            break;

        case UIClass.mechanismUI:
            UI.mechanismUI.initialized = true;
            break;

        default:
            Debug.Log("None set for " + type.ToString());
            break;
        }
    }