initial prep for rebinding controls
rename some bindings properly expose newer JSL stuff
This commit is contained in:
parent
7572106856
commit
800b934db8
|
@ -76,50 +76,50 @@ public static class JSL
|
|||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MOTION_STATE {
|
||||
float quatW;
|
||||
float quatX;
|
||||
float quatY;
|
||||
float quatZ;
|
||||
float accelX;
|
||||
float accelY;
|
||||
float accelZ;
|
||||
float gravX;
|
||||
float gravY;
|
||||
float gravZ;
|
||||
public float quatW;
|
||||
public float quatX;
|
||||
public float quatY;
|
||||
public float quatZ;
|
||||
public float accelX;
|
||||
public float accelY;
|
||||
public float accelZ;
|
||||
public float gravX;
|
||||
public float gravY;
|
||||
public float gravZ;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct TOUCH_STATE {
|
||||
int t0Id;
|
||||
int t1Id;
|
||||
bool t0Down;
|
||||
bool t1Down;
|
||||
float t0X;
|
||||
float t0Y;
|
||||
float t1X;
|
||||
float t1Y;
|
||||
public int t0Id;
|
||||
public int t1Id;
|
||||
public bool t0Down;
|
||||
public bool t1Down;
|
||||
public float t0X;
|
||||
public float t0Y;
|
||||
public float t1X;
|
||||
public float t1Y;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct JSL_AUTO_CALIBRATION {
|
||||
float confidence;
|
||||
bool autoCalibrationEnabled;
|
||||
bool isSteady;
|
||||
public float confidence;
|
||||
public bool autoCalibrationEnabled;
|
||||
public bool isSteady;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct JSL_SETTINGS {
|
||||
int gyroSpace;
|
||||
int bodyColour;
|
||||
int lGripColour;
|
||||
int rGripColour;
|
||||
int buttonColour;
|
||||
int playerNumber;
|
||||
int controllerType;
|
||||
int splitType;
|
||||
bool isCalibrating;
|
||||
bool autoCalibrationEnabled;
|
||||
bool isConnected;
|
||||
public int gyroSpace;
|
||||
public int bodyColour;
|
||||
public int lGripColour;
|
||||
public int rGripColour;
|
||||
public int buttonColour;
|
||||
public int playerNumber;
|
||||
public int controllerType;
|
||||
public int splitType;
|
||||
public bool isCalibrating;
|
||||
public bool autoCalibrationEnabled;
|
||||
public bool isConnected;
|
||||
}
|
||||
|
||||
public delegate void EventCallback(int handle, JOY_SHOCK_STATE state, JOY_SHOCK_STATE lastState,
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace HeavenStudio.InputSystem
|
|||
};
|
||||
|
||||
//TODO: see if single joy-con mappings differ from a normal pad (they don't!)
|
||||
int[] mappings = new[]
|
||||
int[] defaultMappings = new[]
|
||||
{
|
||||
ButtonMaskUp,
|
||||
ButtonMaskDown,
|
||||
|
@ -133,8 +133,9 @@ namespace HeavenStudio.InputSystem
|
|||
ButtonMaskL,
|
||||
ButtonMaskR,
|
||||
ButtonMaskPlus,
|
||||
-1
|
||||
};
|
||||
int[] mappingsSplitLeft = new[]
|
||||
int[] defaultMappingsL = new[]
|
||||
{
|
||||
-1,
|
||||
-1,
|
||||
|
@ -147,8 +148,9 @@ namespace HeavenStudio.InputSystem
|
|||
ButtonMaskSL,
|
||||
ButtonMaskSR,
|
||||
ButtonMaskMinus,
|
||||
-1
|
||||
};
|
||||
int[] mappingsSplitRight = new[]
|
||||
int[] defaultMappingsR = new[]
|
||||
{
|
||||
-1,
|
||||
-1,
|
||||
|
@ -161,6 +163,7 @@ namespace HeavenStudio.InputSystem
|
|||
ButtonMaskSL,
|
||||
ButtonMaskSR,
|
||||
ButtonMaskPlus,
|
||||
-1
|
||||
};
|
||||
|
||||
public static Dictionary<int, InputJoyshock> joyshocks;
|
||||
|
@ -172,16 +175,19 @@ namespace HeavenStudio.InputSystem
|
|||
int splitType;
|
||||
int lightbarColour;
|
||||
string joyshockName;
|
||||
double totalReportDt;
|
||||
DateTime startTime;
|
||||
|
||||
//buttons, sticks, triggers
|
||||
JoyshockButtonState[] buttonStates = new JoyshockButtonState[11];
|
||||
JoyshockButtonState[] buttonStates = new JoyshockButtonState[BINDS_MAX];
|
||||
JOY_SHOCK_STATE joyBtStateCurrent;
|
||||
//gyro and accelerometer
|
||||
IMU_STATE joyImuStateCurrent, joyImuStateLast;
|
||||
//touchpad
|
||||
TOUCH_STATE joyTouchStateCurrent, joyTouchStateLast;
|
||||
|
||||
// controller settings
|
||||
JSL_SETTINGS joySettings;
|
||||
|
||||
InputJoyshock otherHalf;
|
||||
|
||||
public struct JoyshockButtonState
|
||||
|
@ -207,6 +213,24 @@ namespace HeavenStudio.InputSystem
|
|||
joyshockHandle = handle;
|
||||
}
|
||||
|
||||
int GetButtonForSplitType(int action)
|
||||
{
|
||||
if (action < 0 || action >= BINDS_MAX) return -1;
|
||||
if (otherHalf == null)
|
||||
{
|
||||
switch (splitType)
|
||||
{
|
||||
case SplitLeft:
|
||||
return defaultMappingsL[action];
|
||||
case SplitRight:
|
||||
return defaultMappingsR[action];
|
||||
default:
|
||||
return defaultMappings[action];
|
||||
}
|
||||
}
|
||||
return defaultMappings[action];
|
||||
}
|
||||
|
||||
public static void JslEventInit()
|
||||
{
|
||||
JslSetCallback(JslEventCallback);
|
||||
|
@ -224,22 +248,21 @@ namespace HeavenStudio.InputSystem
|
|||
{
|
||||
js.inputStack.Clear();
|
||||
js.wantClearInputStack = false;
|
||||
js.totalReportDt -= js.reportTime;
|
||||
}
|
||||
js.totalReportDt += deltaTime;
|
||||
js.inputStack.Add(new TimestampedState
|
||||
{
|
||||
timestamp = js.totalReportDt,
|
||||
timestamp = (DateTime.Now - js.startTime).TotalSeconds,
|
||||
input = state
|
||||
});
|
||||
}
|
||||
|
||||
public override void InitializeController()
|
||||
{
|
||||
startTime = DateTime.Now;
|
||||
inputStack = new();
|
||||
lastInputStack = new();
|
||||
|
||||
buttonStates = new JoyshockButtonState[11];
|
||||
buttonStates = new JoyshockButtonState[BINDS_MAX];
|
||||
joyBtStateCurrent = new JOY_SHOCK_STATE();
|
||||
|
||||
joyImuStateCurrent = new IMU_STATE();
|
||||
|
@ -248,12 +271,14 @@ namespace HeavenStudio.InputSystem
|
|||
joyTouchStateCurrent = new TOUCH_STATE();
|
||||
joyTouchStateLast = new TOUCH_STATE();
|
||||
|
||||
|
||||
//FUTURE: remappable controls
|
||||
|
||||
type = JslGetControllerType(joyshockHandle);
|
||||
joySettings = JslGetControllerInfoAndSettings(joyshockHandle);
|
||||
type = joySettings.controllerType;
|
||||
joyshockName = joyShockNames[type];
|
||||
|
||||
splitType = JslGetControllerSplitType(joyshockHandle);
|
||||
splitType = joySettings.splitType;
|
||||
|
||||
joyshocks.Add(joyshockHandle, this);
|
||||
}
|
||||
|
@ -266,9 +291,9 @@ namespace HeavenStudio.InputSystem
|
|||
|
||||
public override void UpdateState()
|
||||
{
|
||||
reportTime = (DateTime.Now - startTime).TotalSeconds;
|
||||
lastInputStack = new(inputStack);
|
||||
wantClearInputStack = true;
|
||||
reportTime = totalReportDt;
|
||||
|
||||
for (int i = 0; i < buttonStates.Length; i++)
|
||||
{
|
||||
|
@ -280,22 +305,7 @@ namespace HeavenStudio.InputSystem
|
|||
|
||||
for (int i = 0; i < buttonStates.Length; i++)
|
||||
{
|
||||
int bt = mappings[i];
|
||||
if (otherHalf == null)
|
||||
{
|
||||
switch (splitType)
|
||||
{
|
||||
case SplitLeft:
|
||||
bt = mappingsSplitLeft[i];
|
||||
break;
|
||||
case SplitRight:
|
||||
bt = mappingsSplitRight[i];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int bt = GetButtonForSplitType(i);
|
||||
if (bt != -1)
|
||||
{
|
||||
bool pressed = BitwiseUtils.WantCurrent(state.input.buttons, 1 << bt);
|
||||
|
@ -409,17 +419,20 @@ namespace HeavenStudio.InputSystem
|
|||
|
||||
public override bool GetButton(int button)
|
||||
{
|
||||
if (button == -1) {return false;}
|
||||
return buttonStates[button].pressed;
|
||||
}
|
||||
|
||||
public override bool GetButtonDown(int button, out double dt)
|
||||
{
|
||||
if (button == -1) {dt = 0; return false;}
|
||||
dt = buttonStates[button].dt;
|
||||
return buttonStates[button].pressed && buttonStates[button].isDelta;
|
||||
}
|
||||
|
||||
public override bool GetButtonUp(int button, out double dt)
|
||||
{
|
||||
if (button == -1) {dt = 0; return false;}
|
||||
dt = buttonStates[button].dt;
|
||||
return !buttonStates[button].pressed && buttonStates[button].isDelta;
|
||||
}
|
||||
|
@ -455,16 +468,16 @@ namespace HeavenStudio.InputSystem
|
|||
switch (direction)
|
||||
{
|
||||
case InputDirection.Up:
|
||||
bt = mappings[0];
|
||||
bt = GetButtonForSplitType(0);
|
||||
break;
|
||||
case InputDirection.Down:
|
||||
bt = mappings[1];
|
||||
bt = GetButtonForSplitType(1);
|
||||
break;
|
||||
case InputDirection.Left:
|
||||
bt = mappings[2];
|
||||
bt = GetButtonForSplitType(2);
|
||||
break;
|
||||
case InputDirection.Right:
|
||||
bt = mappings[3];
|
||||
bt = GetButtonForSplitType(3);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -478,16 +491,16 @@ namespace HeavenStudio.InputSystem
|
|||
switch (direction)
|
||||
{
|
||||
case InputDirection.Up:
|
||||
bt = mappings[0];
|
||||
bt = GetButtonForSplitType(0);
|
||||
break;
|
||||
case InputDirection.Down:
|
||||
bt = mappings[1];
|
||||
bt = GetButtonForSplitType(1);
|
||||
break;
|
||||
case InputDirection.Left:
|
||||
bt = mappings[2];
|
||||
bt = GetButtonForSplitType(2);
|
||||
break;
|
||||
case InputDirection.Right:
|
||||
bt = mappings[3];
|
||||
bt = GetButtonForSplitType(3);
|
||||
break;
|
||||
default:
|
||||
dt = 0;
|
||||
|
@ -504,16 +517,16 @@ namespace HeavenStudio.InputSystem
|
|||
switch (direction)
|
||||
{
|
||||
case InputDirection.Up:
|
||||
bt = mappings[0];
|
||||
bt = GetButtonForSplitType(0);
|
||||
break;
|
||||
case InputDirection.Down:
|
||||
bt = mappings[1];
|
||||
bt = GetButtonForSplitType(1);
|
||||
break;
|
||||
case InputDirection.Left:
|
||||
bt = mappings[2];
|
||||
bt = GetButtonForSplitType(2);
|
||||
break;
|
||||
case InputDirection.Right:
|
||||
bt = mappings[3];
|
||||
bt = GetButtonForSplitType(3);
|
||||
break;
|
||||
default:
|
||||
dt = 0;
|
||||
|
@ -558,32 +571,32 @@ namespace HeavenStudio.InputSystem
|
|||
if (otherHalf != null)
|
||||
{
|
||||
// gets the colour of the right controller if is split
|
||||
return BitwiseUtils.IntToRgb(splitType == SplitRight ? JslGetControllerColour(joyshockHandle) : JslGetControllerColour(GetOtherHalf().GetHandle()));
|
||||
return BitwiseUtils.IntToRgb(splitType == SplitRight ? joySettings.bodyColour : GetOtherHalf().joySettings.bodyColour);
|
||||
}
|
||||
return BitwiseUtils.IntToRgb(JslGetControllerColour(joyshockHandle));
|
||||
return BitwiseUtils.IntToRgb(joySettings.bodyColour);
|
||||
}
|
||||
|
||||
public Color GetButtonColor()
|
||||
{
|
||||
return BitwiseUtils.IntToRgb(JslGetControllerButtonColour(joyshockHandle));
|
||||
return BitwiseUtils.IntToRgb(joySettings.buttonColour);
|
||||
}
|
||||
|
||||
public Color GetLeftGripColor()
|
||||
{
|
||||
if (otherHalf != null)
|
||||
{
|
||||
return BitwiseUtils.IntToRgb(splitType == SplitLeft ? JslGetControllerColour(joyshockHandle) : JslGetControllerColour(GetOtherHalf().GetHandle()));
|
||||
return BitwiseUtils.IntToRgb(splitType == SplitLeft ? joySettings.lGripColour : GetOtherHalf().joySettings.lGripColour);
|
||||
}
|
||||
return BitwiseUtils.IntToRgb(JslGetControllerLeftGripColour(joyshockHandle));
|
||||
return BitwiseUtils.IntToRgb(joySettings.lGripColour);
|
||||
}
|
||||
|
||||
public Color GetRightGripColor()
|
||||
{
|
||||
if (otherHalf != null)
|
||||
{
|
||||
return BitwiseUtils.IntToRgb(splitType == SplitRight ? JslGetControllerColour(joyshockHandle) : JslGetControllerColour(GetOtherHalf().GetHandle()));
|
||||
return BitwiseUtils.IntToRgb(splitType == SplitRight ? joySettings.rGripColour : GetOtherHalf().joySettings.rGripColour);
|
||||
}
|
||||
return BitwiseUtils.IntToRgb(JslGetControllerRightGripColour(joyshockHandle));
|
||||
return BitwiseUtils.IntToRgb(joySettings.rGripColour);
|
||||
}
|
||||
|
||||
public Color GetLightbarColour()
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace HeavenStudio.InputSystem
|
|||
|
||||
//FUTURE: remappable controls
|
||||
//KeyCode[] mappings = new KeyCode[Enum.GetNames(typeof(ButtonsPad)).Length];
|
||||
KeyCode[] mappings = new KeyCode[]
|
||||
KeyCode[] defaultMappings = new KeyCode[]
|
||||
{
|
||||
KeyCode.W, // dpad up
|
||||
KeyCode.S, // dpad down
|
||||
|
@ -110,19 +110,19 @@ namespace HeavenStudio.InputSystem
|
|||
|
||||
public override bool GetButton(int button)
|
||||
{
|
||||
return Input.GetKey(mappings[button]);
|
||||
return Input.GetKey(defaultMappings[button]);
|
||||
}
|
||||
|
||||
public override bool GetButtonDown(int button, out double dt)
|
||||
{
|
||||
dt = 0;
|
||||
return Input.GetKeyDown(mappings[button]);
|
||||
return Input.GetKeyDown(defaultMappings[button]);
|
||||
}
|
||||
|
||||
public override bool GetButtonUp(int button, out double dt)
|
||||
{
|
||||
dt = 0;
|
||||
return Input.GetKeyUp(mappings[button]);
|
||||
return Input.GetKeyUp(defaultMappings[button]);
|
||||
}
|
||||
|
||||
public override float GetAxis(InputAxis axis)
|
||||
|
@ -136,13 +136,13 @@ namespace HeavenStudio.InputSystem
|
|||
switch (direction)
|
||||
{
|
||||
case InputDirection.Up:
|
||||
return Input.GetKey(mappings[0]);
|
||||
return Input.GetKey(defaultMappings[0]);
|
||||
case InputDirection.Down:
|
||||
return Input.GetKey(mappings[1]);
|
||||
return Input.GetKey(defaultMappings[1]);
|
||||
case InputDirection.Left:
|
||||
return Input.GetKey(mappings[2]);
|
||||
return Input.GetKey(defaultMappings[2]);
|
||||
case InputDirection.Right:
|
||||
return Input.GetKey(mappings[3]);
|
||||
return Input.GetKey(defaultMappings[3]);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -154,13 +154,13 @@ namespace HeavenStudio.InputSystem
|
|||
switch (direction)
|
||||
{
|
||||
case InputDirection.Up:
|
||||
return Input.GetKeyDown(mappings[0]);
|
||||
return Input.GetKeyDown(defaultMappings[0]);
|
||||
case InputDirection.Down:
|
||||
return Input.GetKeyDown(mappings[1]);
|
||||
return Input.GetKeyDown(defaultMappings[1]);
|
||||
case InputDirection.Left:
|
||||
return Input.GetKeyDown(mappings[2]);
|
||||
return Input.GetKeyDown(defaultMappings[2]);
|
||||
case InputDirection.Right:
|
||||
return Input.GetKeyDown(mappings[3]);
|
||||
return Input.GetKeyDown(defaultMappings[3]);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -172,13 +172,13 @@ namespace HeavenStudio.InputSystem
|
|||
switch (direction)
|
||||
{
|
||||
case InputDirection.Up:
|
||||
return Input.GetKeyUp(mappings[0]);
|
||||
return Input.GetKeyUp(defaultMappings[0]);
|
||||
case InputDirection.Down:
|
||||
return Input.GetKeyUp(mappings[1]);
|
||||
return Input.GetKeyUp(defaultMappings[1]);
|
||||
case InputDirection.Left:
|
||||
return Input.GetKeyUp(mappings[2]);
|
||||
return Input.GetKeyUp(defaultMappings[2]);
|
||||
case InputDirection.Right:
|
||||
return Input.GetKeyUp(mappings[3]);
|
||||
return Input.GetKeyUp(defaultMappings[3]);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -10,34 +10,6 @@ namespace HeavenStudio.InputSystem
|
|||
/// </summary>
|
||||
public abstract class InputController
|
||||
{
|
||||
//Buttons and Axis used by most controllers
|
||||
public enum InputButtons : int
|
||||
{
|
||||
ButtonPadUp = 0,
|
||||
ButtonPadDown = 1,
|
||||
ButtonPadLeft = 2,
|
||||
ButtonPadRight = 3,
|
||||
ButtonPlus = 4,
|
||||
ButtonOptions = 4,
|
||||
ButtonMinus = 5,
|
||||
ButtonShare = 5,
|
||||
ButtonLClick = 6,
|
||||
ButtonRClick = 7,
|
||||
ButtonL = 8,
|
||||
ButtonR = 9,
|
||||
ButtonZL = 10,
|
||||
ButtonZR = 11,
|
||||
ButtonFaceS = 12,
|
||||
ButtonFaceE = 13,
|
||||
ButtonFaceW = 14,
|
||||
ButtonFaceN = 15,
|
||||
ButtonHome = 16,
|
||||
ButtonPS = 16,
|
||||
ButtonCapture = 17,
|
||||
ButtonTouchpadClick = 17,
|
||||
ButtonSL = 18,
|
||||
ButtonSR = 19,
|
||||
}
|
||||
public enum InputAxis : int
|
||||
{
|
||||
AxisLTrigger = 4,
|
||||
|
@ -101,45 +73,56 @@ namespace HeavenStudio.InputSystem
|
|||
Move
|
||||
}
|
||||
|
||||
public const int BINDS_MAX = 12; //maximum number of binds per controller
|
||||
|
||||
//buttons used in Heaven Studio gameplay (Pad Style)
|
||||
public enum ButtonsPad : int
|
||||
{
|
||||
PadUp = 0,
|
||||
PadDown = 1,
|
||||
PadLeft = 2,
|
||||
PadRight = 3,
|
||||
PadS = 4,
|
||||
PadE = 5,
|
||||
PadW = 6,
|
||||
PadN = 7,
|
||||
PadL = 8,
|
||||
PadR = 9,
|
||||
PadPause = 10,
|
||||
Up = 0,
|
||||
Down = 1,
|
||||
Left = 2,
|
||||
Right = 3,
|
||||
South = 4,
|
||||
East = 5,
|
||||
West = 6,
|
||||
North = 7,
|
||||
L = 8,
|
||||
R = 9,
|
||||
Pause = 10,
|
||||
}
|
||||
|
||||
//FUTURE: buttons used in Heaven Studio gameplay ("Form Baton" / WiiMote Style)
|
||||
public enum ButtonsBaton : int
|
||||
{
|
||||
BatonS = 0, //-- all these...
|
||||
BatonE = 1, // |
|
||||
BatonW = 2, // |
|
||||
BatonN = 3, //--
|
||||
BatonFace = 4, // < ...map to this, but are directional
|
||||
BatonTrigger = 5, // should never be used alone
|
||||
Baton1 = 6,
|
||||
Baton2 = 7,
|
||||
BatonPause = 8,
|
||||
South = 0, //-- all these...
|
||||
East = 1, // |
|
||||
West = 2, // |
|
||||
North = 3, //--
|
||||
Face = 4, // < ...are also equivalent to this, but with added directionality
|
||||
Trigger = 5, // should never be used alone, but still bindable separately (controller logic should handle confirming & timestamping face + trigger input)
|
||||
Up = 6, // Wiimote 1
|
||||
Down = 7, // Wiimote 2
|
||||
Pause = 8,
|
||||
}
|
||||
|
||||
//FUTURE: buttons used in Heaven Studio gameplay (Touch Style)
|
||||
public enum ButtonsTouch : int
|
||||
{
|
||||
TouchL = 0,
|
||||
TouchR = 1,
|
||||
TouchTap = 2,
|
||||
TouchFlick = 3,
|
||||
TouchButtonL = 4,
|
||||
TouchButtonR = 5,
|
||||
Tap = 0, // flicks are handled like a motion, don't have a binding
|
||||
Left = 1, // also maps to tap, but with directionality (tap the left side of the panel)
|
||||
Right = 2, // also maps to tap, but with directionality (tap the right side of the panel)
|
||||
ButtonL = 3,
|
||||
ButtonR = 4,
|
||||
Pause = 5,
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct ControlBindings
|
||||
{
|
||||
public string ControllerName;
|
||||
public int[] Pad;
|
||||
public int[] Baton;
|
||||
public int[] Touch;
|
||||
}
|
||||
|
||||
// FUTURE: Move Style needs to be implemented per-game (maybe implement checks for common actions?)
|
||||
|
@ -159,6 +142,10 @@ namespace HeavenStudio.InputSystem
|
|||
public abstract bool GetIsConnected();
|
||||
public abstract bool GetIsPoorConnection();
|
||||
|
||||
// public abstract int[] GetDefaultMappings(ControlStyles style);
|
||||
// public abstract int[] GetCurrentMappings(ControlStyles style);
|
||||
// public abstract int[] SetCurrentMappings(ControlStyles style);
|
||||
|
||||
public abstract int GetLastButtonDown(); // Get the last button down
|
||||
public abstract KeyCode GetLastKeyDown(); // Get the last key down (used for keyboards and other devices that use Keycode)
|
||||
public abstract bool GetButton(int button); // is button currently pressed?
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace HeavenStudio
|
|||
public const int LEFT = 3;
|
||||
|
||||
static List<InputController> inputDevices;
|
||||
static InputController.ControlStyles currentControlStyle = InputController.ControlStyles.Pad;
|
||||
|
||||
public delegate InputController[] InputControllerInitializer();
|
||||
|
||||
|
@ -191,62 +192,62 @@ namespace HeavenStudio
|
|||
|
||||
public static bool Pressed(bool includeDPad = false)
|
||||
{
|
||||
bool keyDown = GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.PadE, out _) || (includeDPad && GetAnyDirectionDown());
|
||||
bool keyDown = GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.East, out _) || (includeDPad && GetAnyDirectionDown());
|
||||
return keyDown && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
public static bool Pressed(out double dt, bool includeDPad = false)
|
||||
{
|
||||
bool keyDown = GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.PadE, out dt) || (includeDPad && GetAnyDirectionDown());
|
||||
bool keyDown = GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.East, out dt) || (includeDPad && GetAnyDirectionDown());
|
||||
return keyDown && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
public static bool PressedUp(bool includeDPad = false)
|
||||
{
|
||||
bool keyUp = GetInputController(1).GetButtonUp((int) InputController.ButtonsPad.PadE, out _) || (includeDPad && GetAnyDirectionUp());
|
||||
bool keyUp = GetInputController(1).GetButtonUp((int) InputController.ButtonsPad.East, out _) || (includeDPad && GetAnyDirectionUp());
|
||||
return keyUp && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
public static bool PressedUp(out double dt, bool includeDPad = false)
|
||||
{
|
||||
bool keyUp = GetInputController(1).GetButtonUp((int) InputController.ButtonsPad.PadE, out dt) || (includeDPad && GetAnyDirectionUp());
|
||||
bool keyUp = GetInputController(1).GetButtonUp((int) InputController.ButtonsPad.East, out dt) || (includeDPad && GetAnyDirectionUp());
|
||||
return keyUp && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
public static bool Pressing(bool includeDPad = false)
|
||||
{
|
||||
bool pressing = GetInputController(1).GetButton((int) InputController.ButtonsPad.PadE) || (includeDPad && GetAnyDirection());
|
||||
bool pressing = GetInputController(1).GetButton((int) InputController.ButtonsPad.East) || (includeDPad && GetAnyDirection());
|
||||
return pressing && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
|
||||
public static bool AltPressed()
|
||||
{
|
||||
bool down = GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.PadS, out _);
|
||||
bool down = GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.South, out _);
|
||||
return down && PlayerHasControl();
|
||||
}
|
||||
|
||||
public static bool AltPressed(out double dt)
|
||||
{
|
||||
bool down = GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.PadS, out dt);
|
||||
bool down = GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.South, out dt);
|
||||
return down && PlayerHasControl();
|
||||
}
|
||||
|
||||
public static bool AltPressedUp()
|
||||
{
|
||||
bool up = GetInputController(1).GetButtonUp((int) InputController.ButtonsPad.PadS, out _);
|
||||
bool up = GetInputController(1).GetButtonUp((int) InputController.ButtonsPad.South, out _);
|
||||
return up && PlayerHasControl();
|
||||
}
|
||||
|
||||
public static bool AltPressedUp(out double dt)
|
||||
{
|
||||
bool up = GetInputController(1).GetButtonUp((int) InputController.ButtonsPad.PadS, out dt);
|
||||
bool up = GetInputController(1).GetButtonUp((int) InputController.ButtonsPad.South, out dt);
|
||||
return up && PlayerHasControl();
|
||||
}
|
||||
|
||||
public static bool AltPressing()
|
||||
{
|
||||
bool pressing = GetInputController(1).GetButton((int) InputController.ButtonsPad.PadS);
|
||||
bool pressing = GetInputController(1).GetButton((int) InputController.ButtonsPad.South);
|
||||
return pressing && PlayerHasControl();
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace HeavenStudio.Common
|
|||
void Update()
|
||||
{
|
||||
if (isQuitting) return;
|
||||
if (PlayerInput.GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.PadPause, out _))
|
||||
if (PlayerInput.GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.Pause, out _))
|
||||
{
|
||||
if (isPaused)
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ namespace HeavenStudio.Common
|
|||
}
|
||||
else if (isPaused && canPick && !settingsDialog.IsOpen)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.UpArrow) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.PadUp, out _))
|
||||
if (Input.GetKeyDown(KeyCode.UpArrow) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.Up, out _))
|
||||
{
|
||||
optionSelected--;
|
||||
if (optionSelected < 0)
|
||||
|
@ -107,7 +107,7 @@ namespace HeavenStudio.Common
|
|||
}
|
||||
ChooseOption((Options) optionSelected);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.DownArrow) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.PadDown, out _))
|
||||
else if (Input.GetKeyDown(KeyCode.DownArrow) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.Down, out _))
|
||||
{
|
||||
optionSelected++;
|
||||
if (optionSelected > optionHolder.transform.childCount - 1)
|
||||
|
@ -116,7 +116,7 @@ namespace HeavenStudio.Common
|
|||
}
|
||||
ChooseOption((Options) optionSelected);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.Return) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.PadE, out _))
|
||||
else if (Input.GetKeyDown(KeyCode.Return) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.East, out _))
|
||||
{
|
||||
UseOption((Options) optionSelected);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue