void BeginClose(UIType type, UIElementHolder uiHolder)
        {
            UIManager.HideUI(uiHolder);

            for (int i = 0; i < inventoryButtonsPerInventory.Length; i++)
            {
                inventoryButtonsPerInventory[i] = null;
            }
            for (int i = 0; i < currentPaginatedOffsets.Length; i++)
            {
                currentPaginatedOffsets[i] = 0;
            }

            BroadcastUIClose(type);
            currentLinkedInventory = null;
        }
Exemplo n.º 2
0
        void OnInventoryUIClose(InventoryUI.UIType type, UIElementHolder uiHolder)
        {
            switch (type)
            {
            // quick inventory
            case InventoryUI.UIType.QuickInventory:
                StandardizedVRInput.MarkActionUnoccupied(QUICK_INVENTORY_CONSUME_ACTION);
                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, QUICK_INVENTORY_CONSUME_ACTION);
                break;

            // full inventory
            case InventoryUI.UIType.FullInventory:
                StandardizedVRInput.MarkActionUnoccupied(FULL_INVENTORY_CONSUME_ACTION);
                StandardizedVRInput.MarkActionUnoccupied(FULL_INVENTORY_DROP_ACTION);
                // StandardizedVRInput.MarkActionUnoccupied(FULL_INVENTORY_FAVORITE_ACTION);

                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, FULL_INVENTORY_CONSUME_ACTION);
                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, FULL_INVENTORY_DROP_ACTION);
                // StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_INVENTORY_FAVORITE_ACTION,);
                break;

            // quick trade
            case InventoryUI.UIType.QuickTrade:
                StandardizedVRInput.MarkActionUnoccupied(QUICK_TRADE_SINGLE_TRADE_ACTION);
                StandardizedVRInput.MarkActionUnoccupied(QUICK_TRADE_TRADE_ALL_ACTION);
                StandardizedVRInput.MarkActionUnoccupied(QUICK_TRADE_SWITCH_TO_FULL_TRADE_ACTION);

                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, QUICK_TRADE_SINGLE_TRADE_ACTION);
                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, QUICK_TRADE_TRADE_ALL_ACTION);
                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, QUICK_TRADE_SWITCH_TO_FULL_TRADE_ACTION);
                break;

            // full trade
            case InventoryUI.UIType.FullTrade:
                StandardizedVRInput.MarkActionUnoccupied(FULL_TRADE_CONSUME_ACTION);
                StandardizedVRInput.MarkActionUnoccupied(FULL_TRADE_TRADE_ALL_ACTION);
                StandardizedVRInput.MarkActionUnoccupied(FULL_TRADE_SINGLE_TRADE_ACTION);

                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, FULL_TRADE_CONSUME_ACTION);
                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, FULL_TRADE_SINGLE_TRADE_ACTION);
                StandardizedVRInput.instance.HideHint(SteamVR_Input_Sources.Any, FULL_TRADE_TRADE_ALL_ACTION);
                break;
            }
        }
        void InitializeCallbacksForUIs(bool isRadial, UIType type, System.Action <GameObject[], object[], Vector2Int> onSubmit)
        {
            for (int i = 0; i < currentPaginatedOffsets.Length; i++)
            {
                currentPaginatedOffsets[i] = 0;
            }

            UIElementHolder uiHolder = Type2UI(type);

            UIManager.ShowUI(uiHolder, true, !isRadial);

            uiHolder.onSubmitEvent += onSubmit;

            // // quick inventory doesnt need alternative inputs, just the one submit
            // if (type != UIType.QuickInventory) {
            // }
            uiHolder.alternativeSubmit += callbackToGetAlternativeSubmit(type);

            if (!isRadial)
            {
                uiHolder.onSelectEvent += OnPaginatedUISelect;
            }
        }
        void BeginShow(bool paginate, bool setSelection, Inventory forInventory, Inventory linkedInventory, UIElementHolder uiHolder, int maxButtons, int uiIndex, int otherIndex)
        {
            if (forInventory != this.inventory)
            {
                currentLinkedInventory = forInventory;
            }

            if (inventoryButtonsPerInventory[uiIndex] == null)
            {
                inventoryButtonsPerInventory[uiIndex] = uiHolder.GetAllElements(maxButtons);
            }
            UpdateUIButtons(paginate, forInventory, linkedInventory, maxButtons, uiIndex, otherIndex);
            if (setSelection)
            {
                UIManager.SetSelection(inventoryButtonsPerInventory[uiIndex][0].gameObject);
            }
        }
