コード例 #1
0
ファイル: Controls.cs プロジェクト: thegamedesigner/OpenESJ2
    public static bool GetInputUp(Type type, int playerNum)
    {
        if (Recon.useRecon)
        {
            if (!customControls[(int)type])
            {
                return(Recon.Translation(type, Recon.ControlState.Up, playerNum));
            }
        }

        bool result = false;

        for (int i = 0; i < controls.Count; i++)
        {
            if (controls[i].type == type && controls[i].player == playerNum)
            {
                Control control = controls[i];
                //is it a key, or an axis?
                if (control.keyInt != -1)
                {
                    if (Input.GetKeyUp((KeyCode)control.keyInt))
                    {
                        result = true;
                    }
                }
                else
                {
                    //handle axis
                    if (control.posAxis)
                    {
                        //if this axis used to be correct, AND it doesn't equal what it used to be.
                        if (axesOld[control.joyNum, control.axisNum] > deadzone
                            &&
                            axesOld[control.joyNum, control.axisNum] != axes[control.joyNum, control.axisNum])
                        {
                            result = true;
                        }
                    }
                    else
                    {
                        if (axesOld[control.joyNum, control.axisNum] < -deadzone
                            &&
                            axesOld[control.joyNum, control.axisNum] != axes[control.joyNum, control.axisNum])
                        {
                            result = true;
                        }
                    }
                }
            }
        }
        return(result);
    }
コード例 #2
0
ファイル: Controls.cs プロジェクト: thegamedesigner/OpenESJ2
    public static bool GetInput(Type type, int playerNum)
    {
        if (Recon.useRecon)
        {
            if (!customControls[(int)type])
            {
                return(Recon.Translation(type, Recon.ControlState.Constant, playerNum));
            }
        }

        //if (!useCustom) { return AutoControls.GetInput(type, playerNum, AutoControls.InputType.Current); }

        bool result = false;

        for (int i = 0; i < controls.Count; i++)
        {
            if (controls[i].type == type && controls[i].player == playerNum)
            {
                Control control = controls[i];
                //is it a key, or an axis?
                if (control.keyInt != -1)
                {
                    if (Input.GetKey((KeyCode)control.keyInt))
                    {
                        result = true;
                    }
                }
                else
                {
                    //handle axis
                    if (control.posAxis)
                    {
                        if (axes[control.joyNum, control.axisNum] > deadzone)
                        {
                            result = true;
                        }
                    }
                    else
                    {
                        if (axes[control.joyNum, control.axisNum] < -deadzone)
                        {
                            result = true;
                        }
                    }
                }
            }
        }

        return(result);
    }
コード例 #3
0
ファイル: Controls.cs プロジェクト: thegamedesigner/OpenESJ2
    public static bool GetInputDown(Type type, int playerNum)
    {
        if (type == Type.OpenMenu)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                return(true);
            }
        }
        if (fa.forceAltMenuControls)
        {
            if (type == Type.MenuSelect)
            {
                if (Input.GetKeyDown(KeyCode.M))
                {
                    Fresh_SoundEffects.PlaySound(Fresh_SoundEffects.Type.Coin);
                    return(true);
                }
            }            //hardcoded, remove at future date
        }

        if (Recon.useRecon)
        {
            if (!customControls[(int)type])
            {
                return(Recon.Translation(type, Recon.ControlState.Down, playerNum));
            }
        }

        bool result = false;

        for (int i = 0; i < controls.Count; i++)
        {
            if (controls[i].type == type && controls[i].player == playerNum)
            {
                Control control = controls[i];
                //is it a key, or an axis?
                if (control.keyInt != -1)
                {
                    if (Input.GetKeyDown((KeyCode)control.keyInt))
                    {
                        result = true;
                    }
                }
                else
                {
                    //handle axis
                    if (control.posAxis)
                    {
                        //if this axis is correct, AND it doesn't equal what it used to be.
                        if (axes[control.joyNum, control.axisNum] > deadzone
                            &&
                            axesOld[control.joyNum, control.axisNum] != axes[control.joyNum, control.axisNum])
                        {
                            result = true;
                        }
                    }
                    else
                    {
                        if (axes[control.joyNum, control.axisNum] < -deadzone
                            &&
                            axesOld[control.joyNum, control.axisNum] != axes[control.joyNum, control.axisNum])
                        {
                            result = true;
                        }
                    }
                }
            }
        }
        return(result);
    }