Пример #1
0
    // Inventory state has "changed"
    void SetInventoryState(int palletteState)
    {
        // Toggle all inventory
        m_inventoryPanel.SetActive(m_inventoryOpen);
        m_inventoryBackground.SetActive(m_inventoryOpen);

        m_slotHighlighter.GetComponent <RectTransform>().sizeDelta = new Vector2(LIB_Inventory.CELL_DIMENSION * 1.1f, LIB_Inventory.CELL_DIMENSION * 1.1f);

        // Enable the slot highlighter
        m_slotHighlighter.SetActive(m_inventoryOpen);

        if (m_inventoryOpen)
        {
            // Pause Game
            Time.timeScale = 0;

            m_palletteState = palletteState;

            // Enable and disable all option windows accordingly
            switch (palletteState)
            {
            case 0:
                // Opened inventory in its default state (Left panel should display character info etc)
                m_equipmentPanel.SetActive(true);

                m_containerPanel.SetActive(false);

                m_invScrollTarget = Vector2.zero;
                m_slotHighlighter.transform.position = m_slotArrayInventory[0].SLOTOBJ.transform.position;

                break;

            case 1:
                // Opened inventory via a container (Left panel should display container contents panel)
                m_equipmentPanel.SetActive(false);

                m_containerPanel.SetActive(true);

                m_invScrollTarget = Vector2.zero;
                m_slotHighlighter.transform.position = m_slotArrayContainer[0].SLOTOBJ.transform.position;

                break;
            }
        }
        else
        {
            // Resume Game
            Time.timeScale = 1;

            m_invScrollTarget = Vector2.zero;

            LIB_Inventory.CleanContainer(m_containerSlotSubPanel);

            m_slotHighlighter.transform.position = m_slotArrayInventory[0].SLOTOBJ.transform.position;

            // Disable all option windows
            m_equipmentPanel.SetActive(false);
            m_containerPanel.SetActive(false);
        }

        // Update the game controller, static vars
        LIB_GameController.IS_INVENTORY_OPEN = m_inventoryOpen;
    }