예제 #1
0
        private IEnumerator WaitForPossibleSecondInventory()
        {
            yield return(StartCoroutine(InventoryEventListener.WaitForPossibleEvent(1)));

            if (receivedInventories[1] == null)
            {
                EnablePanels(receivedInventories[0].owner);
            }
            else
            {
                InventoryOwner nonPlayerOwner = GetNonPlayerOwner();
                EnablePanels(nonPlayerOwner);
            }

            inventoryOpen = true;
        }
예제 #2
0
        private IEnumerator DropCoroutine()
        {
            yield return(StartCoroutine(InventoryEventListener.WaitForPossibleEvent(5)));

            if (!dropOnItemSlot) // drop item on floor
            {
                dataInputAtStart.container.DropItemOnFloor(dataInputAtStart.itemSlot);
                string infoMessage = MakeDropOnFloorMessage(dataInputAtStart.itemSlot.Quantity,
                                                            dataInputAtStart.itemSlot.Item.name);
                SendStringMessage(infoMessage);
                ResetPanel();
            }
            else if (dataInputAtStart.itemSlot == dataInputAtEnd.itemSlot) // depart = destination
            {
                ResetPanel();
            }
            else
            {
                Item itemAtStart = dataInputAtStart.itemSlot.Item;
                Item itemAtEnd   = dataInputAtEnd.itemSlot.Item;

                if (itemAtEnd == null || itemAtEnd != itemAtStart) // swap itemSlot
                {
                    dataInputAtStart.container.SwapItemSlot(dataInputAtStart.container, dataInputAtStart.itemSlot,
                                                            dataInputAtEnd.container, dataInputAtEnd.itemSlot);
                    ResetPanel();
                }
                else if (itemAtEnd == itemAtStart) // stack itemSlot;
                {
                    if (dataInputAtStart.container == dataInputAtEnd.container ||
                        dataInputAtStart.itemSlot.Quantity == 1)
                    {
                        MoveItem(dataInputAtStart.itemSlot.Quantity);
                    }
                    else
                    {
                        AskForQuantity();
                    }
                }
            }
        }