diff --git a/Assets/Resources/Prefabs/Editor/SettingsMenu/ControllerSetup.prefab b/Assets/Resources/Prefabs/Editor/SettingsMenu/ControllerSetup.prefab index 18b9312ce..6ca104222 100644 --- a/Assets/Resources/Prefabs/Editor/SettingsMenu/ControllerSetup.prefab +++ b/Assets/Resources/Prefabs/Editor/SettingsMenu/ControllerSetup.prefab @@ -4143,14 +4143,14 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0, g: 1, b: 1, a: 1} + 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_Sprite: {fileID: 21300000, guid: 39656548c069d5541a9d9d1a808a76e4, type: 3} + m_Sprite: {fileID: 21300000, guid: c158bbf3be7618c468e696e8c2c54e95, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -5495,7 +5495,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &3918594455165826550 RectTransform: m_ObjectHideFlags: 0 @@ -5513,9 +5513,9 @@ RectTransform: m_Father: {fileID: 3918594455809915007} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 500, y: -25} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 206.38, y: 30} m_Pivot: {x: 0, y: 0.5} --- !u!222 &3918594455165826539 @@ -6947,7 +6947,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: ba34210de39bafc4d9bc0bb9163d83c7, type: 3} + m_Sprite: {fileID: 21300000, guid: 5562630d3cb1e1b439e6f0d06c45b14a, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -8052,8 +8052,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 861.5, y: 0} - m_SizeDelta: {x: 1683, y: 0} + m_AnchoredPosition: {x: 951.5, y: 0} + m_SizeDelta: {x: 1863, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3918594456218978261 CanvasRenderer: diff --git a/Assets/Scripts/InputSystem/ControllerTypes/InputJoyshock.cs b/Assets/Scripts/InputSystem/ControllerTypes/InputJoyshock.cs index 946480456..6753aaf64 100644 --- a/Assets/Scripts/InputSystem/ControllerTypes/InputJoyshock.cs +++ b/Assets/Scripts/InputSystem/ControllerTypes/InputJoyshock.cs @@ -635,7 +635,7 @@ namespace HeavenStudio.InputSystem return false; } - public override int GetLastButtonDown() + public override int GetLastButtonDown(bool strict = false) { for (int i = 0; i < buttonStates.Length; i++) { diff --git a/Assets/Scripts/InputSystem/ControllerTypes/InputKeyboard.cs b/Assets/Scripts/InputSystem/ControllerTypes/InputKeyboard.cs index 9521d4975..6cab9c642 100644 --- a/Assets/Scripts/InputSystem/ControllerTypes/InputKeyboard.cs +++ b/Assets/Scripts/InputSystem/ControllerTypes/InputKeyboard.cs @@ -136,7 +136,7 @@ namespace HeavenStudio.InputSystem return false; } - public override int GetLastButtonDown() + public override int GetLastButtonDown(bool strict = false) { if (Input.anyKeyDown) { diff --git a/Assets/Scripts/InputSystem/ControllerTypes/InputMouse.cs b/Assets/Scripts/InputSystem/ControllerTypes/InputMouse.cs index a4b34d672..df4e3bb24 100644 --- a/Assets/Scripts/InputSystem/ControllerTypes/InputMouse.cs +++ b/Assets/Scripts/InputSystem/ControllerTypes/InputMouse.cs @@ -256,12 +256,13 @@ namespace HeavenStudio.InputSystem return action is 0; } - public override int GetLastButtonDown() + public override int GetLastButtonDown(bool strict = false) { if (Input.anyKeyDown) { for (KeyCode i = keyCodes[1]; i <= KeyCode.Mouse6; i++) { + if (strict && i < KeyCode.Mouse0) continue; if (Input.GetKeyDown(i)) return (int)i; } diff --git a/Assets/Scripts/InputSystem/InputController.cs b/Assets/Scripts/InputSystem/InputController.cs index 01a7dcf5a..a9ea3ebb3 100644 --- a/Assets/Scripts/InputSystem/InputController.cs +++ b/Assets/Scripts/InputSystem/InputController.cs @@ -225,7 +225,7 @@ namespace HeavenStudio.InputSystem /// Gets the last pressed physical button /// /// - public abstract int GetLastButtonDown(); + public abstract int GetLastButtonDown(bool strict = false); /// /// Gets the last pressed virtual action diff --git a/Assets/Scripts/TitleManager.cs b/Assets/Scripts/TitleManager.cs index 319f143b8..761230c37 100644 --- a/Assets/Scripts/TitleManager.cs +++ b/Assets/Scripts/TitleManager.cs @@ -100,20 +100,42 @@ namespace HeavenStudio songPos = time + offset; songPosBeat = SecsToBeats(songPos); - if (Input.anyKeyDown) + + var controllers = PlayerInput.GetInputControllers(); + foreach (var newController in controllers) { - if (logoRevealed && !menuMode) + if (newController.GetLastButtonDown(true) > 0) { - menuMode = true; - menuAnim.Play("Revealed", 0, 0); - pressAnyKeyAnim.Play("PressKeyFadeOut", 0, 0); + if (logoRevealed && !menuMode) + { + menuMode = true; + menuAnim.Play("Revealed", 0, 0); + pressAnyKeyAnim.Play("PressKeyFadeOut", 0, 0); + SoundByte.PlayOneShot("ui/UIEnter"); + + Debug.Log("Assigning controller: " + newController.GetDeviceName()); + + var lastController = PlayerInput.GetInputController(1); + if (lastController != newController) + { + lastController.SetPlayer(null); + newController.SetPlayer(1); + + if ((lastController as InputSystem.InputJoyshock) != null) + { + (lastController as InputSystem.InputJoyshock)?.UnAssignOtherHalf(); + } + + if ((newController as InputSystem.InputJoyshock) != null) + { + newController.OnSelected(); + (newController as InputSystem.InputJoyshock)?.UnAssignOtherHalf(); + } + } + } } - // else if (snsRevealed) - // { - // snsRevealed = false; - // snsPanel.SetActive(false); - // } } + if (loops == 0 && !logoRevealed) { float normalizedBeat = GetPositionFromBeat(4, 1); diff --git a/Assets/Scripts/UI/SettingsDialog/Tabs/ControllerSettings.cs b/Assets/Scripts/UI/SettingsDialog/Tabs/ControllerSettings.cs index 896d94747..f111446a2 100644 --- a/Assets/Scripts/UI/SettingsDialog/Tabs/ControllerSettings.cs +++ b/Assets/Scripts/UI/SettingsDialog/Tabs/ControllerSettings.cs @@ -60,7 +60,7 @@ namespace HeavenStudio.Editor if (!initController.GetCurrentStyleSupported()) { PlayerInput.CurrentControlStyle = initController.GetDefaultStyle(); - stylesDropdown.value = (int)PlayerInput.CurrentControlStyle; + stylesDropdown.SetValueWithoutNotify((int)PlayerInput.CurrentControlStyle); } UpdateControlStyleMapping(); @@ -103,13 +103,13 @@ namespace HeavenStudio.Editor var controllers = PlayerInput.GetInputControllers(); foreach (var newController in controllers) { - if (newController.GetLastButtonDown() > 0) + if (newController.GetLastButtonDown(true) > 0) { - isAutoSearching = false; autoSearchLabel.SetActive(false); AssignController(newController, currentController); - controllersDropdown.value = PlayerInput.GetInputControllerId(1); + controllersDropdown.SetValueWithoutNotify(PlayerInput.GetInputControllerId(1)); + isAutoSearching = false; } } } @@ -209,7 +209,7 @@ namespace HeavenStudio.Editor if (!newController.GetCurrentStyleSupported()) { PlayerInput.CurrentControlStyle = newController.GetDefaultStyle(); - stylesDropdown.value = (int)PlayerInput.CurrentControlStyle; + stylesDropdown.SetValueWithoutNotify((int)PlayerInput.CurrentControlStyle); } UpdateControlStyleMapping(); @@ -346,7 +346,7 @@ namespace HeavenStudio.Editor stylesDropdown.ClearOptions(); stylesDropdown.AddOptions(enumNames); - stylesDropdown.value = (int)PlayerInput.CurrentControlStyle; + stylesDropdown.SetValueWithoutNotify((int)PlayerInput.CurrentControlStyle); } public void PopulateControllersDropdown() @@ -361,7 +361,7 @@ namespace HeavenStudio.Editor } controllersDropdown.ClearOptions(); controllersDropdown.AddOptions(dropDownData); - controllersDropdown.value = PlayerInput.GetInputControllerId(1); + controllersDropdown.SetValueWithoutNotify(PlayerInput.GetInputControllerId(1)); } public void ChangeControlStyle()