예제 #1
0
        private bool ButtonCheck(string controlname, ButtonAction bAction)
        {
            Sinput.SinputUpdate();

            for (int i = 0; i < joystickIndeces.Count; i++)
            {
                if (bAction == ButtonAction.DOWN && Sinput.GetButtonDown(controlname, (InputDeviceSlot)joystickIndeces[i]))
                {
                    return(true);
                }
                if (bAction == ButtonAction.HELD && Sinput.GetButton(controlname, (InputDeviceSlot)joystickIndeces[i]))
                {
                    return(true);
                }
                if (bAction == ButtonAction.UP && Sinput.GetButtonUp(controlname, (InputDeviceSlot)joystickIndeces[i]))
                {
                    return(true);
                }
                if (bAction == ButtonAction.REPEATING && Sinput.GetButtonDownRepeating(controlname, (InputDeviceSlot)joystickIndeces[i]))
                {
                    return(true);
                }
            }


            return(false);
        }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (Sinput.GetButtonDownRepeating("Up"))
        {
            //highlight item above
            currentMenuItem.highlighted = false;
            currentMenuItem             = currentMenuItem.itemAbove;
            currentMenuItem.highlighted = true;
        }
        if (Sinput.GetButtonDownRepeating("Down"))
        {
            //highlight item below
            currentMenuItem.highlighted = false;
            currentMenuItem             = currentMenuItem.itemBelow;
            currentMenuItem.highlighted = true;
        }
        if (Sinput.GetButtonDown("Submit"))
        {
            //select this item
            currentMenuItem.Select();
            Sinput.ResetInputs();
        }

        cam.position = Vector3.Lerp(cam.position, currentMenuItem.camTargetPos.position, Time.deltaTime * 4f);
        cam.rotation = Quaternion.Slerp(cam.rotation, currentMenuItem.camTargetPos.rotation, Time.deltaTime * 4f);

        cursor.position = currentMenuItem.cursorTarget.position;
    }
        public override bool ShouldActivateModule()
        {
            //Debug.Log("happens");
            if (!base.ShouldActivateModule())
            {
                return(false);
            }

            var shouldActivate = Sinput.GetButtonDown(m_SinputSubmitButton);

            shouldActivate |= Sinput.GetButtonDown(m_SinputCancelButton);
            shouldActivate |= Sinput.GetButtonDownRepeating(m_SinputUpButton);
            shouldActivate |= Sinput.GetButtonDownRepeating(m_SinputDownButton);
            shouldActivate |= Sinput.GetButtonDownRepeating(m_SinputLeftButton);
            shouldActivate |= Sinput.GetButtonDownRepeating(m_SinputRightButton);

            shouldActivate |= (m_MousePos - m_LastMousePos).sqrMagnitude > 0.0f;
            shouldActivate |= Input.GetMouseButtonDown(0);
            return(shouldActivate);
        }
        private Vector2 GetRawMoveVector()
        {
            Vector2 move = Vector2.zero;

            if (Sinput.GetButtonDownRepeating(m_SinputUpButton))
            {
                move.y += 1f;
            }
            if (Sinput.GetButtonDownRepeating(m_SinputDownButton))
            {
                move.y -= 1f;
            }
            if (Sinput.GetButtonDownRepeating(m_SinputLeftButton))
            {
                move.x -= 1f;
            }
            if (Sinput.GetButtonDownRepeating(m_SinputRightButton))
            {
                move.x += 1f;
            }

            return(move);
        }
예제 #5
0
    public void Update()
    {
        if (noInput)
        {
            return;
        }

        if (SUSPEND_GAMEPLAY)
        {
            return;
        }

        int mix = 0; int miy = 0;

        if (Sinput.GetButtonDown("UL"))
        {
            mix = -1; miy = 1;
        }
        if (Sinput.GetButtonDown("U"))
        {
            miy = 1;
        }
        if (Sinput.GetButtonDown("UR"))
        {
            mix = 1; miy = 1;
        }
        if (Sinput.GetButtonDown("L"))
        {
            mix = -1;
        }
        if (Sinput.GetButtonDown("R"))
        {
            mix = 1;
        }
        if (Sinput.GetButtonDown("DL"))
        {
            mix = -1; miy = -1;
        }
        if (Sinput.GetButtonDown("D"))
        {
            miy = -1;
        }
        if (Sinput.GetButtonDown("DR"))
        {
            mix = 1; miy = -1;
        }
        if (mix != 0 || miy != 0)
        {
            if (tileSelectionMode)
            {
                tileSelectionSprite.transform.position += GameMap.instance.GetMapOffset(mix, miy);
            }
            else
            {
                ((GambitModel)GambitModel.instance).TryMovePlayerRelative(mix, miy);
            }
        }

        if (Sinput.GetButtonDown("PICKUP"))
        {
            ((GambitModel)GambitModel.instance).PickUpItemHere();
            showingPickScreen = true;
        }
        if (Sinput.GetButtonDown("INVENTORY"))
        {
            ((GambitModel)GambitModel.instance).ShowInventory();
            showingInventory = true;
        }
        for (int i = 1; i < 6; i++)
        {
            if (Sinput.GetButtonDown("" + i))
            {
                if (showingPickScreen)
                {
                    if (((GambitModel)GambitModel.instance).SelectPickup(i))
                    {
                        showingPickScreen = false;
                    }
                }
                if (showingInventory)
                {
                    ((GambitModel)GambitModel.instance).SelectInventoryItem(i);
                }
            }
        }
        if (Sinput.GetButtonDown("Cancel"))
        {
            if (showingPickScreen)
            {
                showingPickScreen = false;
            }
            if (showingInventory)
            {
                showingInventory = false;
            }
            ItemListWindow.instance.CloseWindow();
        }

        if (showingInventory && Sinput.GetButtonDown("EQUIP"))
        {
            ((GambitModel)GambitModel.instance).EquipSelected();
        }
        else if (showingInventory && Sinput.GetButtonDown("UNEQUIP"))
        {
            ((GambitModel)GambitModel.instance).UnequipSelected();
        }
        else if (showingInventory && Sinput.GetButtonDown("DRINK"))
        {
            ((GambitModel)GambitModel.instance).DrinkSelected();
        }
        else if (showingInventory && Sinput.GetButtonDown("THROW"))
        {
            ((GambitModel)GambitModel.instance).ThrowSelected();
        }

        if (Sinput.GetButtonDownRepeating("Up") ||
            Sinput.GetButtonDownRepeating("Down") ||
            Sinput.GetButtonDownRepeating("Right") ||
            Sinput.GetButtonDownRepeating("Left"))
        {
            if (editMode)
            {
                editMode = false;
            }
        }
    }