예제 #1
0
    public override void Logic(params object[] obj)
    {
        PSJoystickInput input = (PSJoystickInput)obj[0];

        timer.Tick();

        if (timer.state == Timer.TimerState.FINISHING)
        {
            buttonArray[currentIndex].interactable = true;
            currentIndex -= (int)input.PSKeyUpOrDownNumber;

            if (currentIndex > 2)
            {
                currentIndex = 0;
            }
            else if (currentIndex < 0)
            {
                currentIndex = 2;
            }
            buttonArray[currentIndex].interactable = false;
            timer.InitTimer(0.1f);
        }

        if (input.GameButtonA.OnPressed)
        {
            buttonArray[currentIndex].onClick.Invoke();
        }
    }
예제 #2
0
    void SelectItem(object obj)
    {
        PSJoystickInput psInput = (PSJoystickInput)obj;

        Slot temp = GetSlot(currentInventoryX, currentInventoryY);

        UIManager.Instance.Display("ItemDetail");
        if (temp != null && temp.GetCurrentItem != null)
        {
            UIManager.Instance.GetUIWindowForT <ItemDetail>("ItemDetail").ReSet(temp.GetCurrentItem);
        }
        else
        {
            UIManager.Instance.Hiding("ItemDetail");
        }

        if (timer.state == Timer.TimerState.FINISHING)
        {
            currentInventoryX += (int)psInput.PSKeyLeftOrRightNumber;
            currentInventoryY -= (int)psInput.PSKeyUpOrDownNumber;
            SelectHeightLight.transform.position = temp.transform.position;
            timer.InitTimer(0.05f);
        }

        if (psInput.GameButtonA.OnPressed)
        {
            if (inventoryMode == InventoryMode.REPEATMODE)
            {
                temp.ChangeSlot(CurrentSlot);
                inventoryMode = InventoryMode.SELECTMODE;
            }
            else if (inventoryMode == InventoryMode.PUTINMODE)
            {
                Inventory tempInventory = null;
                if (InventoryType == 1)
                {
                    tempInventory = UIManager.Instance.GetUIWindowForT <Inventory>("Inventory");
                }
                else
                {
                    tempInventory = UIManager.Instance.GetUIWindowForT <Inventory>("BagInventory");
                }

                if (tempInventory.InventoryIsFull())
                {
                    //会进行道具之间的替换
                }
                else
                {
                    tempInventory.GetEmptySlot().ChangeSlot(temp);
                }
            }
            else
            {
                if (temp.HasItem())
                {
                    UIManager.Instance.Freeze("ItemDetail");
                    CurrentSlot = GetSlot(currentInventoryX, currentInventoryY);
                }
            }
        }
    }