Exemplo n.º 1
0
        /**
         * <summary>Runs the item's 'Examine' interaction, if one is defined.</summary>
         */
        public void RunExamineInteraction()
        {
            InvInstance newInstance = new InvInstance(this);

            newInstance.Examine();
        }
Exemplo n.º 2
0
        /**
         * <summary>Combines two inventory items.</summary>
         * <param name = "combineInstance">The instance of the inventory item to combine</param>
         * <param name = "allowSelfCombining">If True, then an item can be combined with itself</param>
         */
        public void Combine(InvInstance combineInstance, bool allowSelfCombining = false)
        {
            if (!IsValid(this))
            {
                return;
            }
            if (!IsValid(combineInstance))
            {
                return;
            }

            if ((this == combineInstance || InvItem == combineInstance.invItem) && !allowSelfCombining)
            {
                if ((KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || KickStarter.settingsManager.InventoryInteractions == InventoryInteractions.Single) && KickStarter.settingsManager.InventoryDragDrop)
                {
                    if (KickStarter.settingsManager.dragDropThreshold <= 0f)
                    {
                        if (KickStarter.settingsManager.inventoryDropLook)
                        {
                            combineInstance.Examine();
                        }
                    }
                    else
                    {
                        if (KickStarter.playerInput.GetDragState() == DragState.Inventory)
                        {
                            if (KickStarter.settingsManager.inventoryDropLook)
                            {
                                combineInstance.Examine();
                            }
                        }
                        else if (KickStarter.settingsManager.inventoryDropLookNoDrag)
                        {
                            combineInstance.Examine();
                        }
                    }
                }
                else if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.settingsManager.InventoryDragDrop &&
                         KickStarter.settingsManager.dragDropThreshold > 0f && KickStarter.playerInput.GetDragState() != DragState.Inventory && KickStarter.settingsManager.inventoryDropLookNoDrag)
                {
                    KickStarter.runtimeInventory.ShowInteractions(this);
                    return;
                }

                if (this == combineInstance && this == KickStarter.runtimeInventory.SelectedInstance && CanStack())
                {
                    AddStack();
                    return;
                }

                KickStarter.runtimeInventory.SetNull();
                KickStarter.eventManager.Call_OnCombineInventory(this, combineInstance);
            }
            else
            {
                KickStarter.eventManager.Call_OnCombineInventory(this, combineInstance);

                for (int i = 0; i < combineInstance.InvItem.combineID.Count; i++)
                {
                    if (combineInstance.InvItem.combineID[i] == ItemID && combineInstance.InvItem.combineActionList[i])
                    {
                        if (KickStarter.settingsManager.inventoryDisableDefined)
                        {
                            KickStarter.runtimeInventory.SetNull();
                        }

                        AdvGame.RunActionListAsset(combineInstance.InvItem.combineActionList[i]);
                        return;
                    }
                }

                if (KickStarter.settingsManager.reverseInventoryCombinations || (KickStarter.settingsManager.SelectInteractionMethod() == SelectInteractions.CyclingCursorAndClickingHotspot && KickStarter.settingsManager.InventoryInteractions == InventoryInteractions.Multiple))
                {
                    // Try opposite: search selected item instead
                    for (int i = 0; i < InvItem.combineID.Count; i++)
                    {
                        if (InvItem.combineID[i] == combineInstance.ItemID && InvItem.combineActionList[i])
                        {
                            if (KickStarter.settingsManager.inventoryDisableDefined)
                            {
                                KickStarter.runtimeInventory.SetNull();
                            }

                            ActionListAsset assetFile = InvItem.combineActionList[i];
                            AdvGame.RunActionListAsset(assetFile);
                            return;
                        }
                    }
                }

                // Found no combine match

                if (KickStarter.settingsManager.inventoryDisableUnhandled)
                {
                    KickStarter.runtimeInventory.SetNull();
                }

                if (InvItem.unhandledCombineActionList)
                {
                    ActionListAsset unhandledActionList = combineInstance.InvItem.unhandledCombineActionList;
                    AdvGame.RunActionListAsset(unhandledActionList);
                }
                else if (KickStarter.inventoryManager.unhandledCombine)
                {
                    AdvGame.RunActionListAsset(KickStarter.inventoryManager.unhandledCombine);
                }
            }

            KickStarter.playerCursor.ResetSelectedCursor();
        }