Example #1
0
        public void ProcessInventoryBoxClick(AC.Menu _menu, MenuInventoryBox inventoryBox, int _slot, MouseState _mouseState)
        {
            if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.Default || inventoryBox.inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected)
            {
                if (KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.playerInput.interactionMenuIsOn)
                {
                    KickStarter.playerMenus.SetInteractionMenus(false);
                    KickStarter.playerInteraction.ClickInvItemToInteract();
                }
                else if (KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.settingsManager.SelectInteractionMethod() == AC.SelectInteractions.CyclingCursorAndClickingHotspot)
                {
                    if (KickStarter.settingsManager.autoCycleWhenInteract && _mouseState == MouseState.SingleClick && (selectedItem == null || KickStarter.settingsManager.cycleInventoryCursors))
                    {
                        int originalIndex = KickStarter.playerInteraction.GetInteractionIndex();
                        KickStarter.playerInteraction.SetNextInteraction();
                        KickStarter.playerInteraction.SetInteractionIndex(originalIndex);
                    }

                    if (!KickStarter.settingsManager.cycleInventoryCursors && selectedItem != null)
                    {
                        inventoryBox.HandleDefaultClick(_mouseState, _slot, KickStarter.settingsManager.interactionMethod);
                    }
                    else if (_mouseState != MouseState.RightClick)
                    {
                        KickStarter.playerMenus.SetInteractionMenus(false);
                        KickStarter.playerInteraction.ClickInvItemToInteract();
                    }

                    if (KickStarter.settingsManager.autoCycleWhenInteract && _mouseState == MouseState.SingleClick)
                    {
                        KickStarter.playerInteraction.RestoreInventoryInteraction();
                    }
                }
                else if (KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Single)
                {
                    inventoryBox.HandleDefaultClick(_mouseState, _slot, AC_InteractionMethod.ContextSensitive);
                }
                else
                {
                    inventoryBox.HandleDefaultClick(_mouseState, _slot, KickStarter.settingsManager.interactionMethod);
                }

                _menu.Recalculate();
            }
            else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.Container)
            {
                inventoryBox.ClickContainer(_mouseState, _slot, KickStarter.playerInput.activeContainer);
                _menu.Recalculate();
            }
            else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.HostpotBased)
            {
                if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    if (_menu.GetTargetInvItem() != null)
                    {
                        //Combine (hoverItem, inventoryBox.items [_slot]);
                        Combine(_menu.GetTargetInvItem(), inventoryBox.items [_slot]);
                    }
                    else if (_menu.GetTargetHotspot())
                    {
                        InvItem _item = inventoryBox.items [_slot];
                        if (_item != null)
                        {
                            SelectItem(_item, SelectItemMode.Use);
                            _menu.TurnOff(false);
                            KickStarter.playerInteraction.ClickButton(InteractionType.Inventory, -2, _item.id, _menu.GetTargetHotspot());
                            KickStarter.playerCursor.ResetSelectedCursor();
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Cannot handle inventory click since there is no active Hotspot.");
                    }
                }
                else
                {
                    Debug.LogWarning("This type of InventoryBox only works with the Choose Hotspot Then Interaction method of interaction.");
                }
            }
        }