Exemplo n.º 5
0
        void OnInventoryUIOpen(InventoryUI.UIType type, UIElementHolder uiHolder)
        {
            SteamVR_Input_Sources hand;

            switch (type)
            {
            // quick inventory
            case InventoryUI.UIType.QuickInventory:
                hand = VRManager.Int2Hand(inventoryUI.quickInventoryInteractorID);

                StandardizedVRInput.MarkActionOccupied(QUICK_INVENTORY_CONSUME_ACTION, VRUIInput.GetUIHand());
                StandardizedVRInput.instance.ShowHint(hand, QUICK_INVENTORY_CONSUME_ACTION, "Use");

                TransformBehavior.AdjustTransform(uiHolder.baseObject.transform, Player.instance.GetHand(hand).transform, quickInventoryEquip, 0);

                VRUIInput.SetUIHand(hand);
                break;

            // full inventory
            case InventoryUI.UIType.FullInventory:
                StandardizedVRInput.MarkActionOccupied(FULL_INVENTORY_CONSUME_ACTION, SteamVR_Input_Sources.Any);
                StandardizedVRInput.MarkActionOccupied(FULL_INVENTORY_DROP_ACTION, SteamVR_Input_Sources.Any);
                // StandardizedVRInput.MarkActionOccupied(FULL_INVENTORY_FAVORITE_ACTION, SteamVR_Input_Sources.Any);

                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.RightHand, FULL_INVENTORY_CONSUME_ACTION, "Use Right Hand");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.LeftHand, FULL_INVENTORY_CONSUME_ACTION, "Use Left Hand");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_INVENTORY_DROP_ACTION, "Drop");
                // StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_INVENTORY_FAVORITE_ACTION, "Favorite");

                VRUIInput.SetUIHand(SteamVR_Input_Sources.Any);
                break;

            // quick trade
            case InventoryUI.UIType.QuickTrade:
                hand = VRManager.Int2Hand(inventoryUI.quickTradeInteractorID);

                StandardizedVRInput.MarkActionOccupied(QUICK_TRADE_SINGLE_TRADE_ACTION, hand);
                StandardizedVRInput.MarkActionOccupied(QUICK_TRADE_TRADE_ALL_ACTION, hand);
                StandardizedVRInput.MarkActionOccupied(QUICK_TRADE_SWITCH_TO_FULL_TRADE_ACTION, hand);

                StandardizedVRInput.instance.ShowHint(hand, QUICK_TRADE_SINGLE_TRADE_ACTION, "Take Item");
                StandardizedVRInput.instance.ShowHint(hand, QUICK_TRADE_TRADE_ALL_ACTION, "Take All");
                StandardizedVRInput.instance.ShowHint(hand, QUICK_TRADE_SWITCH_TO_FULL_TRADE_ACTION, "Open Trade");

                TransformBehavior.AdjustTransform(uiHolder.baseObject.transform, Player.instance.GetHand(hand).transform, quickTradeEquip, 0);

                VRUIInput.SetUIHand(hand);

                break;

            // full trade
            case InventoryUI.UIType.FullTrade:

                StandardizedVRInput.MarkActionOccupied(FULL_TRADE_CONSUME_ACTION, SteamVR_Input_Sources.Any);
                StandardizedVRInput.MarkActionOccupied(FULL_TRADE_TRADE_ALL_ACTION, SteamVR_Input_Sources.Any);
                StandardizedVRInput.MarkActionOccupied(FULL_TRADE_SINGLE_TRADE_ACTION, SteamVR_Input_Sources.Any);

                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.RightHand, FULL_TRADE_CONSUME_ACTION, "Use Right Hand");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.LeftHand, FULL_TRADE_CONSUME_ACTION, "Use Left Hand");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_TRADE_SINGLE_TRADE_ACTION, "Trade Item");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_TRADE_TRADE_ALL_ACTION, "Trade All");

                VRUIInput.SetUIHand(SteamVR_Input_Sources.Any);
                break;
            }
        }