Merge pull request #680 from RHeavenStudio/cherry-pick-release_1_patches-5e804b3bd636255c6bb4bb29c163d67bfae3f4e4

JSL-Related Improvements
This commit is contained in:
minenice55 2024-02-04 06:55:57 +00:00 committed by GitHub
commit 526bf6ee3c
20 changed files with 959 additions and 699 deletions

View file

@ -29,8 +29,11 @@ public static class JSL
public const int ButtonMaskPS = 16; public const int ButtonMaskPS = 16;
public const int ButtonMaskCapture = 17; public const int ButtonMaskCapture = 17;
public const int ButtonMaskTouchpadClick = 17; public const int ButtonMaskTouchpadClick = 17;
public const int ButtonMaskSL = 18; public const int ButtonMaskMic = 18;
public const int ButtonMaskSR = 19; public const int ButtonMaskSL = 19;
public const int ButtonMaskSR = 20;
public const int ButtonMaskFnL = 21;
public const int ButtonMaskFnR = 22;
public const int TypeJoyConLeft = 1; public const int TypeJoyConLeft = 1;
public const int TypeJoyConRight = 2; public const int TypeJoyConRight = 2;

View file

@ -17,31 +17,33 @@
#define JS_SPLIT_TYPE_RIGHT 2 #define JS_SPLIT_TYPE_RIGHT 2
#define JS_SPLIT_TYPE_FULL 3 #define JS_SPLIT_TYPE_FULL 3
#define JSMASK_UP 0x00001 #define JSMASK_UP 0x000001
#define JSMASK_DOWN 0x00002 #define JSMASK_DOWN 0x000002
#define JSMASK_LEFT 0x00004 #define JSMASK_LEFT 0x000004
#define JSMASK_RIGHT 0x00008 #define JSMASK_RIGHT 0x000008
#define JSMASK_PLUS 0x00010 #define JSMASK_PLUS 0x000010
#define JSMASK_OPTIONS 0x00010 #define JSMASK_OPTIONS 0x000010
#define JSMASK_MINUS 0x00020 #define JSMASK_MINUS 0x000020
#define JSMASK_SHARE 0x00020 #define JSMASK_SHARE 0x000020
#define JSMASK_LCLICK 0x00040 #define JSMASK_LCLICK 0x000040
#define JSMASK_RCLICK 0x00080 #define JSMASK_RCLICK 0x000080
#define JSMASK_L 0x00100 #define JSMASK_L 0x000100
#define JSMASK_R 0x00200 #define JSMASK_R 0x000200
#define JSMASK_ZL 0x00400 #define JSMASK_ZL 0x000400
#define JSMASK_ZR 0x00800 #define JSMASK_ZR 0x000800
#define JSMASK_S 0x01000 #define JSMASK_S 0x001000
#define JSMASK_E 0x02000 #define JSMASK_E 0x002000
#define JSMASK_W 0x04000 #define JSMASK_W 0x004000
#define JSMASK_N 0x08000 #define JSMASK_N 0x008000
#define JSMASK_HOME 0x10000 #define JSMASK_HOME 0x010000
#define JSMASK_PS 0x10000 #define JSMASK_PS 0x010000
#define JSMASK_CAPTURE 0x20000 #define JSMASK_CAPTURE 0x020000
#define JSMASK_TOUCHPAD_CLICK 0x20000 #define JSMASK_TOUCHPAD_CLICK 0x020000
#define JSMASK_MIC 0x40000 #define JSMASK_MIC 0x040000
#define JSMASK_SL 0x40000 #define JSMASK_SL 0x080000
#define JSMASK_SR 0x80000 #define JSMASK_SR 0x100000
#define JSMASK_FNL 0x200000
#define JSMASK_FNR 0x400000
#define JSOFFSET_UP 0 #define JSOFFSET_UP 0
#define JSOFFSET_DOWN 1 #define JSOFFSET_DOWN 1
@ -66,8 +68,10 @@
#define JSOFFSET_CAPTURE 17 #define JSOFFSET_CAPTURE 17
#define JSOFFSET_TOUCHPAD_CLICK 17 #define JSOFFSET_TOUCHPAD_CLICK 17
#define JSOFFSET_MIC 18 #define JSOFFSET_MIC 18
#define JSOFFSET_SL 18 #define JSOFFSET_SL 19
#define JSOFFSET_SR 19 #define JSOFFSET_SR 20
#define JSOFFSET_FNL 21
#define JSOFFSET_FNR 22
// PS5 Player maps for the DS Player Lightbar // PS5 Player maps for the DS Player Lightbar
#define DS5_PLAYER_1 4 #define DS5_PLAYER_1 4

View file

