can pass title screen with any controller

fix issues with controller auto-search
This commit is contained in:
minenice55 2023-12-24 20:53:54 -05:00
parent 43f16fb256
commit 92e0a03a12
7 changed files with 53 additions and 30 deletions

View file

@ -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:

View file

@ -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++)
{

View file

@ -136,7 +136,7 @@ namespace HeavenStudio.InputSystem
return false;
}
public override int GetLastButtonDown()
public override int GetLastButtonDown(bool strict = false)
{
if (Input.anyKeyDown)
{

View file

@ -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;
}

View file

@ -225,7 +225,7 @@ namespace HeavenStudio.InputSystem
/// Gets the last pressed physical button
/// </summary>
/// <returns></returns>
public abstract int GetLastButtonDown();
public abstract int GetLastButtonDown(bool strict = false);
/// <summary>
/// Gets the last pressed virtual action

View file

@ -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);

View file

@ -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()