From 92f00e5b044a12b6d29b4172ff8e1d961b5f3ad7 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Sat, 6 Apr 2024 23:46:40 -0400 Subject: [PATCH] 16th note swing more game fixes make pitch change resync optional in the API --- Assets/Scenes/Editor.unity | 574 +++++++++++++++++- Assets/Scripts/Conductor.cs | 72 ++- Assets/Scripts/GameManager.cs | 8 +- Assets/Scripts/Games/CropStomp/Veggie.cs | 12 +- Assets/Scripts/Games/DoubleDate/Basketball.cs | 8 +- Assets/Scripts/Games/DoubleDate/DoubleDate.cs | 17 +- Assets/Scripts/Games/DoubleDate/Football.cs | 10 +- Assets/Scripts/Games/DoubleDate/SoccerBall.cs | 8 +- Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs | 26 +- Assets/Scripts/Games/PlayerActionEvent.cs | 9 +- Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs | 4 +- .../Games/SneakySpirits/SneakySpirits.cs | 2 +- Assets/Scripts/Games/SpaceSoccer/Ball.cs | 4 +- Assets/Scripts/LevelEditor/Editor.cs | 5 + .../SpecialTmeline/SpecialTimeline.cs | 1 + .../Timeline/SpecialTmeline/TempoDialog.cs | 11 + .../TimelineObjs/TempoTimelineObj.cs | 6 + .../Scripts/LevelEditor/Timeline/Timeline.cs | 8 +- Assets/Scripts/Minigames.cs | 1 + 19 files changed, 686 insertions(+), 100 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 5fe0e97e5..91f864705 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -414,9 +414,9 @@ RectTransform: m_Father: {fileID: 574002313} 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: -21} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 32, y: 32} m_Pivot: {x: 0, y: 0.5} --- !u!114 &9435782 @@ -3846,9 +3846,9 @@ RectTransform: m_Father: {fileID: 539838476} 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: 32, y: -21} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 32, y: 32} m_Pivot: {x: 1, y: 0.5} --- !u!114 &121871281 @@ -4070,9 +4070,9 @@ RectTransform: m_Father: {fileID: 539838476} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 72, y: -21} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 32, y: 32} m_Pivot: {x: 1, y: 0.5} --- !u!114 &129013734 @@ -4170,6 +4170,71 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: TooltipText: Metronome [M] +--- !u!1 &143407410 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 143407411} + - component: {fileID: 143407412} + m_Layer: 5 + m_Name: SwingDivision + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &143407411 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 143407410} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 738950517} + - {fileID: 1300133179} + m_Father: {fileID: 980212093} + 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: 809.5935, y: -113} + m_SizeDelta: {x: 1595.187, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &143407412 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 143407410} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 16 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 3 + m_Spacing: 42 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &151246936 GameObject: m_ObjectHideFlags: 0 @@ -4206,9 +4271,9 @@ RectTransform: m_Father: {fileID: 539838476} 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: 112, y: -21} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 32, y: 32} m_Pivot: {x: 1, y: 0.5} --- !u!114 &151246938 @@ -10303,6 +10368,82 @@ MonoBehaviour: volumeTXT: {fileID: 746356640} volumeLine: {fileID: 1126835990} volumeDialog: {fileID: 864592614} +--- !u!1 &406795636 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 406795637} + - component: {fileID: 406795639} + - component: {fileID: 406795638} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &406795637 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 406795636} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 913463862} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &406795638 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 406795636} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &406795639 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 406795636} + m_CullTransparentMesh: 1 --- !u!1 &407289014 GameObject: m_ObjectHideFlags: 0 @@ -11243,7 +11384,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 1236, y: -25} + m_AnchoredPosition: {x: 1182.0001, y: -25} m_SizeDelta: {x: 360, y: 40} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &456251927 @@ -20311,8 +20452,8 @@ RectTransform: m_Father: {fileID: 2062943138} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.01, y: 0} - m_AnchorMax: {x: 0.01, y: 1} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 20, y: 0} m_Pivot: {x: 0.5, y: 0.5} @@ -20354,6 +20495,143 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 738634698} m_CullTransparentMesh: 1 +--- !u!1 &738950516 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 738950517} + - component: {fileID: 738950519} + - component: {fileID: 738950518} + 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 &738950517 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 738950516} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 143407411} + 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: 5} + m_SizeDelta: {x: 249.18692, y: 50} + m_Pivot: {x: 0, y: 1} +--- !u!114 &738950518 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 738950516} + 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: 16th Note Swing? + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 4810e200fa0cb24438bac52343d7674b, type: 2} + m_sharedMaterial: {fileID: 8580487687356851718, guid: 4810e200fa0cb24438bac52343d7674b, 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: 26 + m_fontSizeBase: 26 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: -97.7 + 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: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &738950519 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 738950516} + m_CullTransparentMesh: 1 --- !u!1 &743531235 GameObject: m_ObjectHideFlags: 0 @@ -22205,6 +22483,7 @@ MonoBehaviour: tempoInput: {fileID: 467708510} swingInput: {fileID: 704808992} swingSlider: {fileID: 907963053} + swingDivisionToggle: {fileID: 1950592168} --- !u!224 &788904140 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 3263607626584268237, guid: 5edde5c03f192d242bc2fa6277914e6e, type: 3} @@ -25179,6 +25458,83 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &913463861 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 913463862} + - component: {fileID: 913463864} + - component: {fileID: 913463863} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &913463862 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913463861} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 406795637} + m_Father: {fileID: 1950592167} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &913463863 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913463861} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &913463864 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913463861} + m_CullTransparentMesh: 1 --- !u!1 &918768360 GameObject: m_ObjectHideFlags: 0 @@ -27161,6 +27517,7 @@ RectTransform: m_Children: - {fileID: 278632244} - {fileID: 1922212788} + - {fileID: 143407411} m_Father: {fileID: 788904137} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -31099,7 +31456,7 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0.01, y: 1} + m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 10, y: 0} m_Pivot: {x: 0.5, y: 0.5} @@ -31221,7 +31578,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 136.20409} + m_AnchoredPosition: {x: 0, y: 136.2041} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &1154875945 @@ -34607,6 +34964,79 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: TooltipText: Starting Tempo (BPM) +--- !u!1 &1300133178 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1300133179} + - component: {fileID: 1300133181} + - component: {fileID: 1300133180} + m_Layer: 5 + m_Name: Holder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1300133179 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1300133178} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 1950592167} + m_Father: {fileID: 143407411} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 935.187, y: -20} + m_SizeDelta: {x: 1288.0001, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1300133180 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1300133178} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 3 + m_Spacing: 0 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!222 &1300133181 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1300133178} + m_CullTransparentMesh: 1 --- !u!1 &1310571273 GameObject: m_ObjectHideFlags: 0 @@ -35551,9 +35981,9 @@ RectTransform: m_Father: {fileID: 574002313} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 40, y: -21} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 32, y: 32} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1345846031 @@ -44049,9 +44479,9 @@ RectTransform: m_Father: {fileID: 574002313} 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: 80, y: -21} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 32, y: 32} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1783491359 @@ -47988,6 +48418,104 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1950471846} m_CullTransparentMesh: 1 +--- !u!1 &1950592166 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1950592167} + - component: {fileID: 1950592168} + m_Layer: 5 + m_Name: Toggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1950592167 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950592166} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 913463862} + m_Father: {fileID: 1300133179} + 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: 16, y: -20} + m_SizeDelta: {x: 32, y: 32} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1950592168 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950592166} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 913463863} + toggleTransition: 1 + graphic: {fileID: 406795638} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 788904139} + m_TargetAssemblyTypeName: TempoDialog, Assembly-CSharp + m_MethodName: SwingDivisionToggle + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_IsOn: 0 --- !u!1 &1951710748 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs index e15d44b28..0546fc4fc 100644 --- a/Assets/Scripts/Conductor.cs +++ b/Assets/Scripts/Conductor.cs @@ -96,7 +96,9 @@ namespace HeavenStudio private float timelineVolume = 1f; private float minigameVolume = 1f; - public void SetTimelinePitch(float pitch) + const bool doPitchResync = true; + + public void SetTimelinePitch(float pitch, bool resync = false) { if (isPaused || deferTimeKeeping) return; if (pitch != 0 && pitch != timelinePitch) @@ -109,7 +111,7 @@ namespace HeavenStudio if (musicSource != null && musicSource.clip != null) { musicSource.pitch = SongPitch; - if (isPlaying) + if (doPitchResync && isPlaying && resync && !deferTimeKeeping) { time = MapTimeToPitchChanges(absTime + absTimeAdjust); songPos = startPos + time; @@ -119,7 +121,7 @@ namespace HeavenStudio } } - public void SetMinigamePitch(float pitch) + public void SetMinigamePitch(float pitch, bool resync = false) { if (isPaused || deferTimeKeeping || !isPlaying) return; if (pitch != 0 && pitch != minigamePitch) @@ -132,7 +134,7 @@ namespace HeavenStudio if (musicSource != null && musicSource.clip != null) { musicSource.pitch = SongPitch; - if (isPlaying) + if (doPitchResync && isPlaying && resync && !deferTimeKeeping) { time = MapTimeToPitchChanges(absTime + absTimeAdjust); songPos = startPos + time; @@ -162,8 +164,6 @@ namespace HeavenStudio double offset = chart.data.offset; startPos = GetSongPosFromBeat(beat); - double dspTime = AudioSettings.dspTime; - time = startPos; firstBeatOffset = offset; @@ -264,8 +264,8 @@ namespace HeavenStudio if (!isPlaying) return; isPlaying = false; isPaused = true; - deferTimeKeeping = false; SetMinigamePitch(1f); + deferTimeKeeping = false; musicSource.Stop(); Util.SoundByte.PauseOneShots(); @@ -286,8 +286,8 @@ namespace HeavenStudio isPlaying = false; isPaused = false; - deferTimeKeeping = false; SetMinigamePitch(1f); + deferTimeKeeping = false; musicSource.Stop(); } @@ -447,7 +447,7 @@ namespace HeavenStudio // if (metronome) metronomeSound = Util.SoundByte.PlayOneShot("metronome", Math.Ceiling(startBeat) + _metronomeTally); if (metronome) { - metronomeSound = Util.MultiSound.Play(new List { + metronomeSound = Util.MultiSound.Play(new List { new Util.MultiSound.Sound("metronome", Math.Ceiling(startBeat) + _metronomeTally), new Util.MultiSound.Sound("metronome", Math.Ceiling(startBeat) + _metronomeTally + 0.5, 1.5f, 0.5f) }, false, true); @@ -507,44 +507,58 @@ namespace HeavenStudio return gameManager.Beatmap.TempoChanges; } - public float GetBpmAtBeat(double beat, out float swingRatio) + public float GetBpmAtBeat(double beat, out float swingRatio, out float swingDivision) { swingRatio = 0.5f; + swingDivision = 1f; var chart = gameManager.Beatmap; if (chart.TempoChanges.Count == 0) return 120f; - RiqEntity tempoChange = chart.TempoChanges.FindLast(t => t.beat <= beat); - tempoChange ??= chart.TempoChanges[0]; - swingRatio = tempoChange["swing"] + 0.5f; - return tempoChange["tempo"]; + RiqEntity tempo = null; + foreach (RiqEntity t in chart.TempoChanges) + { + if (t.beat > beat) + { + break; + } + tempo = t; + } + tempo ??= chart.TempoChanges[0]; + swingRatio = tempo["swing"] + 0.5f; + swingDivision = tempo["swingDivision"] ?? 1f; + return tempo["tempo"]; } public float GetBpmAtBeat(double beat) { - return GetBpmAtBeat(beat, out _); + return GetBpmAtBeat(beat, out _, out _); } - public float GetSwingRatioAtBeat(double beat) + public float GetSwingRatioAtBeat(double beat, out float swingDivision) { float swingRatio; - GetBpmAtBeat(beat, out swingRatio); + GetBpmAtBeat(beat, out swingRatio, out swingDivision); return swingRatio; } public double GetSwungBeat(double beat) { - return Math.Floor(beat) + GetSwingOffset(beat, GetSwingRatioAtBeat(beat)); + float ratio = GetSwingRatioAtBeat(beat, out float division); + int floor = (int)Math.Floor(beat / division); + + return (floor * division) + GetSwingOffset(beat, ratio, division); } - public double GetSwungBeat(double beat, float ratio) + public double GetSwungBeat(double beat, float ratio, float division) { - return Math.Floor(beat) + GetSwingOffset(beat, ratio); + int floor = (int)Math.Floor(beat / division); + return (floor * division) + GetSwingOffset(beat, ratio, division); } - public double GetSwingOffset(double beatFrac, float ratio) + public double GetSwingOffset(double beatFrac, float ratio, float division) { - beatFrac %= 1; + beatFrac %= division; if (beatFrac <= ratio) { return 0.5 / ratio * beatFrac; @@ -557,17 +571,21 @@ namespace HeavenStudio public double GetUnSwungBeat(double beat) { - return Math.Floor(beat) + GetUnSwingOffset(beat, GetSwingRatioAtBeat(beat)); + float ratio = GetSwingRatioAtBeat(beat, out float division); + int floor = (int)Math.Floor(beat / division); + + return (floor * division) + GetUnSwingOffset(beat, ratio, division); } - public double GetUnSwungBeat(double beat, float ratio) + public double GetUnSwungBeat(double beat, float ratio, float division) { - return Math.Floor(beat) + GetUnSwingOffset(beat, ratio); + int floor = (int)Math.Floor(beat / division); + return (floor * division) + GetUnSwingOffset(beat, ratio, division); } - public double GetUnSwingOffset(double beatFrac, float ratio) + public double GetUnSwingOffset(double beatFrac, float ratio, float division) { - beatFrac %= 1; + beatFrac %= division; if (beatFrac <= ratio) { return 2 * ratio * beatFrac; diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 1240f041a..79ca0a63a 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -239,8 +239,12 @@ namespace HeavenStudio AudioLoadDone = false; Beatmap = new("1", "HeavenStudio"); Beatmap.data.properties = new(Minigames.propertiesModel); - Beatmap.AddNewTempoChange(0, 120f); + + RiqEntity t = Beatmap.AddNewTempoChange(0, 120f); + t.CreateProperty("swingDivision", 1f); + Beatmap.AddNewVolumeChange(0, 100f); + Beatmap.data.offset = 0f; conductor.musicSource.clip = null; RiqFileHandler.WriteRiq(Beatmap); @@ -798,7 +802,7 @@ namespace HeavenStudio } conductor.Stop(beat); - SetCurrentEventToClosest(beat); + conductor.SetBeat(beat); KillAllSounds(); if (restart) diff --git a/Assets/Scripts/Games/CropStomp/Veggie.cs b/Assets/Scripts/Games/CropStomp/Veggie.cs index ee3b2d954..ea8a4747e 100644 --- a/Assets/Scripts/Games/CropStomp/Veggie.cs +++ b/Assets/Scripts/Games/CropStomp/Veggie.cs @@ -131,7 +131,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp // var key2Pos = key2.Position; // key2.Position = new Vector3(key2Pos.x, veggieTrans.position.y + 2f, key2Pos.z); - pickedBeat = Conductor.instance.songPositionInBeatsAsDouble; + pickedBeat = Conductor.instance.unswungSongPositionInBeatsAsDouble; SoundByte.PlayOneShot("miss"); @@ -222,11 +222,11 @@ namespace HeavenStudio.Games.Scripts_CropStomp veggieState = 1; game.ScheduleInput(targetBeat, isMole ? 0.5f : 1f, CropStomp.InputAction_FlickRelease, PickJust, PickMiss, Out); - targetBeat = targetBeat + (isMole ? 0.5f : 1f); + targetBeat = cond.GetUnSwungBeat(targetBeat + (isMole ? 0.5f : 1f)); - stompedBeat = cond.songPositionInBeatsAsDouble; + stompedBeat = cond.unswungSongPositionInBeatsAsDouble; - landBeat = targetBeat + (float)cond.SecsToBeats(Minigame.NgLateTime() - 1, cond.GetBpmAtBeat(targetBeat)); + landBeat = targetBeat + cond.SecsToBeats(Minigame.NgLateTime() - 1, cond.GetBpmAtBeat(targetBeat)); if (autoTriggered) { @@ -261,12 +261,12 @@ namespace HeavenStudio.Games.Scripts_CropStomp game.bodyAnim.DoScaledAnimationAsync("Pick", 0.5f); game.isFlicking = true; } - + var key1 = game.pickCurve.KeyPoints[0]; var keyPos = key1.Position; key1.Position = new Vector3(keyPos.x, veggieTrans.position.y, keyPos.z); - pickedBeat = Conductor.instance.songPositionInBeatsAsDouble; + pickedBeat = Conductor.instance.unswungSongPositionInBeatsAsDouble; if (!isMole) { diff --git a/Assets/Scripts/Games/DoubleDate/Basketball.cs b/Assets/Scripts/Games/DoubleDate/Basketball.cs index 33b28abbd..9c3cb875e 100644 --- a/Assets/Scripts/Games/DoubleDate/Basketball.cs +++ b/Assets/Scripts/Games/DoubleDate/Basketball.cs @@ -25,7 +25,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Update() { - double beat = conductor.songPositionInBeatsAsDouble; + double beat = conductor.unswungSongPositionInBeatsAsDouble; double height = 0f; if (pathStartBeat > double.MinValue) { @@ -44,7 +44,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate game.ScheduleInput(beat, 1f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty); path = game.GetPath("BasketBallIn"); UpdateLastRealPos(); - pathStartBeat = beat - 1f; + pathStartBeat = Conductor.instance.GetUnSwungBeat(beat - 1f); Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat); transform.position = pos; @@ -65,7 +65,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate }), }); UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeatsAsDouble; + pathStartBeat = conductor.unswungSongPositionInBeatsAsDouble; if (state >= 1f || state <= -1f) { path = game.GetPath("BasketBallNg" + (state > 0 ? "Late" : "Early")); @@ -80,7 +80,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Hit() { UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeatsAsDouble; + pathStartBeat = conductor.unswungSongPositionInBeatsAsDouble; path = game.GetPath("BasketBallJust"); game.Kick(true, false, true, _jump); SoundByte.PlayOneShotGame("doubleDate/kick"); diff --git a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs index 6390c4b6f..7ea8d4257 100644 --- a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs +++ b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs @@ -262,8 +262,7 @@ namespace HeavenStudio.Games void Update() { - var cond = Conductor.instance; - if (cond.isPlaying && !cond.isPaused) + if (conductor.isPlaying && !conductor.isPaused) { if (queuedBalls.Count != 0) { @@ -287,7 +286,7 @@ namespace HeavenStudio.Games } else { - if ((!cond.isPaused) && queuedBalls.Count != 0) + if ((!conductor.isPaused) && queuedBalls.Count != 0) { queuedBalls.Clear(); } @@ -353,7 +352,7 @@ namespace HeavenStudio.Games { boyAnim.DoScaledAnimationAsync(_isStaring ? "IdleBop2" : "IdleBop", _animSpeed); } - if (Conductor.instance.songPositionInBeatsAsDouble > lastGirlGacha) + if (conductor.songPositionInBeatsAsDouble > lastGirlGacha) girlAnim.DoScaledAnimationAsync("GirlBop", _animSpeed); weasels.Bop(); } @@ -366,7 +365,7 @@ namespace HeavenStudio.Games if (jump) { weasels.Jump(); - lastGirlGacha = Conductor.instance.songPositionInBeatsAsDouble + 0.5f; + lastGirlGacha = conductor.songPositionInBeatsAsDouble + 0.5f; girlAnim.DoScaledAnimationAsync("GirlLookUp", _animSpeed); } else if (weaselsHappy) weasels.Happy(); @@ -374,7 +373,7 @@ namespace HeavenStudio.Games { BeatAction.New(instance, new List() { - new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 1f, delegate + new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 1f, delegate { leaves.Play(); treeAnim.DoScaledAnimationAsync("TreeRustle", _animSpeed); @@ -471,11 +470,11 @@ namespace HeavenStudio.Games public void MissKick(double beat, bool hit = false) { - lastGirlGacha = Conductor.instance.songPositionInBeatsAsDouble + 1.5f; + lastGirlGacha = conductor.songPositionInBeatsAsDouble + 1.5f; girlAnim.DoScaledAnimationAsync("GirlSad", _animSpeed); if (hit) { - lastHitWeasel = Conductor.instance.songPositionInBeatsAsDouble; + lastHitWeasel = conductor.songPositionInBeatsAsDouble; BeatAction.New(this, new List() { new BeatAction.Action(beat - (0.25f/3f), delegate { weasels.Hit(beat); }), @@ -483,7 +482,7 @@ namespace HeavenStudio.Games } else { - lastHitWeasel = Conductor.instance.songPositionInBeatsAsDouble; + lastHitWeasel = conductor.songPositionInBeatsAsDouble; BeatAction.New(this, new List() { new BeatAction.Action(beat + 0.25, delegate { weasels.Hide(beat + 0.25f); }), diff --git a/Assets/Scripts/Games/DoubleDate/Football.cs b/Assets/Scripts/Games/DoubleDate/Football.cs index b0f025e07..63a353212 100644 --- a/Assets/Scripts/Games/DoubleDate/Football.cs +++ b/Assets/Scripts/Games/DoubleDate/Football.cs @@ -25,7 +25,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Update() { - double beat = conductor.songPositionInBeatsAsDouble; + double beat = conductor.unswungSongPositionInBeatsAsDouble; double height = 0f; if (pathStartBeat > double.MinValue) { @@ -44,7 +44,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate game.ScheduleInput(beat, 1.5f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty); path = game.GetPath("FootBallInNoHit"); // there's a second path for footballs that hit the weasels, use that if the weasels haven't been hit recently UpdateLastRealPos(); - pathStartBeat = beat - 1f; + pathStartBeat = Conductor.instance.GetUnSwungBeat(beat - 1f); Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat); transform.position = pos; @@ -60,7 +60,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate if (state >= 1f || state <= -1f) { UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeatsAsDouble; + pathStartBeat = conductor.unswungSongPositionInBeatsAsDouble; path = game.GetPath("FootBallNg" + (state > 0 ? "Late" : "Early")); SoundByte.PlayOneShot("miss"); game.Kick(false); @@ -84,7 +84,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate transform.localScale *= 0.25f; path = game.GetPath("FootBallFall"); UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeatsAsDouble + 1f; + pathStartBeat = conductor.unswungSongPositionInBeatsAsDouble + 1f; }), new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 12f, delegate { @@ -96,7 +96,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Hit() { UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeatsAsDouble; + pathStartBeat = conductor.unswungSongPositionInBeatsAsDouble; path = game.GetPath("FootBallJust"); game.Kick(true, true, jump: _jump); SoundByte.PlayOneShotGame("doubleDate/footballKick"); diff --git a/Assets/Scripts/Games/DoubleDate/SoccerBall.cs b/Assets/Scripts/Games/DoubleDate/SoccerBall.cs index a84cacfc1..18ad157a2 100644 --- a/Assets/Scripts/Games/DoubleDate/SoccerBall.cs +++ b/Assets/Scripts/Games/DoubleDate/SoccerBall.cs @@ -25,7 +25,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Update() { - double beat = conductor.songPositionInBeatsAsDouble; + double beat = conductor.unswungSongPositionInBeatsAsDouble; double height = 0f; if (pathStartBeat > double.MinValue) { @@ -44,7 +44,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate game.ScheduleInput(beat, 1f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty); path = game.GetPath("SoccerIn"); UpdateLastRealPos(); - pathStartBeat = beat - 1f; + pathStartBeat = Conductor.instance.GetUnSwungBeat(beat - 1f); Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat); transform.position = pos; @@ -65,7 +65,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate }), }); UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeatsAsDouble; + pathStartBeat = conductor.unswungSongPositionInBeatsAsDouble; if (state >= 1f || state <= -1f) { path = game.GetPath("SoccerNg" + (state > 0 ? "Late" : "Early")); @@ -80,7 +80,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Hit() { UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeatsAsDouble; + pathStartBeat = conductor.unswungSongPositionInBeatsAsDouble; path = game.GetPath("SoccerJust"); game.Kick(true, false, true, _jump); SoundByte.PlayOneShotGame("doubleDate/kick"); diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index 0e18ffac5..f2ed813a8 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -168,6 +168,8 @@ namespace HeavenStudio.Games public int stepIterate = 0; private static double startSteppingBeat = double.MaxValue; private static double startBlippingBeat = double.MaxValue; + private string currentMetronomeDir = "Right"; + private static double metronomeBeat = double.MaxValue; private bool stopStepping; public bool stopBlipping; @@ -241,6 +243,16 @@ namespace HeavenStudio.Games man.RecursiveBlipping(startBlippingBeat); startBlippingBeat = double.MaxValue; } + + if (songPos > metronomeBeat + 1) + { + metronomeAnim.Play("MetronomeGo" + currentMetronomeDir, -1, 1); + metronomeAnim.speed = 0; + } + else if (songPos >= metronomeBeat) + { + metronomeAnim.DoScaledAnimation("MetronomeGo" + currentMetronomeDir, metronomeBeat, 1, ignoreSwing: false); + } } } @@ -291,9 +303,9 @@ namespace HeavenStudio.Games stopStepping = false; return; } - string dir = (stepIterate % 2 == 1) ? "Right" : "Left"; - metronomeAnim.DoScaledAnimationAsync("MetronomeGo" + dir, 0.5f); - SoundByte.PlayOneShotGame("mrUpbeat/metronome" + dir); + currentMetronomeDir = (stepIterate % 2 == 1) ? "Right" : "Left"; + SoundByte.PlayOneShotGame($"mrUpbeat/metronome{currentMetronomeDir}"); + metronomeBeat = beat; ScheduleStep(beat); BeatAction.New(this, new List() { new(beat + 1, delegate { RecursiveStepping(beat + 1); }) @@ -306,11 +318,11 @@ namespace HeavenStudio.Games var actions = new List(); for (int i = 0; i < length; i++) { - ScheduleStep(beat); + ScheduleStep(beat + i); actions.Add(new BeatAction.Action(beat + i, delegate { - string dir = (stepIterate % 2 == 1) ? "Right" : "Left"; - metronomeAnim.DoScaledAnimationAsync("MetronomeGo" + dir, 0.5f); - SoundByte.PlayOneShotGame("mrUpbeat/metronome" + dir); + currentMetronomeDir = (stepIterate % 2 == 1) ? "Right" : "Left"; + SoundByte.PlayOneShotGame($"mrUpbeat/metronome{currentMetronomeDir}"); + metronomeBeat = beat + i; stepIterate++; })); } diff --git a/Assets/Scripts/Games/PlayerActionEvent.cs b/Assets/Scripts/Games/PlayerActionEvent.cs index 4e3b65d24..f9be70c28 100644 --- a/Assets/Scripts/Games/PlayerActionEvent.cs +++ b/Assets/Scripts/Games/PlayerActionEvent.cs @@ -149,6 +149,7 @@ namespace HeavenStudio.Games private bool CheckEventLock() { + Conductor cond = Conductor.instance; foreach (PlayerActionEvent toCompare in allEvents) { if (toCompare == this) continue; @@ -161,9 +162,9 @@ namespace HeavenStudio.Games && toCompare.InputAction.inputLockCategory[catIdx] != InputAction.inputLockCategory[catIdx]) continue; } - double t1 = this.startBeat + this.timer; - double t2 = toCompare.startBeat + toCompare.timer; - double songPos = Conductor.instance.songPositionInBeatsAsDouble; + double t1 = cond.GetUnSwungBeat(this.startBeat + this.timer); + double t2 = cond.GetUnSwungBeat(toCompare.startBeat + toCompare.timer); + double songPos = cond.unswungSongPositionInBeatsAsDouble; // compare distance between current time and the events // events that happen at the exact same time with the exact same inputs will return true @@ -213,7 +214,7 @@ namespace HeavenStudio.Games { var cond = Conductor.instance; double currTime = cond.songPositionAsDouble; - double targetTime = cond.GetSongPosFromBeat(startBeat + timer); + double targetTime = cond.GetSongPosFromBeat(cond.GetUnSwungBeat(startBeat + timer), true); // HS timing window uses 1 as the middle point instead of 0 return 1 + (currTime - targetTime); diff --git a/Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs b/Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs index 45b0e86af..083db321e 100644 --- a/Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs +++ b/Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs @@ -68,7 +68,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw { var cond = Conductor.instance; - double currentBeat = cond.songPositionInBeatsAsDouble; + double currentBeat = cond.unswungSongPositionInBeatsAsDouble; if (cond.isPlaying && !cond.isPaused) { @@ -299,7 +299,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw { lastState = currentState; currentState = state; - startBeat = beat; + startBeat = Conductor.instance.GetUnSwungBeat(beat); heightLastFrame = 0; hasChangedAnimMidAir = false; switch (currentState) diff --git a/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs b/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs index dd1338710..c2154d84e 100644 --- a/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs +++ b/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs @@ -102,7 +102,7 @@ namespace HeavenStudio.Games } if (Conductor.instance.isPlaying) { - Conductor.instance.SetMinigamePitch(1f); + Conductor.instance.SetMinigamePitch(1f, true); } } diff --git a/Assets/Scripts/Games/SpaceSoccer/Ball.cs b/Assets/Scripts/Games/SpaceSoccer/Ball.cs index 2bae47638..02c064643 100644 --- a/Assets/Scripts/Games/SpaceSoccer/Ball.cs +++ b/Assets/Scripts/Games/SpaceSoccer/Ball.cs @@ -85,7 +85,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer if (highKicks[i].beat + GetAnimLength(State.HighKicked) > currentBeat) { - highKickSwing = conductor.GetSwingRatioAtBeat(highKicks[i].beat); + highKickSwing = conductor.GetSwingRatioAtBeat(highKicks[i].beat, out _); //Debug.Log("Setting state to high kick"); state = State.HighKicked; double relativeBeat = highKicks[i].beat - dispensedBeat; @@ -96,7 +96,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer } else { - highKickSwing = conductor.GetSwingRatioAtBeat(highKicks[i].beat + GetAnimLength(State.HighKicked)); + highKickSwing = conductor.GetSwingRatioAtBeat(highKicks[i].beat + GetAnimLength(State.HighKicked), out _); //Debug.Log("Setting state to toe"); state = State.Toe; double relativeBeat = Math.Ceiling(highKicks[i].beat - dispensedBeat) + GetAnimLength(State.HighKicked); //there is a chance this makes startBeat later than the current beat, but it shouldn't matter too much. It would only happen if the user places the high kicks incorrectly. diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index 4765c4469..745fc7ad7 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -270,6 +270,11 @@ namespace HeavenStudio.Editor public void SelectMusic() { + if (Timeline.instance != null) + Timeline.instance?.Stop(0); + else + GameManager.instance.Stop(0); + var extensions = new[] { new ExtensionFilter("Music Files", "mp3", "ogg", "wav", "aiff", "aif", "aifc") diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs index 90750f7de..e04971361 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs @@ -160,6 +160,7 @@ namespace HeavenStudio.Editor.Track lastTempo /= 2f; } RiqEntity tempoC = GameManager.instance.Beatmap.AddNewTempoChange(Timeline.instance.MousePos2BeatSnap, lastTempo); + tempoC.CreateProperty("swingDivision", 1f); tempoTimelineObj.chartEntity = tempoC; CommandManager.Instance.AddCommand(new Commands.AddMarker(tempoC, tempoC.guid, HoveringTypes.TempoChange)); } diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TempoDialog.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TempoDialog.cs index 8211b8929..fe2dd3c35 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TempoDialog.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TempoDialog.cs @@ -16,6 +16,7 @@ public class TempoDialog : Dialog [SerializeField] TMP_InputField tempoInput; [SerializeField] TMP_InputField swingInput; [SerializeField] Slider swingSlider; + [SerializeField] Toggle swingDivisionToggle; public void SwitchTempoDialog() { @@ -52,6 +53,8 @@ public class TempoDialog : Dialog tempoInput.text = tempoObj.chartEntity["tempo"].ToString("F"); swingInput.text = (tempoObj.chartEntity["swing"] * 400).ToString("F"); swingSlider.value = tempoObj.chartEntity["swing"]; + + swingDivisionToggle.isOn = tempoObj.chartEntity["swingDivision"] != 1f; } public void DeleteTempo() @@ -114,4 +117,12 @@ public class TempoDialog : Dialog swingSlider.value = tempoObj.chartEntity["swing"]; } } + + public void SwingDivisionToggle() + { + if (tempoObj != null) + { + tempoObj.SetSwingDivision(swingDivisionToggle.isOn); + } + } } diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs index eaea27474..e327263d2 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs @@ -68,6 +68,12 @@ namespace HeavenStudio.Editor.Track UpdateTempo(); } + public void SetSwingDivision(bool sixteenth) + { + chartEntity["swingDivision"] = sixteenth ? 0.5f : 1f; + UpdateTempo(); + } + public override void Init() { UpdateTempo(); diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index 610272d5b..16ba4d081 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -631,7 +631,7 @@ namespace HeavenStudio.Editor.Track { TimelinePlaybackBeat.text = $"Beat {string.Format("{0:0.000}", PlaybackBeat)}"; - if (TimelineSongPosLine != null) + if (TimelineSongPosLine != null && !Conductor.instance.WaitingForDsp) { TimelineSongPosLine.transform.localPosition = new Vector3(Conductor.instance.songPositionInBeats * PixelsPerBeat, TimelineSongPosLine.transform.localPosition.y); } @@ -656,13 +656,13 @@ namespace HeavenStudio.Editor.Track { if (!Conductor.instance.isPlaying) { - if (TimelineSongPosLine == null) + if (Conductor.instance.isPaused) { - Play(false, PlaybackBeat); + Play(false, Conductor.instance.songPositionInBeats); } else { - Play(false, Conductor.instance.songPositionInBeats); + Play(false, PlaybackBeat); } } else if (!Conductor.instance.isPaused) diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 2bce15860..d355037f1 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -99,6 +99,7 @@ namespace HeavenStudio { {"tempo", 120f}, {"swing", 0f}, + {"swingDivision", 1f}, {"timeSignature", new Vector2(4, 4)}, };