@ -3758,7 +3758,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &3918594454393827276 --- !u!224 &3918594454393827276
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3771,16 +3771,15 @@ RectTransform:
m_LocalScale: {x: 0.9998709, y: 0.9998709, z: 0.9998709} m_LocalScale: {x: 0.9998709, y: 0.9998709, z: 0.9998709}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 3918594454521024533}
- {fileID: 3918594455780710548} - {fileID: 3918594455780710548}
- {fileID: 3918594455337952163} - {fileID: 3918594455337952163}
m_Father: {fileID: 3918594454598345480} m_Father: {fileID: 3918594454598345480}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 754, y: -307.9788} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1468, y: 100} m_SizeDelta: {x: 0, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3918594454393827267 --- !u!114 &3918594454393827267
MonoBehaviour: MonoBehaviour:
@ -3797,10 +3796,10 @@ MonoBehaviour:
m_Padding: m_Padding:
m_Left: 0 m_Left: 0
m_Right: 0 m_Right: 0
m_Top: 10 m_Top: 0
m_Bottom: 16 m_Bottom: 0
m_ChildAlignment: 6 m_ChildAlignment: 4
m_Spacing: 10 m_Spacing: 0
m_ChildForceExpandWidth: 0 m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0 m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0 m_ChildControlWidth: 0
@ -3945,145 +3944,6 @@ MonoBehaviour:
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0} m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3918594454521024534
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3918594454521024533}
- component: {fileID: 3918594454521024523}
- component: {fileID: 3918594454521024532}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3918594454521024533
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3918594454521024534}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.0000798, y: 1.0000798, z: 1.0000798}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3918594454393827276}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -46.5}
m_SizeDelta: {x: 320, y: 75}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &3918594454521024523
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3918594454521024534}
m_CullTransparentMesh: 1
--- !u!114 &3918594454521024532
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3918594454521024534}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 'Joy-Con (L/R) Selected
Pairing Second Joy-Con...'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8597c35f18a008c428fc5870aec75766, type: 2}
m_sharedMaterial: {fileID: -6562250930271150993, guid: 8597c35f18a008c428fc5870aec75766, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24.5
m_fontSizeBase: 32
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 36
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: -7.5}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3918594454531700438 --- !u!1 &3918594454531700438
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5807,11 +5667,11 @@ RectTransform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 3918594454393827276} m_Father: {fileID: 3918594454393827276}
m_RootOrder: 2 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 476.83002, y: -69} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 688.17, y: 30} m_SizeDelta: {x: 688.17, y: 30}
m_Pivot: {x: 0, y: 0.5} m_Pivot: {x: 0, y: 0.5}
--- !u!222 &3918594455337952161 --- !u!222 &3918594455337952161
@ -5842,7 +5702,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: Press button on second Joy-Con to select... m_text: Press ZL + ZR to pair Joy-Con
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8597c35f18a008c428fc5870aec75766, type: 2} m_fontAsset: {fileID: 11400000, guid: 8597c35f18a008c428fc5870aec75766, type: 2}
m_sharedMaterial: {fileID: -6562250930271150993, guid: 8597c35f18a008c428fc5870aec75766, type: 2} m_sharedMaterial: {fileID: -6562250930271150993, guid: 8597c35f18a008c428fc5870aec75766, type: 2}
@ -5876,7 +5736,7 @@ MonoBehaviour:
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 36 m_fontSizeMax: 36
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 2
m_VerticalAlignment: 512 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 0 m_characterSpacing: 0
@ -6010,9 +5870,6 @@ MonoBehaviour:
controllersDropdown: {fileID: 3918594454563211279} controllersDropdown: {fileID: 3918594454563211279}
pairSearchItem: {fileID: 3918594454393827277} pairSearchItem: {fileID: 3918594454393827277}
autoSearchLabel: {fileID: 3918594454453368363} autoSearchLabel: {fileID: 3918594454453368363}
pairSearchLabel: {fileID: 3918594455337952172}
pairSearchCancelBt: {fileID: 3918594455780710549}
pairingLabel: {fileID: 3918594454521024532}
controllerIcons: controllerIcons:
- {fileID: 3918594454983356908} - {fileID: 3918594454983356908}
- {fileID: 3918594455640061334} - {fileID: 3918594455640061334}
@ -6975,7 +6832,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &3918594455780710548 --- !u!224 &3918594455780710548
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6991,11 +6848,11 @@ RectTransform:
- {fileID: 3918594455818177326} - {fileID: 3918594455818177326}
- {fileID: 3918594456368854930} - {fileID: 3918594456368854930}
m_Father: {fileID: 3918594454393827276} m_Father: {fileID: 3918594454393827276}
m_RootOrder: 1 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 330, y: -69} m_AnchoredPosition: {x: 272, y: -25}
m_SizeDelta: {x: 136.83, y: 30} m_SizeDelta: {x: 136.83, y: 30}
m_Pivot: {x: 0, y: 0.5} m_Pivot: {x: 0, y: 0.5}
--- !u!222 &3918594455780710537 --- !u!222 &3918594455780710537
@ -8052,8 +7909,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 723, y: 0} m_AnchoredPosition: {x: 704.5, y: 0}
m_SizeDelta: {x: 1406, y: 0} m_SizeDelta: {x: 1369, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3918594456218978261 --- !u!222 &3918594456218978261
CanvasRenderer: CanvasRenderer:

View file

@ -0,0 +1,495 @@
using System;
using System.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using static JSL;
namespace HeavenStudio.InputSystem.Loaders
{
public static class InputJoyconPairInitializer
{
[LoadOrder(3)]
public static InputController[] Initialize()
{
PlayerInput.PlayerInputRefresh.Add(Refresh);
return Refresh();
}
public static InputController[] Refresh()
{
int joyconLCount = 0, joyconRCount = 0;
foreach (InputController con in PlayerInput.GetInputControllers())
{
if (con is InputJoyshock)
{
InputJoyshock joyshock = (InputJoyshock)con;
if (joyshock.GetJoyshockType() == TypeJoyConLeft)
{
joyconLCount++;
}
else if (joyshock.GetJoyshockType() == TypeJoyConRight)
{
joyconRCount++;
}
}
}
if (joyconLCount > 0 && joyconRCount > 0)
{
InputJoyconPair joyconPair = new InputJoyconPair();
joyconPair.SetPlayer(null);
joyconPair.InitializeController();
return new InputController[] { joyconPair };
}
else
{
Debug.Log("No Joy-Con connected.");
return null;
}
}
}
}
namespace HeavenStudio.InputSystem
{
public class InputJoyconPair : InputController
{
static readonly string[] nsConButtonNames = new[]
{
"Up",
"Down",
"Left",
"Right",
"Plus",
"Minus",
"Left Stick Click",
"Right Stick Click",
"L",
"R",
"ZL",
"ZR",
"B",
"A",
"Y",
"X",
"Home",
"Capture",
"", // mic on playstation, unused here
"SL",
"SR",
"", // fnl on playstation, unused here
"", // fnr on playstation, unused here
"Stick Up",
"Stick Down",
"Stick Left",
"Stick Right",
};
static int[] defaultMappings
{
get
{
return new[]
{
ButtonMaskUp,
ButtonMaskDown,
ButtonMaskLeft,
ButtonMaskRight,
ButtonMaskS,
ButtonMaskE,
ButtonMaskW,
ButtonMaskN,
ButtonMaskL,
ButtonMaskR,
ButtonMaskPlus,
-1
};
}
}
InputJoyshock leftController, rightController;
int GetButtonForAction(int action)
{
if (currentBindings.Pad == null) return -1;
if (action < 0 || action >= BINDS_MAX) return -1;
ControlBindings actionMap = currentBindings;
if (actionMap.Pad[action] > ButtonMaskFnR) return -1;
return actionMap.Pad[action];
}
int GetActionForButton(int button, ControlStyles style)
{
if (style != ControlStyles.Pad) return -1;
if (currentBindings.Pad == null) return -1;
if (button < 0 || button >= ButtonMaskFnR) return -1;
ControlBindings actionMap = currentBindings;
for (int i = 0; i < BINDS_MAX; i++)
{
if (actionMap.Pad[i] == button)
{
return i;
}
}
return -1;
}
public void SetLeftController(InputJoyshock leftController)
{
this.leftController = leftController;
}
public void SetRightController(InputJoyshock rightController)
{
this.rightController = rightController;
}
public bool HasControllers()
{
return leftController != null && rightController != null;
}
public override bool GetAction(ControlStyles style, int action)
{
if (leftController == null || rightController == null)
{
return false;
}
int button = GetButtonForAction(action);
if (button == -1) { return false; }
return leftController.GetButtonState(button).pressed || rightController.GetButtonState(button).pressed;
}
public override bool GetActionDown(ControlStyles style, int action, out double dt)
{
dt = 0;
if (leftController == null || rightController == null)
{
return false;
}
int button = GetButtonForAction(action);
if (button == -1) { dt = 0; return false; }
InputJoyshock.JoyshockButtonState leftState = leftController.GetButtonState(button);
if (leftState.pressed && leftState.isDelta)
{
dt = leftState.dt;
return true;
}
InputJoyshock.JoyshockButtonState rightState = rightController.GetButtonState(button);
if (rightState.pressed && rightState.isDelta)
{
dt = rightState.dt;
return true;
}
return false;
}
public override bool GetActionUp(ControlStyles style, int action, out double dt)
{
dt = 0;
if (leftController == null || rightController == null)
{
return false;
}
int button = GetButtonForAction(action);
if (button == -1) { dt = 0; return false; }
InputJoyshock.JoyshockButtonState leftState = leftController.GetButtonState(button);
if (!leftState.pressed && leftState.isDelta)
{
dt = leftState.dt;
return true;
}
InputJoyshock.JoyshockButtonState rightState = rightController.GetButtonState(button);
if (!rightState.pressed && rightState.isDelta)
{
dt = rightState.dt;
return true;
}
return false;
}
public override float GetAxis(InputAxis axis)
{
if (leftController == null || rightController == null)
{
return 0;
}
return leftController.GetAxis(axis) + rightController.GetAxis(axis);
}
public override int GetBindingsVersion()
{
return 1;
}
public override string[] GetButtonNames()
{
return nsConButtonNames;
}
public override ControlBindings GetCurrentBindings()
{
return currentBindings;
}
public override bool GetCurrentStyleSupported()
{
return PlayerInput.CurrentControlStyle is ControlStyles.Pad; // or ControlStyles.Baton
}
public override ControlBindings GetDefaultBindings()
{
ControlBindings binds = new ControlBindings
{
Pad = defaultMappings,
version = GetBindingsVersion(),
PointerSensitivity = 3
};
return binds;
}
public override ControlStyles GetDefaultStyle()
{
return ControlStyles.Pad;
}
public override string GetDeviceName()
{
return "Joy-Con Pair";
}
public override InputFeatures GetFeatures()
{
if (leftController == null || rightController == null)
{
return 0;
}
InputFeatures features = leftController.GetFeatures() | rightController.GetFeatures();
return features;
}
public override bool GetFlick(out double dt)
{
if (leftController == null || rightController == null)
{
dt = 0;
return false;
}
return leftController.GetFlick(out dt) || rightController.GetFlick(out dt);
}
public override bool GetIsActionUnbindable(int action, ControlStyles style)
{
return false;
}
public override bool GetIsConnected()
{
if (leftController == null || rightController == null)
{
return false;
}
return leftController.GetIsConnected() && rightController.GetIsConnected();
}
public override bool GetIsPoorConnection()
{
if (leftController == null || rightController == null)
{
return false;
}
return leftController.GetIsPoorConnection() || rightController.GetIsPoorConnection();
}
public override int GetLastActionDown()
{
if (leftController == null || rightController == null)
{
return -1;
}
int lastLeftButton = leftController.GetLastButtonDown();
int lastRightButton = rightController.GetLastButtonDown();
int leftAction = GetActionForButton(lastLeftButton, ControlStyles.Pad);
int rightAction = GetActionForButton(lastRightButton, ControlStyles.Pad);
if (leftAction == -1 && rightAction == -1)
{
return -1;
}
if (leftAction == -1)
{
return rightAction;
}
else
{
return leftAction;
}
}
public override int GetLastButtonDown(bool strict = false)
{
if (strict || leftController == null || rightController == null)
{
return -1;
}
return Math.Max(leftController.GetLastButtonDown(strict), rightController.GetLastButtonDown(strict));
}
public override int? GetPlayer()
{
return playerNum;
}
public override Vector2 GetPointer()
{
Camera cam = GameManager.instance.CursorCam;
Vector3 rawPointerPos = Input.mousePosition;
rawPointerPos.z = Mathf.Abs(cam.gameObject.transform.position.z);
return cam.ScreenToWorldPoint(rawPointerPos);
}
public override bool GetPointerLeftRight()
{
return false;
}
public override bool GetSlide(out double dt)
{
dt = 0;
return false;
}
public override bool GetSqueeze()
{
return false;
}
public override bool GetSqueezeDown(out double dt)
{
dt = 0;
return false;
}
public override bool GetSqueezeUp(out double dt)
{
dt = 0;
return false;
}
public override Vector3 GetVector(InputVector vector)
{
if (leftController == null || rightController == null)
{
return Vector3.zero;
}
return leftController.GetVector(vector) + rightController.GetVector(vector);
}
public override void InitializeController()
{
leftController = null;
rightController = null;
LoadBindings();
}
public override void OnSelected()
{
if (leftController == null || rightController == null)
{
return;
}
leftController.OnSelected();
leftController.SetRotatedStickMode(false);
rightController.OnSelected();
rightController.SetRotatedStickMode(false);
}
public override void RecentrePointer()
{
}
public override void ResetBindings()
{
currentBindings = GetDefaultBindings();
}
public override void SetCurrentBindings(ControlBindings newBinds)
{
currentBindings = newBinds;
}
public override void SetMaterialProperties(Material m)
{
Color colour;
m.SetColor("_BodyColor", ColorUtility.TryParseHtmlString("#2F353A", out colour) ? colour : Color.white);
m.SetColor("_BtnColor", ColorUtility.TryParseHtmlString("#2F353A", out colour) ? colour : Color.white);
if (leftController == null)
{
m.SetColor("_LGripColor", Color.white);
}
else
{
m.SetColor("_LGripColor", leftController.GetBodyColor());
}
if (rightController == null)
{
m.SetColor("_RGripColor", Color.white);
}
else
{
m.SetColor("_RGripColor", rightController.GetBodyColor());
}
}
public override void SetPlayer(int? playerNum)
{
this.playerNum = playerNum;
int handle;
if (leftController != null)
{
handle = leftController.GetHandle();
if (playerNum == -1 || playerNum == null)
{
JslSetPlayerNumber(handle, 0);
}
else
{
JslSetPlayerNumber(handle, (int)playerNum);
}
}
if (rightController != null)
{
handle = rightController.GetHandle();
if (playerNum == -1 || playerNum == null)
{
JslSetPlayerNumber(handle, 0);
}
else
{
JslSetPlayerNumber(handle, (int)playerNum);
}
}
}
public override void TogglePointerLock(bool locked)
{
}
public override ControlBindings UpdateBindings(ControlBindings lastBinds)
{
if (lastBinds.version == 0)
{
return GetDefaultBindings();
}
return lastBinds;
}
public override void UpdateState()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 538461cea16b9a94eb31f272a79cd574
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -11,21 +11,31 @@ namespace HeavenStudio.InputSystem.Loaders
{ {
public static class InputJoyshockInitializer public static class InputJoyshockInitializer
{ {
static bool failedJsl = false;
[LoadOrder(2)] [LoadOrder(2)]
public static InputController[] Initialize() public static InputController[] Initialize()
{ {
failedJsl = false;
InputJoyshock.joyshocks = new(); InputJoyshock.joyshocks = new();
PlayerInput.PlayerInputCleanUp += DisposeJoyshocks; PlayerInput.PlayerInputCleanUp += DisposeJoyshocks;
PlayerInput.PlayerInputRefresh.Add(Refresh); PlayerInput.PlayerInputRefresh.Add(Refresh);
InputJoyshock.JslEventInit(); List<InputController> controllers;
InputController[] controllers;
int jslDevicesFound = 0; int jslDevicesFound = 0;
int jslDevicesConnected = 0; int jslDevicesConnected = 0;
int[] jslDeviceHandles; int[] jslDeviceHandles;
jslDevicesFound = JslConnectDevices(); try
{
JslDisconnectAndDisposeAll();
jslDevicesFound = JslConnectDevices();
}
catch (Exception e)
{
Debug.LogError("Failed to initialize JoyShockLibrary: " + e.Message);
failedJsl = true;
return null;
}
if (jslDevicesFound > 0) if (jslDevicesFound > 0)
{ {
jslDeviceHandles = new int[jslDevicesFound]; jslDeviceHandles = new int[jslDevicesFound];
@ -40,16 +50,17 @@ namespace HeavenStudio.InputSystem.Loaders
Debug.Log("Connected " + jslDevicesConnected + " JoyShocks."); Debug.Log("Connected " + jslDevicesConnected + " JoyShocks.");
} }
controllers = new InputController[jslDevicesConnected]; controllers = new();
foreach (int i in jslDeviceHandles) foreach (int i in jslDeviceHandles)
{ {
Debug.Log("Setting up JoyShock: ( Handle " + i + ", type " + JslGetControllerType(i) + " )"); Debug.Log("Setting up JoyShock: ( Handle " + i + ", type " + JslGetControllerType(i) + " )");
InputJoyshock joyshock = new InputJoyshock(i); InputJoyshock joyshock = new InputJoyshock(i);
joyshock.SetPlayer(null); joyshock.SetPlayer(null);
joyshock.InitializeController(); joyshock.InitializeController();
controllers[i] = joyshock; controllers.Add(joyshock);
} }
return controllers; InputJoyshock.JslEventInit();
return controllers.ToArray();
} }
Debug.Log("No JoyShocks found."); Debug.Log("No JoyShocks found.");
return null; return null;
@ -57,38 +68,42 @@ namespace HeavenStudio.InputSystem.Loaders
public static void DisposeJoyshocks() public static void DisposeJoyshocks()
{ {
if (failedJsl) return;
foreach (InputJoyshock joyshock in InputJoyshock.joyshocks.Values) foreach (InputJoyshock joyshock in InputJoyshock.joyshocks.Values)
{ {
joyshock.CleanUp(); joyshock.CleanUp();
} }
JslSetCallback(null);
JslDisconnectAndDisposeAll(); JslDisconnectAndDisposeAll();
JslSetCallback(null);
} }
public static InputController[] Refresh() public static InputController[] Refresh()
{ {
if (failedJsl) return null;
InputJoyshock.joyshocks.Clear(); InputJoyshock.joyshocks.Clear();
InputController[] controllers; List<InputController> controllers;
int jslDevicesFound = 0; int jslDevicesFound = 0;
int jslDevicesConnected = 0; int jslDevicesConnected = 0;
int[] jslDeviceHandles; int[] jslDeviceHandles;
JslDisconnectAndDisposeAll();
jslDevicesFound = JslConnectDevices(); jslDevicesFound = JslConnectDevices();
if (jslDevicesFound > 0) if (jslDevicesFound > 0)
{ {
jslDeviceHandles = new int[jslDevicesFound]; jslDeviceHandles = new int[jslDevicesFound];
jslDevicesConnected = JslGetConnectedDeviceHandles(jslDeviceHandles, jslDevicesFound); jslDevicesConnected = JslGetConnectedDeviceHandles(jslDeviceHandles, jslDevicesFound);
controllers = new InputController[jslDevicesConnected]; controllers = new();
foreach (int i in jslDeviceHandles) foreach (int i in jslDeviceHandles)
{ {
Debug.Log("Setting up JoyShock: ( Handle " + i + ", type " + JslGetControllerType(i) + " )"); Debug.Log("Setting up JoyShock: ( Handle " + i + ", type " + JslGetControllerType(i) + " )");
InputJoyshock joyshock = new InputJoyshock(i); InputJoyshock joyshock = new InputJoyshock(i);
joyshock.SetPlayer(null); joyshock.SetPlayer(null);
joyshock.InitializeController(); joyshock.InitializeController();
controllers[i] = joyshock; controllers.Add(joyshock);
} }
return controllers; InputJoyshock.JslEventInit();
return controllers.ToArray();
} }
Debug.Log("No JoyShocks found."); Debug.Log("No JoyShocks found.");
return null; return null;
@ -107,7 +122,7 @@ namespace HeavenStudio.InputSystem
"Joy-Con (R)", "Joy-Con (R)",
"Pro Controller", "Pro Controller",
"DualShock 4", "DualShock 4",
"DualSense" "DualSense/Edge" // jsl doesn't expose a new device ID for DSE
}; };
static readonly int[] dsPlayerColours = new[] static readonly int[] dsPlayerColours = new[]
@ -148,10 +163,10 @@ namespace HeavenStudio.InputSystem
{ {
return new[] return new[]
{ {
20,
21,
22,
23, 23,
24,
25,
26,
ButtonMaskLeft, ButtonMaskLeft,
ButtonMaskDown, ButtonMaskDown,
ButtonMaskUp, ButtonMaskUp,
@ -170,10 +185,10 @@ namespace HeavenStudio.InputSystem
{ {
return new[] return new[]
{ {
20,
21,
22,
23, 23,
24,
25,
26,
ButtonMaskE, ButtonMaskE,
ButtonMaskN, ButtonMaskN,
ButtonMaskS, ButtonMaskS,
@ -228,8 +243,11 @@ namespace HeavenStudio.InputSystem
"X", "X",
"Home", "Home",
"Capture", "Capture",
"", // mic on playstation, unused here
"SL", "SL",
"SR", "SR",
"", // fnl on playstation, unused here
"", // fnr on playstation, unused here
"Stick Up", "Stick Up",
"Stick Down", "Stick Down",
"Stick Left", "Stick Left",
@ -256,6 +274,7 @@ namespace HeavenStudio.InputSystem
"Triangle", "Triangle",
"PS", "PS",
"Touchpad Click", "Touchpad Click",
"Mic",
}; };
static readonly string[] ps5ButtonNames = new[] static readonly string[] ps5ButtonNames = new[]
@ -279,13 +298,17 @@ namespace HeavenStudio.InputSystem
"PS", "PS",
"Create", "Create",
"Mic", "Mic",
"Left Grip",
"Right Grip",
"Left Function",
"Right Function",
}; };
static readonly float debounceTime = 1f / 90f; static readonly float debounceTime = 1f / 90f;
public static Dictionary<int, InputJoyshock> joyshocks; public static Dictionary<int, InputJoyshock> joyshocks;
float stickDeadzone = 0.5f; const float STICK_DEAD = 0.6f;
int joyshockHandle; int joyshockHandle;
int type; int type;
@ -293,10 +316,11 @@ namespace HeavenStudio.InputSystem
int lightbarColour; int lightbarColour;
string joyshockName; string joyshockName;
DateTime startTime; DateTime startTime;
bool joyConWantRotatedStick = true;
//buttons, sticks, triggers //buttons, sticks, triggers
JoyshockButtonState[] actionStates = new JoyshockButtonState[BINDS_MAX]; JoyshockButtonState[] actionStates = new JoyshockButtonState[BINDS_MAX];
JoyshockButtonState[] buttonStates = new JoyshockButtonState[ButtonMaskSR + 1]; JoyshockButtonState[] buttonStates = new JoyshockButtonState[ButtonMaskFnR + 1];
JOY_SHOCK_STATE joyBtStateCurrent; JOY_SHOCK_STATE joyBtStateCurrent;
//gyro and accelerometer //gyro and accelerometer
IMU_STATE joyImuStateCurrent, joyImuStateLast; IMU_STATE joyImuStateCurrent, joyImuStateLast;
@ -306,9 +330,6 @@ namespace HeavenStudio.InputSystem
// controller settings // controller settings
JSL_SETTINGS joySettings; JSL_SETTINGS joySettings;
InputJoyshock otherHalf;
bool isPair;
public struct JoyshockButtonState public struct JoyshockButtonState
{ {
public double dt; // time passed since state public double dt; // time passed since state
@ -333,12 +354,12 @@ namespace HeavenStudio.InputSystem
joyshockHandle = handle; joyshockHandle = handle;
} }
int GetButtonForSplitType(int action) int GetButtonForAction(int action)
{ {
if (currentBindings.Pad == null) return -1; if (currentBindings.Pad == null) return -1;
if (action < 0 || action >= BINDS_MAX) return -1; if (action < 0 || action >= BINDS_MAX) return -1;
ControlBindings actionMap = currentBindings; ControlBindings actionMap = currentBindings;
if (actionMap.Pad[action] > ButtonMaskSR) return -1; if (actionMap.Pad[action] > ButtonMaskFnR) return -1;
return actionMap.Pad[action]; return actionMap.Pad[action];
} }
@ -379,7 +400,7 @@ namespace HeavenStudio.InputSystem
lastInputStack = new(); lastInputStack = new();
actionStates = new JoyshockButtonState[BINDS_MAX]; actionStates = new JoyshockButtonState[BINDS_MAX];
buttonStates = new JoyshockButtonState[ButtonMaskSR + 1]; buttonStates = new JoyshockButtonState[ButtonMaskFnR + 1];
joyBtStateCurrent = new JOY_SHOCK_STATE(); joyBtStateCurrent = new JOY_SHOCK_STATE();
joyImuStateCurrent = new IMU_STATE(); joyImuStateCurrent = new IMU_STATE();
@ -423,6 +444,9 @@ namespace HeavenStudio.InputSystem
for (int i = 0; i < buttonStates.Length; i++) for (int i = 0; i < buttonStates.Length; i++)
{ {
buttonStates[i].isDelta = false; buttonStates[i].isDelta = false;
buttonStates[i].debounce -= Time.deltaTime;
if (buttonStates[i].debounce < 0)
buttonStates[i].debounce = 0;
} }
foreach (TimestampedState state in lastInputStack) foreach (TimestampedState state in lastInputStack)
@ -431,7 +455,7 @@ namespace HeavenStudio.InputSystem
for (int i = 0; i < actionStates.Length; i++) for (int i = 0; i < actionStates.Length; i++)
{ {
int bt = GetButtonForSplitType(i); int bt = GetButtonForAction(i);
if (bt != -1) if (bt != -1)
{ {
bool pressed = BitwiseUtils.WantCurrent(state.input.buttons, 1 << bt); bool pressed = BitwiseUtils.WantCurrent(state.input.buttons, 1 << bt);
@ -453,9 +477,13 @@ namespace HeavenStudio.InputSystem
bool pressed = BitwiseUtils.WantCurrent(state.input.buttons, 1 << i); bool pressed = BitwiseUtils.WantCurrent(state.input.buttons, 1 << i);
if (pressed != buttonStates[i].pressed && !buttonStates[i].isDelta) if (pressed != buttonStates[i].pressed && !buttonStates[i].isDelta)
{ {
buttonStates[i].pressed = pressed; if (buttonStates[i].debounce <= 0)
buttonStates[i].isDelta = true; {
buttonStates[i].dt = reportTime - state.timestamp; buttonStates[i].pressed = pressed;
buttonStates[i].isDelta = true;
buttonStates[i].dt = reportTime - state.timestamp;
}
buttonStates[i].debounce = debounceTime;
} }
} }
} }
@ -465,22 +493,19 @@ namespace HeavenStudio.InputSystem
//left rotates counterclockwise, right rotates clockwise, all by 90 degrees //left rotates counterclockwise, right rotates clockwise, all by 90 degrees
float xAxis = 0f; float xAxis = 0f;
float yAxis = 0f; float yAxis = 0f;
if (otherHalf == null)
if (joyConWantRotatedStick && type is TypeJoyConLeft or TypeJoyConRight)
{ {
switch (splitType) switch (type)
{ {
case SplitLeft: case TypeJoyConLeft:
xAxis = -joyBtStateCurrent.stickLY; xAxis = -joyBtStateCurrent.stickLY;
yAxis = joyBtStateCurrent.stickLX; yAxis = joyBtStateCurrent.stickLX;
break; break;
case SplitRight: //use the right stick instead case TypeJoyConRight:
xAxis = joyBtStateCurrent.stickRY; xAxis = joyBtStateCurrent.stickRY;
yAxis = -joyBtStateCurrent.stickRX; yAxis = -joyBtStateCurrent.stickRX;
break; break;
case SplitFull:
xAxis = joyBtStateCurrent.stickLX;
yAxis = joyBtStateCurrent.stickLY;
break;
} }
} }
else else
@ -491,17 +516,18 @@ namespace HeavenStudio.InputSystem
directionStateLast = directionStateCurrent; directionStateLast = directionStateCurrent;
directionStateCurrent = 0; directionStateCurrent = 0;
directionStateCurrent |= ((yAxis >= stickDeadzone) ? (1 << ((int)InputDirection.Up)) : 0); directionStateCurrent |= (yAxis >= STICK_DEAD) ? (1 << (int)ActionsPad.Up) : 0;
directionStateCurrent |= ((yAxis <= -stickDeadzone) ? (1 << ((int)InputDirection.Down)) : 0); directionStateCurrent |= (yAxis <= -STICK_DEAD) ? (1 << (int)ActionsPad.Down) : 0;
directionStateCurrent |= ((xAxis >= stickDeadzone) ? (1 << ((int)InputDirection.Right)) : 0); directionStateCurrent |= (xAxis <= -STICK_DEAD) ? (1 << (int)ActionsPad.Left) : 0;
directionStateCurrent |= ((xAxis <= -stickDeadzone) ? (1 << ((int)InputDirection.Left)) : 0); directionStateCurrent |= (xAxis >= STICK_DEAD) ? (1 << (int)ActionsPad.Right) : 0;
//Debug.Log("stick direction: " + directionStateCurrent + "| x axis: " + xAxis + " y axis: " + yAxis); // Debug.Log($"{GetDeviceName()} stick direction: {directionStateCurrent}| x axis: {xAxis}, y axis: {yAxis}");
lastInputStack.Clear(); lastInputStack.Clear();
} }
public override void OnSelected() public override void OnSelected()
{ {
SetRotatedStickMode(true);
Task.Run(() => SelectionVibrate()); Task.Run(() => SelectionVibrate());
} }
@ -514,8 +540,6 @@ namespace HeavenStudio.InputSystem
public override string GetDeviceName() public override string GetDeviceName()
{ {
if (otherHalf != null)
return "Joy-Con Pair";
return joyshockName; return joyshockName;
} }
@ -530,10 +554,7 @@ namespace HeavenStudio.InputSystem
case TypeDualSense: case TypeDualSense:
return ps5ButtonNames; return ps5ButtonNames;
default: default:
if (otherHalf == null) return nsConButtonNames;
return nsConButtonNames;
else
return nsProButtonNames;
} }
} }
@ -577,16 +598,10 @@ namespace HeavenStudio.InputSystem
switch (type) switch (type)
{ {
case TypeJoyConLeft: case TypeJoyConLeft:
if (otherHalf == null) binds.Pad = defaultMappingsL;
binds.Pad = defaultMappingsL;
else
binds.Pad = defaultMappings;
break; break;
case TypeJoyConRight: case TypeJoyConRight:
if (otherHalf == null) binds.Pad = defaultMappingsR;
binds.Pad = defaultMappingsR;
else
binds.Pad = defaultMappings;
break; break;
case TypeProController: case TypeProController:
binds.Pad = defaultMappings; binds.Pad = defaultMappings;
@ -599,6 +614,7 @@ namespace HeavenStudio.InputSystem
break; break;
} }
binds.PointerSensitivity = 3; binds.PointerSensitivity = 3;
binds.version = GetBindingsVersion();
return binds; return binds;
} }
@ -617,20 +633,41 @@ namespace HeavenStudio.InputSystem
currentBindings = newBinds; currentBindings = newBinds;
} }
public override ControlBindings UpdateBindings(ControlBindings lastBinds)
{
if (lastBinds.version == 0)
{
switch (type)
{
case TypeProController:
case TypeDualShock4:
case TypeDualSense:
return lastBinds;
case TypeJoyConLeft:
case TypeJoyConRight:
for (int i = 0; i < lastBinds.Pad.Length; i++)
{
if (lastBinds.Pad[i] is 18 or 19)
lastBinds.Pad[i] = lastBinds.Pad[i] + 1;
}
return lastBinds;
}
}
return lastBinds;
}
public override int GetBindingsVersion()
{
return 1;
}
public override bool GetIsActionUnbindable(int action, ControlStyles style) public override bool GetIsActionUnbindable(int action, ControlStyles style)
{ {
if (otherHalf == null) if (type is TypeJoyConLeft or TypeJoyConRight)
{ {
switch (splitType) if (style is ControlStyles.Pad)
{ {
case SplitLeft: return action is 0 or 1 or 2 or 3;
case SplitRight:
switch (style)
{
case ControlStyles.Pad:
return action is 0 or 1 or 2 or 3;
}
break;
} }
} }
return false; return false;
@ -652,48 +689,74 @@ namespace HeavenStudio.InputSystem
{ {
for (int i = 0; i < actionStates.Length; i++) for (int i = 0; i < actionStates.Length; i++)
{ {
if (i is 0 or 1 or 2 or 3)
{
if (BitwiseUtils.WantCurrentAndNotLast(directionStateCurrent, directionStateLast, 1 << i))
{
return i;
}
}
if (actionStates[i].pressed && actionStates[i].isDelta) if (actionStates[i].pressed && actionStates[i].isDelta)
{ {
return i; return i;
} }
} }
if (otherHalf != null)
{
return otherHalf.GetLastActionDown();
}
return -1; return -1;
} }
public override bool GetAction(ControlStyles style, int button) public JoyshockButtonState GetButtonState(int button)
{ {
if (button == -1) { return false; } return buttonStates[button];
if (otherHalf != null)
{
return actionStates[button].pressed || otherHalf.actionStates[button].pressed;
}
return actionStates[button].pressed;
} }
public override bool GetActionDown(ControlStyles style, int button, out double dt) public JoyshockButtonState[] GetButtonStates()
{ {
if (button == -1) { dt = 0; return false; } return buttonStates;
if (otherHalf != null && otherHalf.GetActionDown(style, button, out dt)) }
public override bool GetAction(ControlStyles style, int action)
{
if (action == -1) { return false; }
bool stick = false;
if (action is 0 or 1 or 2 or 3)
{
stick = BitwiseUtils.WantCurrent(directionStateCurrent, 1 << action);
}
return actionStates[action].pressed || stick;
}
public override bool GetActionDown(ControlStyles style, int action, out double dt)
{
if (action == -1) { dt = 0; return false; }
dt = actionStates[action].dt;
bool bt = actionStates[action].pressed && actionStates[action].isDelta;
if (bt)
{ {
return true; return true;
} }
dt = actionStates[button].dt; else if (action is 0 or 1 or 2 or 3)
return actionStates[button].pressed && actionStates[button].isDelta; {
dt = 0;
return BitwiseUtils.WantCurrentAndNotLast(directionStateCurrent, directionStateLast, 1 << action);
}
return false;
} }
public override bool GetActionUp(ControlStyles style, int button, out double dt) public override bool GetActionUp(ControlStyles style, int button, out double dt)
{ {
if (button == -1) { dt = 0; return false; } if (button == -1) { dt = 0; return false; }
if (otherHalf != null && otherHalf.GetActionUp(style, button, out dt)) dt = actionStates[button].dt;
bool bt = !actionStates[button].pressed && actionStates[button].isDelta;
if (bt)
{ {
return true; return true;
} }
dt = actionStates[button].dt; else if (button is 0 or 1 or 2 or 3)
return !actionStates[button].pressed && actionStates[button].isDelta; {
dt = 0;
return BitwiseUtils.WantNotCurrentAndLast(directionStateCurrent, directionStateLast, 1 << button);
}
return false;
} }
public override float GetAxis(InputAxis axis) public override float GetAxis(InputAxis axis)
@ -713,7 +776,7 @@ namespace HeavenStudio.InputSystem
case InputAxis.AxisRStickY: case InputAxis.AxisRStickY:
return joyBtStateCurrent.stickRY; return joyBtStateCurrent.stickRY;
case InputAxis.PointerX: //isn't updated for now, so always returns 0f case InputAxis.PointerX: //isn't updated for now, so always returns 0f
//return joyTouchStateCurrent.t0X; //return joyTouchStateCurrent.t0X;
case InputAxis.PointerY: case InputAxis.PointerY:
//return joyTouchStateCurrent.t0Y; //return joyTouchStateCurrent.t0Y;
default: default:
@ -747,93 +810,6 @@ namespace HeavenStudio.InputSystem
return cam.ScreenToWorldPoint(rawPointerPos); return cam.ScreenToWorldPoint(rawPointerPos);
} }
public override bool GetHatDirection(InputDirection direction)
{
int bt;
switch (direction)
{
case InputDirection.Up:
bt = 0;
break;
case InputDirection.Down:
bt = 1;
break;
case InputDirection.Left:
bt = 2;
break;
case InputDirection.Right:
bt = 3;
break;
default:
return false;
}
if (otherHalf != null)
{
return GetAction(ControlStyles.Pad, bt) || BitwiseUtils.WantCurrent(otherHalf.directionStateCurrent, 1 << (int)direction) || BitwiseUtils.WantCurrent(directionStateCurrent, 1 << (int)direction);
}
return GetAction(ControlStyles.Pad, bt) || BitwiseUtils.WantCurrent(directionStateCurrent, 1 << (int)direction);
}
public override bool GetHatDirectionDown(InputDirection direction, out double dt)
{
int bt;
switch (direction)
{
case InputDirection.Up:
bt = 0;
break;
case InputDirection.Down:
bt = 1;
break;
case InputDirection.Left:
bt = 2;
break;
case InputDirection.Right:
bt = 3;
break;
default:
dt = 0;
return false;
}
bool btbool = GetActionDown(ControlStyles.Pad, bt, out dt);
if (!btbool) dt = 0;
if (otherHalf != null)
{
return btbool || BitwiseUtils.WantCurrentAndNotLast(otherHalf.directionStateCurrent, otherHalf.directionStateLast, 1 << (int)direction) || BitwiseUtils.WantCurrentAndNotLast(directionStateCurrent, directionStateLast, 1 << (int)direction);
}
return btbool || BitwiseUtils.WantCurrentAndNotLast(directionStateCurrent, directionStateLast, 1 << (int)direction);
}
public override bool GetHatDirectionUp(InputDirection direction, out double dt)
{
int bt;
switch (direction)
{
case InputDirection.Up:
bt = 0;
break;
case InputDirection.Down:
bt = 1;
break;
case InputDirection.Left:
bt = 2;
break;
case InputDirection.Right:
bt = 3;
break;
default:
dt = 0;
return false;
}
bool btbool = GetActionUp(ControlStyles.Pad, bt, out dt);
if (!btbool) dt = 0;
if (otherHalf != null)
{
return btbool || BitwiseUtils.WantNotCurrentAndLast(otherHalf.directionStateCurrent, otherHalf.directionStateLast, 1 << (int)direction) || BitwiseUtils.WantNotCurrentAndLast(directionStateCurrent, directionStateLast, 1 << (int)direction);
}
return btbool || BitwiseUtils.WantNotCurrentAndLast(directionStateCurrent, directionStateLast, 1 << (int)direction);
}
public override void SetPlayer(int? playerNum) public override void SetPlayer(int? playerNum)
{ {
//TODO: dualshock 4 and dualsense lightbar colour support //TODO: dualshock 4 and dualsense lightbar colour support
@ -865,11 +841,6 @@ namespace HeavenStudio.InputSystem
public Color GetBodyColor() public Color GetBodyColor()
{ {
if (otherHalf != null)
{
// gets the colour of the right controller if is split
return BitwiseUtils.IntToRgb(splitType == SplitRight ? joySettings.bodyColour : GetOtherHalf().joySettings.bodyColour);
}
return BitwiseUtils.IntToRgb(joySettings.bodyColour); return BitwiseUtils.IntToRgb(joySettings.bodyColour);
} }
@ -882,10 +853,6 @@ namespace HeavenStudio.InputSystem
public Color GetLeftGripColor() public Color GetLeftGripColor()
{ {
if (otherHalf != null)
{
return BitwiseUtils.IntToRgb(splitType == SplitLeft ? joySettings.lGripColour : GetOtherHalf().joySettings.lGripColour);
}
if (joySettings.lGripColour == 0xFFFFFF) if (joySettings.lGripColour == 0xFFFFFF)
return GetBodyColor(); return GetBodyColor();
return BitwiseUtils.IntToRgb(joySettings.lGripColour); return BitwiseUtils.IntToRgb(joySettings.lGripColour);
@ -893,10 +860,6 @@ namespace HeavenStudio.InputSystem
public Color GetRightGripColor() public Color GetRightGripColor()
{ {
if (otherHalf != null)
{
return BitwiseUtils.IntToRgb(splitType == SplitRight ? joySettings.rGripColour : GetOtherHalf().joySettings.rGripColour);
}
if (joySettings.rGripColour == 0xFFFFFF) if (joySettings.rGripColour == 0xFFFFFF)
return GetBodyColor(); return GetBodyColor();
return BitwiseUtils.IntToRgb(joySettings.rGripColour); return BitwiseUtils.IntToRgb(joySettings.rGripColour);
@ -907,6 +870,16 @@ namespace HeavenStudio.InputSystem
return BitwiseUtils.IntToRgb(lightbarColour); return BitwiseUtils.IntToRgb(lightbarColour);
} }
public int GetJoyshockType()
{
return type;
}
public void SetRotatedStickMode(bool rotated)
{
joyConWantRotatedStick = rotated;
}
public void SetLightbarColour(Color color) public void SetLightbarColour(Color color)
{ {
lightbarColour = BitwiseUtils.RgbToInt(color); lightbarColour = BitwiseUtils.RgbToInt(color);
@ -931,47 +904,11 @@ namespace HeavenStudio.InputSystem
public void DisconnectJoyshock() public void DisconnectJoyshock()
{ {
if (otherHalf != null)
{
otherHalf = null;
}
JslSetRumble(joyshockHandle, 0, 0); JslSetRumble(joyshockHandle, 0, 0);
JslSetLightColour(joyshockHandle, 0); JslSetLightColour(joyshockHandle, 0);
JslSetPlayerNumber(joyshockHandle, 0); JslSetPlayerNumber(joyshockHandle, 0);
} }
public void AssignOtherHalf(InputJoyshock otherHalf, bool force = false)
{
InputFeatures features = otherHalf.GetFeatures();
if (features.HasFlag(InputFeatures.Extra_SplitControllerLeft) || features.HasFlag(InputFeatures.Extra_SplitControllerRight))
{
//two-way link
this.otherHalf = otherHalf;
this.otherHalf.UnAssignOtherHalf(); //juste en cas
this.otherHalf.otherHalf = this;
this.otherHalf.SetPlayer(this.playerNum);
}
else if (force)
{
UnAssignOtherHalf();
}
}
public void UnAssignOtherHalf()
{
if (otherHalf != null)
{
this.otherHalf.otherHalf = null;
this.otherHalf.SetPlayer(-1);
}
otherHalf = null;
}
public InputJoyshock GetOtherHalf()
{
return otherHalf;
}
public override bool GetFlick(out double dt) public override bool GetFlick(out double dt)
{ {
dt = 0; dt = 0;
@ -996,12 +933,6 @@ namespace HeavenStudio.InputSystem
m.SetColor("_LGripColor", ColorUtility.TryParseHtmlString("#2F353A", out colour) ? colour : Color.white); m.SetColor("_LGripColor", ColorUtility.TryParseHtmlString("#2F353A", out colour) ? colour : Color.white);
m.SetColor("_RGripColor", ColorUtility.TryParseHtmlString("#2F353A", out colour) ? colour : Color.white); m.SetColor("_RGripColor", ColorUtility.TryParseHtmlString("#2F353A", out colour) ? colour : Color.white);
break; break;
case "Joy-Con Pair":
m.SetColor("_BodyColor", splitType == SplitRight ? GetButtonColor() : GetOtherHalf().GetButtonColor());
m.SetColor("_BtnColor", splitType == SplitLeft ? GetButtonColor() : GetOtherHalf().GetButtonColor());
m.SetColor("_LGripColor", GetLeftGripColor());
m.SetColor("_RGripColor", GetRightGripColor());
break;
case "DualShock 4": case "DualShock 4":
m.SetColor("_BodyColor", ColorUtility.TryParseHtmlString("#E1E2E4", out colour) ? colour : Color.white); m.SetColor("_BodyColor", ColorUtility.TryParseHtmlString("#E1E2E4", out colour) ? colour : Color.white);
m.SetColor("_BtnColor", ColorUtility.TryParseHtmlString("#414246", out colour) ? colour : Color.white); m.SetColor("_BtnColor", ColorUtility.TryParseHtmlString("#414246", out colour) ? colour : Color.white);

View file

@ -131,6 +131,16 @@ namespace HeavenStudio.InputSystem
currentBindings = newBinds; currentBindings = newBinds;
} }
public override ControlBindings UpdateBindings(ControlBindings lastBinds)
{
return lastBinds;
}
public override int GetBindingsVersion()
{
return 0;
}
public override bool GetIsActionUnbindable(int action, ControlStyles style) public override bool GetIsActionUnbindable(int action, ControlStyles style)
{ {
return false; return false;
@ -197,60 +207,6 @@ namespace HeavenStudio.InputSystem
return cam.ScreenToWorldPoint(rawPointerPos); return cam.ScreenToWorldPoint(rawPointerPos);
} }
//todo: directionals
public override bool GetHatDirection(InputDirection direction)
{
switch (direction)
{
case InputDirection.Up:
return Input.GetKey((KeyCode)currentBindings.Pad[0]);
case InputDirection.Down:
return Input.GetKey((KeyCode)currentBindings.Pad[1]);
case InputDirection.Left:
return Input.GetKey((KeyCode)currentBindings.Pad[2]);
case InputDirection.Right:
return Input.GetKey((KeyCode)currentBindings.Pad[3]);
default:
return false;
}
}
public override bool GetHatDirectionDown(InputDirection direction, out double dt)
{
dt = 0;
switch (direction)
{
case InputDirection.Up:
return Input.GetKeyDown((KeyCode)currentBindings.Pad[0]);
case InputDirection.Down:
return Input.GetKeyDown((KeyCode)currentBindings.Pad[1]);
case InputDirection.Left:
return Input.GetKeyDown((KeyCode)currentBindings.Pad[2]);
case InputDirection.Right:
return Input.GetKeyDown((KeyCode)currentBindings.Pad[3]);
default:
return false;
}
}
public override bool GetHatDirectionUp(InputDirection direction, out double dt)
{
dt = 0;
switch (direction)
{
case InputDirection.Up:
return Input.GetKeyUp((KeyCode)currentBindings.Pad[0]);
case InputDirection.Down:
return Input.GetKeyUp((KeyCode)currentBindings.Pad[1]);
case InputDirection.Left:
return Input.GetKeyUp((KeyCode)currentBindings.Pad[2]);
case InputDirection.Right:
return Input.GetKeyUp((KeyCode)currentBindings.Pad[3]);
default:
return false;
}
}
public override void SetPlayer(int? playerNum) public override void SetPlayer(int? playerNum)
{ {
if (playerNum == -1 || playerNum == null) if (playerNum == -1 || playerNum == null)

View file

@ -259,6 +259,16 @@ namespace HeavenStudio.InputSystem
currentBindings = newBinds; currentBindings = newBinds;
} }
public override ControlBindings UpdateBindings(ControlBindings lastBinds)
{
return lastBinds;
}
public override int GetBindingsVersion()
{
return 0;
}
public override bool GetIsActionUnbindable(int action, ControlStyles style) public override bool GetIsActionUnbindable(int action, ControlStyles style)
{ {
return action is 0; return action is 0;
@ -395,24 +405,6 @@ namespace HeavenStudio.InputSystem
return realPos; return realPos;
} }
//todo: directionals
public override bool GetHatDirection(InputDirection direction)
{
return false;
}
public override bool GetHatDirectionDown(InputDirection direction, out double dt)
{
dt = 0;
return false;
}
public override bool GetHatDirectionUp(InputDirection direction, out double dt)
{
dt = 0;
return false;
}
public override void SetPlayer(int? playerNum) public override void SetPlayer(int? playerNum)
{ {
if (playerNum == -1 || playerNum == null) if (playerNum == -1 || playerNum == null)

View file

@ -141,6 +141,7 @@ namespace HeavenStudio.InputSystem
[System.Serializable] [System.Serializable]
public struct ControlBindings public struct ControlBindings
{ {
public int version;
public int[] Pad; public int[] Pad;
public int[] Baton; public int[] Baton;
public int[] Touch; public int[] Touch;
@ -184,7 +185,19 @@ namespace HeavenStudio.InputSystem
string json = File.ReadAllText(path); string json = File.ReadAllText(path);
if (json is not null or "") if (json is not null or "")
{ {
currentBindings = JsonUtility.FromJson<ControlBindings>(json); try
{
currentBindings = JsonUtility.FromJson<ControlBindings>(json);
if (currentBindings.version != GetBindingsVersion())
{
currentBindings = UpdateBindings(currentBindings);
SaveBindings();
}
}
catch (System.Exception)
{
ResetBindings();
}
} }
else else
{ {
@ -220,6 +233,19 @@ namespace HeavenStudio.InputSystem
/// <param name="newBinds"></param> /// <param name="newBinds"></param>
public abstract void SetCurrentBindings(ControlBindings newBinds); public abstract void SetCurrentBindings(ControlBindings newBinds);
/// <summary>
/// updates controller bindings to new versions
/// </summary>
/// <param name="lastBinds">bindings of a previous version</param>
/// <returns></returns>
public abstract ControlBindings UpdateBindings(ControlBindings lastBinds);
/// <summary>
/// gets the current bindings version for this controller
/// </summary>
/// <returns></returns>
public abstract int GetBindingsVersion();
/// <summary> /// <summary>
/// Whether a given action can have be rebount /// Whether a given action can have be rebount
/// </summary> /// </summary>
@ -286,29 +312,6 @@ namespace HeavenStudio.InputSystem
public abstract void TogglePointerLock(bool locked); public abstract void TogglePointerLock(bool locked);
public abstract void RecentrePointer(); public abstract void RecentrePointer();
/// <summary>
/// True if the current direction is active
/// </summary>
/// <param name="direction"></param>
/// <returns></returns>
public abstract bool GetHatDirection(InputDirection direction);
/// <summary>
/// True if the current direction just became active this Update
/// </summary>
/// <param name="direction"></param>
/// <param name="dt">time since the reported event, use to compensate for controller delays</param>
/// <returns></returns>
public abstract bool GetHatDirectionDown(InputDirection direction, out double dt);
/// <summary>
/// True if the current direction just became inactive this Update
/// </summary>
/// <param name="direction"></param>
/// <param name="dt">time since the reported event, use to compensate for controller delays</param>
/// <returns></returns>
public abstract bool GetHatDirectionUp(InputDirection direction, out double dt);
public abstract bool GetFlick(out double dt); public abstract bool GetFlick(out double dt);
public abstract bool GetSlide(out double dt); public abstract bool GetSlide(out double dt);
public abstract bool GetSqueezeDown(out double dt); public abstract bool GetSqueezeDown(out double dt);

View file

@ -23,16 +23,6 @@ namespace HeavenStudio
PlayerInputRefresh = new(); PlayerInputRefresh = new();
PlayerInputCleanUp = null; PlayerInputCleanUp = null;
controllers = InputJoyshockInitializer.Initialize();
if (controllers != null)
{
inputDevices.AddRange(controllers);
}
else
{
Debug.Log("InputJoyshockInitializer.Initialize had no controllers to initialize.");
}
controllers = InputKeyboardInitializer.Initialize(); controllers = InputKeyboardInitializer.Initialize();
if (controllers != null) if (controllers != null)
{ {
@ -53,6 +43,26 @@ namespace HeavenStudio
Debug.Log("InputMouseInitializer.Initialize had no controllers to initialize."); Debug.Log("InputMouseInitializer.Initialize had no controllers to initialize.");
} }
controllers = InputJoyshockInitializer.Initialize();
if (controllers != null)
{
inputDevices.AddRange(controllers);
}
else
{
Debug.Log("InputJoyshockInitializer.Initialize had no controllers to initialize.");
}
controllers = InputJoyconPairInitializer.Initialize();
if (controllers != null)
{
inputDevices.AddRange(controllers);
}
else
{
Debug.Log("InputJoyconPairInitializer.Initialize had no controllers to initialize.");
}
return inputDevices.Count; return inputDevices.Count;
} }

View file

@ -32,27 +32,44 @@ namespace HeavenStudio.Editor
if (File.Exists(Application.persistentDataPath + "/editorTheme.json")) if (File.Exists(Application.persistentDataPath + "/editorTheme.json"))
{ {
string json = File.ReadAllText(Application.persistentDataPath + "/editorTheme.json"); string json = File.ReadAllText(Application.persistentDataPath + "/editorTheme.json");
theme = JsonConvert.DeserializeObject<Theme>(json); if (json == "")
// Naive way of doing it? Possibly, but we should have a theme editor in the future.
if (defaultTheme.properties.LayerColors != null)
{ {
theme.properties.LayerColors = new string[] PersistentDataManager.SaveTheme(ThemeTXT.text);
theme = defaultTheme;
theme.SetLayersGradient();
return;
}
try
{
theme = JsonConvert.DeserializeObject<Theme>(json);
// Naive way of doing it? Possibly, but we should have a theme editor in the future.
if (defaultTheme.properties.LayerColors != null)
{ {
theme.properties.Layer1Col, theme.properties.LayerColors = new string[]
theme.properties.Layer2Col, {
theme.properties.Layer3Col, theme.properties.Layer1Col,
theme.properties.Layer4Col, theme.properties.Layer2Col,
theme.properties.Layer5Col theme.properties.Layer3Col,
}; theme.properties.Layer4Col,
// Create a function for this in the future. theme.properties.Layer5Col
var savedTheme = JsonConvert.SerializeObject(theme, Formatting.Indented, new JsonSerializerSettings() };
{ // Create a function for this in the future.
TypeNameHandling = TypeNameHandling.None, var savedTheme = JsonConvert.SerializeObject(theme, Formatting.Indented, new JsonSerializerSettings()
NullValueHandling = NullValueHandling.Include, {
ReferenceLoopHandling = ReferenceLoopHandling.Ignore, TypeNameHandling = TypeNameHandling.None,
}); NullValueHandling = NullValueHandling.Include,
PersistentDataManager.SaveTheme(savedTheme); ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
});
PersistentDataManager.SaveTheme(savedTheme);
}
}
catch
{
PersistentDataManager.SaveTheme(ThemeTXT.text);
theme = defaultTheme;
theme.SetLayersGradient();
return;
} }
} }
else else

View file

@ -67,7 +67,22 @@ namespace HeavenStudio.Common
if (File.Exists(Application.persistentDataPath + "/settings.json")) if (File.Exists(Application.persistentDataPath + "/settings.json"))
{ {
string json = File.ReadAllText(Application.persistentDataPath + "/settings.json"); string json = File.ReadAllText(Application.persistentDataPath + "/settings.json");
gameSettings = JsonUtility.FromJson<GameSettings>(json); if (json == "")
{
GlobalGameManager.IsFirstBoot = true;
CreateDefaultSettings();
return;
}
try
{
gameSettings = JsonConvert.DeserializeObject<GameSettings>(json);
}
catch (Exception e)
{
Debug.LogError($"Error while loading settings, creating default settings;\n{e.Message}");
GlobalGameManager.IsFirstBoot = true;
CreateDefaultSettings();
}
} }
else else
{ {

View file

@ -38,6 +38,8 @@ public partial class ControllerLoaderGenerator
false false
)) ))
.ToList(); .ToList();
// sort by load order attribute (lower is first)
loadRunners.Sort((x, y) => x.Method.GetCustomAttribute<LoadOrder>().Order.CompareTo(y.Method.GetCustomAttribute<LoadOrder>().Order));
// USG: static classes are IsAbstract is set. // USG: static classes are IsAbstract is set.
if (!context.TargetClass.IsClass) if (!context.TargetClass.IsClass)

View file

@ -83,7 +83,6 @@ namespace {context.TargetClass.Namespace}
string fullMethodLabel = $"{callingClass}.{method}"; string fullMethodLabel = $"{callingClass}.{method}";
sb.Append($@" sb.Append($@"
Debug.Log(""Running game loader {callingClass}"");
game = {fullMethodLabel}(eventCaller); game = {fullMethodLabel}(eventCaller);
if (game != null) if (game != null)
{{ {{

View file

@ -155,14 +155,9 @@ namespace HeavenStudio
var nextController = newController; var nextController = newController;
var lastController = PlayerInput.GetInputController(1); var lastController = PlayerInput.GetInputController(1);
if ((newController is InputMouse) && !(lastController is InputMouse))
{
Debug.Log("Mouse used, selecting keyboard instead");
nextController = controllers[0];
}
Debug.Log("Assigning controller: " + newController.GetDeviceName()); Debug.Log("Assigning controller: " + newController.GetDeviceName());
if (lastController != nextController && !firstBoot) if (lastController != nextController)// && !firstBoot)
{ {
firstBoot = false; firstBoot = false;
if (nextController == null) if (nextController == null)
@ -172,6 +167,7 @@ namespace HeavenStudio
} }
lastController.SetPlayer(null); lastController.SetPlayer(null);
nextController.SetPlayer(1); nextController.SetPlayer(1);
nextController.OnSelected();
PlayerInput.CurrentControlStyle = nextController.GetDefaultStyle(); PlayerInput.CurrentControlStyle = nextController.GetDefaultStyle();
usingMouse = PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch; usingMouse = PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch;
selectedDisplayIcon.SetActive(!usingMouse); selectedDisplayIcon.SetActive(!usingMouse);
@ -179,18 +175,8 @@ namespace HeavenStudio
{ {
obj.SetActive(!usingMouse); obj.SetActive(!usingMouse);
} }
if ((lastController as InputJoyshock) != null)
{
(lastController as InputJoyshock)?.UnAssignOtherHalf();
}
if ((nextController as InputJoyshock) != null)
{
nextController.OnSelected();
(nextController as InputJoyshock)?.UnAssignOtherHalf();
}
} }
break;
} }
else else
{ {
@ -276,13 +262,13 @@ namespace HeavenStudio
} }
else if (settingsPanel.IsOpen) else if (settingsPanel.IsOpen)
{ {
if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch) // if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)
{ // {
if (controller.GetLastActionDown() == (int)InputController.ActionsPad.South) // if (controller.GetLastActionDown() == (int)InputController.ActionsPad.South)
{ // {
SettingsClose(); // SettingsClose();
} // }
} // }
} }
else if (!firstPress) else if (!firstPress)
{ {
@ -570,7 +556,7 @@ namespace HeavenStudio
} }
// waitingForButtonUp = true; // waitingForButtonUp = true;
playPanelRevealTime = Time.realtimeSinceStartup + 0.2f; playPanelRevealTime = Time.realtimeSinceStartup + 0.5f;
playPanel.SetActive(true); playPanel.SetActive(true);
playMenuRevealed = true; playMenuRevealed = true;
SoundByte.PlayOneShot("ui/UISelect"); SoundByte.PlayOneShot("ui/UISelect");

View file

@ -23,9 +23,9 @@ namespace HeavenStudio.Editor
[SerializeField] private TMP_Dropdown controllersDropdown; [SerializeField] private TMP_Dropdown controllersDropdown;
[SerializeField] private GameObject pairSearchItem; [SerializeField] private GameObject pairSearchItem;
[SerializeField] private GameObject autoSearchLabel; [SerializeField] private GameObject autoSearchLabel;
[SerializeField] private GameObject pairSearchLabel; // [SerializeField] private GameObject pairSearchLabel;
[SerializeField] private GameObject pairSearchCancelBt; // [SerializeField] private GameObject pairSearchCancelBt;
[SerializeField] private TMP_Text pairingLabel; // [SerializeField] private TMP_Text pairingLabel;
[SerializeField] private List<GameObject> controllerIcons; [SerializeField] private List<GameObject> controllerIcons;
[SerializeField] private Material controllerMat; [SerializeField] private Material controllerMat;
@ -41,8 +41,8 @@ namespace HeavenStudio.Editor
[SerializeField] private Slider cursorSensitivitySlider; [SerializeField] private Slider cursorSensitivitySlider;
private bool isAutoSearching = false; private bool isAutoSearching = false;
private bool isPairSearching = false; // private bool isPairSearching = false;
private bool pairSelectLR = false; //true = left, false = right // private bool pairSelectLR = false; //true = left, false = right
private bool bindAllMode; private bool bindAllMode;
private int currentBindingBt; private int currentBindingBt;
@ -113,28 +113,35 @@ namespace HeavenStudio.Editor
} }
} }
} }
else if (isPairSearching) else if (currentController.GetType() == typeof(InputJoyconPair))
{ {
var controllers = PlayerInput.GetInputControllers(); InputJoyconPair pair = (InputJoyconPair)currentController;
InputController.InputFeatures lrFlag = pairSelectLR ? InputController.InputFeatures.Extra_SplitControllerLeft : InputController.InputFeatures.Extra_SplitControllerRight; if (!pair.HasControllers())
foreach (var pairController in controllers)
{ {
if (pairController == currentController) continue; Debug.Log("Pair searching");
List<InputJoyshock> controllers = PlayerInput.GetInputControllers()
InputController.InputFeatures features = pairController.GetFeatures(); .Select(x => x as InputJoyshock)
if (!features.HasFlag(lrFlag)) continue; .Where(x => x != null && x.GetJoyshockType() is TypeJoyConLeft or TypeJoyConRight)
.ToList();
if (pairController.GetLastButtonDown() > 0) foreach (var possibleController in controllers)
{ {
(PlayerInput.GetInputController(1) as InputJoyshock)?.AssignOtherHalf((InputJoyshock)pairController); if (possibleController.GetLastButtonDown(true) == ButtonMaskZL && possibleController.GetJoyshockType() == TypeJoyConLeft)
isPairSearching = false; {
pairSearchLabel.SetActive(false); pair.SetLeftController(possibleController);
currentControllerLabel.text = "Current Controller: " + pairController.GetDeviceName(); pair.SetMaterialProperties(controllerMat);
pairingLabel.text = "Joy-Con Pair Selected\nPairing Successful!"; }
ShowControllerIcon(pairController); else if (possibleController.GetLastButtonDown(true) == ButtonMaskZR && possibleController.GetJoyshockType() == TypeJoyConRight)
{
currentController.OnSelected(); pair.SetRightController(possibleController);
pairController.OnSelected(); pair.SetMaterialProperties(controllerMat);
}
}
if (pair.HasControllers())
{
pairSearchItem.SetActive(false);
pair.OnSelected();
pair.SetPlayer(1);
pair.SetMaterialProperties(controllerMat);
} }
} }
} }
@ -193,17 +200,6 @@ namespace HeavenStudio.Editor
lastController.SetPlayer(null); lastController.SetPlayer(null);
newController.SetPlayer(1); newController.SetPlayer(1);
if ((lastController as InputJoyshock) != null)
{
(lastController as InputJoyshock)?.UnAssignOtherHalf();
}
if ((newController as InputJoyshock) != null)
{
newController.OnSelected();
(newController as InputJoyshock)?.UnAssignOtherHalf();
}
currentControllerLabel.text = "Current Controller: " + newController.GetDeviceName(); currentControllerLabel.text = "Current Controller: " + newController.GetDeviceName();
if (!newController.GetCurrentStyleSupported()) if (!newController.GetCurrentStyleSupported())
@ -212,32 +208,23 @@ namespace HeavenStudio.Editor
stylesDropdown.SetValueWithoutNotify((int)PlayerInput.CurrentControlStyle); stylesDropdown.SetValueWithoutNotify((int)PlayerInput.CurrentControlStyle);
} }
UpdateControlStyleMapping(); newController.OnSelected();
ShowControllerBinds(newController);
ShowControllerIcon(newController);
InputController.InputFeatures features = newController.GetFeatures(); if (newController is InputJoyconPair)
if (features.HasFlag(InputController.InputFeatures.Extra_SplitControllerLeft))
{ {
pairingLabel.text = "Joy-Con (L) Selected\nPress any button on Joy-Con (R) to pair."; InputJoyconPair pair = (InputJoyconPair)newController;
pair.SetLeftController(null);
pairSelectLR = !features.HasFlag(InputController.InputFeatures.Extra_SplitControllerLeft); pair.SetRightController(null);
pairSearchItem.SetActive(true); pairSearchItem.SetActive(true);
StartPairSearch();
}
else if (features.HasFlag(InputController.InputFeatures.Extra_SplitControllerRight))
{
pairingLabel.text = "Joy-Con (R) Selected\nPress any button on Joy-Con (L) to pair.";
pairSelectLR = !features.HasFlag(InputController.InputFeatures.Extra_SplitControllerLeft);
pairSearchItem.SetActive(true);
StartPairSearch();
} }
else else
{ {
CancelPairSearch();
pairSearchItem.SetActive(false); pairSearchItem.SetActive(false);
} }
UpdateControlStyleMapping();
ShowControllerBinds(newController);
ShowControllerIcon(newController);
} }
public void ControllerDropdownChange() public void ControllerDropdownChange()
@ -253,7 +240,12 @@ namespace HeavenStudio.Editor
public void StartBindSingle(int bt) public void StartBindSingle(int bt)
{ {
CancelBind(); CancelBind();
if (PlayerInput.GetInputController(1).GetIsActionUnbindable(bt, PlayerInput.CurrentControlStyle)) InputController currentController = PlayerInput.GetInputController(1);
if (currentController.GetIsActionUnbindable(bt, PlayerInput.CurrentControlStyle))
{
return;
}
if (currentController is InputJoyconPair && !(currentController as InputJoyconPair).HasControllers())
{ {
return; return;
} }
@ -276,9 +268,14 @@ namespace HeavenStudio.Editor
public void StartBindAll() public void StartBindAll()
{ {
CancelBind(); CancelBind();
InputController currentController = PlayerInput.GetInputController(1);
if (currentController is InputJoyconPair && !(currentController as InputJoyconPair).HasControllers())
{
return;
}
bindAllMode = true; bindAllMode = true;
currentBindingBt = -1; currentBindingBt = -1;
AdvanceAutoBind(PlayerInput.GetInputController(1)); AdvanceAutoBind(currentController);
} }
public void CancelBind() public void CancelBind()
@ -300,34 +297,18 @@ namespace HeavenStudio.Editor
public void StartAutoSearch() public void StartAutoSearch()
{ {
CancelBind(); CancelBind();
if (!isPairSearching) autoSearchLabel.SetActive(true);
{ isAutoSearching = true;
autoSearchLabel.SetActive(true);
isAutoSearching = true;
}
} }
public void StartPairSearch() public void StartPairSearch()
{ {
CancelBind(); CancelBind();
if (!isAutoSearching)
{
pairSearchLabel.SetActive(true);
pairSearchCancelBt.SetActive(true);
isPairSearching = true;
}
} }
public void CancelPairSearch() public void CancelPairSearch()
{ {
CancelBind(); CancelBind();
if (isPairSearching)
{
pairSearchLabel.SetActive(false);
pairSearchCancelBt.SetActive(false);
isPairSearching = false;
pairingLabel.text = "Joy-Con Selected\nPairing was cancelled.";
}
} }
public void SearchAndConnectControllers() public void SearchAndConnectControllers()

View file

@ -13,7 +13,6 @@ namespace HeavenStudio
Minigames.Minigame game; Minigames.Minigame game;
Debug.Log("Running game loader RvlBadmintonLoader");
game = RvlBadmintonLoader.AddGame(eventCaller); game = RvlBadmintonLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -24,7 +23,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlBadmintonLoader failed!"); Debug.LogWarning("Game loader RvlBadmintonLoader failed!");
} }
Debug.Log("Running game loader CtrBearLoader");
game = CtrBearLoader.AddGame(eventCaller); game = CtrBearLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -35,7 +33,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader CtrBearLoader failed!"); Debug.LogWarning("Game loader CtrBearLoader failed!");
} }
Debug.Log("Running game loader RvlBoardMeetingLoader");
game = RvlBoardMeetingLoader.AddGame(eventCaller); game = RvlBoardMeetingLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -46,7 +43,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlBoardMeetingLoader failed!"); Debug.LogWarning("Game loader RvlBoardMeetingLoader failed!");
} }
Debug.Log("Running game loader NtrFlickLoader");
game = NtrFlickLoader.AddGame(eventCaller); game = NtrFlickLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -57,7 +53,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrFlickLoader failed!"); Debug.LogWarning("Game loader NtrFlickLoader failed!");
} }
Debug.Log("Running game loader CtrCatchLoader");
game = CtrCatchLoader.AddGame(eventCaller); game = CtrCatchLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -68,7 +63,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader CtrCatchLoader failed!"); Debug.LogWarning("Game loader CtrCatchLoader failed!");
} }
Debug.Log("Running game loader RvlBookLoader");
game = RvlBookLoader.AddGame(eventCaller); game = RvlBookLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -79,7 +73,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlBookLoader failed!"); Debug.LogWarning("Game loader RvlBookLoader failed!");
} }
Debug.Log("Running game loader AgbClapLoader");
game = AgbClapLoader.AddGame(eventCaller); game = AgbClapLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -90,7 +83,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbClapLoader failed!"); Debug.LogWarning("Game loader AgbClapLoader failed!");
} }
Debug.Log("Running game loader NtrCoinLoader");
game = NtrCoinLoader.AddGame(eventCaller); game = NtrCoinLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -101,7 +93,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrCoinLoader failed!"); Debug.LogWarning("Game loader NtrCoinLoader failed!");
} }
Debug.Log("Running game loader NtrCropLoader");
game = NtrCropLoader.AddGame(eventCaller); game = NtrCropLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -112,7 +103,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrCropLoader failed!"); Debug.LogWarning("Game loader NtrCropLoader failed!");
} }
Debug.Log("Running game loader NtrDjLoader");
game = NtrDjLoader.AddGame(eventCaller); game = NtrDjLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -123,7 +113,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrDjLoader failed!"); Debug.LogWarning("Game loader NtrDjLoader failed!");
} }
Debug.Log("Running game loader NtrDogNinjaLoader");
game = NtrDogNinjaLoader.AddGame(eventCaller); game = NtrDogNinjaLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -134,7 +123,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrDogNinjaLoader failed!"); Debug.LogWarning("Game loader NtrDogNinjaLoader failed!");
} }
Debug.Log("Running game loader RvlDoubleDateLoader");
game = RvlDoubleDateLoader.AddGame(eventCaller); game = RvlDoubleDateLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -145,7 +133,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlDoubleDateLoader failed!"); Debug.LogWarning("Game loader RvlDoubleDateLoader failed!");
} }
Debug.Log("Running game loader CtrDrummingLoader");
game = CtrDrummingLoader.AddGame(eventCaller); game = CtrDrummingLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -156,7 +143,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader CtrDrummingLoader failed!"); Debug.LogWarning("Game loader CtrDrummingLoader failed!");
} }
Debug.Log("Running game loader NtrIdolLoader");
game = NtrIdolLoader.AddGame(eventCaller); game = NtrIdolLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -167,7 +153,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrIdolLoader failed!"); Debug.LogWarning("Game loader NtrIdolLoader failed!");
} }
Debug.Log("Running game loader AgbFireworkLoader");
game = AgbFireworkLoader.AddGame(eventCaller); game = AgbFireworkLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -178,7 +163,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbFireworkLoader failed!"); Debug.LogWarning("Game loader AgbFireworkLoader failed!");
} }
Debug.Log("Running game loader CtrFirstContact");
game = CtrFirstContact.AddGame(eventCaller); game = CtrFirstContact.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -189,7 +173,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader CtrFirstContact failed!"); Debug.LogWarning("Game loader CtrFirstContact failed!");
} }
Debug.Log("Running game loader RvlFlipperFlopLoader");
game = RvlFlipperFlopLoader.AddGame(eventCaller); game = RvlFlipperFlopLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -200,7 +183,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlFlipperFlopLoader failed!"); Debug.LogWarning("Game loader RvlFlipperFlopLoader failed!");
} }
Debug.Log("Running game loader RvlForkLoader");
game = RvlForkLoader.AddGame(eventCaller); game = RvlForkLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -211,7 +193,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlForkLoader failed!"); Debug.LogWarning("Game loader RvlForkLoader failed!");
} }
Debug.Log("Running game loader NtrGleeClubLoader");
game = NtrGleeClubLoader.AddGame(eventCaller); game = NtrGleeClubLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -222,7 +203,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrGleeClubLoader failed!"); Debug.LogWarning("Game loader NtrGleeClubLoader failed!");
} }
Debug.Log("Running game loader RvlNewKarateLoader");
game = RvlNewKarateLoader.AddGame(eventCaller); game = RvlNewKarateLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -233,7 +213,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlNewKarateLoader failed!"); Debug.LogWarning("Game loader RvlNewKarateLoader failed!");
} }
Debug.Log("Running game loader CtrTeppanLoader");
game = CtrTeppanLoader.AddGame(eventCaller); game = CtrTeppanLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -244,7 +223,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader CtrTeppanLoader failed!"); Debug.LogWarning("Game loader CtrTeppanLoader failed!");
} }
Debug.Log("Running game loader RvlRocketLoader");
game = RvlRocketLoader.AddGame(eventCaller); game = RvlRocketLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -255,7 +233,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlRocketLoader failed!"); Debug.LogWarning("Game loader RvlRocketLoader failed!");
} }
Debug.Log("Running game loader NtrBackbeatLoader");
game = NtrBackbeatLoader.AddGame(eventCaller); game = NtrBackbeatLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -266,7 +243,26 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrBackbeatLoader failed!"); Debug.LogWarning("Game loader NtrBackbeatLoader failed!");
} }
Debug.Log("Running game loader AgbMarcherLoader"); game = AgbMannequinFactoryLoader.AddGame(eventCaller);
if (game != null)
{
eventCaller.minigames.Add(game.name, game);
}
else
{
Debug.LogWarning("Game loader AgbMannequinFactoryLoader failed!");
}
game = RvlManzaiLoader.AddGame(eventCaller);
if (game != null)
{
eventCaller.minigames.Add(game.name, game);
}
else
{
Debug.LogWarning("Game loader RvlManzaiLoader failed!");
}
game = AgbMarcherLoader.AddGame(eventCaller); game = AgbMarcherLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -277,7 +273,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbMarcherLoader failed!"); Debug.LogWarning("Game loader AgbMarcherLoader failed!");
} }
Debug.Log("Running game loader PcoMeatLoader");
game = PcoMeatLoader.AddGame(eventCaller); game = PcoMeatLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -288,7 +283,16 @@ namespace HeavenStudio
Debug.LogWarning("Game loader PcoMeatLoader failed!"); Debug.LogWarning("Game loader PcoMeatLoader failed!");
} }
Debug.Log("Running game loader AgbUpbeatLoader"); game = RvlMonkeyWatchLoader.AddGame(eventCaller);
if (game != null)
{
eventCaller.minigames.Add(game.name, game);
}
else
{
Debug.LogWarning("Game loader RvlMonkeyWatchLoader failed!");
}
game = AgbUpbeatLoader.AddGame(eventCaller); game = AgbUpbeatLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -299,7 +303,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbUpbeatLoader failed!"); Debug.LogWarning("Game loader AgbUpbeatLoader failed!");
} }
Debug.Log("Running game loader ntrMunchyMonkLoader");
game = ntrMunchyMonkLoader.AddGame(eventCaller); game = ntrMunchyMonkLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -310,7 +313,16 @@ namespace HeavenStudio
Debug.LogWarning("Game loader ntrMunchyMonkLoader failed!"); Debug.LogWarning("Game loader ntrMunchyMonkLoader failed!");
} }
Debug.Log("Running game loader NtrOctopusMachineLoader"); game = AgbNightWalkLoader.AddGame(eventCaller);
if (game != null)
{
eventCaller.minigames.Add(game.name, game);
}
else
{
Debug.LogWarning("Game loader AgbNightWalkLoader failed!");
}
game = NtrOctopusMachineLoader.AddGame(eventCaller); game = NtrOctopusMachineLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -321,7 +333,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrOctopusMachineLoader failed!"); Debug.LogWarning("Game loader NtrOctopusMachineLoader failed!");
} }
Debug.Log("Running game loader CtrPillowLoader");
game = CtrPillowLoader.AddGame(eventCaller); game = CtrPillowLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -332,7 +343,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader CtrPillowLoader failed!"); Debug.LogWarning("Game loader CtrPillowLoader failed!");
} }
Debug.Log("Running game loader AgbQuizShowLoader");
game = AgbQuizShowLoader.AddGame(eventCaller); game = AgbQuizShowLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -343,7 +353,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbQuizShowLoader failed!"); Debug.LogWarning("Game loader AgbQuizShowLoader failed!");
} }
Debug.Log("Running game loader NtrPingpongLoader");
game = NtrPingpongLoader.AddGame(eventCaller); game = NtrPingpongLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -354,7 +363,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrPingpongLoader failed!"); Debug.LogWarning("Game loader NtrPingpongLoader failed!");
} }
Debug.Log("Running game loader PcoSomenLoader");
game = PcoSomenLoader.AddGame(eventCaller); game = PcoSomenLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -365,7 +373,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader PcoSomenLoader failed!"); Debug.LogWarning("Game loader PcoSomenLoader failed!");
} }
Debug.Log("Running game loader AgbHairLoader");
game = AgbHairLoader.AddGame(eventCaller); game = AgbHairLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -376,7 +383,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbHairLoader failed!"); Debug.LogWarning("Game loader AgbHairLoader failed!");
} }
Debug.Log("Running game loader RvlRingsideLoader");
game = RvlRingsideLoader.AddGame(eventCaller); game = RvlRingsideLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -387,7 +393,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlRingsideLoader failed!"); Debug.LogWarning("Game loader RvlRingsideLoader failed!");
} }
Debug.Log("Running game loader NtrRockersLoader");
game = NtrRockersLoader.AddGame(eventCaller); game = NtrRockersLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -398,7 +403,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrRockersLoader failed!"); Debug.LogWarning("Game loader NtrRockersLoader failed!");
} }
Debug.Log("Running game loader NtrSamuraiLoader");
game = NtrSamuraiLoader.AddGame(eventCaller); game = NtrSamuraiLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -409,7 +413,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrSamuraiLoader failed!"); Debug.LogWarning("Game loader NtrSamuraiLoader failed!");
} }
Debug.Log("Running game loader RvlSeeSawLoader");
game = RvlSeeSawLoader.AddGame(eventCaller); game = RvlSeeSawLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -420,7 +423,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlSeeSawLoader failed!"); Debug.LogWarning("Game loader RvlSeeSawLoader failed!");
} }
Debug.Log("Running game loader AgbGhostLoader");
game = AgbGhostLoader.AddGame(eventCaller); game = AgbGhostLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -431,7 +433,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbGhostLoader failed!"); Debug.LogWarning("Game loader AgbGhostLoader failed!");
} }
Debug.Log("Running game loader AgbBatterLoader");
game = AgbBatterLoader.AddGame(eventCaller); game = AgbBatterLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -442,7 +443,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbBatterLoader failed!"); Debug.LogWarning("Game loader AgbBatterLoader failed!");
} }
Debug.Log("Running game loader AgbSpaceDanceLoader");
game = AgbSpaceDanceLoader.AddGame(eventCaller); game = AgbSpaceDanceLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -453,7 +453,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbSpaceDanceLoader failed!"); Debug.LogWarning("Game loader AgbSpaceDanceLoader failed!");
} }
Debug.Log("Running game loader NtrSoccerLoader");
game = NtrSoccerLoader.AddGame(eventCaller); game = NtrSoccerLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -464,7 +463,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrSoccerLoader failed!"); Debug.LogWarning("Game loader NtrSoccerLoader failed!");
} }
Debug.Log("Running game loader NtrSplashdownLoader");
game = NtrSplashdownLoader.AddGame(eventCaller); game = NtrSplashdownLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -475,7 +473,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrSplashdownLoader failed!"); Debug.LogWarning("Game loader NtrSplashdownLoader failed!");
} }
Debug.Log("Running game loader RvlTambourineLoader");
game = RvlTambourineLoader.AddGame(eventCaller); game = RvlTambourineLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -486,7 +483,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlTambourineLoader failed!"); Debug.LogWarning("Game loader RvlTambourineLoader failed!");
} }
Debug.Log("Running game loader AgbTapLoader");
game = AgbTapLoader.AddGame(eventCaller); game = AgbTapLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -497,7 +493,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbTapLoader failed!"); Debug.LogWarning("Game loader AgbTapLoader failed!");
} }
Debug.Log("Running game loader RvlTapTroupeLoader");
game = RvlTapTroupeLoader.AddGame(eventCaller); game = RvlTapTroupeLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -508,7 +503,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlTapTroupeLoader failed!"); Debug.LogWarning("Game loader RvlTapTroupeLoader failed!");
} }
Debug.Log("Running game loader NtrDazzlesLoader");
game = NtrDazzlesLoader.AddGame(eventCaller); game = NtrDazzlesLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -519,7 +513,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrDazzlesLoader failed!"); Debug.LogWarning("Game loader NtrDazzlesLoader failed!");
} }
Debug.Log("Running game loader AgbTossBoysLoader");
game = AgbTossBoysLoader.AddGame(eventCaller); game = AgbTossBoysLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -530,7 +523,16 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbTossBoysLoader failed!"); Debug.LogWarning("Game loader AgbTossBoysLoader failed!");
} }
Debug.Log("Running game loader AgbTramLoader"); game = TotemClimbLoader.AddGame(eventCaller);
if (game != null)
{
eventCaller.minigames.Add(game.name, game);
}
else
{
Debug.LogWarning("Game loader TotemClimbLoader failed!");
}
game = AgbTramLoader.AddGame(eventCaller); game = AgbTramLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -541,7 +543,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbTramLoader failed!"); Debug.LogWarning("Game loader AgbTramLoader failed!");
} }
Debug.Log("Running game loader MobTrickLoader");
game = MobTrickLoader.AddGame(eventCaller); game = MobTrickLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -552,7 +553,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader MobTrickLoader failed!"); Debug.LogWarning("Game loader MobTrickLoader failed!");
} }
Debug.Log("Running game loader NtrTunnelLoader");
game = NtrTunnelLoader.AddGame(eventCaller); game = NtrTunnelLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -563,7 +563,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader NtrTunnelLoader failed!"); Debug.LogWarning("Game loader NtrTunnelLoader failed!");
} }
Debug.Log("Running game loader AgbWaltzLoader");
game = AgbWaltzLoader.AddGame(eventCaller); game = AgbWaltzLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {
@ -574,7 +573,6 @@ namespace HeavenStudio
Debug.LogWarning("Game loader AgbWaltzLoader failed!"); Debug.LogWarning("Game loader AgbWaltzLoader failed!");
} }
Debug.Log("Running game loader RvlWorkingDoughLoader");
game = RvlWorkingDoughLoader.AddGame(eventCaller); game = RvlWorkingDoughLoader.AddGame(eventCaller);
if (game != null) if (game != null)
{ {