From afc665ed61de036e37ff11d4cc5ff28f04d52524 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Sat, 10 Jun 2023 15:17:06 -0400 Subject: [PATCH] Integration of Jukebox Library (#451) (#457) * add Jukebox library todo: - saving / loading of new format - inferrence of unknown data like past versions - move the temporary float casts to proper use of double - make sound related functions take double for timing - inform people that the Jukebox sound player was renamed to SoundByte lol * make sound, input scheduling, and super curve use double precision * successfully load charts * editor works again v1 riqs can be saved and loaded * first tempo and volume markers are unmovable fix loading of charts' easing values * use gsync / freesync * update Jukebox refs to SoundByte * game events use double part 1 Air Rally - Glee Club converted * don't load song if chart load fails * finish conversion of all minigames * remove editor waveform toggle * timeline now respects added song offset length clear cache files on app close prepped notes for dsp sync * update timeline length when offset changed * update to latest Jukebox * make error panel object in global game manager * improve conductor music scheduling * added error message box fix first game events sometimes not playing --- .../Prefabs/GlobalGameManager.prefab | 2029 +++++++++++++++++ .../Sprites/UI/Common/GlobalGameManager.meta | 8 + .../GlobalGameManager/ErrorPanelMaterial.mat | 92 + .../ErrorPanelMaterial.mat.meta | 8 + Assets/Scenes/Editor.unity | 56 +- Assets/Scripts/BeatmapFormats/Beatmap.cs | 124 - .../Scripts/BeatmapFormats/DynamicBeatmap.cs | 468 ---- .../BeatmapFormats/DynamicBeatmap.cs.meta | 11 - Assets/Scripts/Common/SoundSequence.cs | 6 +- Assets/Scripts/Conductor.cs | 211 +- Assets/Scripts/DebugUI.cs | 6 +- Assets/Scripts/EventCaller.cs | 26 +- Assets/Scripts/GameCamera.cs | 14 +- Assets/Scripts/GameInitializer.cs | 58 +- Assets/Scripts/GameManager.cs | 277 ++- Assets/Scripts/Games/AirRally/AirRally.cs | 75 +- Assets/Scripts/Games/AirRally/Shuttlecock.cs | 8 +- Assets/Scripts/Games/BlueBear/BlueBear.cs | 8 +- Assets/Scripts/Games/BlueBear/Treat.cs | 8 +- .../Scripts/Games/BoardMeeting/BMExecutive.cs | 6 +- .../Games/BoardMeeting/BoardMeeting.cs | 44 +- Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs | 16 +- .../Games/BuiltToScaleDS/BuiltToScaleDS.cs | 25 +- .../Scripts/Games/CallAndResponseHandler.cs | 20 +- Assets/Scripts/Games/CatchyTune/CatchyTune.cs | 44 +- Assets/Scripts/Games/CatchyTune/Fruit.cs | 10 +- .../Games/CheerReaders/CheerReaders.cs | 79 +- Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs | 32 +- .../Games/ClappyTrio/ClappyTrioPlayer.cs | 8 +- Assets/Scripts/Games/CoinToss/CoinToss.cs | 18 +- Assets/Scripts/Games/CropStomp/CropStomp.cs | 39 +- Assets/Scripts/Games/CropStomp/Farmer.cs | 2 +- Assets/Scripts/Games/CropStomp/Veggie.cs | 22 +- Assets/Scripts/Games/DJSchool/DJSchool.cs | 53 +- Assets/Scripts/Games/DJSchool/Student.cs | 18 +- Assets/Scripts/Games/DogNinja/DogNinja.cs | 26 +- Assets/Scripts/Games/DogNinja/SpawnHalves.cs | 6 +- Assets/Scripts/Games/DogNinja/ThrowObject.cs | 11 +- Assets/Scripts/Games/DoubleDate/Basketball.cs | 28 +- Assets/Scripts/Games/DoubleDate/DoubleDate.cs | 40 +- .../Games/DoubleDate/DoubleDateWeasels.cs | 4 +- Assets/Scripts/Games/DoubleDate/Football.cs | 39 +- Assets/Scripts/Games/DoubleDate/SoccerBall.cs | 29 +- .../Scripts/Games/DrummingPractice/Drummer.cs | 10 +- .../Games/DrummingPractice/DrummerHit.cs | 4 +- .../DrummingPractice/DrummingPractice.cs | 14 +- Assets/Scripts/Games/FanClub/FanClub.cs | 110 +- Assets/Scripts/Games/FanClub/NtrIdolAmie.cs | 28 +- Assets/Scripts/Games/FanClub/NtrIdolFan.cs | 34 +- Assets/Scripts/Games/Fireworks/Fireworks.cs | 12 +- .../Scripts/Games/Fireworks/FireworksBomb.cs | 10 +- Assets/Scripts/Games/Fireworks/Rocket.cs | 10 +- .../Games/FirstContact/FirstContact.cs | 46 +- .../Scripts/Games/FirstContact/Translator.cs | 6 +- .../Scripts/Games/FlipperFlop/FlipperFlop.cs | 62 +- .../Games/FlipperFlop/FlipperFlopFlipper.cs | 24 +- Assets/Scripts/Games/ForkLifter/ForkLifter.cs | 8 +- .../Games/ForkLifter/ForkLifterHand.cs | 10 +- .../Games/ForkLifter/ForkLifterPlayer.cs | 8 +- Assets/Scripts/Games/ForkLifter/Pea.cs | 14 +- Assets/Scripts/Games/GleeClub/ChorusKid.cs | 18 +- Assets/Scripts/Games/GleeClub/GleeClub.cs | 55 +- .../Games/GleeClub/GleeClubSingInput.cs | 2 +- Assets/Scripts/Games/Global/Filter.cs | 16 +- Assets/Scripts/Games/Global/Flash.cs | 28 +- Assets/Scripts/Games/Global/Textbox.cs | 12 +- Assets/Scripts/Games/KarateMan/KarateMan.cs | 109 +- .../Scripts/Games/KarateMan/KarateManJoe.cs | 92 +- .../KarateMan/KarateManNoriController.cs | 8 +- .../Scripts/Games/KarateMan/KarateManPot.cs | 126 +- .../Scripts/Games/Kitties/CtrTeppanPlayer.cs | 54 +- Assets/Scripts/Games/Kitties/Kitties.cs | 8 +- .../Scripts/Games/LaunchParty/LaunchParty.cs | 53 +- .../Games/LaunchParty/LaunchPartyRocket.cs | 30 +- Assets/Scripts/Games/Lockstep/Lockstep.cs | 36 +- .../Games/MarchingOrders/MarchingOrders.cs | 54 +- .../Scripts/Games/MeatGrinder/MeatGrinder.cs | 26 +- Assets/Scripts/Games/MeatGrinder/MeatToss.cs | 6 +- Assets/Scripts/Games/Minigame.cs | 26 +- Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs | 22 +- Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs | 12 +- Assets/Scripts/Games/MunchyMonk/Dumpling.cs | 12 +- Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs | 36 +- .../Scripts/Games/OctopusMachine/Octopus.cs | 13 +- .../Games/OctopusMachine/OctopusMachine.cs | 28 +- .../Games/PajamaParty/CtrPillowMonkey.cs | 20 +- .../Games/PajamaParty/CtrPillowPlayer.cs | 68 +- .../Scripts/Games/PajamaParty/PajamaParty.cs | 54 +- Assets/Scripts/Games/PlayerActionEvent.cs | 4 +- Assets/Scripts/Games/QuizShow/QuizShow.cs | 54 +- Assets/Scripts/Games/RhythmRally/Paddlers.cs | 8 +- .../Scripts/Games/RhythmRally/RhythmRally.cs | 32 +- .../Scripts/Games/RhythmSomen/RhythmSomen.cs | 22 +- Assets/Scripts/Games/RhythmTweezers/Hair.cs | 4 +- .../Scripts/Games/RhythmTweezers/LongHair.cs | 8 +- .../Games/RhythmTweezers/NoPeekingSign.cs | 4 +- .../Games/RhythmTweezers/RhythmTweezers.cs | 44 +- .../Scripts/Games/RhythmTweezers/Tweezers.cs | 8 +- Assets/Scripts/Games/Ringside/Ringside.cs | 89 +- .../Scripts/Games/Rockers/RockerBendInput.cs | 2 +- Assets/Scripts/Games/Rockers/Rockers.cs | 102 +- Assets/Scripts/Games/Rockers/RockersInput.cs | 2 +- Assets/Scripts/Games/Rockers/RockersRocker.cs | 18 +- .../Games/SamuraiSliceNtr/NtrSamuraiChild.cs | 2 +- .../Games/SamuraiSliceNtr/NtrSamuraiObject.cs | 24 +- .../Games/SamuraiSliceNtr/SamuraiSliceNtr.cs | 14 +- Assets/Scripts/Games/SeeSaw/SeeSaw.cs | 117 +- Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs | 40 +- .../Games/SneakySpirits/SneakySpirits.cs | 30 +- .../Games/SneakySpirits/SneakySpiritsGhost.cs | 2 +- .../SneakySpirits/SneakySpiritsGhostDeath.cs | 2 +- Assets/Scripts/Games/SoundEffects.cs | 14 +- Assets/Scripts/Games/SpaceDance/SpaceDance.cs | 44 +- Assets/Scripts/Games/SpaceSoccer/Ball.cs | 42 +- Assets/Scripts/Games/SpaceSoccer/Kicker.cs | 34 +- .../Scripts/Games/SpaceSoccer/SpaceSoccer.cs | 32 +- Assets/Scripts/Games/Spaceball/Alien.cs | 4 +- Assets/Scripts/Games/Spaceball/Spaceball.cs | 27 +- .../Scripts/Games/Spaceball/SpaceballBall.cs | 16 +- .../Games/Spaceball/SpaceballPlayer.cs | 2 +- Assets/Scripts/Games/Tambourine/Tambourine.cs | 40 +- Assets/Scripts/Games/TapTrial/TapTrial.cs | 48 +- .../Scripts/Games/TapTrial/TapTrialPlayer.cs | 8 +- Assets/Scripts/Games/TapTroupe/TapTroupe.cs | 67 +- .../Games/TapTroupe/TapTroupeCorner.cs | 4 +- Assets/Scripts/Games/TheDazzles/TheDazzles.cs | 61 +- .../Games/TheDazzles/TheDazzlesGirl.cs | 2 +- Assets/Scripts/Games/TossBoys/TossBoys.cs | 59 +- Assets/Scripts/Games/TossBoys/TossBoysBall.cs | 6 +- Assets/Scripts/Games/TossBoys/TossKid.cs | 4 +- .../Scripts/Games/TrickClass/MobTrickObj.cs | 14 +- Assets/Scripts/Games/TrickClass/TrickClass.cs | 48 +- Assets/Scripts/Games/Tunnel/Tunnel.cs | 10 +- Assets/Scripts/Games/WizardsWaltz/Plant.cs | 2 +- Assets/Scripts/Games/WizardsWaltz/Wizard.cs | 8 +- .../Games/WizardsWaltz/WizardsWaltz.cs | 16 +- Assets/Scripts/Games/WorkingDough/BGBall.cs | 2 +- .../Games/WorkingDough/NPCDoughBall.cs | 2 +- .../WorkingDough/PlayerEnterDoughBall.cs | 2 +- .../Games/WorkingDough/WorkingDough.cs | 86 +- Assets/Scripts/GlobalGameManager.cs | 90 +- Assets/Scripts/LevelEditor/BeatGrid.cs | 1 - Assets/Scripts/LevelEditor/BoxSelection.cs | 4 +- Assets/Scripts/LevelEditor/Commands/Block.cs | 16 +- Assets/Scripts/LevelEditor/Editor.cs | 211 +- .../EventSelector/EventParameterManager.cs | 10 +- .../EventSelector/GridGameSelector.cs | 6 +- .../RemixPropertiesDialog.cs | 8 +- .../Timeline/SpecialTmeline/SectionDialog.cs | 10 +- .../SpecialTmeline/SpecialTimeline.cs | 69 +- .../TimelineObjs/SectionTimelineObj.cs | 7 +- .../TimelineObjs/SpecialTimelineObj.cs | 3 + .../TimelineObjs/TempoTimelineObj.cs | 20 +- .../TimelineObjs/VolumeTimelineObj.cs | 19 +- .../Scripts/LevelEditor/Timeline/Timeline.cs | 94 +- .../LevelEditor/Timeline/TimelineEventObj.cs | 24 +- Assets/Scripts/Minigames.cs | 220 +- Assets/Scripts/StaticCamera.cs | 16 +- Assets/Scripts/StudioDance/Dancer.cs | 4 +- Assets/Scripts/Transform/SuperCurveObject.cs | 20 +- .../UI/Overlays/ChartSectionDisplay.cs | 16 +- Assets/Scripts/UI/Overlays/GoForAPerfect.cs | 6 +- .../UI/Overlays/SectionMedalsManager.cs | 4 +- .../Scripts/UI/Overlays/SkillStarManager.cs | 10 +- Assets/Scripts/UI/PauseMenu.cs | 14 +- .../Tabs/CreditsLegalSettings.cs | 2 +- Assets/Scripts/Util/AnimationHelpers.cs | 2 +- Assets/Scripts/Util/GameEvent.cs | 4 +- Assets/Scripts/Util/MultiSound.cs | 12 +- Assets/Scripts/Util/Sound.cs | 21 +- .../Scripts/Util/{Jukebox.cs => SoundByte.cs} | 6 +- .../{Jukebox.cs.meta => SoundByte.cs.meta} | 0 Assets/Scripts/Util/StringUtils.cs | 32 + .../StringUtils.cs.meta} | 2 +- Packages/manifest.json | 2 +- Packages/packages-lock.json | 14 +- 176 files changed, 4868 insertions(+), 3013 deletions(-) create mode 100644 Assets/Resources/Sprites/UI/Common/GlobalGameManager.meta create mode 100644 Assets/Resources/Sprites/UI/Common/GlobalGameManager/ErrorPanelMaterial.mat create mode 100644 Assets/Resources/Sprites/UI/Common/GlobalGameManager/ErrorPanelMaterial.mat.meta delete mode 100644 Assets/Scripts/BeatmapFormats/Beatmap.cs delete mode 100644 Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs delete mode 100644 Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs.meta rename Assets/Scripts/Util/{Jukebox.cs => SoundByte.cs} (96%) rename Assets/Scripts/Util/{Jukebox.cs.meta => SoundByte.cs.meta} (100%) create mode 100644 Assets/Scripts/Util/StringUtils.cs rename Assets/Scripts/{BeatmapFormats/Beatmap.cs.meta => Util/StringUtils.cs.meta} (83%) diff --git a/Assets/Resources/Prefabs/GlobalGameManager.prefab b/Assets/Resources/Prefabs/GlobalGameManager.prefab index 8d409db9..a8548f92 100644 --- a/Assets/Resources/Prefabs/GlobalGameManager.prefab +++ b/Assets/Resources/Prefabs/GlobalGameManager.prefab @@ -1,5 +1,253 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &35633998839310304 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3851990725902427646} + - component: {fileID: 8885097425117568230} + - component: {fileID: 1072486849487063010} + m_Layer: 5 + m_Name: TextArea + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3851990725902427646 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 35633998839310304} + 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: 7194965054414425612} + - {fileID: 2095411176170037320} + - {fileID: 8772409952625763519} + - {fileID: 7908269211812857846} + m_Father: {fileID: 5540306190758867069} + m_RootOrder: 1 + 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: -592, y: -276} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8885097425117568230 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 35633998839310304} + m_CullTransparentMesh: 1 +--- !u!114 &1072486849487063010 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 35633998839310304} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 0 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 1 + m_ChildScaleHeight: 1 + m_ReverseArrangement: 0 +--- !u!1 &85087762189268629 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2447706353256968729} + - component: {fileID: 5139424071278252567} + - component: {fileID: 1781065221427936660} + 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 &2447706353256968729 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 85087762189268629} + 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: 6473016552050376965} + 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!222 &5139424071278252567 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 85087762189268629} + m_CullTransparentMesh: 1 +--- !u!114 &1781065221427936660 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 85087762189268629} + 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: OK + 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: 48 + m_fontSizeBase: 48 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + 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_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 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!1 &1168527660933212220 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4420812721894448309} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4420812721894448309 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1168527660933212220} + 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: 1555455311209668142} + m_Father: {fileID: 4221106375047911161} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -10, y: 0} + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1323854835484021605 GameObject: m_ObjectHideFlags: 0 @@ -33,6 +281,7 @@ RectTransform: m_Children: - {fileID: 1279656563842697233} - {fileID: 3667450265656160665} + - {fileID: 5540306190758867069} m_Father: {fileID: 1841519332817814688} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -102,6 +351,881 @@ MonoBehaviour: m_BlockingMask: serializedVersion: 2 m_Bits: 0 +--- !u!1 &1768707854483863185 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 394420881089999126} + - component: {fileID: 6386187867922676028} + - component: {fileID: 566080651577445302} + 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 &394420881089999126 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1768707854483863185} + 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: 6034055082154682024} + 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!222 &6386187867922676028 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1768707854483863185} + m_CullTransparentMesh: 1 +--- !u!114 &566080651577445302 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1768707854483863185} + 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: Show Log Folder + 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: 28 + m_fontSizeBase: 28 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + 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_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 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!1 &1883015435624595608 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8009517130657727131} + - component: {fileID: 8643414652072817202} + - component: {fileID: 2047803115340193113} + m_Layer: 5 + m_Name: Down + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8009517130657727131 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1883015435624595608} + 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: 8492029422355461181} + - {fileID: 4593702512633222933} + m_Father: {fileID: 2979839938841152676} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8643414652072817202 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1883015435624595608} + m_CullTransparentMesh: 1 +--- !u!114 &2047803115340193113 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1883015435624595608} + 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: 7 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!1 &2510029787714358465 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7908269211812857846} + - component: {fileID: 5749177832471922939} + - component: {fileID: 2639521322656803325} + m_Layer: 5 + m_Name: BuildInfo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7908269211812857846 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2510029787714358465} + 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: 3851990725902427646} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1136.5, y: 105.4575} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &5749177832471922939 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2510029787714358465} + m_CullTransparentMesh: 1 +--- !u!114 &2639521322656803325 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2510029787714358465} + 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: 'vAWWWWWWW BWWWWWWW + +' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: c2df694f599b22b42817910ff570a9df, type: 2} + m_sharedMaterial: {fileID: -5829441969153149921, guid: c2df694f599b22b42817910ff570a9df, 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: 32 + m_fontSizeBase: 32 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 4 + m_VerticalAlignment: 1024 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 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!1 &2551053406814384838 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6473016552050376965} + - component: {fileID: 2890947672468987088} + - component: {fileID: 2799171323366178123} + - component: {fileID: 4025337939531588272} + m_Layer: 5 + m_Name: OKButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &6473016552050376965 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551053406814384838} + 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: 2447706353256968729} + m_Father: {fileID: 8772409952625763519} + 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: 855.60004, y: -38.97375} + m_SizeDelta: {x: 244, y: 76} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2890947672468987088 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551053406814384838} + m_CullTransparentMesh: 1 +--- !u!114 &2799171323366178123 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551053406814384838} + 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: 21300000, guid: 77703dfffd29ca6439338d6adfc62c9b, type: 3} + 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!114 &4025337939531588272 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551053406814384838} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, 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: 2799171323366178123} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 7690871514487521256} + m_TargetAssemblyTypeName: HeavenStudio.GlobalGameManager, Assembly-CSharp + m_MethodName: HideDialog + 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 +--- !u!1 &2925861648682993421 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1555455311209668142} + - component: {fileID: 3872848836230823658} + - component: {fileID: 8454222159838173737} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1555455311209668142 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2925861648682993421} + 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: 4420812721894448309} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + 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} +--- !u!222 &3872848836230823658 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2925861648682993421} + m_CullTransparentMesh: 1 +--- !u!114 &8454222159838173737 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2925861648682993421} + 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!1 &3038697057990290621 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4549678077829132668} + - component: {fileID: 3587260218382003305} + - component: {fileID: 4264152588835585767} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4549678077829132668 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3038697057990290621} + 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: 4221106375047911161} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3587260218382003305 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3038697057990290621} + m_CullTransparentMesh: 1 +--- !u!114 &4264152588835585767 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3038697057990290621} + 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: 10907, 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!1 &3129469091808830243 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4221106375047911161} + - component: {fileID: 6933230496934097465} + m_Layer: 5 + m_Name: ProgressSlider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &4221106375047911161 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3129469091808830243} + 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: 4549678077829132668} + - {fileID: 4420812721894448309} + - {fileID: 8594415106060206419} + m_Father: {fileID: 8772409952625763519} + 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: 570.4, y: -38.97375} + m_SizeDelta: {x: 512, y: 52} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &6933230496934097465 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3129469091808830243} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, 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: 0} + m_FillRect: {fileID: 1555455311209668142} + m_HandleRect: {fileID: 0} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 1 + m_WholeNumbers: 0 + m_Value: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &4001679222529169895 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4593702512633222933} + - component: {fileID: 3763651429928189129} + - component: {fileID: 6115146557502685908} + m_Layer: 5 + m_Name: BoxDR + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4593702512633222933 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4001679222529169895} + 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: 8009517130657727131} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0} +--- !u!222 &3763651429928189129 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4001679222529169895} + m_CullTransparentMesh: 1 +--- !u!114 &6115146557502685908 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4001679222529169895} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: efcc40f3353c0f6449f5289c2a5efb7e, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 8a606dc38dd29bd49b9aba3a8c440736, type: 3} + 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: 0.2 +--- !u!1 &4298243932468917377 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8492029422355461181} + - component: {fileID: 6771072274678637784} + - component: {fileID: 5199619716351041521} + m_Layer: 5 + m_Name: BoxDL + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8492029422355461181 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4298243932468917377} + 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: 8009517130657727131} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!222 &6771072274678637784 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4298243932468917377} + m_CullTransparentMesh: 1 +--- !u!114 &5199619716351041521 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4298243932468917377} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: efcc40f3353c0f6449f5289c2a5efb7e, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 8a606dc38dd29bd49b9aba3a8c440736, type: 3} + 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: 0.2 --- !u!1 &4590302042177785724 GameObject: m_ObjectHideFlags: 0 @@ -237,6 +1361,605 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4779824633923558356 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7194965054414425612} + - component: {fileID: 5137532937747120058} + - component: {fileID: 2164721024475170670} + m_Layer: 5 + m_Name: Header + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7194965054414425612 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4779824633923558356} + 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: 3851990725902427646} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1149.1, y: 139.9575} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &5137532937747120058 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4779824633923558356} + m_CullTransparentMesh: 1 +--- !u!114 &2164721024475170670 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4779824633923558356} + 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: Error! + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 99ae3dd1bd4da234a96fa1bc4a5f098b, type: 2} + m_sharedMaterial: {fileID: 2100000, guid: 03a32d07775a72f4ea29f38a2b5bf10e, 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: 72 + m_fontSizeBase: 72 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + 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_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 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!1 &5100485853334244329 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6034055082154682024} + - component: {fileID: 2068361535340028007} + - component: {fileID: 3182887848499678633} + - component: {fileID: 5723928714908954180} + m_Layer: 5 + m_Name: LogsButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &6034055082154682024 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5100485853334244329} + 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: 394420881089999126} + m_Father: {fileID: 8772409952625763519} + 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: 285.2, y: -38.97375} + m_SizeDelta: {x: 244, y: 76} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2068361535340028007 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5100485853334244329} + m_CullTransparentMesh: 1 +--- !u!114 &3182887848499678633 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5100485853334244329} + 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: 21300000, guid: 77703dfffd29ca6439338d6adfc62c9b, type: 3} + 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!114 &5723928714908954180 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5100485853334244329} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, 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: 3182887848499678633} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &5668310765832141390 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6554696626326264249} + - component: {fileID: 8582850386734763092} + - component: {fileID: 5396538093097141} + m_Layer: 5 + m_Name: BoxUR + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6554696626326264249 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5668310765832141390} + 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: 6713243069600572421} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &8582850386734763092 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5668310765832141390} + m_CullTransparentMesh: 1 +--- !u!114 &5396538093097141 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5668310765832141390} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: efcc40f3353c0f6449f5289c2a5efb7e, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 8a606dc38dd29bd49b9aba3a8c440736, type: 3} + 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: 0.2 +--- !u!1 &6695299710708230916 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8594415106060206419} + m_Layer: 5 + m_Name: Handle Slide Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8594415106060206419 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6695299710708230916} + 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: 4221106375047911161} + m_RootOrder: 2 + 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: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &7029079361521483480 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5540306190758867069} + - component: {fileID: 7811577261616831946} + - component: {fileID: 1332643497859456409} + m_Layer: 5 + m_Name: ErrorPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5540306190758867069 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7029079361521483480} + 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: 2979839938841152676} + - {fileID: 3851990725902427646} + m_Father: {fileID: 6699561459062169273} + m_RootOrder: 2 + 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!222 &7811577261616831946 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7029079361521483480} + m_CullTransparentMesh: 1 +--- !u!114 &1332643497859456409 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7029079361521483480} + 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: 0, g: 0, b: 0, a: 0.392} + 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: 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!1 &7520465997762233065 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2095411176170037320} + - component: {fileID: 4991754008448111961} + - component: {fileID: 85068618210157816} + m_Layer: 5 + m_Name: Content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2095411176170037320 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7520465997762233065} + 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: 3851990725902427646} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1136, y: 372.6375} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &4991754008448111961 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7520465997762233065} + m_CullTransparentMesh: 1 +--- !u!114 &85068618210157816 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7520465997762233065} + 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: 'bla bla bla shit went down + + instructions to tell the guy here + + exception + info here + + Exception e at line bla bla bla: wahh wahh rainbows make me cry + + bla + bla bla shit went down + + instructions to tell the guy here + + exception + info here + + Exception e at line bla bla bla: wahh wahh rainbows make me cry' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 35949c950a936b744936efd75ae436ea, type: 2} + m_sharedMaterial: {fileID: -212896991529246517, guid: 35949c950a936b744936efd75ae436ea, 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: 52 + m_fontSizeBase: 52 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 1 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 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!1 &7572968838572974203 GameObject: m_ObjectHideFlags: 0 @@ -360,3 +2083,309 @@ MonoBehaviour: m_EditorClassIdentifier: fadeImage: {fileID: 4601285202933501097} loadingText: {fileID: 7511993328364652166} + messagePanel: {fileID: 7029079361521483480} + messageHeader: {fileID: 2164721024475170670} + messageBody: {fileID: 85068618210157816} + errorBuild: {fileID: 2639521322656803325} + errorOkButton: {fileID: 4025337939531588272} + errorLogButton: {fileID: 5723928714908954180} + dialogProgress: {fileID: 6933230496934097465} +--- !u!1 &7708528282509202509 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8772409952625763519} + - component: {fileID: 1229622800894914623} + - component: {fileID: 6062333096147036805} + m_Layer: 5 + m_Name: Buttons + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8772409952625763519 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7708528282509202509} + 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: 6034055082154682024} + - {fileID: 6473016552050376965} + - {fileID: 4221106375047911161} + m_Father: {fileID: 3851990725902427646} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1140.8, y: 77.9475} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1229622800894914623 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7708528282509202509} + m_CullTransparentMesh: 1 +--- !u!114 &6062333096147036805 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7708528282509202509} + 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: 4 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 1 + m_ReverseArrangement: 0 +--- !u!1 &7797643908597087981 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2979839938841152676} + - component: {fileID: 2923998794131877632} + - component: {fileID: 6924388233123237201} + m_Layer: 5 + m_Name: Box + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2979839938841152676 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7797643908597087981} + 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: 6713243069600572421} + - {fileID: 8009517130657727131} + m_Father: {fileID: 5540306190758867069} + 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: -64, y: -39.999992} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2923998794131877632 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7797643908597087981} + m_CullTransparentMesh: 1 +--- !u!114 &6924388233123237201 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7797643908597087981} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!1 &7994824443195667110 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3011993497983312799} + - component: {fileID: 2666134685600664026} + - component: {fileID: 2671014360766176846} + m_Layer: 5 + m_Name: BoxUL + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3011993497983312799 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7994824443195667110} + 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: 6713243069600572421} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!222 &2666134685600664026 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7994824443195667110} + m_CullTransparentMesh: 1 +--- !u!114 &2671014360766176846 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7994824443195667110} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: efcc40f3353c0f6449f5289c2a5efb7e, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 8a606dc38dd29bd49b9aba3a8c440736, type: 3} + 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: 0.2 +--- !u!1 &8931238225162443095 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6713243069600572421} + - component: {fileID: 897102463759875336} + - component: {fileID: 3213900062191126953} + m_Layer: 5 + m_Name: Up + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6713243069600572421 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8931238225162443095} + 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: 3011993497983312799} + - {fileID: 6554696626326264249} + m_Father: {fileID: 2979839938841152676} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &897102463759875336 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8931238225162443095} + m_CullTransparentMesh: 1 +--- !u!114 &3213900062191126953 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8931238225162443095} + 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: 1 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 diff --git a/Assets/Resources/Sprites/UI/Common/GlobalGameManager.meta b/Assets/Resources/Sprites/UI/Common/GlobalGameManager.meta new file mode 100644 index 00000000..6195ce6f --- /dev/null +++ b/Assets/Resources/Sprites/UI/Common/GlobalGameManager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0d89ef13f0e54ef4a9d25d14626da7d5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Sprites/UI/Common/GlobalGameManager/ErrorPanelMaterial.mat b/Assets/Resources/Sprites/UI/Common/GlobalGameManager/ErrorPanelMaterial.mat new file mode 100644 index 00000000..f0af96f9 --- /dev/null +++ b/Assets/Resources/Sprites/UI/Common/GlobalGameManager/ErrorPanelMaterial.mat @@ -0,0 +1,92 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ErrorPanelMaterial + m_Shader: {fileID: 4800000, guid: 777678d31f953e04e8f15812003b9c27, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _OutSmoothness: 0.015 + - _OutThickness: 0.75 + - _Parallax: 0.02 + - _Smoothness: 0.015 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _Thickness: 0.85 + - _UVSec: 0 + - _UseUIAlphaClip: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _OutColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Resources/Sprites/UI/Common/GlobalGameManager/ErrorPanelMaterial.mat.meta b/Assets/Resources/Sprites/UI/Common/GlobalGameManager/ErrorPanelMaterial.mat.meta new file mode 100644 index 00000000..3edbe8f3 --- /dev/null +++ b/Assets/Resources/Sprites/UI/Common/GlobalGameManager/ErrorPanelMaterial.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: efcc40f3353c0f6449f5289c2a5efb7e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index b459388b..8e334c22 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -3577,7 +3577,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -289.15, y: 2} + m_AnchoredPosition: {x: -289.15002, y: 2} m_SizeDelta: {x: -578.29, y: 49.92} m_Pivot: {x: 0.5, y: 0} --- !u!114 &156962255 @@ -8240,12 +8240,9 @@ MonoBehaviour: raycastRect: {fileID: 1186810249} moving: 0 hovering: 0 + first: 0 volumeTXT: {fileID: 746356640} volumeLine: {fileID: 1126835990} - volumeChange: - beat: 0 - length: 0 - volume: 0 --- !u!114 &380411596 MonoBehaviour: m_ObjectHideFlags: 0 @@ -14314,12 +14311,9 @@ MonoBehaviour: raycastRect: {fileID: 983551349} moving: 0 hovering: 0 + first: 0 tempoTXT: {fileID: 499528699} tempoLine: {fileID: 1287203019} - tempoChange: - beat: 0 - length: 0 - tempo: 0 --- !u!114 &666273486 MonoBehaviour: m_ObjectHideFlags: 0 @@ -14922,7 +14916,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: -84, y: -128.1} + m_AnchoredPosition: {x: -84, y: -128.09998} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0} --- !u!114 &683816223 @@ -17478,13 +17472,6 @@ MonoBehaviour: resizeGraphic: {fileID: 880758902} leftDrag: {fileID: 2046851080} rightDrag: {fileID: 184364176} - entity: - beat: 0 - track: 0 - length: 0 - swing: 0 - datamodel: - eventObj: {fileID: 0} length: 0 eligibleToMove: 0 selected: 0 @@ -17494,7 +17481,7 @@ MonoBehaviour: moving: 0 wasDuplicated: 0 isCreating: 0 - eventObjID: + eventObjID: 0 NormalCol: {r: 0.8470589, g: 0.8470589, b: 1, a: 1} --- !u!222 &798021451 CanvasRenderer: @@ -18298,13 +18285,6 @@ MonoBehaviour: DropdownP: {fileID: 184838087} ColorP: {fileID: 1443721746} StringP: {fileID: 1671827686} - entity: - beat: 0 - track: 0 - length: 0 - swing: 0 - datamodel: - eventObj: {fileID: 0} active: 0 canDisable: 1 --- !u!114 &830452355 @@ -23941,7 +23921,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: 129.96861} + m_AnchoredPosition: {x: 0, y: 129.92226} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -25916,7 +25896,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1274337802 RectTransform: m_ObjectHideFlags: 0 @@ -25933,9 +25913,9 @@ RectTransform: m_Father: {fileID: 1871675778} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 129, y: -23} m_SizeDelta: {x: 35, y: 35} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1274337803 @@ -31347,14 +31327,10 @@ MonoBehaviour: raycastRect: {fileID: 738028140} moving: 0 hovering: 0 + first: 0 sectionLabel: {fileID: 297792673} chartLine: {fileID: 856705695} sectionDialog: {fileID: 292323699} - chartSection: - beat: 0 - startPerfect: 0 - sectionName: - isCheckpoint: 0 --- !u!114 &1542666928 MonoBehaviour: m_ObjectHideFlags: 0 @@ -32174,7 +32150,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1292844878} m_HandleRect: {fileID: 1292844877} m_Direction: 2 - m_Value: 1 + m_Value: 0 m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: @@ -33034,7 +33010,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 111.50012, y: -29.533981} + m_AnchoredPosition: {x: 111.50012, y: -29.533966} m_SizeDelta: {x: 223, y: -108.27} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1671351976 @@ -35819,7 +35795,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -84.98996} + m_AnchoredPosition: {x: 0, y: -84.98999} m_SizeDelta: {x: 320, y: -84.99} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 @@ -38348,7 +38324,7 @@ RectTransform: 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: -29.529953} + m_AnchoredPosition: {x: 0, y: -29.529938} m_SizeDelta: {x: 0, y: -108.26} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1980243267 @@ -41342,7 +41318,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 8995444695224805070, guid: 51bd6620194834c4c9118dd0f64b1b3d, type: 3} propertyPath: m_AnchoredPosition.y - value: -49.99991 + value: -49.999878 objectReference: {fileID: 0} - target: {fileID: 8995444695466730802, guid: 51bd6620194834c4c9118dd0f64b1b3d, type: 3} propertyPath: tabs.Array.size diff --git a/Assets/Scripts/BeatmapFormats/Beatmap.cs b/Assets/Scripts/BeatmapFormats/Beatmap.cs deleted file mode 100644 index f1f4dc9f..00000000 --- a/Assets/Scripts/BeatmapFormats/Beatmap.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using UnityEngine; - -using Newtonsoft.Json; - -using HeavenStudio.Util; - -namespace HeavenStudio -{ - [Serializable] - public class Beatmap - { - public float bpm; - - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] - [DefaultValue(100)] - public int musicVolume; // In percent (1-100) - - public List entities = new List(); - public List tempoChanges = new List(); - public List volumeChanges = new List(); - public float firstBeatOffset; - - [Serializable] - public class Entity : ICloneable - { - public float beat; - public int track; - - // consideration: use arrays instead of hardcoding fixed parameter names - // note from zeo: yeah definately use arrays - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valA; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valC; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool toggle; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type3; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type4; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type5; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type6; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorC; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorD; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorE; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorF; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text1; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text2; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text3; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float swing; - public string datamodel; - [JsonIgnore] public Editor.Track.TimelineEventObj eventObj; - - public object Clone() - { - return this.MemberwiseClone(); - } - - public Entity DeepCopy() - { - //lol the AI generated this - return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(this)); - } - - public dynamic this[string propertyName] - { - get - { - try - { - return typeof(Entity).GetField(propertyName).GetValue(this); - } - catch (NullReferenceException ex) - { - UnityEngine.Debug.LogWarning($"{propertyName} doesn't exist in this Legacy Entity. Conversion needs to create this field... Exception log: {ex}"); - return null; - } - } - set - { - try - { - typeof(Entity).GetField(propertyName).SetValue(this, value); - } - catch (Exception ex) - { - UnityEngine.Debug.LogError($"You probably misspelled a parameter, or defined the object type wrong. Exception log: {ex}"); - } - } - } - } - - [Serializable] - public class TempoChange : ICloneable - { - public float beat; - public float length; - public float tempo; - - public object Clone() - { - return this.MemberwiseClone(); - } - } - - [Serializable] - public class VolumeChange : ICloneable - { - public float beat; - public float length; - public float volume; - - public object Clone() - { - return this.MemberwiseClone(); - } - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs deleted file mode 100644 index 6b5efb42..00000000 --- a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs +++ /dev/null @@ -1,468 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text.RegularExpressions; -using UnityEngine; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -using HeavenStudio.Util; - -namespace HeavenStudio -{ - [Serializable] - public class DynamicBeatmap - { - public static int CurrentRiqVersion = 0; - public float bpm; - - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] - [DefaultValue(100)] public int musicVolume; // In percent (1-100) - - public Dictionary properties = - new Dictionary() { - // software version (MajorMinorPatch, revision) - {"productversion", 000}, - {"productsubversion", 0}, - // file format version - {"riqversion", CurrentRiqVersion}, - // mapper set properties? (future: use this to flash the button) - {"propertiesmodified", false}, - - ////// CATEGORY 1: SONG INFO - // general chart info - {"remixtitle", "New Remix"}, // chart name - {"remixauthor", "Your Name"}, // charter's name - {"remixdesc", "Remix Description"}, // chart description - {"remixlevel", 1}, // chart difficulty (maybe offer a suggestion but still have the mapper determine it) - {"remixtempo", 120f}, // avg. chart tempo - {"remixtags", ""}, // chart tags - {"icontype", 0}, // chart icon (presets, custom - future) - {"iconurl", ""}, // custom icon location (future) - - // chart song info - {"idolgenre", "Song Genre"}, // song genre - {"idolsong", "Song Name"}, // song name - {"idolcredit", "Artist"}, // song artist - - ////// CATEGORY 2: PROLOGUE AND EPILOGUE - // chart prologue - {"prologuetype", 0}, // prologue card animation (future) - {"prologuecaption", "Remix"}, // prologue card sub-title (future) - - // chart results screen messages - {"resultcaption", "Rhythm League Notes"}, // result screen header - {"resultcommon_hi", "Good rhythm."}, // generic "Superb" message (one-liner, or second line for single-type) - {"resultcommon_ok", "Eh. Passable."}, // generic "OK" message (one-liner, or second line for single-type) - {"resultcommon_ng", "Try harder next time."}, // generic "Try Again" message (one-liner, or second line for single-type) - - // the following are shown / hidden in-editor depending on the tags of the games used - {"resultnormal_hi", "You show strong fundamentals."}, // "Superb" message for normal games (two-liner) - {"resultnormal_ng", "Work on your fundamentals."}, // "Try Again" message for normal games (two-liner) - - {"resultkeep_hi", "You kept the beat well."}, // "Superb" message for keep-the-beat games (two-liner) - {"resultkeep_ng", "You had trouble keeping the beat."}, // "Try Again" message for keep-the-beat games (two-liner) - - {"resultaim_hi", "You had great aim."}, // "Superb" message for aim games (two-liner) - {"resultaim_ng", "Your aim was a little shaky."}, // "Try Again" message for aim games (two-liner) - - {"resultrepeat_hi", "You followed the example well."}, // "Superb" message for call-and-response games (two-liner) - {"resultrepeat_ng", "Next time, follow the example better."}, // "Try Again" message for call-and-response games (two-liner) - }; - - public List entities = new List(); - public List tempoChanges = new List(); - public List volumeChanges = new List(); - public List beatmapSections = new List(); - public float firstBeatOffset; - - [Serializable] - public class DynamicEntity : ICloneable - { - public float beat; - public int track; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length; - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float swing; - public Dictionary DynamicData = new Dictionary(); - - public string datamodel; - [JsonIgnore] public Editor.Track.TimelineEventObj eventObj; - - public object Clone() - { - return this.MemberwiseClone(); - } - - public DynamicEntity DeepCopy() - { - DynamicEntity copy = (DynamicEntity)this.MemberwiseClone(); - copy.DynamicData = new Dictionary(this.DynamicData); - return copy; - } - - public dynamic this[string propertyName] - { - get - { - switch (propertyName) - { - case "beat": - return beat; - case "track": - return track; - case "length": - return length; - case "swing": - return swing; - case "datamodel": - return datamodel; - default: - if (DynamicData.ContainsKey(propertyName)) - return DynamicData[propertyName]; - else - { - Minigames.Minigame game = EventCaller.instance.GetMinigame(datamodel.Split(0)); - Minigames.Param param = EventCaller.instance.GetGameParam(game, datamodel.Split(1), propertyName); - return param.parameter; - } - } - } - set - { - switch (propertyName) - { - case "beat": - case "track": - case "length": - case "swing": - case "datamodel": - UnityEngine.Debug.LogWarning($"Property name {propertyName} is reserved and cannot be set."); - break; - default: - if (DynamicData.ContainsKey(propertyName)) - DynamicData[propertyName] = value; - else - UnityEngine.Debug.LogError($"This entity does not have a property named {propertyName}! Attempted to insert value of type {value.GetType()}"); - break; - } - - } - } - - public void CreateProperty(string name, dynamic defaultValue) - { - if (!DynamicData.ContainsKey(name)) - DynamicData.Add(name, defaultValue); - } - } - - [Serializable] - public class TempoChange : ICloneable - { - public float beat; - public float length; - public float tempo; - - public object Clone() - { - return this.MemberwiseClone(); - } - } - - [Serializable] - public class VolumeChange : ICloneable - { - public float beat; - public float length; - public float volume; - - public object Clone() - { - return this.MemberwiseClone(); - } - } - - [Serializable] - public class ChartSection : ICloneable - { - public float beat; - public bool startPerfect; - public string sectionName; - public bool isCheckpoint; // really don't think we need this but who knows - - public object Clone() - { - return this.MemberwiseClone(); - } - } - - public dynamic this[string propertyName] - { - get - { - return properties[propertyName] ?? null; - } - set - { - if (properties.ContainsKey(propertyName)) - { - properties[propertyName] = value; - } - else - { - UnityEngine.Debug.LogError($"This beatmap does not have a property named {propertyName}! Attempted to insert value of type {value.GetType()}"); - } - } - } - - /// - /// converts from the old "rhmania" / "tengoku" format to the new "riq" format - /// - /// a deserialized .rhmania or .tengoku beatmap - /// a .riq beatmap - public static DynamicBeatmap BeatmapConverter(Beatmap beatmap) - { - DynamicBeatmap dynamicBeatmap = new DynamicBeatmap(); - dynamicBeatmap.bpm = beatmap.bpm; - dynamicBeatmap.musicVolume = beatmap.musicVolume; - dynamicBeatmap.firstBeatOffset = beatmap.firstBeatOffset; - - Minigames.Minigame game; - Minigames.GameAction action; - System.Type type, pType; - foreach (var e in beatmap.entities) - { - game = EventCaller.instance.GetMinigame(e.datamodel.Split(0)); - action = EventCaller.instance.GetGameAction(game, e.datamodel.Split(1)); - - if (game == null || action == null) - { - //FUTURE: attempt to convert to a new entity if a converter exists for this datamodel - UnityEngine.Debug.LogError($"Could not find game or gameaction from datamodel {e.datamodel} @ beat {e.beat}, skipping entity"); - continue; - } - // Debug.Log($"{game.name} {action.displayName} @ beat {e.beat}"); - - Dictionary dynamicData = new Dictionary(); - //check each param of the action - if (action.parameters != null) - { - foreach (var param in action.parameters) - { - if (e[param.propertyName] == null) - { - dynamicData.Add(param.propertyName, param.parameter); - continue; - } - type = param.parameter.GetType(); - pType = e[param.propertyName].GetType(); - // Debug.Log($"adding parameter {param.propertyName} of type {type}"); - if (!dynamicData.ContainsKey(param.propertyName)) - { - if (pType == type) - { - dynamicData.Add(param.propertyName, e[param.propertyName]); - } - else - { - if (type == typeof(EntityTypes.Integer)) - dynamicData.Add(param.propertyName, (int) e[param.propertyName]); - else if (type == typeof(EntityTypes.Float)) - dynamicData.Add(param.propertyName, (float) e[param.propertyName]); - else if (type.IsEnum && param.propertyName != "ease") - dynamicData.Add(param.propertyName, (int) e[param.propertyName]); - else if (pType == typeof(Newtonsoft.Json.Linq.JObject)) - dynamicData.Add(param.propertyName, e[param.propertyName].ToObject(type)); - else - dynamicData.Add(param.propertyName, Convert.ChangeType(e[param.propertyName], type)); - } - } - else - { - Debug.LogWarning($"Property {param.propertyName} already exists in the entity's dynamic data! Skipping..."); - } - } - } - - dynamicBeatmap.entities.Add(new DynamicEntity() - { - beat = e.beat, - track = e.track, - length = e.length, - swing = e.swing, - datamodel = e.datamodel, - DynamicData = dynamicData - }); - } - foreach (var tempoChange in beatmap.tempoChanges) - { - dynamicBeatmap.tempoChanges.Add(new TempoChange() - { - beat = tempoChange.beat, - length = tempoChange.length, - tempo = tempoChange.tempo - }); - } - foreach (var volumeChange in beatmap.volumeChanges) - { - dynamicBeatmap.volumeChanges.Add(new VolumeChange() - { - beat = volumeChange.beat, - length = volumeChange.length, - volume = volumeChange.volume - }); - } - return dynamicBeatmap; - } - - /// - /// FUTURE: converts from a karateka mania chart ("bor") to the "riq" format - /// - /// a rawtext .bor chart - /// a .riq beatmap - /// not implemented yet - public static DynamicBeatmap KManiaBorConverter(String bor) - { - return null; - } - - /// - /// updates an "riq" beatmap - /// - /// old beatmap - /// version of old beatmap - /// updated beatmap - /// not implemented yet - public static DynamicBeatmap BeatmapUpdater(DynamicBeatmap beatmap, int version) - { - return beatmap; - } - - /// - /// processes an riq beatmap after it is loaded - /// - public void PostProcess() - { - DynamicBeatmap beatmapModel = new DynamicBeatmap(); - Minigames.Minigame game; - Minigames.GameAction action; - System.Type type, pType; - foreach (var e in entities) - { - var gameName = e.datamodel.Split(0); - var actionName = e.datamodel.Split(1); - game = EventCaller.instance.GetMinigame(gameName); - if (game == null) - { - Debug.LogWarning($"Unknown game {gameName} found in remix.json! Adding game..."); - game = new Minigames.Minigame(gameName, DisplayName(gameName) + " \n[inferred from remix.json]", "", false, false, new List(), inferred: true); - EventCaller.instance.minigames.Add(game); - if (Editor.Editor.instance != null) - Editor.Editor.instance.AddIcon(game); - } - action = EventCaller.instance.GetGameAction(game, actionName); - if (action == null) - { - Debug.LogWarning($"Unknown action {gameName}/{actionName} found in remix.json! Adding action..."); - var parameters = new List(); - foreach (var item in e.DynamicData) - { - var value = item.Value; - if (value.GetType() == typeof(long)) - value = new EntityTypes.Integer(int.MinValue, int.MaxValue, (int)value); - else if (value.GetType() == typeof(double)) - value = new EntityTypes.Float(float.NegativeInfinity, float.PositiveInfinity, (float)value); - parameters.Add(new Minigames.Param(item.Key, value, item.Key, "[inferred from remix.json]")); - } - action = new Minigames.GameAction(actionName, DisplayName(actionName), e.length, true, parameters); - game.actions.Add(action); - } - Dictionary dynamicData = new Dictionary(); - //check each param of the action - if (action.parameters != null) - { - foreach (var param in action.parameters) - { - if (!dynamicData.ContainsKey(param.propertyName)) - { - type = param.parameter.GetType(); - //FUTURE: attempt to convert to a new entity if a converter exists for this datamodel - //add property if it doesn't exist - if (!e.DynamicData.ContainsKey(param.propertyName)) - { - Debug.LogWarning($"Property {param.propertyName} does not exist in the entity's dynamic data! Adding..."); - if (type == typeof(EntityTypes.Integer)) - dynamicData.Add(param.propertyName, ((EntityTypes.Integer)param.parameter).val); - else if (type == typeof(EntityTypes.Float)) - dynamicData.Add(param.propertyName, ((EntityTypes.Float)param.parameter).val); - else if (type.IsEnum && param.propertyName != "ease") - dynamicData.Add(param.propertyName, (int)param.parameter); - else - dynamicData.Add(param.propertyName, Convert.ChangeType(param.parameter, type)); - continue; - } - pType = e[param.propertyName].GetType(); - if (pType == type) - { - dynamicData.Add(param.propertyName, e[param.propertyName]); - } - else - { - if (type == typeof(EntityTypes.Integer)) - dynamicData.Add(param.propertyName, (int)e[param.propertyName]); - else if (type == typeof(EntityTypes.Float)) - dynamicData.Add(param.propertyName, (float)e[param.propertyName]); - else if (type == typeof(EasingFunction.Ease) && pType == typeof(string)) - dynamicData.Add(param.propertyName, Enum.Parse(typeof(EasingFunction.Ease), (string)e[param.propertyName])); - else if (type.IsEnum) - dynamicData.Add(param.propertyName, (int)e[param.propertyName]); - else if (pType == typeof(Newtonsoft.Json.Linq.JObject)) - dynamicData.Add(param.propertyName, e[param.propertyName].ToObject(type)); - else - dynamicData.Add(param.propertyName, Convert.ChangeType(e[param.propertyName], type)); - } - } - else - { - Debug.LogWarning($"Property {param.propertyName} already exists in the entity's dynamic data! Skipping..."); - } - } - } - e.DynamicData = dynamicData; - } - //go thru each property of the model beatmap and add any missing keyvalue pair - foreach (var prop in beatmapModel.properties) - { - if (!properties.ContainsKey(prop.Key)) - { - properties.Add(prop.Key, prop.Value); - } - } - } - - private string DisplayName(string name) - { - // "gameName" -> "Game Name" - // "action name" -> "Action Name" - if (!name.Contains(" ")) - name = SplitCamelCase(name); - System.Globalization.TextInfo textInfo = new System.Globalization.CultureInfo("en-US", false).TextInfo; - return textInfo.ToTitleCase(name); - } - - // https://stackoverflow.com/a/5796793 - public static string SplitCamelCase(string str) - { - return Regex.Replace( - Regex.Replace( - str, - @"(\P{Ll})(\P{Ll}\p{Ll})", - "$1 $2" - ), - @"(\p{Ll})(\P{Ll})", - "$1 $2" - ); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs.meta b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs.meta deleted file mode 100644 index d1fd7530..00000000 --- a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ca2149f692fc3d84ba6526d33c132822 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Common/SoundSequence.cs b/Assets/Scripts/Common/SoundSequence.cs index ffd85f59..0ce2f8e2 100644 --- a/Assets/Scripts/Common/SoundSequence.cs +++ b/Assets/Scripts/Common/SoundSequence.cs @@ -26,7 +26,7 @@ namespace HeavenStudio.Util this.clips = new List(clips); } - public MultiSound Play(float startBeat, params SequenceParams[] args) + public MultiSound Play(double startBeat, params SequenceParams[] args) { List sounds = new List(); Dictionary paramMaps = new Dictionary(); @@ -34,11 +34,11 @@ namespace HeavenStudio.Util foreach (SequenceClip clipdat in clips) { string clip = clipdat.clip; - float beat = clipdat.beat; + double beat = clipdat.beat; float pitch = clipdat.pitch; float volume = clipdat.volume; bool looping = clipdat.looping; - float offset = clipdat.offset; + double offset = clipdat.offset; if (args != null && clipdat.parameters != null && clipdat.parameters.Length > 0) { paramMaps.Clear(); diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs index 2e76614c..e03044db 100644 --- a/Assets/Scripts/Conductor.cs +++ b/Assets/Scripts/Conductor.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using UnityEngine; using Starpelly; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio { @@ -14,10 +16,12 @@ namespace HeavenStudio public float songBpm; // The number of seconds for each song beat - public float secPerBeat; + public float secPerBeat => (float)secPerBeatAsDouble; + public double secPerBeatAsDouble; // The number of seconds for each song beat, inversely scaled to song pitch (higer pitch = shorter time) - public float pitchedSecPerBeat => (secPerBeat / SongPitch); + public float pitchedSecPerBeat => (float)pitchedSecPerBeatAsDouble; + public double pitchedSecPerBeatAsDouble => (secPerBeat / SongPitch); // Current song position, in seconds private double songPos; // for Conductor use only @@ -31,12 +35,14 @@ namespace HeavenStudio // Current time of the song private double time; - - double lastAbsTime; + double dspTime, lastDspTime; + double absTime, lastAbsTime; // the dspTime we started at - private double dspStartTime; - public double dspStartTimeAsDouble => dspStartTime; + private double dspStart; + private float dspStartTime => (float)dspStart; + public double dspStartTimeAsDouble => dspStart; + DateTime startTime; //the beat we started at private double startBeat; @@ -46,7 +52,7 @@ namespace HeavenStudio public AudioSource musicSource; // The offset to the first beat of the song in seconds - public float firstBeatOffset; + public double firstBeatOffset; // Conductor instance public static Conductor instance; @@ -58,7 +64,7 @@ namespace HeavenStudio public bool isPaused; // Last reported beat based on song position - private float lastReportedBeat = 0f; + private double lastReportedBeat = 0f; // Metronome tick sound enabled public bool metronome = false; @@ -68,6 +74,8 @@ namespace HeavenStudio private float timelinePitch = 1f; private float minigamePitch = 1f; public float SongPitch { get => isPaused ? 0f : (timelinePitch * minigamePitch); } + private float musicScheduledPitch = 1f; + private double musicScheduledTime = 0; public void SetTimelinePitch(float pitch) { @@ -105,84 +113,60 @@ namespace HeavenStudio public void Play(double beat) { + if (isPlaying) return; + var chart = GameManager.instance.Beatmap; + double offset = chart.data.offset; + bool negativeOffset = offset < 0; + double dspTime = AudioSettings.dspTime; GameManager.instance.SortEventsList(); - bool negativeOffset = firstBeatOffset < 0f; - bool negativeStartTime = false; - // Debug.Log("starting playback @ beat " + beat + ", offset is " + firstBeatOffset); + double startPos = GetSongPosFromBeat(beat); + time = startPos; - var startPos = GetSongPosFromBeat(beat); - if (negativeOffset) + if (musicSource.clip != null && startPos < musicSource.clip.length - offset) { - time = startPos; - } - else - { - negativeStartTime = startPos - firstBeatOffset < 0f; - - if (negativeStartTime) - time = startPos - firstBeatOffset; + // https://www.desmos.com/calculator/81ywfok6xk + double musicStartDelay = -offset - startPos; + if (musicStartDelay > 0) + { + musicSource.time = 0; + // this can break if the user changes pitch before the audio starts playing + musicScheduledTime = dspTime + musicStartDelay / SongPitch; + musicScheduledPitch = SongPitch; + musicSource.PlayScheduled(musicScheduledTime); + } else - time = startPos; + { + musicSource.time = (float)-musicStartDelay; + musicSource.PlayScheduled(dspTime); + } } - - //TODO: make this take into account past tempo changes - songPosBeat = GetBeatFromSongPos(time - firstBeatOffset); - // Debug.Log("corrected starting playback @ beat " + songPosBeat); + songPosBeat = GetBeatFromSongPos(time); + startTime = DateTime.Now; + lastAbsTime = (DateTime.Now - startTime).TotalSeconds; + lastDspTime = AudioSettings.dspTime; + dspStart = dspTime; + startBeat = songPosBeat; + isPlaying = true; isPaused = false; - - if (SongPosLessThanClipLength(startPos)) - { - if (negativeOffset) - { - var musicStartTime = startPos + firstBeatOffset; - - if (musicStartTime < 0f) - { - musicSource.time = (float) startPos; - musicSource.PlayScheduled(AudioSettings.dspTime - firstBeatOffset / SongPitch); - } - else - { - musicSource.time = (float) musicStartTime; - musicSource.PlayScheduled(AudioSettings.dspTime); - } - } - else - { - if (negativeStartTime) - { - musicSource.time = (float) startPos; - } - else - { - musicSource.time = (float) startPos + firstBeatOffset; - } - - musicSource.PlayScheduled(AudioSettings.dspTime); - } - } - lastAbsTime = Time.realtimeSinceStartupAsDouble; - dspStartTime = AudioSettings.dspTime; - startBeat = beat; - - // GameManager.instance.SetCurrentEventToClosest(songPositionInBeats); } public void Pause() { + if (!isPlaying) return; isPlaying = false; isPaused = true; musicSource.Pause(); } - public void Stop(float time) + public void Stop(double time) { this.time = time; + songPos = time; songPosBeat = 0; isPlaying = false; @@ -190,31 +174,61 @@ namespace HeavenStudio musicSource.Stop(); } - float test; + double deltaTimeReal { get { + double ret = absTime - lastAbsTime; + lastAbsTime = absTime; + return ret; + }} + + double deltaTimeDsp { get { + double ret = dspTime - lastDspTime; + lastDspTime = dspTime; + return ret; + }} + public void Update() { if (isPlaying) { - double absTime = Time.realtimeSinceStartupAsDouble; - double dt = (absTime - lastAbsTime) * SongPitch; - lastAbsTime = absTime; + if (AudioSettings.dspTime < musicScheduledTime && musicScheduledPitch != SongPitch) + { + if (SongPitch == 0f) + { + musicSource.Pause(); + } + else + { + if (musicScheduledPitch == 0f) + musicSource.UnPause(); + musicScheduledPitch = SongPitch; - time += dt; + musicScheduledTime = (AudioSettings.dspTime + (-GameManager.instance.Beatmap.data.offset - songPositionAsDouble)/(double)SongPitch); + musicSource.SetScheduledStartTime(musicScheduledTime); + } + } + + absTime = (DateTime.Now - startTime).TotalSeconds; + dspTime = AudioSettings.dspTime - dspStart; + double dt = deltaTimeReal; + + //todo: dspTime to sync with audio thread in case of drift + + time += dt * SongPitch; songPos = time; - songPosBeat = GetBeatFromSongPos(songPos - firstBeatOffset); } } + public void LateUpdate() { if (metronome && isPlaying) { if (ReportBeat(ref lastReportedBeat)) { - metronomeSound = Util.Jukebox.PlayOneShot("metronome", lastReportedBeat); + metronomeSound = Util.SoundByte.PlayOneShot("metronome", lastReportedBeat); } else if (songPositionInBeats < lastReportedBeat) { @@ -231,7 +245,7 @@ namespace HeavenStudio } } - public bool ReportBeat(ref float lastReportedBeat, float offset = 0, bool shiftBeatToOffset = true) + public bool ReportBeat(ref double lastReportedBeat, double offset = 0, bool shiftBeatToOffset = true) { bool result = songPositionInBeats + (shiftBeatToOffset ? offset : 0f) >= (lastReportedBeat) + 1f; if (result) @@ -250,15 +264,15 @@ namespace HeavenStudio return Mathf.Repeat((songPositionInBeats / length) + beatOffset, 1); } - public float GetPositionFromBeat(float startBeat, float length) + public float GetPositionFromBeat(double startBeat, double length) { - float a = Mathp.Normalize(songPositionInBeats, startBeat, startBeat + length); + float a = Mathp.Normalize(songPositionInBeats, (float)startBeat, (float)(startBeat + length)); return a; } public float GetBeatFromPosition(float position, float startBeat, float length) { - return Mathp.DeNormalize(position, startBeat, startBeat + length); + return Mathp.DeNormalize(position, (float)startBeat, (float)(startBeat + length)); } public float GetPositionFromMargin(float targetBeat, float margin) @@ -271,26 +285,26 @@ namespace HeavenStudio return GetBeatFromPosition(position, targetBeat - margin, margin); } - private List GetSortedTempoChanges(DynamicBeatmap chart) + private List GetSortedTempoChanges() { GameManager.instance.SortEventsList(); - return GameManager.instance.Beatmap.tempoChanges; + return GameManager.instance.Beatmap.TempoChanges; } - public float GetBpmAtBeat(float beat) + public float GetBpmAtBeat(double beat) { var chart = GameManager.instance.Beatmap; - if (chart.tempoChanges.Count == 0) - return chart.bpm; - float bpm = chart.bpm; + if (chart.TempoChanges.Count == 0) + return 120f; + float bpm = chart.TempoChanges[0]["tempo"]; - foreach (DynamicBeatmap.TempoChange t in chart.tempoChanges) + foreach (RiqEntity t in chart.TempoChanges) { if (t.beat > beat) { break; } - bpm = t.tempo; + bpm = t["tempo"]; } return bpm; @@ -299,13 +313,13 @@ namespace HeavenStudio public double GetSongPosFromBeat(double beat) { var chart = GameManager.instance.Beatmap; - float bpm = chart.bpm; + float bpm = 120f; double counter = 0f; - float lastTempoChangeBeat = 0f; + double lastTempoChangeBeat = 0f; - foreach (DynamicBeatmap.TempoChange t in chart.tempoChanges) + foreach (RiqEntity t in chart.TempoChanges) { if (t.beat > beat) { @@ -313,7 +327,7 @@ namespace HeavenStudio } counter += (t.beat - lastTempoChangeBeat) * 60/bpm; - bpm = t.tempo; + bpm = t["tempo"]; lastTempoChangeBeat = t.beat; } @@ -336,9 +350,9 @@ namespace HeavenStudio { double lastTempoChangeBeat = 0f; double counterSeconds = -firstBeatOffset; - float lastBpm = GameManager.instance.Beatmap.bpm; + float lastBpm = 120f; - foreach (DynamicBeatmap.TempoChange t in GameManager.instance.Beatmap.tempoChanges) + foreach (RiqEntity t in GameManager.instance.Beatmap.TempoChanges) { double beatToNext = t.beat - lastTempoChangeBeat; double secToNext = BeatsToSecs(beatToNext, lastBpm); @@ -348,7 +362,7 @@ namespace HeavenStudio break; lastTempoChangeBeat = t.beat; - lastBpm = t.tempo; + lastBpm = t["tempo"]; counterSeconds = nextSecs; } return lastTempoChangeBeat + SecsToBeats(seconds - counterSeconds, lastBpm); @@ -356,7 +370,7 @@ namespace HeavenStudio // // convert real seconds to beats - public float GetRestFromRealTime(float seconds) + public double GetRestFromRealTime(double seconds) { return seconds/pitchedSecPerBeat; } @@ -364,7 +378,7 @@ namespace HeavenStudio public void SetBpm(float bpm) { this.songBpm = bpm; - secPerBeat = 60f / songBpm; + secPerBeatAsDouble = 60.0 / songBpm; } public void SetVolume(float percent) @@ -374,22 +388,19 @@ namespace HeavenStudio public float SongLengthInBeats() { - if (!musicSource.clip) return 0; - return (float) GetBeatFromSongPos(musicSource.clip.length); + return (float)SongLengthInBeatsAsDouble(); } - public bool SongPosLessThanClipLength(float t) + public double SongLengthInBeatsAsDouble() { - if (musicSource.clip != null) - return t < musicSource.clip.length; - else - return false; + if (!musicSource.clip) return 0; + return GetBeatFromSongPos(musicSource.clip.length - firstBeatOffset); } public bool SongPosLessThanClipLength(double t) { if (musicSource.clip != null) - return t < musicSource.clip.length; + return t < musicSource.clip.length - firstBeatOffset; else return false; } diff --git a/Assets/Scripts/DebugUI.cs b/Assets/Scripts/DebugUI.cs index 349d667a..6d8f61fd 100644 --- a/Assets/Scripts/DebugUI.cs +++ b/Assets/Scripts/DebugUI.cs @@ -65,12 +65,12 @@ namespace HeavenStudio int minus = 0; - if (GameManager.instance.Beatmap.entities.Count > 0) + if (GameManager.instance.Beatmap.Entities.Count > 0) { if (GameManager.instance.currentEvent - 1 >= 0) minus = 1; - SetText(currEvent, $"CurrentEvent: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - minus].datamodel}"); - SetText(eventLength, $"Event Length: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - minus].length}"); + SetText(currEvent, $"CurrentEvent: {GameManager.instance.Beatmap.Entities[GameManager.instance.currentEvent - minus].datamodel}"); + SetText(eventLength, $"Event Length: {GameManager.instance.Beatmap.Entities[GameManager.instance.currentEvent - minus].length}"); } } diff --git a/Assets/Scripts/EventCaller.cs b/Assets/Scripts/EventCaller.cs index 7e0d896b..f2a4ee83 100644 --- a/Assets/Scripts/EventCaller.cs +++ b/Assets/Scripts/EventCaller.cs @@ -3,13 +3,15 @@ using System.Linq; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio { public class EventCaller : MonoBehaviour { public Transform GamesHolder; - public DynamicBeatmap.DynamicEntity currentEntity = new DynamicBeatmap.DynamicEntity(); + public RiqEntity currentEntity = new RiqEntity(); public string currentSwitchGame; public delegate void EventCallback(); @@ -37,15 +39,15 @@ namespace HeavenStudio { instance = this; - currentEntity = new DynamicBeatmap.DynamicEntity(); + currentEntity = new RiqEntity(); Minigames.Init(this); List minigamesInBeatmap = new List(); - for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++) + for (int i = 0; i < GameManager.instance.Beatmap.Entities.Count; i++) { //go through every entity in the timeline and add the game that they're from to the minigamesInBeatmap list (ignore entities from FX only categories, i.e. Game Manager and Count-Ins) - Minigames.Minigame game = GetMinigame(GameManager.instance.Beatmap.entities[i].datamodel.Split('/')[0]); + Minigames.Minigame game = GetMinigame(GameManager.instance.Beatmap.Entities[i].datamodel.Split('/')[0]); if (!minigamesInBeatmap.Contains(game) && !FXOnlyGames().Contains(game)) { minigamesInBeatmap.Add(game); @@ -63,7 +65,7 @@ namespace HeavenStudio } - public void CallEvent(DynamicBeatmap.DynamicEntity entity, bool gameActive) + public void CallEvent(RiqEntity entity, bool gameActive) { string[] details = entity.datamodel.Split('/'); Minigames.Minigame game = minigames.Find(c => c.name == details[0]); @@ -89,7 +91,7 @@ namespace HeavenStudio } } - public void CallPreEvent(DynamicBeatmap.DynamicEntity entity) + public void CallPreEvent(RiqEntity entity) { string[] details = entity.datamodel.Split('/'); Minigames.Minigame game = minigames.Find(c => c.name == details[0]); @@ -106,10 +108,10 @@ namespace HeavenStudio } } - public static List GetAllInGameManagerList(string gameName, string[] include) + public static List GetAllInGameManagerList(string gameName, string[] include) { - List temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); - List temp2 = new List(); + List temp1 = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); + List temp2 = new List(); foreach (string s in include) { temp2.AddRange(temp1.FindAll(c => c.datamodel.Split('/')[1].Equals(s))); @@ -117,10 +119,10 @@ namespace HeavenStudio return temp2; } - public static List GetAllInGameManagerListExclude(string gameName, string[] exclude) + public static List GetAllInGameManagerListExclude(string gameName, string[] exclude) { - List temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); - List temp2 = new List(); + List temp1 = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); + List temp2 = new List(); foreach (string s in exclude) { temp2.AddRange(temp1.FindAll(c => !c.datamodel.Split('/')[1].Equals(s))); diff --git a/Assets/Scripts/GameCamera.cs b/Assets/Scripts/GameCamera.cs index ea189817..6bb41578 100644 --- a/Assets/Scripts/GameCamera.cs +++ b/Assets/Scripts/GameCamera.cs @@ -4,6 +4,8 @@ using UnityEngine; using HeavenStudio.Util; using System.Linq; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio { @@ -20,9 +22,9 @@ namespace HeavenStudio Z } - private List positionEvents = new List(); - private List rotationEvents = new List(); - private List shakeEvents = new List(); + private List positionEvents = new(); + private List rotationEvents = new(); + private List shakeEvents = new(); /** default cam position, for quick-resetting @@ -77,7 +79,7 @@ namespace HeavenStudio rotEluerLast = defaultRotEluer; } - public void OnBeatChanged(float beat) + public void OnBeatChanged(double beat) { ResetTransforms(); ResetAdditionalTransforms(); @@ -128,7 +130,7 @@ namespace HeavenStudio float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); if (prog >= 0f) { - EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); switch (e["axis"]) { case (int) CameraAxis.X: @@ -176,7 +178,7 @@ namespace HeavenStudio float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); if (prog >= 0f) { - EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); switch (e["axis"]) { case (int) CameraAxis.X: diff --git a/Assets/Scripts/GameInitializer.cs b/Assets/Scripts/GameInitializer.cs index d49df501..99868746 100644 --- a/Assets/Scripts/GameInitializer.cs +++ b/Assets/Scripts/GameInitializer.cs @@ -9,6 +9,8 @@ using System.Text; using UnityEngine; using UnityEngine.Audio; +using Jukebox; + namespace HeavenStudio { public class GameInitializer : MonoBehaviour @@ -34,9 +36,6 @@ namespace HeavenStudio public bool playOnStart = false; public bool fromCmd = false; - string json = ""; - string ext = ""; - private void Start() { string input = ""; @@ -98,11 +97,8 @@ namespace HeavenStudio if (editorGO == null) { - OpenCmdRemix(input); - Debug.Log(json); - gameManager.txt = json; - gameManager.ext = ext; - gameManager.Init(); + bool success = OpenCmdRemix(input); + gameManager.Init(success); } else { @@ -110,44 +106,18 @@ namespace HeavenStudio } } - public void OpenCmdRemix(string path) + public bool OpenCmdRemix(string path) { - if (path == string.Empty) return; - if (!File.Exists(path)) return; - byte[] MusicBytes; - bool loadedMusic = false; - string extension = path.GetExtension(); - - using var zipFile = File.Open(path, FileMode.Open); - using var archive = new ZipArchive(zipFile, ZipArchiveMode.Read); - - foreach (var entry in archive.Entries) - switch (entry.Name) - { - case "remix.json": - { - using var stream = entry.Open(); - using var reader = new StreamReader(stream); - json = reader.ReadToEnd(); - ext = extension; - break; - } - case "song.ogg": - { - using var stream = entry.Open(); - using var memoryStream = new MemoryStream(); - stream.CopyTo(memoryStream); - MusicBytes = memoryStream.ToArray(); - Conductor.instance.musicSource.clip = OggVorbis.VorbisPlugin.ToAudioClip(MusicBytes, "music"); - loadedMusic = true; - break; - } - } - - if (!loadedMusic) + try { - Conductor.instance.musicSource.clip = null; - MusicBytes = null; + string tmpDir = RiqFileHandler.ExtractRiq(path); + Debug.Log("Imported RIQ successfully!"); + return true; + } + catch (System.Exception e) + { + Debug.Log($"Error importing RIQ: {e.Message}"); + return false; } } } diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 8ece022b..135e8fb8 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -5,6 +5,8 @@ using System.Linq; using UnityEngine; using Starpelly; +using Jukebox; +using Jukebox.Legacy; using Newtonsoft.Json; using HeavenStudio.Games; using HeavenStudio.Common; @@ -14,7 +16,7 @@ namespace HeavenStudio public class GameManager : MonoBehaviour { [Header("Lists")] - [NonSerialized] public DynamicBeatmap Beatmap = new DynamicBeatmap(); + [NonSerialized] public RiqBeatmap Beatmap = new(); private List preloadedGames = new List(); [NonSerialized] public List SoundObjects = new List(); @@ -35,22 +37,22 @@ namespace HeavenStudio [NonSerialized] public int currentEvent, currentTempoEvent, currentVolumeEvent, currentSectionEvent, currentPreEvent, currentPreSwitch, currentPreSequence; - [NonSerialized] public float endBeat; + [NonSerialized] public double endBeat; [NonSerialized] public float startOffset; [NonSerialized] public bool playOnStart; - [NonSerialized] public float startBeat; + [NonSerialized] public double startBeat; [NonSerialized] public GameObject currentGameO; [NonSerialized] public bool autoplay; [NonSerialized] public bool canInput = true; - [NonSerialized] public DynamicBeatmap.ChartSection currentSection, nextSection; - public float sectionProgress { get; private set; } + [NonSerialized] public RiqEntity currentSection, nextSection; + public double sectionProgress { get; private set; } - public event Action onBeatChanged; - public event Action onSectionChange; + public event Action onBeatChanged; + public event Action onSectionChange; public int BeatmapEntities() { - return Beatmap.entities.Count + Beatmap.tempoChanges.Count + Beatmap.volumeChanges.Count + Beatmap.beatmapSections.Count; + return Beatmap.Entities.Count + Beatmap.TempoChanges.Count + Beatmap.VolumeChanges.Count + Beatmap.SectionMarkers.Count; } public static GameManager instance { get; private set; } @@ -101,7 +103,7 @@ namespace HeavenStudio instance = this; } - public void Init() + public void Init(bool preLoaded = false) { currentPreEvent= 0; currentPreSwitch = 0; @@ -113,9 +115,9 @@ namespace HeavenStudio eventCaller = this.gameObject.AddComponent(); eventCaller.GamesHolder = GamesHolder.transform; eventCaller.Init(); - Conductor.instance.SetBpm(Beatmap.bpm); - Conductor.instance.SetVolume(Beatmap.musicVolume); - Conductor.instance.firstBeatOffset = Beatmap.firstBeatOffset; + Conductor.instance.SetBpm(120f); + Conductor.instance.SetVolume(100f); + Conductor.instance.firstBeatOffset = Beatmap.data.offset; // note: serialize this shit in the inspector // GameObject textbox = Instantiate(Resources.Load("Prefabs/Common/Textbox")); @@ -134,9 +136,9 @@ namespace HeavenStudio ///// - if (txt != null && ext != null && txt.Length != 0 && ext.Length != 0) + if (preLoaded) { - LoadRemix(txt, ext); + LoadRemix(false); } else { @@ -145,10 +147,10 @@ namespace HeavenStudio SortEventsList(); - if (Beatmap.entities.Count >= 1) + if (Beatmap.Entities.Count >= 1) { - SetCurrentGame(Beatmap.entities[0].datamodel.Split(0)); - SetGame(Beatmap.entities[0].datamodel.Split(0)); + SetCurrentGame(Beatmap.Entities[0].datamodel.Split(0)); + SetGame(Beatmap.Entities[0].datamodel.Split(0)); } else { @@ -163,52 +165,68 @@ namespace HeavenStudio public void NewRemix() { - Beatmap = new DynamicBeatmap(); - Beatmap.bpm = 120f; - Beatmap.musicVolume = 100; - Beatmap.firstBeatOffset = 0f; + Beatmap = new("1", "HeavenStudio"); + Beatmap.data.properties = Minigames.propertiesModel; + Beatmap.AddNewTempoChange(0, 120f); + Beatmap.AddNewVolumeChange(0, 100f); + Beatmap.data.offset = 0f; Conductor.instance.musicSource.clip = null; + RiqFileHandler.WriteRiq(Beatmap); } - public void LoadRemix(string json = "", string type = "riq", int version = 0) + public IEnumerator LoadMusic() { - - if (json != "") + IEnumerator load = RiqFileHandler.LoadSong(); + while (true) { - switch (type) + object current = load.Current; + try { - case "tengoku": - case "rhmania": - Beatmap toConvert = JsonConvert.DeserializeObject(json); - Beatmap = DynamicBeatmap.BeatmapConverter(toConvert); - break; - case "riq": - Beatmap = JsonConvert.DeserializeObject(json); - Beatmap.PostProcess(); - break; - default: - NewRemix(); + if (load.MoveNext() == false) + { break; + } + current = load.Current; } + catch (Exception e) + { + Debug.LogError($"Failed to load music: {e.Message}"); + GlobalGameManager.ShowErrorMessage("Error Loading Music", e.Message + "\n\n" + e.StackTrace); + yield break; + } + yield return current; } - else + Conductor.instance.musicSource.clip = RiqFileHandler.StreamedAudioClip; + } + + public void LoadRemix(bool editor = false) + { + try { - NewRemix(); + Beatmap = RiqFileHandler.ReadRiq(); } + catch (Exception e) + { + Debug.LogError($"Failed to load remix: {e.Message}"); + GlobalGameManager.ShowErrorMessage("Error Loading RIQ", e.Message + "\n\n" + e.StackTrace); + return; + } + if (!editor) + StartCoroutine(LoadMusic()); SortEventsList(); - Conductor.instance.SetBpm(Beatmap.bpm); - Conductor.instance.SetVolume(Beatmap.musicVolume); - Conductor.instance.firstBeatOffset = Beatmap.firstBeatOffset; + Conductor.instance.SetBpm(Beatmap.TempoChanges[0]["tempo"]); + Conductor.instance.SetVolume(Beatmap.VolumeChanges[0]["volume"]); + Conductor.instance.firstBeatOffset = Beatmap.data.offset; if (!playOnStart) { Stop(0); } SetCurrentEventToClosest(0); - if (Beatmap.entities.Count >= 1) + if (Beatmap.Entities.Count >= 1) { - SetCurrentGame(Beatmap.entities[0].datamodel.Split(0)); - SetGame(Beatmap.entities[0].datamodel.Split(0)); + SetCurrentGame(Beatmap.Entities[0].datamodel.Split(0)); + SetGame(Beatmap.Entities[0].datamodel.Split(0)); } else { @@ -241,14 +259,14 @@ namespace HeavenStudio { //seek ahead to preload games that have assetbundles //check game switches first - var gameSwitchs = Beatmap.entities.FindAll(c => c.datamodel.Split(1) == "switchGame"); + var gameSwitchs = Beatmap.Entities.FindAll(c => c.datamodel.Split(1) == "switchGame"); if (currentPreSwitch < gameSwitchs.Count && currentPreSwitch >= 0) { if (start + seekTime >= gameSwitchs[currentPreSwitch].beat) { string gameName = gameSwitchs[currentPreSwitch].datamodel.Split(2); var inf = GetGameInfo(gameName); - if (inf.usesAssetBundle && !inf.AssetsLoaded) + if (inf != null && inf.usesAssetBundle && !inf.AssetsLoaded) { Debug.Log($"ASYNC loading assetbundles for game {gameName}"); StartCoroutine(inf.LoadCommonAssetBundleAsync()); @@ -258,18 +276,18 @@ namespace HeavenStudio } } //then check game entities - List entities = Beatmap.entities.Select(c => c.beat).ToList(); - if (currentPreEvent < Beatmap.entities.Count && currentPreEvent >= 0) + List entities = Beatmap.Entities.Select(c => c.beat).ToList(); + if (currentPreEvent < Beatmap.Entities.Count && currentPreEvent >= 0) { if (start + seekTime >= entities[currentPreEvent]) { - var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentPreEvent].beat && !EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0]))); + var entitiesAtSameBeat = Beatmap.Entities.FindAll(c => c.beat == Beatmap.Entities[currentPreEvent].beat && !EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0]))); SortEventsByPriority(entitiesAtSameBeat); - foreach (DynamicBeatmap.DynamicEntity entity in entitiesAtSameBeat) + foreach (RiqEntity entity in entitiesAtSameBeat) { string gameName = entity.datamodel.Split('/')[0]; var inf = GetGameInfo(gameName); - if (inf.usesAssetBundle && !inf.AssetsLoaded) + if (inf != null && inf.usesAssetBundle && !inf.AssetsLoaded) { Debug.Log($"ASYNC loading assetbundles for game {gameName}"); StartCoroutine(inf.LoadCommonAssetBundleAsync()); @@ -283,33 +301,30 @@ namespace HeavenStudio public void SeekAheadAndDoPreEvent(double start) { - List entities = Beatmap.entities.Select(c => c.beat).ToList(); - if (currentPreSequence < Beatmap.entities.Count && currentPreSequence >= 0) + List entities = Beatmap.Entities.Select(c => c.beat).ToList(); + if (currentPreSequence < Beatmap.Entities.Count && currentPreSequence >= 0) { - var seekEntity = Beatmap.entities[currentPreSequence]; + var seekEntity = Beatmap.Entities[currentPreSequence]; float seekTime = EventCaller.instance.GetGameAction( EventCaller.instance.GetMinigame(seekEntity.datamodel.Split(0)), seekEntity.datamodel.Split(1)).preFunctionLength; if (start + seekTime >= entities[currentPreSequence]) { - float beat = seekEntity.beat; - var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == seekEntity.beat); + double beat = seekEntity.beat; + var entitiesAtSameBeat = Beatmap.Entities.FindAll(c => c.beat == seekEntity.beat); SortEventsByPriority(entitiesAtSameBeat); - foreach (DynamicBeatmap.DynamicEntity entity in entitiesAtSameBeat) + foreach (RiqEntity entity in entitiesAtSameBeat) { currentPreSequence++; string gameName = entity.datamodel.Split('/')[0]; var inf = GetGameInfo(gameName); - if (inf.usesAssetBundle && inf.AssetsLoaded && !inf.SequencesPreloaded) + if (inf != null && inf.usesAssetBundle && inf.AssetsLoaded && !inf.SequencesPreloaded) { Debug.Log($"Preloading game {gameName}"); PreloadGameSequences(gameName); } - else - { - eventCaller.CallPreEvent(entity); - } + eventCaller.CallPreEvent(entity); } } } @@ -323,40 +338,40 @@ namespace HeavenStudio return; Conductor cond = Conductor.instance; - List entities = Beatmap.entities.Select(c => c.beat).ToList(); + List entities = Beatmap.Entities.Select(c => c.beat).ToList(); - List tempoChanges = Beatmap.tempoChanges.Select(c => c.beat).ToList(); - if (currentTempoEvent < Beatmap.tempoChanges.Count && currentTempoEvent >= 0) + List tempoChanges = Beatmap.TempoChanges.Select(c => c.beat).ToList(); + if (currentTempoEvent < Beatmap.TempoChanges.Count && currentTempoEvent >= 0) { if (cond.songPositionInBeatsAsDouble >= tempoChanges[currentTempoEvent]) { - cond.SetBpm(Beatmap.tempoChanges[currentTempoEvent].tempo); + cond.SetBpm(Beatmap.TempoChanges[currentTempoEvent]["tempo"]); currentTempoEvent++; } } - List volumeChanges = Beatmap.volumeChanges.Select(c => c.beat).ToList(); - if (currentVolumeEvent < Beatmap.volumeChanges.Count && currentVolumeEvent >= 0) + List volumeChanges = Beatmap.VolumeChanges.Select(c => c.beat).ToList(); + if (currentVolumeEvent < Beatmap.VolumeChanges.Count && currentVolumeEvent >= 0) { if (cond.songPositionInBeatsAsDouble >= volumeChanges[currentVolumeEvent]) { - cond.SetVolume(Beatmap.volumeChanges[currentVolumeEvent].volume); + cond.SetVolume(Beatmap.VolumeChanges[currentVolumeEvent]["volume"]); currentVolumeEvent++; } } - List chartSections = Beatmap.beatmapSections.Select(c => c.beat).ToList(); - if (currentSectionEvent < Beatmap.beatmapSections.Count && currentSectionEvent >= 0) + List chartSections = Beatmap.SectionMarkers.Select(c => c.beat).ToList(); + if (currentSectionEvent < Beatmap.SectionMarkers.Count && currentSectionEvent >= 0) { if (cond.songPositionInBeatsAsDouble >= chartSections[currentSectionEvent]) { - Debug.Log("Section " + Beatmap.beatmapSections[currentSectionEvent].sectionName + " started"); - currentSection = Beatmap.beatmapSections[currentSectionEvent]; + Debug.Log("Section " + Beatmap.SectionMarkers[currentSectionEvent]["sectionName"] + " started"); + currentSection = Beatmap.SectionMarkers[currentSectionEvent]; currentSectionEvent++; - if (currentSectionEvent < Beatmap.beatmapSections.Count) - nextSection = Beatmap.beatmapSections[currentSectionEvent]; + if (currentSectionEvent < Beatmap.SectionMarkers.Count) + nextSection = Beatmap.SectionMarkers[currentSectionEvent]; else - nextSection = null; + nextSection = default(RiqEntity); onSectionChange?.Invoke(currentSection); } } @@ -367,13 +382,13 @@ namespace HeavenStudio SeekAheadAndDoPreEvent(Conductor.instance.songPositionInBeatsAsDouble); - if (currentEvent < Beatmap.entities.Count && currentEvent >= 0) + if (currentEvent < Beatmap.Entities.Count && currentEvent >= 0) { if (cond.songPositionInBeatsAsDouble >= entities[currentEvent]) { // allows for multiple events on the same beat to be executed on the same frame, so no more 1-frame delay - var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentEvent].beat && !EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0]))); - var fxEntities = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentEvent].beat && EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0]))); + var entitiesAtSameBeat = Beatmap.Entities.FindAll(c => c.beat == Beatmap.Entities[currentEvent].beat && !EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0]))); + var fxEntities = Beatmap.Entities.FindAll(c => c.beat == Beatmap.Entities[currentEvent].beat && EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0]))); SortEventsByPriority(fxEntities); SortEventsByPriority(entitiesAtSameBeat); @@ -385,7 +400,7 @@ namespace HeavenStudio currentEvent++; } - foreach (DynamicBeatmap.DynamicEntity entity in entitiesAtSameBeat) + foreach (RiqEntity entity in entitiesAtSameBeat) { // if game isn't loaded, preload game so whatever event that would be called will still run outside if needed if (entity.datamodel.Split('/')[0] != currentGame) @@ -409,12 +424,12 @@ namespace HeavenStudio } else { - float currectSectionStart = (float)cond.GetSongPosFromBeat(currentSection.beat); + double currectSectionStart = cond.GetSongPosFromBeat(currentSection.beat); - if (nextSection == null) - sectionProgress = (cond.songPosition - currectSectionStart) / ((float)cond.GetSongPosFromBeat(endBeat) - currectSectionStart); + if (nextSection == null) + sectionProgress = (cond.songPosition - currectSectionStart) / (cond.GetSongPosFromBeat(endBeat) - currectSectionStart); else - sectionProgress = (cond.songPosition - currectSectionStart) / ((float)cond.GetSongPosFromBeat(nextSection.beat) - currectSectionStart); + sectionProgress = (cond.songPosition - currectSectionStart) / (cond.GetSongPosFromBeat(nextSection.beat) - currectSectionStart); } } @@ -429,7 +444,7 @@ namespace HeavenStudio #region Play Events - public void Play(float beat, float delay = 0f) + public void Play(double beat, float delay = 0f) { bool paused = Conductor.instance.isPaused; Debug.Log("Playing at " + beat); @@ -457,7 +472,7 @@ namespace HeavenStudio onBeatChanged?.Invoke(beat); } - private IEnumerator PlayCo(float beat, float delay = 0f) + private IEnumerator PlayCo(double beat, float delay = 0f) { yield return new WaitForSeconds(delay); bool paused = Conductor.instance.isPaused; @@ -465,13 +480,13 @@ namespace HeavenStudio Conductor.instance.Play(beat); if (paused) { - Util.Jukebox.UnpauseOneShots(); + Util.SoundByte.UnpauseOneShots(); } else { - Conductor.instance.SetBpm(Beatmap.bpm); - Conductor.instance.SetVolume(Beatmap.musicVolume); - Conductor.instance.firstBeatOffset = Beatmap.firstBeatOffset; + Conductor.instance.SetBpm(Beatmap.TempoChanges[0]["tempo"]); + Conductor.instance.SetVolume(Beatmap.VolumeChanges[0]["volume"]); + Conductor.instance.firstBeatOffset = Beatmap.data.offset; SetCurrentEventToClosest(beat); KillAllSounds(); } @@ -484,11 +499,11 @@ namespace HeavenStudio public void Pause() { Conductor.instance.Pause(); - Util.Jukebox.PauseOneShots(); + Util.SoundByte.PauseOneShots(); canInput = false; } - public void Stop(float beat, bool restart = false, float restartDelay = 0f) + public void Stop(double beat, bool restart = false, float restartDelay = 0f) { Minigame miniGame = currentGameO.GetComponent(); if (miniGame != null) @@ -509,7 +524,7 @@ namespace HeavenStudio Debug.Log($"== Playthrough statistics of {Beatmap["remixtitle"]} (played at {System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}) =="); Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms"); Debug.Log($"Accuracy for playthrough: {(PlayerAccuracy * 100) : 0.00}"); - Debug.Log($"Cleared {clearedSections.FindAll(c => c).Count} sections out of {Beatmap.beatmapSections.Count}"); + Debug.Log($"Cleared {clearedSections.FindAll(c => c).Count} sections out of {Beatmap.SectionMarkers.Count}"); if (SkillStarManager.instance.IsCollected) Debug.Log($"Skill Star collected"); else @@ -524,12 +539,14 @@ namespace HeavenStudio // when rating screen gets added playOnStart will instead move to that scene } - private IEnumerator WaitReadyAndPlayCo(float beat) + private IEnumerator WaitReadyAndPlayCo(double beat) { // wait for overlays to be ready yield return new WaitUntil(() => OverlaysManager.OverlaysReady); // wait for first game to be loaded - yield return new WaitUntil(() => Beatmap != null && Beatmap.entities.Count > 0); + yield return new WaitUntil(() => Beatmap != null && Beatmap.Entities.Count > 0); + //wait for audio clip to be loaded + yield return new WaitUntil(() => Conductor.instance.musicSource.clip != null); SkillStarManager.instance.KillStar(); TimingAccuracyDisplay.instance.StopStarFlash(); @@ -547,7 +564,7 @@ namespace HeavenStudio Destroy(SoundObjects[i].gameObject); SoundObjects.Clear(); - Util.Jukebox.KillOneShots(); + Util.SoundByte.KillOneShots(); } #endregion @@ -556,12 +573,13 @@ namespace HeavenStudio public void SortEventsList() { - Beatmap.entities.Sort((x, y) => x.beat.CompareTo(y.beat)); - Beatmap.tempoChanges.Sort((x, y) => x.beat.CompareTo(y.beat)); - Beatmap.volumeChanges.Sort((x, y) => x.beat.CompareTo(y.beat)); + Beatmap.Entities.Sort((x, y) => x.beat.CompareTo(y.beat)); + Beatmap.TempoChanges.Sort((x, y) => x.beat.CompareTo(y.beat)); + Beatmap.VolumeChanges.Sort((x, y) => x.beat.CompareTo(y.beat)); + Beatmap.SectionMarkers.Sort((x, y) => x.beat.CompareTo(y.beat)); } - void SortEventsByPriority(List entities) + void SortEventsByPriority(List entities) { entities.Sort((x, y) => { Minigames.Minigame xGame = EventCaller.instance.GetMinigame(x.datamodel.Split(0)); @@ -574,25 +592,33 @@ namespace HeavenStudio } - public void SetCurrentEventToClosest(float beat) + public static double GetClosestInList(List list, double compareTo) + { + if (list.Count > 0) + return list.Aggregate((x, y) => Math.Abs(x - compareTo) < Math.Abs(y - compareTo) ? x : y); + else + return double.MinValue; + } + + public void SetCurrentEventToClosest(double beat) { SortEventsList(); onBeatChanged?.Invoke(beat); - if (Beatmap.entities.Count > 0) + if (Beatmap.Entities.Count > 0) { - List entities = Beatmap.entities.Select(c => c.beat).ToList(); + List entities = Beatmap.Entities.Select(c => c.beat).ToList(); - currentEvent = entities.IndexOf(Mathp.GetClosestInList(entities, beat)); - currentPreEvent = entities.IndexOf(Mathp.GetClosestInList(entities, beat)); - currentPreSequence = entities.IndexOf(Mathp.GetClosestInList(entities, beat)); + currentEvent = entities.IndexOf(GetClosestInList(entities, beat)); + currentPreEvent = entities.IndexOf(GetClosestInList(entities, beat)); + currentPreSequence = entities.IndexOf(GetClosestInList(entities, beat)); - var gameSwitchs = Beatmap.entities.FindAll(c => c.datamodel.Split(1) == "switchGame"); + var gameSwitchs = Beatmap.Entities.FindAll(c => c.datamodel.Split(1) == "switchGame"); - string newGame = Beatmap.entities[currentEvent].datamodel.Split(0); + string newGame = Beatmap.Entities[currentEvent].datamodel.Split(0); if (gameSwitchs.Count > 0) { - int index = gameSwitchs.FindIndex(c => c.beat == Mathp.GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat)); + int index = gameSwitchs.FindIndex(c => c.beat == GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat)); currentPreSwitch = index; var closestGameSwitch = gameSwitchs[index]; if (closestGameSwitch.beat <= beat) @@ -603,7 +629,7 @@ namespace HeavenStudio { if (index == 0) { - newGame = Beatmap.entities[0].datamodel.Split(0); + newGame = Beatmap.Entities[0].datamodel.Split(0); } else { @@ -613,7 +639,7 @@ namespace HeavenStudio } else { - newGame = Beatmap.entities[Beatmap.entities.IndexOf(closestGameSwitch) - 1].datamodel.Split(0); + newGame = Beatmap.Entities[Beatmap.Entities.IndexOf(closestGameSwitch) - 1].datamodel.Split(0); } } } @@ -625,22 +651,22 @@ namespace HeavenStudio SetGame(newGame); } - List allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "end" }); + List allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "end" }); if (allEnds.Count > 0) endBeat = allEnds.Select(c => c.beat).Min(); else - endBeat = Conductor.instance.SongLengthInBeats(); + endBeat = Conductor.instance.SongLengthInBeatsAsDouble(); } else { SetGame("noGame"); - endBeat = Conductor.instance.SongLengthInBeats(); + endBeat = Conductor.instance.SongLengthInBeatsAsDouble(); } - if (Beatmap.tempoChanges.Count > 0) + if (Beatmap.TempoChanges.Count > 0) { currentTempoEvent = 0; - List tempoChanges = Beatmap.tempoChanges.Select(c => c.beat).ToList(); + List tempoChanges = Beatmap.TempoChanges.Select(c => c.beat).ToList(); //for tempo changes, just go over all of em until the last one we pass for (int t = 0; t < tempoChanges.Count; t++) @@ -655,10 +681,10 @@ namespace HeavenStudio // Debug.Log("currentTempoEvent is now " + currentTempoEvent); } - if (Beatmap.volumeChanges.Count > 0) + if (Beatmap.VolumeChanges.Count > 0) { currentVolumeEvent = 0; - List volumeChanges = Beatmap.volumeChanges.Select(c => c.beat).ToList(); + List volumeChanges = Beatmap.VolumeChanges.Select(c => c.beat).ToList(); for (int t = 0; t < volumeChanges.Count; t++) { @@ -670,12 +696,12 @@ namespace HeavenStudio } } - currentSection = null; - nextSection = null; - if (Beatmap.beatmapSections.Count > 0) + currentSection = default(RiqEntity); + nextSection = default(RiqEntity); + if (Beatmap.SectionMarkers.Count > 0) { currentSectionEvent = 0; - List beatmapSections = Beatmap.beatmapSections.Select(c => c.beat).ToList(); + List beatmapSections = Beatmap.SectionMarkers.Select(c => c.beat).ToList(); for (int t = 0; t < beatmapSections.Count; t++) { @@ -693,7 +719,7 @@ namespace HeavenStudio #endregion - public void SwitchGame(string game, float beat, bool flash) + public void SwitchGame(string game, double beat, bool flash) { if (game != currentGame) { @@ -703,7 +729,7 @@ namespace HeavenStudio } } - IEnumerator SwitchGameIE(string game, float beat, bool flash) + IEnumerator SwitchGameIE(string game, double beat, bool flash) { if(flash == true) { @@ -739,6 +765,7 @@ namespace HeavenStudio { var gameInfo = GetGameInfo(game); //load the games' sound sequences + // TODO: this blocks the main thread, and sound sequences sould be stored in a ScriptableObject if (gameInfo != null && gameInfo.LoadedSoundSequences == null) gameInfo.LoadedSoundSequences = GetGame(game).GetComponent().SoundSequences; } @@ -750,7 +777,7 @@ namespace HeavenStudio { if (gameInfo.fxOnly) { - var gameInfos = Beatmap.entities + var gameInfos = Beatmap.Entities .Select(x => x.datamodel.Split(0)) .Select(x => GetGameInfo(x)) .Where(x => x != null) diff --git a/Assets/Scripts/Games/AirRally/AirRally.cs b/Assets/Scripts/Games/AirRally/AirRally.cs index b087dd82..423c6e42 100644 --- a/Assets/Scripts/Games/AirRally/AirRally.cs +++ b/Assets/Scripts/Games/AirRally/AirRally.cs @@ -87,25 +87,22 @@ namespace HeavenStudio.Games Tween tweenForForth; [Header("Variables")] - public float serveBeat; + public double serveBeat; public bool started; public bool served; bool babum; bool shuttleActive; public bool hasMissed; - public static List queuedVoiceLines = new List(); + public static List queuedVoiceLines = new(); [Header("Waypoint")] public float wayPointZForForth; [Header("Debug")] - public float beatShown; - public float lengthHolder; - public float lengthShown; + public double lengthHolder; + public double lengthShown; public int wantDistance; public bool wantSilent; - public float beatHolder; - public Transform holderPos; void OnDestroy() { @@ -133,11 +130,11 @@ namespace HeavenStudio.Games if(PlayerInput.Pressed() && !IsExpectingInputNow()) { Baxter.GetComponent().Play("Hit"); - Jukebox.PlayOneShotGame("airRally/whooshForth_Close", -1f); + SoundByte.PlayOneShotGame("airRally/whooshForth_Close", -1f); } var cond = Conductor.instance; - var currentBeat = cond.songPositionInBeats; + var currentBeat = cond.songPositionInBeatsAsDouble; var hitBeat = serveBeat; if (started) @@ -190,7 +187,7 @@ namespace HeavenStudio.Games four } - public void ServeObject(float beat, float targetBeat, bool type) + public void ServeObject(double beat, double targetBeat, bool type) { if (!shuttleActive) { @@ -210,7 +207,7 @@ namespace HeavenStudio.Games Forthington.GetComponent().Play("Hit"); } - public void ReturnObject(float beat, float targetBeat, bool type) + public void ReturnObject(double beat, double targetBeat, bool type) { var shuttleScript = ActiveShuttle.GetComponent(); shuttleScript.flyPos = 0f; @@ -220,7 +217,7 @@ namespace HeavenStudio.Games shuttleScript.flyType = type; } - public static void ForthVoice(float beat, int type, int type2) + public static void ForthVoice(double beat, int type, int type2) { if (GameManager.instance.currentGame == "airRally") { @@ -311,17 +308,15 @@ namespace HeavenStudio.Games started = start; } - public void Rally(float beat, bool silent, float length) + public void Rally(double beat, bool silent, double length) { started = true; - beatShown = beat; if (started) { wantSilent = silent; - serveBeat += 2f; + serveBeat += 2.0; lengthHolder = length; - lengthShown += 2f; - beatHolder = beat; + lengthShown += 2.0; BeatAction.New(gameObject, new List() { @@ -336,9 +331,9 @@ namespace HeavenStudio.Games BeatAction.New(gameObject, new List() { new BeatAction.Action(beat, delegate { Baxter.GetComponent().Play("CloseReady"); }), - new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Close"); }), - new BeatAction.Action(beat, delegate { if(!(silent || babum)) { Jukebox.PlayOneShotGame("airRally/nya_Close"); } }), - new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent().Play("Ready"); } }), + new BeatAction.Action(beat, delegate { SoundByte.PlayOneShotGame("airRally/hitForth_Close"); }), + new BeatAction.Action(beat, delegate { if(!(silent || babum)) { SoundByte.PlayOneShotGame("airRally/nya_Close"); } }), + new BeatAction.Action(beat + 1, delegate { if(!babum) { Forthington.GetComponent().Play("Ready"); } }), }); break; @@ -347,9 +342,9 @@ namespace HeavenStudio.Games BeatAction.New(gameObject, new List() { new BeatAction.Action(beat, delegate { Baxter.GetComponent().Play("FarReady"); }), - new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Far"); }), - new BeatAction.Action(beat, delegate { if(!(silent || babum)) { Jukebox.PlayOneShotGame("airRally/nya_Far"); } }), - new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent().Play("Ready"); } }), + new BeatAction.Action(beat, delegate { SoundByte.PlayOneShotGame("airRally/hitForth_Far"); }), + new BeatAction.Action(beat, delegate { if(!(silent || babum)) { SoundByte.PlayOneShotGame("airRally/nya_Far"); } }), + new BeatAction.Action(beat + 1, delegate { if(!babum) { Forthington.GetComponent().Play("Ready"); } }), }); break; @@ -358,9 +353,9 @@ namespace HeavenStudio.Games BeatAction.New(gameObject, new List() { new BeatAction.Action(beat, delegate { Baxter.GetComponent().Play("FarReady"); }), - new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Farther"); }), - new BeatAction.Action(beat, delegate { if(!(silent || babum)) { Jukebox.PlayOneShotGame("airRally/nya_Farther"); } }), - new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent().Play("Ready"); } }), + new BeatAction.Action(beat, delegate { SoundByte.PlayOneShotGame("airRally/hitForth_Farther"); }), + new BeatAction.Action(beat, delegate { if(!(silent || babum)) { SoundByte.PlayOneShotGame("airRally/nya_Farther"); } }), + new BeatAction.Action(beat + 1, delegate { if(!babum) { Forthington.GetComponent().Play("Ready"); } }), }); break; @@ -369,9 +364,9 @@ namespace HeavenStudio.Games BeatAction.New(gameObject, new List() { new BeatAction.Action(beat, delegate { Baxter.GetComponent().Play("FarReady"); }), - new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Farthest"); }), - new BeatAction.Action(beat, delegate { if(!(silent || babum)) { Jukebox.PlayOneShotGame("airRally/nya_Farthest"); } }), - new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent().Play("Ready"); } }), + new BeatAction.Action(beat, delegate { SoundByte.PlayOneShotGame("airRally/hitForth_Farthest"); }), + new BeatAction.Action(beat, delegate { if(!(silent || babum)) { SoundByte.PlayOneShotGame("airRally/nya_Farthest"); } }), + new BeatAction.Action(beat + 1, delegate { if(!babum) { Forthington.GetComponent().Play("Ready"); } }), }); break; } @@ -393,7 +388,7 @@ namespace HeavenStudio.Games } - public void BaBumBumBum(float beat, bool count, int type) + public void BaBumBumBum(double beat, bool count, int type) { //This feels wrong, will keep until I figure out what's wrong babum = true; @@ -518,25 +513,25 @@ namespace HeavenStudio.Games } else { - ReturnObject(Conductor.instance.songPositionInBeats, caller.startBeat + caller.timer + 1f, false); + ReturnObject(Conductor.instance.songPositionInBeatsAsDouble, caller.startBeat + caller.timer + 1f, false); hasMissed = false; ActiveShuttle.GetComponent().DoHit(e_BaBumState); if (e_BaBumState == DistanceSound.close) { - Jukebox.PlayOneShotGame("airRally/hitBaxter_Close"); + SoundByte.PlayOneShotGame("airRally/hitBaxter_Close"); } if (e_BaBumState == DistanceSound.far) { - Jukebox.PlayOneShotGame("airRally/hitBaxter_Far"); + SoundByte.PlayOneShotGame("airRally/hitBaxter_Far"); } if (e_BaBumState == DistanceSound.farther) { - Jukebox.PlayOneShotGame("airRally/hitBaxter_Farther"); + SoundByte.PlayOneShotGame("airRally/hitBaxter_Farther"); } if (e_BaBumState == DistanceSound.farthest) { - Jukebox.PlayOneShotGame("airRally/hitBaxter_Farthest"); + SoundByte.PlayOneShotGame("airRally/hitBaxter_Farthest"); } } served = false; @@ -554,25 +549,25 @@ namespace HeavenStudio.Games } else { - ReturnObject(Conductor.instance.songPositionInBeats, caller.startBeat + caller.timer + 2f, true); + ReturnObject(Conductor.instance.songPositionInBeatsAsDouble, caller.startBeat + caller.timer + 2f, true); hasMissed = false; ActiveShuttle.GetComponent().DoHit(e_BaBumState); if (e_BaBumState == DistanceSound.close) { - Jukebox.PlayOneShotGame("airRally/hitBaxter_Close"); + SoundByte.PlayOneShotGame("airRally/hitBaxter_Close"); } if (e_BaBumState == DistanceSound.far) { - Jukebox.PlayOneShotGame("airRally/hitBaxter_Far"); + SoundByte.PlayOneShotGame("airRally/hitBaxter_Far"); } if (e_BaBumState == DistanceSound.farther) { - Jukebox.PlayOneShotGame("airRally/hitBaxter_Farther"); + SoundByte.PlayOneShotGame("airRally/hitBaxter_Farther"); } if (e_BaBumState == DistanceSound.farthest) { - Jukebox.PlayOneShotGame("airRally/hitBaxter_Farthest"); + SoundByte.PlayOneShotGame("airRally/hitBaxter_Farthest"); } } served = false; diff --git a/Assets/Scripts/Games/AirRally/Shuttlecock.cs b/Assets/Scripts/Games/AirRally/Shuttlecock.cs index f515fdf1..5fd84c32 100644 --- a/Assets/Scripts/Games/AirRally/Shuttlecock.cs +++ b/Assets/Scripts/Games/AirRally/Shuttlecock.cs @@ -15,8 +15,8 @@ namespace HeavenStudio.Games.Scripts_AirRally [SerializeField] float TargetHeightLong; [SerializeField] ParticleSystem hitEffect; - public float startBeat; - public float flyBeats; + public double startBeat; + public double flyBeats; public bool flyType; bool miss = false; @@ -74,7 +74,7 @@ namespace HeavenStudio.Games.Scripts_AirRally if (miss && flyPos > 4f) { - if (cond.GetPositionFromBeat(startBeat, flyBeats + 1f) >= 1f) + if (cond.GetPositionFromBeat(startBeat, flyBeats + 1) >= 1.0) { GameObject.Destroy(gameObject); return; @@ -106,7 +106,7 @@ namespace HeavenStudio.Games.Scripts_AirRally public void DoNearMiss() { miss = true; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); transform.position = PlayerTarget.position; Rigidbody2D rb = GetComponent(); rb.simulated = true; diff --git a/Assets/Scripts/Games/BlueBear/BlueBear.cs b/Assets/Scripts/Games/BlueBear/BlueBear.cs index 3f1351d6..96537091 100644 --- a/Assets/Scripts/Games/BlueBear/BlueBear.cs +++ b/Assets/Scripts/Games/BlueBear/BlueBear.cs @@ -93,7 +93,7 @@ namespace HeavenStudio.Games static int rightCrumbAppearThreshold = 15; static int leftCrumbAppearThreshold = 30; static int eatenTreats = 0; - float emotionStartBeat; + double emotionStartBeat; float emotionLength; string emotionAnimName; bool crying; @@ -216,7 +216,7 @@ namespace HeavenStudio.Games } } - public void SetEmotion(float beat, float length, int emotion) + public void SetEmotion(double beat, float length, int emotion) { switch (emotion) { @@ -270,7 +270,7 @@ namespace HeavenStudio.Games } } - public void SpawnTreat(float beat, bool isCake) + public void SpawnTreat(double beat, bool isCake) { var objectToSpawn = isCake ? cakeBase : donutBase; var newTreat = GameObject.Instantiate(objectToSpawn, foodHolder); @@ -281,7 +281,7 @@ namespace HeavenStudio.Games newTreat.SetActive(true); - Jukebox.PlayOneShotGame(isCake ? "blueBear/cake" : "blueBear/donut"); + SoundByte.PlayOneShotGame(isCake ? "blueBear/cake" : "blueBear/donut"); SquashBag(isCake); } diff --git a/Assets/Scripts/Games/BlueBear/Treat.cs b/Assets/Scripts/Games/BlueBear/Treat.cs index 68246991..b85f2100 100644 --- a/Assets/Scripts/Games/BlueBear/Treat.cs +++ b/Assets/Scripts/Games/BlueBear/Treat.cs @@ -13,10 +13,10 @@ namespace HeavenStudio.Games.Scripts_BlueBear const float rotSpeed = 360f; public bool isCake; - public float startBeat; + public double startBeat; bool flying = true; - float flyBeats; + double flyBeats; [NonSerialized] public BezierCurve3D curve; @@ -59,11 +59,11 @@ namespace HeavenStudio.Games.Scripts_BlueBear if (isCake) { - Jukebox.PlayOneShotGame("blueBear/chompCake"); + SoundByte.PlayOneShotGame("blueBear/chompCake"); } else { - Jukebox.PlayOneShotGame("blueBear/chompDonut"); + SoundByte.PlayOneShotGame("blueBear/chompDonut"); } game.Bite(isCake); diff --git a/Assets/Scripts/Games/BoardMeeting/BMExecutive.cs b/Assets/Scripts/Games/BoardMeeting/BMExecutive.cs index f367a541..405d87cb 100644 --- a/Assets/Scripts/Games/BoardMeeting/BMExecutive.cs +++ b/Assets/Scripts/Games/BoardMeeting/BMExecutive.cs @@ -39,7 +39,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting if (this == game.firstSpinner) anim.DoUnscaledAnimation("Spin", 0); else anim.DoUnscaledAnimation(forceStart ? "Spin" : animToPlay, forceStart ? 0 : game.firstSpinner.anim.GetCurrentAnimatorStateInfo(0).normalizedTime); canBop = false; - Jukebox.PlayOneShotGame("boardMeeting/rollPrepare" + soundToPlay); + SoundByte.PlayOneShotGame("boardMeeting/rollPrepare" + soundToPlay); float offset = 0; switch (soundToPlay) { @@ -55,7 +55,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting offset = 0; break; } - rollLoop = Jukebox.PlayOneShotGame("boardMeeting/roll" + soundToPlay, Conductor.instance.songPositionInBeats + 0.5f - Conductor.instance.GetRestFromRealTime(offset), 1, 1, true); + rollLoop = SoundByte.PlayOneShotGame("boardMeeting/roll" + soundToPlay, Conductor.instance.songPositionInBeatsAsDouble + 0.5f - Conductor.instance.GetRestFromRealTime(offset), 1, 1, true); } public void Stop(bool hit = true) @@ -71,7 +71,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting BeatAction.New(game.gameObject, new List() { - new BeatAction.Action(Conductor.instance.songPositionInBeats + 1.5f, delegate { canBop = true; }) + new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 1.5f, delegate { canBop = true; }) }); } diff --git a/Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs b/Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs index 0a21d06e..13aaa75c 100644 --- a/Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs +++ b/Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs @@ -121,8 +121,8 @@ namespace HeavenStudio.Games if (executives[executiveCount - 1].spinning) { executives[executiveCount - 1].Stop(false); - Jukebox.PlayOneShotGame("boardMeeting/miss"); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShotGame("boardMeeting/miss"); + SoundByte.PlayOneShot("miss"); ScoreMiss(); } } @@ -144,7 +144,7 @@ namespace HeavenStudio.Games } } - public void Bop(float beat, float length, bool goBop, bool autoBop) + public void Bop(double beat, float length, bool goBop, bool autoBop) { shouldBop = autoBop; if (goBop) @@ -162,7 +162,7 @@ namespace HeavenStudio.Games } } - public void AssistantStop(float beat) + public void AssistantStop(double beat) { assistantCanBop = false; string twoSound = "boardMeeting/two"; @@ -199,7 +199,7 @@ namespace HeavenStudio.Games ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustAssistant, MissAssistant, Empty); } - public void Stop(float beat, float length) + public void Stop(double beat, float length) { executivesCanBop = false; List stops = new List(); @@ -213,15 +213,15 @@ namespace HeavenStudio.Games if (executiveCount < 4) ex = 4; if (index < ex - 3) { - Jukebox.PlayOneShotGame("boardMeeting/stopA"); + SoundByte.PlayOneShotGame("boardMeeting/stopA"); } else if (index == ex - 3) { - Jukebox.PlayOneShotGame("boardMeeting/stopB"); + SoundByte.PlayOneShotGame("boardMeeting/stopB"); } else if (index == ex - 2) { - Jukebox.PlayOneShotGame("boardMeeting/stopC"); + SoundByte.PlayOneShotGame("boardMeeting/stopC"); } if (index == executiveCount - 2 && !executives[executiveCount - 1].spinning) @@ -242,16 +242,16 @@ namespace HeavenStudio.Games public void Prepare() { - Jukebox.PlayOneShotGame("boardMeeting/prepare"); + SoundByte.PlayOneShotGame("boardMeeting/prepare"); foreach (var executive in executives) { executive.Prepare(); } } - public void SpinEqui(float beat, float length) + public void SpinEqui(double beat, float length) { - if (chairLoopSound == null) chairLoopSound = Jukebox.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true); + if (chairLoopSound == null) chairLoopSound = SoundByte.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true); firstSpinner = executives[0]; List rolls = new List(); for (int i = 0; i < executiveCount; i++) @@ -287,7 +287,7 @@ namespace HeavenStudio.Games bool forceStart = false; if (chairLoopSound == null) { - chairLoopSound = Jukebox.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true); + chairLoopSound = SoundByte.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true); firstSpinner = executives[start - 1]; forceStart = true; } @@ -367,12 +367,12 @@ namespace HeavenStudio.Games } if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("boardMeeting/missThrough"); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShotGame("boardMeeting/missThrough"); + SoundByte.PlayOneShot("miss"); executives[executiveCount - 1].Stop(false); return; } - Jukebox.PlayOneShotGame("boardMeeting/stopPlayer"); + SoundByte.PlayOneShotGame("boardMeeting/stopPlayer"); executives[executiveCount - 1].Stop(); BeatAction.New(instance.gameObject, new List() { @@ -395,8 +395,8 @@ namespace HeavenStudio.Games } if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("boardMeeting/missThrough"); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShotGame("boardMeeting/missThrough"); + SoundByte.PlayOneShot("miss"); executives[executiveCount - 1].Stop(false); return; } @@ -407,7 +407,7 @@ namespace HeavenStudio.Games Conductor.instance.pitchedSecPerBeat * 0.5f, 18, 1f); executives[executiveCount - 1].Stop(); assistantAnim.DoScaledAnimationAsync("Stop", 0.5f); - Jukebox.PlayOneShotGame("boardMeeting/stopAllPlayer"); + SoundByte.PlayOneShotGame("boardMeeting/stopAllPlayer"); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(caller.timer + caller.startBeat + 1f, delegate @@ -425,8 +425,8 @@ namespace HeavenStudio.Games if (executives[executiveCount - 1].spinning) { executives[executiveCount - 1].Stop(false); - Jukebox.PlayOneShotGame("boardMeeting/missThrough"); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShotGame("boardMeeting/missThrough"); + SoundByte.PlayOneShot("miss"); if (chairLoopSound != null) { chairLoopSound.KillLoop(0); @@ -440,8 +440,8 @@ namespace HeavenStudio.Games if (executives[executiveCount - 1].spinning) { executives[executiveCount - 1].Stop(false); - Jukebox.PlayOneShotGame("boardMeeting/missThrough"); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShotGame("boardMeeting/missThrough"); + SoundByte.PlayOneShot("miss"); if (chairLoopSound != null) { chairLoopSound.KillLoop(0); diff --git a/Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs b/Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs index a8bcdf98..3b95389d 100644 --- a/Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs +++ b/Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs @@ -8,15 +8,15 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS using HeavenStudio.Util; public class Blocks : MonoBehaviour { - public float createBeat; + public double createBeat; public float createLength; public Animator anim; private bool moving = true; private BuiltToScaleDS game; - float windupBeat; - float hitBeat; - float sinkBeat; + double windupBeat; + double hitBeat; + double sinkBeat; private void Awake() { @@ -36,7 +36,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS private void Update() { if (!moving) return; - float currentBeat = Conductor.instance.songPositionInBeats; + double currentBeat = Conductor.instance.songPositionInBeatsAsDouble; var shooterState = game.shooterAnim.GetCurrentAnimatorStateInfo(0); if (currentBeat > windupBeat && currentBeat < hitBeat @@ -66,7 +66,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS private void Miss(PlayerActionEvent caller) { - float sinkBeat = hitBeat + (createLength * 2f); + double sinkBeat = hitBeat + (createLength * 2f); MultiSound.Play( new MultiSound.Sound[] { new MultiSound.Sound("builtToScaleDS/Sink", sinkBeat), @@ -90,7 +90,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS game.SpawnObject(BuiltToScaleDS.BTSObject.HitPieces); Destroy(gameObject); - Jukebox.PlayOneShotGame("builtToScaleDS/Hit"); + SoundByte.PlayOneShotGame("builtToScaleDS/Hit"); } void NearMiss() @@ -102,7 +102,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS game.SpawnObject(BuiltToScaleDS.BTSObject.MissPieces); Destroy(gameObject); - Jukebox.PlayOneShotGame("builtToScaleDS/Crumble"); + SoundByte.PlayOneShotGame("builtToScaleDS/Crumble"); } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs index e0a4f346..388650bb 100644 --- a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs +++ b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs @@ -6,6 +6,7 @@ using DG.Tweening; using System; using HeavenStudio.Util; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -230,15 +231,15 @@ namespace HeavenStudio.Games } } - List spawnedBlockEvents = new List(); + List spawnedBlockEvents = new List(); void Update() { if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused) return; - var currentBeat = Conductor.instance.songPositionInBeats; + var currentBeat = Conductor.instance.songPositionInBeatsAsDouble; - var blockEvents = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "builtToScaleDS/spawn blocks"); + var blockEvents = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel == "builtToScaleDS/spawn blocks"); for (int i = 0; i < blockEvents.Count; i++) { var ev = blockEvents[i]; @@ -278,7 +279,7 @@ namespace HeavenStudio.Games shootingThisFrame = true; Shoot(); SpawnObject(BTSObject.FlyingRod); - Jukebox.PlayOneShotGame("builtToScaleDS/Boing"); + SoundByte.PlayOneShotGame("builtToScaleDS/Boing"); } if (!shootingThisFrame) @@ -292,7 +293,7 @@ namespace HeavenStudio.Games shootingThisFrame = false; } - public void Lights(float beat, float length, bool autoLights, bool shouldLights) + public void Lights(double beat, float length, bool autoLights, bool shouldLights) { autoLight = autoLights; lighting = autoLights || shouldLights; @@ -361,7 +362,7 @@ namespace HeavenStudio.Games firstLight = !firstLight; } - public void SpawnBlocks(float beat, float length) + public void SpawnBlocks(double beat, float length) { var newBlocks = GameObject.Instantiate(movingBlocksBase, blocksHolder).GetComponent(); newBlocks.createBeat = beat; @@ -376,7 +377,7 @@ namespace HeavenStudio.Games const int blockTotalFrames = 80; const int spawnFrameOffset = -3; List criticalFrames = new List { 7, 15, 23, 31, 39, 47 }; - public void SetBlockTime(Blocks blocks, float spawnBeat, float length) + public void SetBlockTime(Blocks blocks, double spawnBeat, float length) { float spawnTimeOffset = (float)spawnFrameOffset / (float)blockFramesPerSecond; @@ -388,7 +389,7 @@ namespace HeavenStudio.Games float speedMult = secondsToHitFrame / secondsToHitBeat; - float secondsPastSpawnTime = secondsPerBeat * (Conductor.instance.songPositionInBeats - spawnBeat) + spawnTimeOffset; + float secondsPastSpawnTime = secondsPerBeat * (Conductor.instance.songPositionInBeats - (float)spawnBeat) + spawnTimeOffset; float framesPastSpawnTime = blockFramesPerSecond * speedMult * secondsPastSpawnTime; // The only way I could deal with Unity's interpolation shenanigans without having a stroke. @@ -434,15 +435,15 @@ namespace HeavenStudio.Games elevatorAnim.Play("MakeRod", 0, 0); } - public void PlayPiano(float beat, float length, int semiTones) + public void PlayPiano(double beat, float length, int semiTones) { - var pianoPitch = Jukebox.GetPitchFromSemiTones(semiTones, true); - var pianoSource = Jukebox.PlayOneShotGame("builtToScaleDS/Piano", -1, pianoPitch, 0.8f, true); + var pianoPitch = SoundByte.GetPitchFromSemiTones(semiTones, true); + var pianoSource = SoundByte.PlayOneShotGame("builtToScaleDS/Piano", -1, pianoPitch, 0.8f, true); pianoSource.SetLoopParams(beat + length, 0.1f); } - public void MultiplePiano(float beat, float length, bool silent, int note1, int note2, int note3, int note4, int note5, int note6) + public void MultiplePiano(double beat, float length, bool silent, int note1, int note2, int note3, int note4, int note5, int note6) { if (silent) return; BeatAction.New(instance.gameObject, new List() diff --git a/Assets/Scripts/Games/CallAndResponseHandler.cs b/Assets/Scripts/Games/CallAndResponseHandler.cs index 20506f31..721af3e0 100644 --- a/Assets/Scripts/Games/CallAndResponseHandler.cs +++ b/Assets/Scripts/Games/CallAndResponseHandler.cs @@ -19,13 +19,13 @@ namespace HeavenStudio.Games } public class CallAndResponseEvent { - public float beat; + public double beat; public float length; - public float relativeBeat; // this beat is relative to the intervalStartBeat + public double relativeBeat; // this beat is relative to the intervalStartBeat public Dictionary DynamicData; //if you need more properties for your queued event public string tag; - public CallAndResponseEvent(float beat, float relativeBeat, string tag, float length = 0) + public CallAndResponseEvent(double beat, double relativeBeat, string tag, float length = 0) { this.beat = beat; this.length = length; @@ -73,7 +73,7 @@ namespace HeavenStudio.Games } } - public float intervalStartBeat = -1; // the first beat of the interval + public double intervalStartBeat = -1; // the first beat of the interval public float intervalLength = -1; // the duration of the interval in beats public float defaultIntervalLength; // when an event is queued and the interval has not started yet, it will use this as the interval length. @@ -93,9 +93,9 @@ namespace HeavenStudio.Games return Conductor.instance.GetPositionFromBeat(intervalStartBeat, intervalLength - lengthOffset); } - public float GetIntervalProgressFromBeat(float beat, float lengthOffset = 0) + public float GetIntervalProgressFromBeat(double beat, float lengthOffset = 0) { - return Mathp.Normalize(beat, intervalStartBeat, intervalStartBeat + intervalLength - lengthOffset); + return (float)((beat - intervalStartBeat) / ((intervalStartBeat + intervalLength - lengthOffset) - intervalStartBeat)); } /// @@ -112,7 +112,7 @@ namespace HeavenStudio.Games /// /// The interval start beat. /// The length of the interval. - public void StartInterval(float beat, float length) + public void StartInterval(double beat, float length) { if (!IntervalIsActive()) { @@ -129,7 +129,7 @@ namespace HeavenStudio.Games /// Extra properties to add to the event. /// If true, this function will not start a new interval if the interval isn't active. /// If true, overrides the current interval. - public void AddEvent(float beat, float length = 0, string tag = "", List crParams = null, bool ignoreInterval = false, bool overrideInterval = false) + public void AddEvent(double beat, float length = 0, string tag = "", List crParams = null, bool ignoreInterval = false, bool overrideInterval = false) { if ((!IntervalIsActive() && !ignoreInterval) || overrideInterval) { @@ -150,7 +150,7 @@ namespace HeavenStudio.Games /// Check if an event exists at beat. /// /// The beat to check. - public bool EventExistsAtBeat(float beat) + public bool EventExistsAtBeat(double beat) { if (queuedEvents.Count == 0) { @@ -164,7 +164,7 @@ namespace HeavenStudio.Games /// Check if an event exists at relativeBeat. /// /// The beat to check. - public bool EventExistsAtRelativetBeat(float relativeBeat) + public bool EventExistsAtRelativetBeat(double relativeBeat) { if (queuedEvents.Count == 0) { diff --git a/Assets/Scripts/Games/CatchyTune/CatchyTune.cs b/Assets/Scripts/Games/CatchyTune/CatchyTune.cs index f78e34dd..0f71fc11 100644 --- a/Assets/Scripts/Games/CatchyTune/CatchyTune.cs +++ b/Assets/Scripts/Games/CatchyTune/CatchyTune.cs @@ -98,11 +98,11 @@ namespace HeavenStudio.Games public GameObject bg2; // when to stop playing the catch animation - private float stopCatchLeft = 0f; - private float stopCatchRight = 0f; + private double stopCatchLeft = 0; + private double stopCatchRight = 0; - private float startSmile = 0f; - private float stopSmile = 0f; + private double startSmile = 0; + private double stopSmile = 0; private bool bopLeft = true; private bool bopRight = true; @@ -112,7 +112,7 @@ namespace HeavenStudio.Games static List queuedFruits = new List(); struct QueuedFruit { - public float beat; + public double beat; public int side; public bool smile; public bool isPineapple; @@ -143,20 +143,20 @@ namespace HeavenStudio.Games } // print(stopCatchLeft + " " + stopCatchRight); - // print("current beat: " + conductor.songPositionInBeats); - if (stopCatchLeft > 0 && stopCatchLeft <= cond.songPositionInBeats) + // print("current beat: " + conductor.songPositionInBeatsAsDouble); + if (stopCatchLeft > 0 && stopCatchLeft <= cond.songPositionInBeatsAsDouble) { plalinAnim.Play("idle", 0, 0); stopCatchLeft = 0; } - if (stopCatchRight > 0 && stopCatchRight <= cond.songPositionInBeats) + if (stopCatchRight > 0 && stopCatchRight <= cond.songPositionInBeatsAsDouble) { alalinAnim.Play("idle", 0, 0); stopCatchRight = 0; } - if (startSmile > 0 && startSmile <= cond.songPositionInBeats) + if (startSmile > 0 && startSmile <= cond.songPositionInBeatsAsDouble) { //print("smile start"); plalinAnim.Play("smile", 1, 0); @@ -165,7 +165,7 @@ namespace HeavenStudio.Games heartMessage.SetActive(true); } - if (stopSmile > 0 && stopSmile <= cond.songPositionInBeats) + if (stopSmile > 0 && stopSmile <= cond.songPositionInBeatsAsDouble) { //print("smile stop"); plalinAnim.Play("stopsmile", 1, 0); @@ -201,7 +201,7 @@ namespace HeavenStudio.Games } } - public void DropFruit(float beat, int side, bool smile, bool isPineapple, float endSmile) + public void DropFruit(double beat, int side, bool smile, bool isPineapple, float endSmile) { var objectToSpawn = isPineapple ? pineappleBase : orangeBase; @@ -217,9 +217,9 @@ namespace HeavenStudio.Games } //minenice: experiment to test preFunction - public static void PreDropFruit(float beat, int side, bool smile, bool isPineapple, float endSmile) + public static void PreDropFruit(double beat, int side, bool smile, bool isPineapple, float endSmile) { - float spawnBeat = beat - 1f; + double spawnBeat = beat - 1; beat = beat - (isPineapple ? 2f : 1f); if (GameManager.instance.currentGame == "catchyTune") { @@ -250,7 +250,7 @@ namespace HeavenStudio.Games } } - public void DropFruitSingle(float beat, bool side, bool smile, GameObject objectToSpawn, float endSmile) + public void DropFruitSingle(double beat, bool side, bool smile, GameObject objectToSpawn, float endSmile) { var newFruit = GameObject.Instantiate(objectToSpawn, fruitHolder); @@ -262,7 +262,7 @@ namespace HeavenStudio.Games newFruit.SetActive(true); } - public void Bop(float beat, float length, int whoBops, int whoBopsAuto) + public void Bop(double beat, float length, int whoBops, int whoBopsAuto) { bopLeft = whoBopsAuto == (int)WhoBops.Plalin || whoBopsAuto == (int)WhoBops.Both; bopRight = whoBopsAuto == (int)WhoBops.Alalin || whoBopsAuto == (int)WhoBops.Both; @@ -309,7 +309,7 @@ namespace HeavenStudio.Games } } - public void catchSuccess(bool side, bool isPineapple, bool smile, float beat, float endSmile) + public void catchSuccess(bool side, bool isPineapple, bool smile, double beat, float endSmile) { string anim = isPineapple ? "catchPineapple" : "catchOrange"; @@ -335,9 +335,9 @@ namespace HeavenStudio.Games public void catchMiss(bool side, bool isPineapple) { // not the right sound at all but need an accurate rip - Jukebox.PlayOneShotGame("catchyTune/fruitThrough"); + SoundByte.PlayOneShotGame("catchyTune/fruitThrough"); - float beat = Conductor.instance.songPositionInBeats; + double beat = Conductor.instance.songPositionInBeatsAsDouble; string fruitType = isPineapple ? "Pineapple" : "Orange"; @@ -355,7 +355,7 @@ namespace HeavenStudio.Games public void catchWhiff(bool side) { - Jukebox.PlayOneShotGame("catchyTune/whiff"); + SoundByte.PlayOneShotGame("catchyTune/whiff"); whiffAnim(side); } @@ -363,11 +363,11 @@ namespace HeavenStudio.Games { if (side) { - Jukebox.PlayOneShotGame("catchyTune/barely right"); + SoundByte.PlayOneShotGame("catchyTune/barely right"); } else { - Jukebox.PlayOneShotGame("catchyTune/barely left"); + SoundByte.PlayOneShotGame("catchyTune/barely left"); } whiffAnim(side); @@ -375,7 +375,7 @@ namespace HeavenStudio.Games public void whiffAnim(bool side) { - float beat = Conductor.instance.songPositionInBeats; + double beat = Conductor.instance.songPositionInBeatsAsDouble; if (side) { diff --git a/Assets/Scripts/Games/CatchyTune/Fruit.cs b/Assets/Scripts/Games/CatchyTune/Fruit.cs index 75b8f215..769db01f 100644 --- a/Assets/Scripts/Games/CatchyTune/Fruit.cs +++ b/Assets/Scripts/Games/CatchyTune/Fruit.cs @@ -11,13 +11,13 @@ namespace HeavenStudio.Games.Scripts_CatchyTune { public bool isPineapple; - public float startBeat; + public double startBeat; public Animator anim; public bool side; - public float barelyStart = 0f; + public double barelyStart = 0f; public bool smile; @@ -87,7 +87,7 @@ namespace HeavenStudio.Games.Scripts_CatchyTune } } - public static void PlaySound(float startBeat, bool side, bool isPineapple) + public static void PlaySound(double startBeat, bool side, bool isPineapple) { string soundText = "catchyTune/"; @@ -141,7 +141,7 @@ namespace HeavenStudio.Games.Scripts_CatchyTune if (state <= -1f || state >= 1f) { //near miss (barely) - barelyStart = Conductor.instance.songPositionInBeats; + barelyStart = Conductor.instance.songPositionInBeatsAsDouble; game.catchBarely(side); @@ -156,7 +156,7 @@ namespace HeavenStudio.Games.Scripts_CatchyTune } else { - Jukebox.PlayOneShotGame(soundText + "Catch"); + SoundByte.PlayOneShotGame(soundText + "Catch"); game.catchSuccess(side, isPineapple, smile, startBeat + beatLength, endSmile); Destroy(this.gameObject); } diff --git a/Assets/Scripts/Games/CheerReaders/CheerReaders.cs b/Assets/Scripts/Games/CheerReaders/CheerReaders.cs index 6ef7e6f3..57edc889 100644 --- a/Assets/Scripts/Games/CheerReaders/CheerReaders.cs +++ b/Assets/Scripts/Games/CheerReaders/CheerReaders.cs @@ -8,6 +8,7 @@ using UnityEngine; using UnityEngine.Rendering; using static HeavenStudio.EntityTypes; using static HeavenStudio.Games.CheerReaders; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -164,20 +165,20 @@ namespace HeavenStudio.Games bool shouldBop = true; bool canBop = true; public bool doingCue; - float cueLength; - float cueBeat; + double cueLength; + double cueBeat; bool shouldYay; bool shouldDoSuccessZoom; public bool shouldBeBlack = false; public GameEvent bop = new GameEvent(); int currentZoomIndex; - float currentZoomCamBeat; + double currentZoomCamBeat; float currentZoomCamLength; - private List allCameraEvents = new List(); + private List allCameraEvents = new List(); void OnDestroy() { - Jukebox.KillLoop(SpinningLoop, 0.5f); + SoundByte.KillLoop(SpinningLoop, 0.5f); foreach (var evt in scheduledInputs) { evt.Disable(); @@ -210,10 +211,10 @@ namespace HeavenStudio.Games allGirls.AddRange(thirdRow); var camEvents = EventCaller.GetAllInGameManagerList("cheerReaders", new string[] { "okItsOn" }); camEvents.AddRange(EventCaller.GetAllInGameManagerList("cheerReaders", new string[] { "okItsOnStretch" })); - List tempEvents = new List(); + List tempEvents = new List(); for (int i = 0; i < camEvents.Count; i++) { - if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats) + if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { tempEvents.Add(camEvents[i]); } @@ -238,7 +239,7 @@ namespace HeavenStudio.Games { if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0) { - if (Conductor.instance.songPositionInBeats >= allCameraEvents[currentZoomIndex].beat) + if (Conductor.instance.songPositionInBeatsAsDouble >= allCameraEvents[currentZoomIndex].beat) { UpdateCameraZoom(); currentZoomIndex++; @@ -256,7 +257,7 @@ namespace HeavenStudio.Games } else { - EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInOutQuint); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuint); float newZoom = func(shouldDoSuccessZoom ? 4f : 1.5f, 0, normalizedZoomOutAgainBeat); GameCamera.additionalPosition = new Vector3(0, 0, newZoom); } @@ -269,7 +270,7 @@ namespace HeavenStudio.Games } else { - EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseOutQuint); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuint); float newZoom = func(-1, shouldDoSuccessZoom ? 4f : 1.5f, normalizedZoomInBeat); GameCamera.additionalPosition = new Vector3(0, 0, newZoom); } @@ -282,7 +283,7 @@ namespace HeavenStudio.Games } else { - EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseOutQuint); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuint); float newZoom = func(0f, 1f, normalizedZoomOutBeat); GameCamera.additionalPosition = new Vector3(0, 0, newZoom * -1); } @@ -292,22 +293,22 @@ namespace HeavenStudio.Games { player.FlipBook(false); missPoster.SetActive(false); - Jukebox.PlayOneShotGame("cheerReaders/miss"); + SoundByte.PlayOneShotGame("cheerReaders/miss"); ScoreMiss(1f); } if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN)) { - Jukebox.PlayOneShotGame("cheerReaders/doingoing"); + SoundByte.PlayOneShotGame("cheerReaders/doingoing"); player.StartSpinBook(); missPoster.SetActive(false); - SpinningLoop = Jukebox.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true); + SpinningLoop = SoundByte.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true); ScoreMiss(1f); } if (PlayerInput.AltPressedUp() && !IsExpectingInputNow(InputType.STANDARD_ALT_UP)) { - Jukebox.PlayOneShotGame("cheerReaders/doingoing"); + SoundByte.PlayOneShotGame("cheerReaders/doingoing"); player.StopSpinBook(); - Jukebox.KillLoop(SpinningLoop, 0f); + SoundByte.KillLoop(SpinningLoop, 0f); ScoreMiss(1f); missPoster.SetActive(true); } @@ -326,7 +327,7 @@ namespace HeavenStudio.Games } else if (!cond.isPlaying) { - Jukebox.KillLoop(SpinningLoop, 0.5f); + SoundByte.KillLoop(SpinningLoop, 0.5f); } } @@ -399,7 +400,7 @@ namespace HeavenStudio.Games switch (whoSpeaks) { case (int)WhoSpeaks.Solo: - Jukebox.PlayOneShotGame("cheerReaders/Solo/yayS"); + SoundByte.PlayOneShotGame("cheerReaders/Solo/yayS"); player.Yay(true); foreach (var nerd in allGirls) { @@ -407,7 +408,7 @@ namespace HeavenStudio.Games } break; case (int)WhoSpeaks.Girls: - Jukebox.PlayOneShotGame("cheerReaders/Girls/yayGirls"); + SoundByte.PlayOneShotGame("cheerReaders/Girls/yayGirls"); foreach (var nerd in allGirls) { nerd.Yay(true); @@ -415,7 +416,7 @@ namespace HeavenStudio.Games player.Yay(false); break; default: - Jukebox.PlayOneShotGame("cheerReaders/All/yay"); + SoundByte.PlayOneShotGame("cheerReaders/All/yay"); foreach (var nerd in allGirls) { nerd.Yay(true); @@ -425,7 +426,7 @@ namespace HeavenStudio.Games } } - public void BopToggle(float beat, float length, bool startBop, bool bopAuto) + public void BopToggle(double beat, float length, bool startBop, bool bopAuto) { shouldBop = bopAuto; if (startBop) @@ -463,7 +464,7 @@ namespace HeavenStudio.Games } } - public void SetIsDoingCue(float beat, float length, bool shouldSwitchColor = true) + public void SetIsDoingCue(double beat, float length, bool shouldSwitchColor = true) { if (!doingCue) shouldYay = false; foreach (var girl in allGirls) @@ -481,7 +482,7 @@ namespace HeavenStudio.Games }); } - public void OneTwoThree(float beat, int whoSpeaks) + public void OneTwoThree(double beat, int whoSpeaks) { canBop = false; ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing); @@ -609,7 +610,7 @@ namespace HeavenStudio.Games }); } - public void ItsUpToYou(float beat, int whoSpeaks) + public void ItsUpToYou(double beat, int whoSpeaks) { canBop = false; ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing); @@ -767,7 +768,7 @@ namespace HeavenStudio.Games }); } - public void LetsGoReadABunchaBooks(float beat, int whoSpeaks) + public void LetsGoReadABunchaBooks(double beat, int whoSpeaks) { canBop = false; ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing); @@ -953,7 +954,7 @@ namespace HeavenStudio.Games }); } - public void RahRahSisBoomBaBoom(float beat, int whoSpeaks, bool consecutive) + public void RahRahSisBoomBaBoom(double beat, int whoSpeaks, bool consecutive) { canBop = false; ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, JustFlipBoom, MissFlip, Nothing); @@ -1163,7 +1164,7 @@ namespace HeavenStudio.Games }); } - public void OkItsOnStretchable(float beat, float length, int whoSpeaks, bool whistle, int posterToChoose, bool shouldHappyFace) + public void OkItsOnStretchable(double beat, float length, int whoSpeaks, bool whistle, int posterToChoose, bool shouldHappyFace) { canBop = false; float actualLength = length * 0.25f; @@ -1360,7 +1361,7 @@ namespace HeavenStudio.Games missPoster.SetActive(false); if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("cheerReaders/doingoing"); + SoundByte.PlayOneShotGame("cheerReaders/doingoing"); player.FlipBook(); //Need near miss anims return; } @@ -1372,7 +1373,7 @@ namespace HeavenStudio.Games missPoster.SetActive(false); if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("cheerReaders/doingoing"); + SoundByte.PlayOneShotGame("cheerReaders/doingoing"); player.FlipBook(); //Need near miss anims return; } @@ -1385,11 +1386,11 @@ namespace HeavenStudio.Games shouldYay = true; if (boom) { - Jukebox.PlayOneShotGame("cheerReaders/bookBoom"); + SoundByte.PlayOneShotGame("cheerReaders/bookBoom"); } else { - Jukebox.PlayOneShotGame("cheerReaders/bookPlayer"); + SoundByte.PlayOneShotGame("cheerReaders/bookPlayer"); } } @@ -1398,9 +1399,9 @@ namespace HeavenStudio.Games missPoster.SetActive(false); if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("cheerReaders/doingoing"); + SoundByte.PlayOneShotGame("cheerReaders/doingoing"); player.StartSpinBook(); - SpinningLoop = Jukebox.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true); + SpinningLoop = SoundByte.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true); return; } SuccessHoldSpin(); @@ -1409,16 +1410,16 @@ namespace HeavenStudio.Games void SuccessHoldSpin() { player.StartSpinBook(); - Jukebox.PlayOneShotGame("cheerReaders/bookSpin"); - SpinningLoop = Jukebox.PlayOneShotScheduledGame("cheerReaders/bookSpinLoop", Jukebox.GetClipLengthGame("cheerReaders/bookSpin"), 1, 1, true); + SoundByte.PlayOneShotGame("cheerReaders/bookSpin"); + SpinningLoop = SoundByte.PlayOneShotScheduledGame("cheerReaders/bookSpinLoop", SoundByte.GetClipLengthGame("cheerReaders/bookSpin"), 1, 1, true); } void JustReleaseSpin(PlayerActionEvent caller, float state) { - Jukebox.KillLoop(SpinningLoop, 0f); + SoundByte.KillLoop(SpinningLoop, 0f); if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("cheerReaders/doingoing"); + SoundByte.PlayOneShotGame("cheerReaders/doingoing"); player.StopSpinBook(); shouldDoSuccessZoom = false; missPoster.SetActive(true); @@ -1429,7 +1430,7 @@ namespace HeavenStudio.Games void SuccessReleaseSpin() { - Jukebox.PlayOneShotGame("cheerReaders/bookOpen"); + SoundByte.PlayOneShotGame("cheerReaders/bookOpen"); player.StopSpinBook(); shouldYay = true; shouldDoSuccessZoom = true; @@ -1440,7 +1441,7 @@ namespace HeavenStudio.Games { playerMask.SetActive(false); missPoster.SetActive(false); - Jukebox.PlayOneShotGame("cheerReaders/doingoing"); + SoundByte.PlayOneShotGame("cheerReaders/doingoing"); player.Miss(); shouldDoSuccessZoom = false; foreach (var girl in allGirls) diff --git a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs index 1ac48ac0..03c0fdcb 100644 --- a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs +++ b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Games.Loaders { @@ -41,7 +43,7 @@ namespace HeavenStudio.Games.Loaders function = delegate { var e = eventCaller.currentEntity; ClappyTrio.instance.Sign(e.beat, e.length, e["ease"], e["down"]); }, parameters = new List() { - new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the sign move with?"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Which ease should the sign move with?"), new Param("down", true, "Down", "Should the sign go down?") }, resizable = true @@ -96,9 +98,9 @@ namespace HeavenStudio.Games public GameEvent bop = new GameEvent(); [SerializeField] Animator signAnim; - float signStartBeat; + double signStartBeat; float signLength; - EasingFunction.Ease lastEase; + Util.EasingFunction.Ease lastEase; bool signGoDown; public static ClappyTrio instance { get; set; } @@ -112,9 +114,9 @@ namespace HeavenStudio.Games clapSounds = null; InitLions(); } - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { - DynamicBeatmap.DynamicEntity changeLion = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "clappyTrio/change lion count" && c.beat <= beat); + RiqEntity changeLion = GameManager.instance.Beatmap.Entities.FindLast(c => c.datamodel == "clappyTrio/change lion count" && c.beat <= beat); if(changeLion != null) { EventCaller.instance.CallEvent(changeLion, true); @@ -126,7 +128,7 @@ namespace HeavenStudio.Games var cond = Conductor.instance; if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) { - if (shouldBop) Bop(cond.songPositionInBeats); + if (shouldBop) Bop(cond.songPositionInBeatsAsDouble); } if (cond.isPlaying && !cond.isPaused) { @@ -134,19 +136,19 @@ namespace HeavenStudio.Games if (normalizedBeat > 0 && normalizedBeat <= 1) { - EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase); float newPos = func(0, 1, normalizedBeat); signAnim.DoNormalizedAnimation(signGoDown ? "Enter" : "Exit", newPos); } } } - public void Sign(float beat, float length, int ease, bool down) + public void Sign(double beat, float length, int ease, bool down) { - Jukebox.PlayOneShotGame("clappyTrio/sign"); + SoundByte.PlayOneShotGame("clappyTrio/sign"); signStartBeat = beat; signLength = length; - lastEase = (EasingFunction.Ease)ease; + lastEase = (Util.EasingFunction.Ease)ease; signGoDown = down; } @@ -179,7 +181,7 @@ namespace HeavenStudio.Games clapAction.Delete(); } - public void Clap(float beat, float length) + public void Clap(double beat, float length) { ClappyTrioPlayer.clapStarted = true; ClappyTrioPlayer.canHit = true; // this is technically a lie, this just restores the ability to hit @@ -209,10 +211,10 @@ namespace HeavenStudio.Games SetFace(i, type); } PlayAnimationAll("Prepare"); - Jukebox.PlayOneShotGame("clappyTrio/ready"); + SoundByte.PlayOneShotGame("clappyTrio/ready"); } - public void BopToggle(float beat, float length, bool startBop, bool autoBop, bool emo) + public void BopToggle(double beat, float length, bool startBop, bool autoBop, bool emo) { doEmotion = !emo; shouldBop = autoBop; @@ -222,7 +224,7 @@ namespace HeavenStudio.Games for (int i = 0; i < length; i++) { if (i == 0 && startBop && autoBop) continue; - float spawnBeat = beat + i; + double spawnBeat = beat + i; bops.Add(new BeatAction.Action(spawnBeat, delegate { Bop(spawnBeat); })); if (i == length - 1) { @@ -233,7 +235,7 @@ namespace HeavenStudio.Games } } - public void Bop(float beat) + public void Bop(double beat) { if (doEmotion && emoCounter > 0) { diff --git a/Assets/Scripts/Games/ClappyTrio/ClappyTrioPlayer.cs b/Assets/Scripts/Games/ClappyTrio/ClappyTrioPlayer.cs index 595730af..620f033d 100644 --- a/Assets/Scripts/Games/ClappyTrio/ClappyTrioPlayer.cs +++ b/Assets/Scripts/Games/ClappyTrio/ClappyTrioPlayer.cs @@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio public class ClappyTrioPlayer : MonoBehaviour { ClappyTrio game; - private float lastClapBeat; + private double lastClapBeat; private float lastClapLength; public bool clapStarted = false; @@ -32,7 +32,7 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio } } - public void QueueClap(float startBeat, float length) + public void QueueClap(double startBeat, float length) { lastClapBeat = startBeat; lastClapLength = length; @@ -69,12 +69,12 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio if (just) { clapEffect.SetActive(true); - Jukebox.PlayOneShotGame("clappyTrio/rightClap"); + SoundByte.PlayOneShotGame("clappyTrio/rightClap"); } else { clapEffect.SetActive(false); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); game.misses++; if (clapStarted) diff --git a/Assets/Scripts/Games/CoinToss/CoinToss.cs b/Assets/Scripts/Games/CoinToss/CoinToss.cs index 4b19ac9c..ab36c384 100644 --- a/Assets/Scripts/Games/CoinToss/CoinToss.cs +++ b/Assets/Scripts/Games/CoinToss/CoinToss.cs @@ -155,12 +155,12 @@ namespace HeavenStudio.Games //nothing } - public void TossCoin(float beat, int type, bool audienceReacting) + public void TossCoin(double beat, int type, bool audienceReacting) { if (coin != null) return; //Play sound and animations - Jukebox.PlayOneShotGame("coinToss/throw"); + SoundByte.PlayOneShotGame("coinToss/throw"); handAnimator.Play("Throw", 0, 0); //Game state says the hand is throwing the coin isThrowing = true; @@ -169,7 +169,7 @@ namespace HeavenStudio.Games { case (int) CoinToss.CoinVariation.Cowbell: //this was intentional. it was to avoid the throw and cowbells to go offbeat. - Jukebox.PlayOneShotGame("coinToss/cowbell1"); + SoundByte.PlayOneShotGame("coinToss/cowbell1"); MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("coinToss/cowbell2", beat + 1f, offset: 0.01f), new MultiSound.Sound("coinToss/cowbell1", beat + 2f, offset: 0.01f), @@ -189,12 +189,12 @@ namespace HeavenStudio.Games //coin.perfectOnly = true; } - public void TossCoin(float beat) + public void TossCoin(double beat) { if (coin != null) return; //Play sound and animations - Jukebox.PlayOneShotGame("coinToss/throw"); + SoundByte.PlayOneShotGame("coinToss/throw"); handAnimator.Play("Throw", 0, 0); //Game state says the hand is throwing the coin isThrowing = true; @@ -206,8 +206,8 @@ namespace HeavenStudio.Games public void CatchSuccess(PlayerActionEvent caller, float state) { - Jukebox.PlayOneShotGame("coinToss/catch"); - if(this.audienceReacting) Jukebox.PlayOneShot("applause"); + SoundByte.PlayOneShotGame("coinToss/catch"); + if(this.audienceReacting) SoundByte.PlayOneShot("applause"); handAnimator.Play("Catch_success", 0, 0); isThrowing = false; @@ -215,8 +215,8 @@ namespace HeavenStudio.Games public void CatchMiss(PlayerActionEvent caller) { - Jukebox.PlayOneShot("miss"); - if(this.audienceReacting) Jukebox.PlayOneShot("audience/disappointed"); + SoundByte.PlayOneShot("miss"); + if(this.audienceReacting) SoundByte.PlayOneShot("audience/disappointed"); handAnimator.Play("Pickup", 0, 0); isThrowing = false; diff --git a/Assets/Scripts/Games/CropStomp/CropStomp.cs b/Assets/Scripts/Games/CropStomp/CropStomp.cs index e5446e47..4f77a0ce 100644 --- a/Assets/Scripts/Games/CropStomp/CropStomp.cs +++ b/Assets/Scripts/Games/CropStomp/CropStomp.cs @@ -4,6 +4,7 @@ using HeavenStudio.Util; using System; using System.Collections.Generic; using UnityEngine; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -64,14 +65,14 @@ namespace HeavenStudio.Games float grassWidth; float dotsWidth = 19.2f; - private float newBeat = -1f; // So that marching can happen on beat 0. - private float marchStartBeat = -1f; - private float marchOffset; + private double newBeat = -1f; // So that marching can happen on beat 0. + private double marchStartBeat = -1f; + private double marchOffset; private int currentMarchBeat; private int stepCount; private bool isStepping; - private static float inactiveStart = -1f; + private static double inactiveStart = -1f; public bool isMarching => marchStartBeat != -1f; @@ -111,10 +112,10 @@ namespace HeavenStudio.Games // Initialize vegetables. var cond = Conductor.instance; - var entities = GameManager.instance.Beatmap.entities; + var entities = GameManager.instance.Beatmap.Entities; - float startBeat = cond.songPositionInBeats; - float endBeat = Single.MaxValue; + double startBeat = cond.songPositionInBeatsAsDouble; + double endBeat = double.MaxValue; if (inactiveStart == -1f) { @@ -123,7 +124,7 @@ namespace HeavenStudio.Games for (int i = 0; i < marchStarts.Count; i++) { var sampleBeat = marchStarts[i].beat; - if (cond.songPositionInBeats <= sampleBeat + 0.25f) // 0.25-beat buffer in case the start marching event is directly next to the game switch event. + if (cond.songPositionInBeatsAsDouble <= sampleBeat + 0.25f) // 0.25-beat buffer in case the start marching event is directly next to the game switch event. { startBeat = sampleBeat; break; @@ -135,7 +136,7 @@ namespace HeavenStudio.Games // Find the beat of the next step, assuming marching started at inactiveStart. int stepsPassed = 0; - while (inactiveStart + (stepsPassed * 2f) < cond.songPositionInBeats) + while (inactiveStart + (stepsPassed * 2f) < cond.songPositionInBeatsAsDouble) { stepsPassed++; @@ -210,7 +211,7 @@ namespace HeavenStudio.Games } } - List cuedMoleSounds = new List(); + List cuedMoleSounds = new List(); private void Update() { var cond = Conductor.instance; @@ -219,12 +220,12 @@ namespace HeavenStudio.Games return; // Mole sounds. - var moleEvents = GameManager.instance.Beatmap.entities.FindAll(m => m.datamodel == "cropStomp/mole"); + var moleEvents = GameManager.instance.Beatmap.Entities.FindAll(m => m.datamodel == "cropStomp/mole"); for (int i = 0; i < moleEvents.Count; i++) { var moleEvent = moleEvents[i]; if (moleEvent["mute"]) continue; - var timeToEvent = moleEvent.beat - cond.songPositionInBeats; + var timeToEvent = moleEvent.beat - cond.songPositionInBeatsAsDouble; if (timeToEvent <= 4f && timeToEvent > 2f && !cuedMoleSounds.Contains(moleEvent)) { cuedMoleSounds.Add(moleEvent); @@ -328,7 +329,7 @@ namespace HeavenStudio.Games } } - public void StartMarching(float beat) + public void StartMarching(double beat) { marchStartBeat = beat; marchOffset = marchStartBeat % 1; @@ -348,7 +349,7 @@ namespace HeavenStudio.Games legsAnim.Play(stompAnim, 0, 0); - Jukebox.PlayOneShotGame("cropStomp/stomp"); + SoundByte.PlayOneShotGame("cropStomp/stomp"); if (shakeTween != null) shakeTween.Kill(true); @@ -359,29 +360,29 @@ namespace HeavenStudio.Games isStepping = true; } - private void SpawnVeggie(float beat, float startBeat, bool isMole) + private void SpawnVeggie(double beat, double startBeat, bool isMole) { var newVeggie = GameObject.Instantiate(isMole ? baseMole : baseVeggie, veggieHolder).GetComponent(); newVeggie.targetBeat = beat; var veggieX = (beat - startBeat) * -stepDistance / 2f; - newVeggie.transform.localPosition = new Vector3(veggieX, 0f, 0f); + newVeggie.transform.localPosition = new Vector3((float)veggieX, 0f, 0f); newVeggie.Init(); newVeggie.gameObject.SetActive(true); } - public static void MarchInactive(float beat) + public static void MarchInactive(double beat) { if (GameManager.instance.currentGame == "cropStomp") //this function is only meant for making march sounds while the game is inactive { return; } inactiveStart = beat; - DynamicBeatmap.DynamicEntity gameSwitch = GameManager.instance.Beatmap.entities.Find(c => c.beat >= beat && c.datamodel == "gameManager/switchGame/cropStomp"); + RiqEntity gameSwitch = GameManager.instance.Beatmap.Entities.Find(c => c.beat >= beat && c.datamodel == "gameManager/switchGame/cropStomp"); if (gameSwitch == null) return; - int length = Mathf.CeilToInt((gameSwitch.beat - beat)/2); + int length = (int)Math.Ceiling((gameSwitch.beat - beat)/2); MultiSound.Sound[] sounds = new MultiSound.Sound[length]; for(int i = 0; i < length; i++) { diff --git a/Assets/Scripts/Games/CropStomp/Farmer.cs b/Assets/Scripts/Games/CropStomp/Farmer.cs index 0e1ca626..7dfc89ea 100644 --- a/Assets/Scripts/Games/CropStomp/Farmer.cs +++ b/Assets/Scripts/Games/CropStomp/Farmer.cs @@ -8,7 +8,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp { public class Farmer : MonoBehaviour { - public float nextStompBeat; + public double nextStompBeat; private CropStomp game; diff --git a/Assets/Scripts/Games/CropStomp/Veggie.cs b/Assets/Scripts/Games/CropStomp/Veggie.cs index d2ae32f1..67902e6c 100644 --- a/Assets/Scripts/Games/CropStomp/Veggie.cs +++ b/Assets/Scripts/Games/CropStomp/Veggie.cs @@ -20,15 +20,15 @@ namespace HeavenStudio.Games.Scripts_CropStomp public BezierCurve3D curve; private BezierCurve3D hitCurve; - public float targetBeat; - private float stompedBeat; - private float pickedBeat; + public double targetBeat; + private double stompedBeat; + private double pickedBeat; private float pickTime = 1f; private int veggieState = 0; private bool boinked; // Player got barely when trying to pick. private bool pickEligible = true; - private float landBeat; + private double landBeat; private Tween squashTween; @@ -137,9 +137,9 @@ namespace HeavenStudio.Games.Scripts_CropStomp var key2Pos = key2.Position; key2.Position = new Vector3(key2Pos.x, veggieTrans.position.y + 2f, key2Pos.z); - pickedBeat = Conductor.instance.songPositionInBeats; + pickedBeat = Conductor.instance.songPositionInBeatsAsDouble; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); MissedUpdate(); } @@ -154,7 +154,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp veggieState = -1; if (!isMole) - Jukebox.PlayOneShotGame("cropStomp/veggieMiss"); + SoundByte.PlayOneShotGame("cropStomp/veggieMiss"); caller.Disable(); } @@ -231,7 +231,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp game.ScheduleInput(targetBeat, isMole ? 0.5f : 1f, InputType.STANDARD_UP, PickJust, PickMiss, Out); targetBeat = targetBeat + (isMole ? 0.5f : 1f); - stompedBeat = cond.songPositionInBeats; + stompedBeat = cond.songPositionInBeatsAsDouble; landBeat = targetBeat + (float)cond.SecsToBeats(Minigame.EndTime()-1, cond.GetBpmAtBeat(targetBeat)); @@ -273,7 +273,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp var keyPos = key1.Position; key1.Position = new Vector3(keyPos.x, veggieTrans.position.y, keyPos.z); - pickedBeat = Conductor.instance.songPositionInBeats; + pickedBeat = Conductor.instance.songPositionInBeatsAsDouble; if (!isMole) { @@ -283,7 +283,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp new BeatAction.Action(pickedBeat + pickTime, delegate { GameObject.Destroy(gameObject); }) }); - Jukebox.PlayOneShotGame("cropStomp/veggieKay"); + SoundByte.PlayOneShotGame("cropStomp/veggieKay"); hitCurve = game.pickCurve; } @@ -294,7 +294,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp new BeatAction.Action(pickedBeat + pickTime, delegate { GameObject.Destroy(gameObject); }) }); - Jukebox.PlayOneShotGame("cropStomp/GEUH"); + SoundByte.PlayOneShotGame("cropStomp/GEUH"); hitCurve = game.moleCurve; } diff --git a/Assets/Scripts/Games/DJSchool/DJSchool.cs b/Assets/Scripts/Games/DJSchool/DJSchool.cs index 94e09d6d..a7966e35 100644 --- a/Assets/Scripts/Games/DJSchool/DJSchool.cs +++ b/Assets/Scripts/Games/DJSchool/DJSchool.cs @@ -113,7 +113,7 @@ namespace HeavenStudio.Games [SerializeField] private Student student; [SerializeField] private GameObject djYellow; private Animator djYellowAnim; - private float lastReportedBeat = 0f; + private double lastReportedBeat = 0f; public DJYellow djYellowScript; [Header("Properties")] @@ -121,10 +121,10 @@ namespace HeavenStudio.Games public bool djYellowHolding; public bool andStop; public bool goBop; - public float beatOfInstance; + public double beatOfInstance; private bool djYellowBopLeft; public bool shouldBeHolding = false; - public float smileBeat = -10f; + public double smileBeat = double.MinValue; public static DJSchool instance { get; private set; } @@ -138,26 +138,26 @@ namespace HeavenStudio.Games } //For inactive game purposes - static float wantBreak = Single.MinValue; - static float wantAndStop = Single.MinValue; - static float wantDJVoiceLines = Single.MinValue; + static double wantBreak = double.MinValue; + static double wantAndStop = double.MinValue; + static double wantDJVoiceLines = double.MinValue; - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { - if (wantBreak != Single.MinValue) + if (wantBreak != double.MinValue) { BreakCmon(wantBreak, 0, false, false); - wantBreak = Single.MinValue; + wantBreak = double.MinValue; } - else if(wantAndStop != Single.MinValue) + else if(wantAndStop != double.MinValue) { AndStop(wantAndStop, false, false); - wantAndStop = Single.MinValue; + wantAndStop = double.MinValue; } - else if(wantDJVoiceLines != Single.MinValue) + else if(wantDJVoiceLines != double.MinValue) { VoiceLines(wantDJVoiceLines, 0); - wantDJVoiceLines = Single.MinValue; + wantDJVoiceLines = double.MinValue; } } @@ -168,7 +168,7 @@ namespace HeavenStudio.Games //if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) //{ - // if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length) + // if (cond.songPositionInBeatsAsDouble >= bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length) // { // if (student.anim.IsAnimationNotPlaying()) // { @@ -245,9 +245,9 @@ namespace HeavenStudio.Games } } - else if (Conductor.instance.songPositionInBeats < lastReportedBeat) + else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat) { - lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats); + lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble); } if(PlayerInput.Pressed() && !IsExpectingInputNow() && !student.isHolding) //Start hold miss @@ -287,7 +287,7 @@ namespace HeavenStudio.Games shouldBeHolding = true; } - public void Bop(float beat, float length, bool isBopping, bool autoBop) + public void Bop(double beat, float length, bool isBopping, bool autoBop) { goBop = autoBop; if (isBopping) @@ -314,7 +314,7 @@ namespace HeavenStudio.Games } if (!andStop && !djYellowHolding) { - float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f); + double normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f); if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy); else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft); djYellowScript.Reverse((normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) || djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)); @@ -339,7 +339,7 @@ namespace HeavenStudio.Games } } - public void BreakCmon(float beat, int type, bool ooh, bool doSound = true) + public void BreakCmon(double beat, int type, bool ooh, bool doSound = true) { if (djYellowHolding) return; @@ -404,7 +404,7 @@ namespace HeavenStudio.Games ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty); } - public void AndStop(float beat, bool ooh, bool doSound = true) + public void AndStop(double beat, bool ooh, bool doSound = true) { if (djYellowHolding) return; @@ -427,7 +427,7 @@ namespace HeavenStudio.Games new BeatAction.Action(beat + 0.5f, delegate { djYellow.GetComponent().DoScaledAnimationAsync("BreakCmon", 0.5f); - float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f); + double normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f); if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) { djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy); @@ -450,7 +450,7 @@ namespace HeavenStudio.Games ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty); } - public void ScratchoHey(float beat, int type, bool remix4, bool cheer) + public void ScratchoHey(double beat, int type, bool remix4, bool cheer) { string[] sounds = new string[] { }; @@ -539,7 +539,7 @@ namespace HeavenStudio.Games { Student.soundFX = toggle; } - public static void VoiceLines(float beat, int type) + public static void VoiceLines(double beat, int type) { string[] sounds; var sound = new MultiSound.Sound[] { }; @@ -592,18 +592,19 @@ namespace HeavenStudio.Games break; case 4: - Jukebox.PlayOneShotGame("djSchool/yay", forcePlay: true); + SoundByte.PlayOneShotGame("djSchool/yay", forcePlay: true); break; } } #region Inactive Game Commands - public static void WarnBreakCmon(float beat, int type, bool ooh) + public static void WarnBreakCmon(double beat, int type, bool ooh) { string[] sounds = type switch { 0 => new string[] { "djSchool/breakCmon1", "djSchool/breakCmon2", "djSchool/ooh" }, 1 => new string[] { "djSchool/breakCmonAlt1", "djSchool/breakCmonAlt2", "djSchool/oohAlt" }, 2 => new string[] { "djSchool/breakCmonLoud1", "djSchool/breakCmonLoud2", "djSchool/oohLoud" }, + _ => new string[] { "djSchool/breakCmon1", "djSchool/breakCmon2", "djSchool/ooh" }, }; List sound = new List() @@ -618,7 +619,7 @@ namespace HeavenStudio.Games wantBreak = beat; } - public static void WarnAndStop(float beat, bool ooh) + public static void WarnAndStop(double beat, bool ooh) { List sound = new List() { diff --git a/Assets/Scripts/Games/DJSchool/Student.cs b/Assets/Scripts/Games/DJSchool/Student.cs index edca01a1..f29b6a68 100644 --- a/Assets/Scripts/Games/DJSchool/Student.cs +++ b/Assets/Scripts/Games/DJSchool/Student.cs @@ -107,7 +107,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool missed = false; shouldBeHolding = true; - Jukebox.PlayOneShotGame("djSchool/recordStop"); + SoundByte.PlayOneShotGame("djSchool/recordStop"); anim.DoScaledAnimationAsync("Hold", 0.5f); tableAnim.DoScaledAnimationAsync("Student_Turntable_StartHold", 0.5f); @@ -124,7 +124,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool //isHolding = true; if (canBoo) { - Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f); + Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f); CancelInvoke(); canBoo = false; Invoke("EnableBoo", booSound.clip.length); @@ -145,7 +145,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool missed = true; - Jukebox.PlayOneShotGame("djSchool/recordStop"); + SoundByte.PlayOneShotGame("djSchool/recordStop"); anim.DoScaledAnimationAsync("Hold", 0.5f); tableAnim.DoScaledAnimationAsync("Student_Turntable_StartHold", 0.5f); @@ -170,7 +170,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool anim.DoScaledAnimationAsync("Unhold", 0.5f); if (canBoo) { - Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f); + Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f); CancelInvoke(); canBoo = false; Invoke("EnableBoo", booSound.clip.length); @@ -190,7 +190,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool public void OnHitSwipeCheer(PlayerActionEvent caller, float beat) { OnHitSwipe(caller, beat); - Jukebox.PlayOneShotGame("djSchool/cheer", caller.timer + caller.startBeat + 1f, 1, 0.8f); + SoundByte.PlayOneShotGame("djSchool/cheer", caller.timer + caller.startBeat + 1f, 1, 0.8f); } public void OnHitSwipe(PlayerActionEvent caller, float beat) { @@ -202,7 +202,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool missed = false; shouldBeHolding = false; - Jukebox.PlayOneShotGame("djSchool/recordSwipe"); + SoundByte.PlayOneShotGame("djSchool/recordSwipe"); FlashFX(false); swiping = true; @@ -225,7 +225,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool else { OnMissSwipeForPlayerInput(caller.timer + caller.startBeat + 1f); - Jukebox.PlayOneShotGame("djSchool/recordSwipe"); + SoundByte.PlayOneShotGame("djSchool/recordSwipe"); BeatAction.New(gameObject, new List() { new BeatAction.Action(beat, delegate { anim.Play("Swipe", 0, 0); }), @@ -249,7 +249,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f); if (canBoo) { - Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", caller.timer + caller.startBeat + 1f, 1, 0.8f); + Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", caller.timer + caller.startBeat + 1f, 1, 0.8f); CancelInvoke(); canBoo = false; Invoke("EnableBoo", booSound.clip.length); @@ -268,7 +268,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool }); } - public void OnMissSwipeForPlayerInput(float beat) + public void OnMissSwipeForPlayerInput(double beat) { isHolding = false; diff --git a/Assets/Scripts/Games/DogNinja/DogNinja.cs b/Assets/Scripts/Games/DogNinja/DogNinja.cs index 32435dce..9105eb87 100644 --- a/Assets/Scripts/Games/DogNinja/DogNinja.cs +++ b/Assets/Scripts/Games/DogNinja/DogNinja.cs @@ -111,7 +111,7 @@ namespace HeavenStudio.Games static List queuedThrows = new List(); struct QueuedThrow { - public float beat; + public double beat; public int direction; public int typeL; public int typeR; @@ -137,7 +137,7 @@ namespace HeavenStudio.Games [SerializeField] Sprite[] ObjectTypes; - private float lastReportedBeat = 0f; + private double lastReportedBeat = 0f; private bool birdOnScreen = false; static bool dontBop = false; private const string sfxNum = "dogNinja/"; @@ -211,7 +211,7 @@ namespace HeavenStudio.Games } DogAnim.DoScaledAnimationAsync(slice, 0.5f); - Jukebox.PlayOneShotGame("dogNinja/whiff"); + SoundByte.PlayOneShotGame("dogNinja/whiff"); DogAnim.SetBool("needPrepare", false); } @@ -231,12 +231,12 @@ namespace HeavenStudio.Games } } - public void Bop(float beat, bool bop) + public void Bop(double beat, bool bop) { dontBop = !bop; } - public static void QueueObject(float beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow) + public static void QueueObject(double beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow) { int ObjSprite = 1; if (typeL == 0 || typeR == 0) { @@ -249,14 +249,14 @@ namespace HeavenStudio.Games if (direction is 0 or 2) { sfxNumL += typeL < 7 ? "fruit" : Enum.GetName(typeof(ObjectType), typeL); if (typeL == 0) typeL = ObjSprite; - if (!muteThrow) Jukebox.PlayOneShotGame(sfxNumL+"1", forcePlay: true); + if (!muteThrow) SoundByte.PlayOneShotGame(sfxNumL+"1", forcePlay: true); } string sfxNumR = "dogNinja/"; if (direction is 1 or 2) { sfxNumR += typeR < 7 ? "fruit" : Enum.GetName(typeof(ObjectType), typeR); if (typeR == 0) typeR = ObjSprite; - if (!(direction == 2 && typeL == typeR) && !muteThrow) Jukebox.PlayOneShotGame(sfxNumR+"1", forcePlay: true); + if (!(direction == 2 && typeL == typeR) && !muteThrow) SoundByte.PlayOneShotGame(sfxNumR+"1", forcePlay: true); } queuedThrows.Add(new QueuedThrow() { @@ -271,7 +271,7 @@ namespace HeavenStudio.Games if (prepare) DogNinja.instance.DogAnim.SetBool("needPrepare", true); } - public void ThrowObject(float beat, int direction, int typeL, int typeR, string sfxNumL, string sfxNumR) + public void ThrowObject(double beat, int direction, int typeL, int typeR, string sfxNumL, string sfxNumR) { // instantiate a game object and give it its variables if (direction is 0 or 2) { @@ -299,13 +299,13 @@ namespace HeavenStudio.Games } } - public void CutEverything(float beat, bool sound, string customText) + public void CutEverything(double beat, bool sound, string customText) { // plays one anim with sfx when it's not on screen, plays a different anim with no sfx when on screen. ez if (!birdOnScreen) { FullBird.SetActive(true); if (sound) { - Jukebox.PlayOneShotGame(sfxNum+"bird_flap"); + SoundByte.PlayOneShotGame(sfxNum+"bird_flap"); } BirdAnim.Play("FlyIn", 0, 0); birdOnScreen = true; @@ -316,13 +316,13 @@ namespace HeavenStudio.Games } } - public void Prepare(float beat) + public void Prepare(double beat) { if (!DogAnim.GetBool("needPrepare")) DogAnim.DoScaledAnimationAsync("Prepare", 0.5f); DogAnim.SetBool("needPrepare", true); } - public void HereWeGo(float beat) + public void HereWeGo(double beat) { MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound(sfxNum+"here", beat), @@ -331,7 +331,7 @@ namespace HeavenStudio.Games }, forcePlay: true); } - public static void HereWeGoInactive(float beat) + public static void HereWeGoInactive(double beat) { DogNinja.instance.HereWeGo(beat); } diff --git a/Assets/Scripts/Games/DogNinja/SpawnHalves.cs b/Assets/Scripts/Games/DogNinja/SpawnHalves.cs index 0c79a489..30c76e4c 100644 --- a/Assets/Scripts/Games/DogNinja/SpawnHalves.cs +++ b/Assets/Scripts/Games/DogNinja/SpawnHalves.cs @@ -10,12 +10,12 @@ namespace HeavenStudio.Games.Scripts_DogNinja { public class SpawnHalves : MonoBehaviour { - public float startBeat; + public double startBeat; public Vector3 objPos; private Vector3 posModifier; public bool lefty; float bpmModifier; - float songPos; + double songPos; [SerializeField] float rotSpeed; @@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_DogNinja { game = DogNinja.instance; bpmModifier = Conductor.instance.songBpm / 100; - songPos = Conductor.instance.songPositionInBeats; + songPos = Conductor.instance.songPositionInBeatsAsDouble; } private void Start() diff --git a/Assets/Scripts/Games/DogNinja/ThrowObject.cs b/Assets/Scripts/Games/DogNinja/ThrowObject.cs index 84dcd5f5..b34a79d0 100644 --- a/Assets/Scripts/Games/DogNinja/ThrowObject.cs +++ b/Assets/Scripts/Games/DogNinja/ThrowObject.cs @@ -10,7 +10,7 @@ namespace HeavenStudio.Games.Scripts_DogNinja { public class ThrowObject : MonoBehaviour { - public float startBeat; + public double startBeat; public int type; public bool fromLeft; public bool shouldSfx = true; @@ -19,7 +19,7 @@ namespace HeavenStudio.Games.Scripts_DogNinja private Vector3 objPos; private bool isActive = true; - private float barelyTime; + private double barelyTime; [Header("Animators")] Animator DogAnim; @@ -88,7 +88,7 @@ namespace HeavenStudio.Games.Scripts_DogNinja }; DogAnim.DoScaledAnimationAsync(slice, 0.5f); - if (shouldSfx) Jukebox.PlayOneShotGame(sfxNum+"2"); + if (shouldSfx) SoundByte.PlayOneShotGame(sfxNum+"2"); game.WhichLeftHalf.sprite = objectLeftHalves[type-1]; game.WhichRightHalf.sprite = objectRightHalves[type-1]; @@ -109,17 +109,18 @@ namespace HeavenStudio.Games.Scripts_DogNinja private void JustSlice() { isActive = false; - barelyTime = Conductor.instance.songPositionInBeats; + barelyTime = Conductor.instance.songPositionInBeatsAsDouble; string barely = "Barely" + direction switch { 0 => "Left", 1 => "Right", 2 => "Both", + _ => "Both", }; DogAnim.DoScaledAnimationAsync(barely, 0.5f); - Jukebox.PlayOneShotGame("dogNinja/barely"); + SoundByte.PlayOneShotGame("dogNinja/barely"); } private void Hit(PlayerActionEvent caller, float state) diff --git a/Assets/Scripts/Games/DoubleDate/Basketball.cs b/Assets/Scripts/Games/DoubleDate/Basketball.cs index 7bdcb3e1..f225199e 100644 --- a/Assets/Scripts/Games/DoubleDate/Basketball.cs +++ b/Assets/Scripts/Games/DoubleDate/Basketball.cs @@ -1,3 +1,5 @@ + +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -10,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate { private DoubleDate game; private SuperCurveObject.Path path; - private float pathStartBeat = float.MinValue; + private double pathStartBeat = double.MinValue; private Conductor conductor; private GameObject shadow; @@ -22,20 +24,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Update() { - float beat = conductor.songPositionInBeats; - float height = 0f; - if (pathStartBeat > float.MinValue) + double beat = conductor.songPositionInBeatsAsDouble; + double height = 0f; + if (pathStartBeat > double.MinValue) { - Vector3 pos = GetPathPositionFromBeat(path, Mathf.Max(beat, pathStartBeat), out height, pathStartBeat); + Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat); transform.position = pos; float rot = GetPathValue("rot"); transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f/conductor.pitchedSecPerBeat))); } - shadow.transform.position = new Vector3(transform.position.x, Mathf.Min(transform.position.y - height, game.floorHeight), transform.position.z); + shadow.transform.position = new Vector3(transform.position.x, (float) Math.Min(transform.position.y - height, game.floorHeight), transform.position.z); shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f); } - public void Init(float beat) + public void Init(double beat) { game.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, Just, Miss, Empty); path = game.GetPath("BasketBallIn"); @@ -55,17 +57,17 @@ namespace HeavenStudio.Games.Scripts_DoubleDate { BeatAction.New(gameObject, new List() { - new BeatAction.Action(conductor.songPositionInBeats + 3f, delegate + new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 3f, delegate { Destroy(gameObject); }), }); UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeats; + pathStartBeat = conductor.songPositionInBeatsAsDouble; if (state >= 1f || state <= -1f) { path = game.GetPath("BasketBallNg" + (state > 0 ? "Late" : "Early")); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); game.Kick(false); GetComponent().sortingOrder = 8; return; @@ -76,15 +78,15 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Hit() { UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeats; + pathStartBeat = conductor.songPositionInBeatsAsDouble; path = game.GetPath("BasketBallJust"); game.Kick(); - Jukebox.PlayOneShotGame("doubleDate/kick"); + SoundByte.PlayOneShotGame("doubleDate/kick"); } void Miss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("doubleDate/weasel_hide"); + SoundByte.PlayOneShotGame("doubleDate/weasel_hide"); game.MissKick(pathStartBeat + 2.25f); } diff --git a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs index 092000a5..52e792a3 100644 --- a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs +++ b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs @@ -75,13 +75,13 @@ namespace HeavenStudio.Games [SerializeField] public float shadowDepthScaleMin; [SerializeField] public float shadowDepthScaleMax; [SerializeField] SuperCurveObject.Path[] ballBouncePaths; - float lastGirlGacha = float.MinValue; + double lastGirlGacha = double.MinValue; bool shouldBop = true; bool canBop = true; GameEvent bop = new GameEvent(); public static DoubleDate instance; public static List queuedBalls = new List(); - [NonSerialized] public float lastHitWeasel = float.MinValue; + [NonSerialized] public double lastHitWeasel = double.MinValue; public enum BallType { @@ -92,7 +92,7 @@ namespace HeavenStudio.Games public struct QueuedBall { - public float beat; + public double beat; public BallType type; } @@ -109,7 +109,7 @@ namespace HeavenStudio.Games } } - public override void OnPlay(float beat) + public override void OnPlay(double beat) { queuedBalls.Clear(); } @@ -169,7 +169,7 @@ namespace HeavenStudio.Games } if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) { - Jukebox.PlayOneShotGame("doubleDate/kick_whiff"); + SoundByte.PlayOneShotGame("doubleDate/kick_whiff"); Kick(true, true, false); } clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance); @@ -180,7 +180,7 @@ namespace HeavenStudio.Games canBop = go; } - public void Bop(float beat, float length, bool goBop, bool autoBop) + public void Bop(double beat, float length, bool goBop, bool autoBop) { shouldBop = autoBop; if (goBop) @@ -201,7 +201,7 @@ namespace HeavenStudio.Games { boyAnim.DoScaledAnimationAsync("IdleBop", 1f); } - if (Conductor.instance.songPositionInBeats > lastGirlGacha) + if (Conductor.instance.songPositionInBeatsAsDouble > lastGirlGacha) girlAnim.DoScaledAnimationAsync("GirlBop", 1f); weasels.Bop(); } @@ -214,7 +214,7 @@ namespace HeavenStudio.Games if (jump) { weasels.Jump(); - lastGirlGacha = Conductor.instance.songPositionInBeats + 0.5f; + lastGirlGacha = Conductor.instance.songPositionInBeatsAsDouble + 0.5f; girlAnim.DoScaledAnimationAsync("GirlLookUp", 0.5f); } else if (weaselsHappy) weasels.Happy(); @@ -222,7 +222,7 @@ namespace HeavenStudio.Games { BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(Conductor.instance.songPositionInBeats + 1f, delegate + new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 1f, delegate { leaves.Play(); treeAnim.DoScaledAnimationAsync("TreeRustle", 1f); @@ -237,7 +237,7 @@ namespace HeavenStudio.Games } } - public static void QueueSoccerBall(float beat) + public static void QueueSoccerBall(double beat) { if (GameManager.instance.currentGame != "doubleDate") { @@ -251,10 +251,10 @@ namespace HeavenStudio.Games { instance.SpawnSoccerBall(beat); } - Jukebox.PlayOneShotGame("doubleDate/soccerBounce", beat, forcePlay: true); + SoundByte.PlayOneShotGame("doubleDate/soccerBounce", beat, forcePlay: true); } - public static void QueueBasketBall(float beat) + public static void QueueBasketBall(double beat) { if (GameManager.instance.currentGame != "doubleDate") { @@ -275,7 +275,7 @@ namespace HeavenStudio.Games }, forcePlay: true); } - public static void QueueFootBall(float beat) + public static void QueueFootBall(double beat) { if (GameManager.instance.currentGame != "doubleDate") { @@ -296,31 +296,31 @@ namespace HeavenStudio.Games }, forcePlay: true); } - public void SpawnSoccerBall(float beat) + public void SpawnSoccerBall(double beat) { SoccerBall spawnedBall = Instantiate(soccer, instance.transform).GetComponent(); spawnedBall.Init(beat); } - public void SpawnBasketBall(float beat) + public void SpawnBasketBall(double beat) { Basketball spawnedBall = Instantiate(basket, instance.transform).GetComponent(); spawnedBall.Init(beat); } - public void SpawnFootBall(float beat) + public void SpawnFootBall(double beat) { Football spawnedBall = Instantiate(football, instance.transform).GetComponent(); spawnedBall.Init(beat); } - public void MissKick(float beat, bool hit = false) + public void MissKick(double beat, bool hit = false) { - lastGirlGacha = Conductor.instance.songPositionInBeats + 1.5f; + lastGirlGacha = Conductor.instance.songPositionInBeatsAsDouble + 1.5f; girlAnim.DoScaledAnimationAsync("GirlSad", 0.5f); if (hit) { - lastHitWeasel = Conductor.instance.songPositionInBeats; + lastHitWeasel = Conductor.instance.songPositionInBeatsAsDouble; BeatAction.New(gameObject, new List() { new BeatAction.Action(beat - (0.25f/3f), delegate { weasels.Hit(beat); }), @@ -328,7 +328,7 @@ namespace HeavenStudio.Games } else { - lastHitWeasel = Conductor.instance.songPositionInBeats; + lastHitWeasel = Conductor.instance.songPositionInBeatsAsDouble; BeatAction.New(gameObject, new List() { new BeatAction.Action(beat + 0.25, delegate { weasels.Hide(beat + 0.25f); }), diff --git a/Assets/Scripts/Games/DoubleDate/DoubleDateWeasels.cs b/Assets/Scripts/Games/DoubleDate/DoubleDateWeasels.cs index 58b30cc1..7b176489 100644 --- a/Assets/Scripts/Games/DoubleDate/DoubleDateWeasels.cs +++ b/Assets/Scripts/Games/DoubleDate/DoubleDateWeasels.cs @@ -42,7 +42,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate } } - public void Hide(float beat) + public void Hide(double beat) { if (notHit) { @@ -69,7 +69,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate } } - public void Hit(float beat) + public void Hit(double beat) { if (notHit) { diff --git a/Assets/Scripts/Games/DoubleDate/Football.cs b/Assets/Scripts/Games/DoubleDate/Football.cs index 538aa745..302c818a 100644 --- a/Assets/Scripts/Games/DoubleDate/Football.cs +++ b/Assets/Scripts/Games/DoubleDate/Football.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -11,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate private DoubleDate game; private SuperCurveObject.Path path; - private float pathStartBeat = float.MinValue; + private double pathStartBeat = double.MinValue; private Conductor conductor; private GameObject shadow; @@ -23,20 +24,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Update() { - float beat = conductor.songPositionInBeats; - float height = 0f; - if (pathStartBeat > float.MinValue) + double beat = conductor.songPositionInBeatsAsDouble; + double height = 0f; + if (pathStartBeat > double.MinValue) { - Vector3 pos = GetPathPositionFromBeat(path, Mathf.Max(beat, pathStartBeat), out height, pathStartBeat); + Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat); transform.position = pos; float rot = GetPathValue("rot"); transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f/conductor.pitchedSecPerBeat))); } - shadow.transform.position = new Vector3(transform.position.x, Mathf.Min(transform.position.y - height, game.floorHeight), transform.position.z); + shadow.transform.position = new Vector3(transform.position.x, (float) Math.Min(transform.position.y - height, game.floorHeight), transform.position.z); shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f); } - public void Init(float beat) + public void Init(double beat) { game.ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, 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 @@ -57,14 +58,14 @@ namespace HeavenStudio.Games.Scripts_DoubleDate if (state >= 1f || state <= -1f) { UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeats; + pathStartBeat = conductor.songPositionInBeatsAsDouble; path = game.GetPath("FootBallNg" + (state > 0 ? "Late" : "Early")); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); game.Kick(false); GetComponent().sortingOrder = 8; BeatAction.New(gameObject, new List() { - new BeatAction.Action(conductor.songPositionInBeats + 4f, delegate + new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 4f, delegate { Destroy(gameObject); }), @@ -74,16 +75,16 @@ namespace HeavenStudio.Games.Scripts_DoubleDate Hit(); BeatAction.New(gameObject, new List() { - new BeatAction.Action(conductor.songPositionInBeats + 1f, delegate + new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 1f, delegate { shadow.SetActive(false); GetComponent().sortingOrder = -5; transform.localScale *= 0.25f; path = game.GetPath("FootBallFall"); UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeats + 1f; + pathStartBeat = conductor.songPositionInBeatsAsDouble + 1f; }), - new BeatAction.Action(conductor.songPositionInBeats + 12f, delegate + new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 12f, delegate { Destroy(gameObject); }), @@ -93,30 +94,30 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Hit() { UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeats; + pathStartBeat = conductor.songPositionInBeatsAsDouble; path = game.GetPath("FootBallJust"); game.Kick(true, true, jump: true); - Jukebox.PlayOneShotGame("doubleDate/footballKick"); + SoundByte.PlayOneShotGame("doubleDate/footballKick"); } void Miss(PlayerActionEvent caller) { - if (conductor.songPositionInBeats > game.lastHitWeasel + 2.25f) + if (conductor.songPositionInBeatsAsDouble > game.lastHitWeasel + 2.25f) { path = game.GetPath("FootBallIn"); float impact = GetPointTimeByTag(path, "impact"); if (impact > 0) { GetComponent().sortingOrder = 8; - Jukebox.PlayOneShotGame("doubleDate/weasel_hit", pathStartBeat + impact); - Jukebox.PlayOneShotGame("doubleDate/weasel_scream", pathStartBeat + impact); + SoundByte.PlayOneShotGame("doubleDate/weasel_hit", pathStartBeat + impact); + SoundByte.PlayOneShotGame("doubleDate/weasel_scream", pathStartBeat + impact); game.MissKick(pathStartBeat + impact, true); } } BeatAction.New(gameObject, new List() { - new BeatAction.Action(conductor.songPositionInBeats + 5f, delegate + new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 5f, delegate { Destroy(gameObject); }), diff --git a/Assets/Scripts/Games/DoubleDate/SoccerBall.cs b/Assets/Scripts/Games/DoubleDate/SoccerBall.cs index ade5eec6..f2c755bf 100644 --- a/Assets/Scripts/Games/DoubleDate/SoccerBall.cs +++ b/Assets/Scripts/Games/DoubleDate/SoccerBall.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -11,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate { private DoubleDate game; private SuperCurveObject.Path path; - private float pathStartBeat = float.MinValue; + private double pathStartBeat = double.MinValue; private Conductor conductor; private GameObject shadow; @@ -23,20 +24,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Update() { - float beat = conductor.songPositionInBeats; - float height = 0f; - if (pathStartBeat > float.MinValue) + double beat = conductor.songPositionInBeatsAsDouble; + double height = 0f; + if (pathStartBeat > double.MinValue) { - Vector3 pos = GetPathPositionFromBeat(path, Mathf.Max(beat, pathStartBeat), out height, pathStartBeat); + Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat); transform.position = pos; float rot = GetPathValue("rot"); transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f/conductor.pitchedSecPerBeat))); } - shadow.transform.position = new Vector3(transform.position.x, Mathf.Min(transform.position.y - height, game.floorHeight), transform.position.z); + shadow.transform.position = new Vector3(transform.position.x, (float) Math.Min(transform.position.y - height, game.floorHeight), transform.position.z); shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f); } - public void Init(float beat) + public void Init(double beat) { game.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, Just, Miss, Empty); path = game.GetPath("SoccerIn"); @@ -56,17 +57,17 @@ namespace HeavenStudio.Games.Scripts_DoubleDate { BeatAction.New(gameObject, new List() { - new BeatAction.Action(conductor.songPositionInBeats + 3f, delegate + new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 3f, delegate { Destroy(gameObject); }), }); UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeats; + pathStartBeat = conductor.songPositionInBeatsAsDouble; if (state >= 1f || state <= -1f) { path = game.GetPath("SoccerNg" + (state > 0 ? "Late" : "Early")); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); game.Kick(false); GetComponent().sortingOrder = 8; return; @@ -77,20 +78,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate void Hit() { UpdateLastRealPos(); - pathStartBeat = conductor.songPositionInBeats; + pathStartBeat = conductor.songPositionInBeatsAsDouble; path = game.GetPath("SoccerJust"); game.Kick(); - Jukebox.PlayOneShotGame("doubleDate/kick"); + SoundByte.PlayOneShotGame("doubleDate/kick"); } void Miss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("doubleDate/weasel_hide"); + SoundByte.PlayOneShotGame("doubleDate/weasel_hide"); game.MissKick(pathStartBeat + 2.25f); BeatAction.New(gameObject, new List() { - new BeatAction.Action(conductor.songPositionInBeats + 4f, delegate + new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 4f, delegate { Destroy(gameObject); }), diff --git a/Assets/Scripts/Games/DrummingPractice/Drummer.cs b/Assets/Scripts/Games/DrummingPractice/Drummer.cs index c4768ce7..7b75bd48 100644 --- a/Assets/Scripts/Games/DrummingPractice/Drummer.cs +++ b/Assets/Scripts/Games/DrummingPractice/Drummer.cs @@ -24,7 +24,7 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice private bool hitting = false; - private float canBopBeat = -2f; + private double canBopBeat = -2f; // in the future: use the MiiStudio API to render any mii from a nintendo account / MNMS / Mii Studio code? // figure out how to call the API from unity? @@ -59,7 +59,7 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice animator.Play("Bop", 0, 0); } - public void Prepare(float beat, int type) + public void Prepare(double beat, int type) { canBopBeat = beat; count = type; @@ -103,13 +103,13 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice private void HitSound(bool applause) { - Jukebox.PlayOneShotGame("drummingPractice/hit"); - if (applause) Jukebox.PlayOneShot("applause"); + SoundByte.PlayOneShotGame("drummingPractice/hit"); + if (applause) SoundByte.PlayOneShot("applause"); } private void MissSound() { - Jukebox.PlayOneShotGame("drummingPractice/miss"); + SoundByte.PlayOneShotGame("drummingPractice/miss"); } public void EndHit() diff --git a/Assets/Scripts/Games/DrummingPractice/DrummerHit.cs b/Assets/Scripts/Games/DrummingPractice/DrummerHit.cs index a3777809..f95ab161 100644 --- a/Assets/Scripts/Games/DrummingPractice/DrummerHit.cs +++ b/Assets/Scripts/Games/DrummingPractice/DrummerHit.cs @@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice public class DrummerHit : MonoBehaviour { DrummingPractice game; - public float startBeat; + public double startBeat; public bool applause = true; // Start is called before the first frame update @@ -25,7 +25,7 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice BeatAction.New(game.gameObject, new List() { new BeatAction.Action(startBeat+1f, delegate { - Jukebox.PlayOneShotGame("drummingPractice/drum"); + SoundByte.PlayOneShotGame("drummingPractice/drum"); game.leftDrummer.Hit(true, false); game.rightDrummer.Hit(true, false); }), diff --git a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs index 1f2378c8..1ff795e8 100644 --- a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs +++ b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs @@ -109,7 +109,7 @@ namespace HeavenStudio.Games [Header("Variables")] float movingLength; - float movingStartBeat; + double movingStartBeat; bool isMoving; string moveAnim; EasingFunction.Ease lastEase; @@ -126,9 +126,9 @@ namespace HeavenStudio.Games SetMiis(); } - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { - var changeMii = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "drummingPractice/set mii" && c.beat <= beat); + var changeMii = GameManager.instance.Beatmap.Entities.FindLast(c => c.datamodel == "drummingPractice/set mii" && c.beat <= beat); if(changeMii != null) { EventCaller.instance.CallEvent(changeMii, true); @@ -164,7 +164,7 @@ namespace HeavenStudio.Games } } - public void NPCDrummersEnterOrExit(float beat, float length, bool exit, int ease) + public void NPCDrummersEnterOrExit(double beat, float length, bool exit, int ease) { movingStartBeat = beat; movingLength = length; @@ -177,7 +177,7 @@ namespace HeavenStudio.Games }); } - public void SetBop(float beat, float length, bool shouldBop, bool autoBop) + public void SetBop(double beat, float length, bool shouldBop, bool autoBop) { goBop = autoBop; if (shouldBop) @@ -199,7 +199,7 @@ namespace HeavenStudio.Games rightDrummer.Bop(); } - public void Prepare(float beat, bool applause) + public void Prepare(double beat, bool applause) { int type = count % 2; player.Prepare(beat, type); @@ -208,7 +208,7 @@ namespace HeavenStudio.Games count++; SetFaces(0); - Jukebox.PlayOneShotGame("drummingPractice/prepare"); + SoundByte.PlayOneShotGame("drummingPractice/prepare"); GameObject hit = Instantiate(hitPrefab); hit.transform.parent = hitPrefab.transform.parent; diff --git a/Assets/Scripts/Games/FanClub/FanClub.cs b/Assets/Scripts/Games/FanClub/FanClub.cs index 2d845106..12587695 100644 --- a/Assets/Scripts/Games/FanClub/FanClub.cs +++ b/Assets/Scripts/Games/FanClub/FanClub.cs @@ -209,14 +209,14 @@ namespace HeavenStudio.Games private GameEvent noCall = new GameEvent(); private GameEvent noSpecBop = new GameEvent(); - private float idolJumpStartTime = Single.MinValue; + private double idolJumpStartTime = double.MinValue; private static int performanceType = (int) IdolPerformanceType.Normal; private bool responseToggle = false; - private static float wantHais = Single.MinValue; - private static float wantKamone = Single.MinValue; + private static double wantHais = double.MinValue; + private static double wantKamone = double.MinValue; private static int wantKamoneType = (int) KamoneResponseType.Through; private static bool wantKamoneAlt = false; - private static float wantBigReady = Single.MinValue; + private static double wantBigReady = double.MinValue; private bool hasJumped = false; private bool goBopIdol = true; private bool goBopSpec = true; @@ -331,22 +331,22 @@ namespace HeavenStudio.Games } } - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { - if (wantHais != Single.MinValue) + if (wantHais != double.MinValue) { ContinueHais(wantHais); - wantHais = Single.MinValue; + wantHais = double.MinValue; } - if (wantKamone != Single.MinValue) + if (wantKamone != double.MinValue) { ContinueKamone(wantKamone, 0, wantKamoneType, wantKamoneAlt); - wantKamone = Single.MinValue; + wantKamone = double.MinValue; } - if (wantBigReady != Single.MinValue) + if (wantBigReady != double.MinValue) { ContinueBigReady(wantBigReady); - wantBigReady = Single.MinValue; + wantBigReady = double.MinValue; } } @@ -357,7 +357,7 @@ namespace HeavenStudio.Games { if (goBopIdol) { - if (!(cond.songPositionInBeats >= noBop.startBeat && cond.songPositionInBeats < noBop.startBeat + noBop.length)) + if (!(cond.songPositionInBeatsAsDouble >= noBop.startBeat && cond.songPositionInBeatsAsDouble < noBop.startBeat + noBop.length)) { idolAnimator.Play("IdolBeat" + GetPerformanceSuffix(), 0, 0); Blue.PlayAnimState("Beat"); @@ -370,7 +370,7 @@ namespace HeavenStudio.Games { if (goBopSpec) { - if (!(cond.songPositionInBeats >= noSpecBop.startBeat && cond.songPositionInBeats < noSpecBop.startBeat + noSpecBop.length)) + if (!(cond.songPositionInBeatsAsDouble >= noSpecBop.startBeat && cond.songPositionInBeatsAsDouble < noSpecBop.startBeat + noSpecBop.length)) BopAll(); } } @@ -378,7 +378,7 @@ namespace HeavenStudio.Games //idol jumping physics float jumpPos = cond.GetPositionFromBeat(idolJumpStartTime, 1f); float IDOL_SHADOW_SCALE = 1.18f; - if (cond.songPositionInBeats >= idolJumpStartTime && cond.songPositionInBeats < idolJumpStartTime + 1f) + if (cond.songPositionInBeatsAsDouble >= idolJumpStartTime && cond.songPositionInBeatsAsDouble < idolJumpStartTime + 1f) { hasJumped = true; float yMul = jumpPos * 2f - 1f; @@ -388,13 +388,13 @@ namespace HeavenStudio.Games } else { - idolJumpStartTime = Single.MinValue; + idolJumpStartTime = double.MinValue; ArisaRootMotion.transform.localPosition = new Vector3(0, 0); ArisaShadow.transform.localScale = new Vector3(IDOL_SHADOW_SCALE, IDOL_SHADOW_SCALE, 1f); } } - public void Bop(float beat, float length, int target = (int) IdolBopType.Both, int targetAuto = (int)IdolBopType.Both) + public void Bop(double beat, float length, int target = (int) IdolBopType.Both, int targetAuto = (int)IdolBopType.Both) { goBopIdol = targetAuto == (int)IdolBopType.Both || targetAuto == (int)IdolBopType.Idol; goBopSpec = targetAuto == (int)IdolBopType.Both || targetAuto == (int)IdolBopType.Spectators; @@ -430,33 +430,33 @@ namespace HeavenStudio.Games } } - private void DisableBop(float beat, float length) + private void DisableBop(double beat, float length) { noBop.length = length; noBop.startBeat = beat; } - private void DisableResponse(float beat, float length) + private void DisableResponse(double beat, float length) { noResponse.length = length; noResponse.startBeat = beat; } - private void DisableCall(float beat, float length) + private void DisableCall(double beat, float length) { noCall.length = length; noCall.startBeat = beat; } - private void DisableSpecBop(float beat, float length) + private void DisableSpecBop(double beat, float length) { - float bt = Conductor.instance.songPositionInBeats; + double bt = Conductor.instance.songPositionInBeatsAsDouble; if (bt >= noSpecBop.startBeat && bt < noSpecBop.startBeat + noSpecBop.length) { - float thisStToNextSt = beat - noSpecBop.startBeat; - float newLen = thisStToNextSt + length; + double thisStToNextSt = beat - noSpecBop.startBeat; + double newLen = thisStToNextSt + length; if (newLen > noSpecBop.length) - noSpecBop.length = thisStToNextSt + length; + noSpecBop.length = (float)thisStToNextSt + length; } else { @@ -465,9 +465,9 @@ namespace HeavenStudio.Games } } - public void PlayAnim(float beat, float length, int type, int who) + public void PlayAnim(double beat, float length, int type, int who) { - idolJumpStartTime = Single.MinValue; + idolJumpStartTime = double.MinValue; DisableResponse(beat, length + 0.5f); DisableBop(beat, length + 0.5f); DisableCall(beat, length + 0.5f); @@ -529,14 +529,14 @@ namespace HeavenStudio.Games break; case (int)IdolAnimations.Dab: idolAnimator.Play("IdolDab" + GetPerformanceSuffix(), -1, 0); - Jukebox.PlayOneShotGame("fanClub/arisa_dab"); + SoundByte.PlayOneShotGame("fanClub/arisa_dab"); break; default: break; } } } - public void PlayAnimStage(float beat, int type) + public void PlayAnimStage(double beat, int type) { switch (type) { @@ -566,7 +566,7 @@ namespace HeavenStudio.Games spectatorMat.SetColor("_Color", new Color(117/255f, 177/255f, 209/255f, 1)); } - private void DoIdolJump(float beat, float length = 3f) + private void DoIdolJump(double beat, float length = 3f) { DisableBop(beat, length); DisableResponse(beat, length); @@ -584,7 +584,7 @@ namespace HeavenStudio.Games { if (!responseToggle) { - if (!(Conductor.instance.songPositionInBeats >= noResponse.startBeat && Conductor.instance.songPositionInBeats < noResponse.startBeat + noResponse.length)) + if (!(Conductor.instance.songPositionInBeatsAsDouble >= noResponse.startBeat && Conductor.instance.songPositionInBeatsAsDouble < noResponse.startBeat + noResponse.length)) { idolAnimator.Play("IdolCrap" + GetPerformanceSuffix(), -1, 0); Blue.PlayAnimState("Crap"); @@ -595,7 +595,7 @@ namespace HeavenStudio.Games private void DoIdolPeace(bool sync = true) { - if (!(Conductor.instance.songPositionInBeats >= noCall.startBeat && Conductor.instance.songPositionInBeats < noCall.startBeat + noCall.length)) + if (!(Conductor.instance.songPositionInBeatsAsDouble >= noCall.startBeat && Conductor.instance.songPositionInBeatsAsDouble < noCall.startBeat + noCall.length)) { if (sync) idolAnimator.Play("IdolPeace" + GetPerformanceSuffix(), -1, 0); @@ -610,14 +610,14 @@ namespace HeavenStudio.Games { if (responseToggle) { - if (!(Conductor.instance.songPositionInBeats >= noResponse.startBeat && Conductor.instance.songPositionInBeats < noResponse.startBeat + noResponse.length)) + if (!(Conductor.instance.songPositionInBeatsAsDouble >= noResponse.startBeat && Conductor.instance.songPositionInBeatsAsDouble < noResponse.startBeat + noResponse.length)) idolAnimator.Play("IdolResponse" + GetPerformanceSuffix(), -1, 0); } } private void DoIdolCall(int part = 0, bool big = false) { - if (!(Conductor.instance.songPositionInBeats >= noCall.startBeat && Conductor.instance.songPositionInBeats < noCall.startBeat + noCall.length)) + if (!(Conductor.instance.songPositionInBeatsAsDouble >= noCall.startBeat && Conductor.instance.songPositionInBeatsAsDouble < noCall.startBeat + noCall.length)) { if (big) { @@ -631,7 +631,7 @@ namespace HeavenStudio.Games } const float HAIS_LENGTH = 4.5f; - public void CallHai(float beat, bool noSound = false, int type = 0) + public void CallHai(double beat, bool noSound = false, int type = 0) { responseToggle = false; DisableBop(beat, 8f); @@ -658,25 +658,25 @@ namespace HeavenStudio.Games PlaySoundSequence("fanClub", "crowd_hai", beat + 4f); } - public static void WarnHai(float beat, bool noSound = false, int type = 0) + public static void WarnHai(double beat, bool noSound = false, int type = 0) { wantHais = beat; } - public static void HaiSound(float beat, bool noSound = false, int type = 0) + public static void HaiSound(double beat, bool noSound = false, int type = 0) { if (noSound) return; PlaySoundSequence("fanClub", "arisa_hai", beat); } - public void ContinueHais(float beat, int type = 0) + public void ContinueHais(double beat, int type = 0) { CallHai(beat, true, type); } const float CALL_LENGTH = 2.5f; - public void CallKamone(float beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false) + public void CallKamone(double beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false) { bool doJump = (responseType == (int) KamoneResponseType.Jump || responseType == (int) KamoneResponseType.JumpFast); bool isBig = (responseType == (int) KamoneResponseType.ThroughFast || responseType == (int) KamoneResponseType.JumpFast); @@ -719,14 +719,14 @@ namespace HeavenStudio.Games PlaySoundSequence("fanClub", alt ? "crowd_iina" : "crowd_kamone", beat + 2f); } - public static void WarnKamone(float beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false) + public static void WarnKamone(double beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false) { wantKamone = beat; wantKamoneType = responseType; wantKamoneAlt = alt; } - public static void KamoneSound(float beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false) + public static void KamoneSound(double beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false) { if (noSound) return; if (responseType == (int) KamoneResponseType.ThroughFast || responseType == (int) KamoneResponseType.JumpFast) @@ -739,13 +739,13 @@ namespace HeavenStudio.Games } } - public void ContinueKamone(float beat, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false) + public void ContinueKamone(double beat, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false) { CallKamone(beat, true, type, responseType, alt); } const float BIGCALL_LENGTH = 2.75f; - public void CallBigReady(float beat, bool noSound = false) + public void CallBigReady(double beat, bool noSound = false) { Prepare(beat + 1.5f); Prepare(beat + 2f); @@ -762,23 +762,23 @@ namespace HeavenStudio.Games }); } - public static void WarnBigReady(float beat, bool noSound = false) + public static void WarnBigReady(double beat, bool noSound = false) { wantBigReady = beat; } - public static void BigReadySound(float beat, bool noSound = false) + public static void BigReadySound(double beat, bool noSound = false) { if (noSound) return; PlaySoundSequence("fanClub", "crowd_big_ready", beat); } - public void ContinueBigReady(float beat) + public void ContinueBigReady(double beat) { CallBigReady(beat, true); } - public void Prepare(float beat, int type = 0) + public void Prepare(double beat, int type = 0) { Player.AddHit(beat, type); } @@ -832,7 +832,7 @@ namespace HeavenStudio.Games } } - private void PlayOneClap(float beat, int who = -1) + private void PlayOneClap(double beat, int who = -1) { if (who != -1) { @@ -845,7 +845,7 @@ namespace HeavenStudio.Games return; } // Jukebox.PlayOneShotGame("fanClub/play_clap", volume: 0.08f); - Jukebox.PlayOneShotGame("fanClub/crap_impact", pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.1f); + SoundByte.PlayOneShotGame("fanClub/crap_impact", pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.1f); BeatAction.New(Spectators[who], new List() { new BeatAction.Action(beat, delegate { Spectators[who].GetComponent().Play("FanClap", -1, 0); }), @@ -863,7 +863,7 @@ namespace HeavenStudio.Games } } - private void PlayLongClap(float beat) + private void PlayLongClap(double beat) { BeatAction.New(this.gameObject, new List() { @@ -872,7 +872,7 @@ namespace HeavenStudio.Games }); } - private void PlayChargeClap(float beat) + private void PlayChargeClap(double beat) { BeatAction.New(this.gameObject, new List() { @@ -881,7 +881,7 @@ namespace HeavenStudio.Games }); } - private void StartJump(int idx, float beat) + private void StartJump(int idx, double beat) { Spectators[idx].GetComponent().jumpStartTime = beat; BeatAction.New(Spectators[idx], new List() @@ -891,7 +891,7 @@ namespace HeavenStudio.Games }); } - private void PlayJump(float beat) + private void PlayJump(double beat) { for (int i = 0; i < Spectators.Count; i++) { @@ -912,7 +912,7 @@ namespace HeavenStudio.Games } } - public void DancerTravel(float beat, float length, bool exit, bool instant) + public void DancerTravel(double beat, float length, bool exit, bool instant) { if (instant) { @@ -926,7 +926,7 @@ namespace HeavenStudio.Games } } - public void FinalCheer(float beat) + public void FinalCheer(double beat) { if (noJudgement) return; noJudgement = true; @@ -970,7 +970,7 @@ namespace HeavenStudio.Games }); } - void StartClapLoop(float beat, int who) + void StartClapLoop(double beat, int who) { BeatAction.New(Spectators[who], new List() { diff --git a/Assets/Scripts/Games/FanClub/NtrIdolAmie.cs b/Assets/Scripts/Games/FanClub/NtrIdolAmie.cs index 372df410..a036c495 100644 --- a/Assets/Scripts/Games/FanClub/NtrIdolAmie.cs +++ b/Assets/Scripts/Games/FanClub/NtrIdolAmie.cs @@ -25,11 +25,11 @@ namespace HeavenStudio.Games.Scripts_FanClub public Material coreMat; Animator anim; - float startStepBeat = float.MaxValue; + double startStepBeat = double.MaxValue; float stepLength = 16f; bool exiting = false; int currentAnim = 0; - float startJumpTime = float.MinValue; + double startJumpTime = double.MinValue; bool hasJumped = false; const int StepCount = 8; @@ -41,14 +41,14 @@ namespace HeavenStudio.Games.Scripts_FanClub if (cond.songPositionInBeatsAsDouble >= startStepBeat + stepLength) { FinishEntrance(exiting); - startStepBeat = float.MaxValue; + startStepBeat = double.MaxValue; currentAnim = 0; } else if (cond.songPositionInBeatsAsDouble >= startStepBeat) { currentAnim = (int)((cond.songPositionInBeatsAsDouble - startStepBeat) / (stepLength / AnimCount)); - float startAnimBeat = startStepBeat + (stepLength / AnimCount) * currentAnim; - float endAnimBeat = startAnimBeat + (stepLength / AnimCount); + double startAnimBeat = startStepBeat + (stepLength / AnimCount) * currentAnim; + double endAnimBeat = startAnimBeat + (stepLength / AnimCount); float prog = (float)((cond.songPositionInBeatsAsDouble - startAnimBeat - 0.75) / (endAnimBeat - startAnimBeat)); prog = Mathf.Clamp01(prog * 4); if (exiting) @@ -64,12 +64,12 @@ namespace HeavenStudio.Games.Scripts_FanClub rootTransform.transform.localPosition = new Vector3(startPostion + stepDistance * currentAnim + stepDistance * prog, rootYPos); } - if (startStepBeat == float.MaxValue) + if (startStepBeat == double.MaxValue) { //idol jumping physics float jumpPos = cond.GetPositionFromBeat(startJumpTime, 1f); float IDOL_SHADOW_SCALE = 1.18f; - if (cond.songPositionInBeats >= startJumpTime && cond.songPositionInBeats < startJumpTime + 1f) + if (cond.songPositionInBeatsAsDouble >= startJumpTime && cond.songPositionInBeatsAsDouble < startJumpTime + 1f) { hasJumped = true; float yMul = jumpPos * 2f - 1f; @@ -111,7 +111,7 @@ namespace HeavenStudio.Games.Scripts_FanClub anim = GetComponent(); } - public void StartEntrance(float beat, float length, bool exit) { + public void StartEntrance(double beat, float length, bool exit) { gameObject.SetActive(true); rootTransform.SetActive(true); shadow.SetActive(true); @@ -156,9 +156,9 @@ namespace HeavenStudio.Games.Scripts_FanClub coreMat.SetColor("_Color", new Color(117/255f, 177/255f, 209/255f, 1)); } - public void DoIdolJump(float beat) + public void DoIdolJump(double beat) { - if (startStepBeat != float.MaxValue) return; + if (startStepBeat != double.MaxValue) return; if (!gameObject.activeInHierarchy) return; startJumpTime = beat; @@ -170,11 +170,11 @@ namespace HeavenStudio.Games.Scripts_FanClub }); } - public void PlayAnim(float beat, float length, int type) + public void PlayAnim(double beat, float length, int type) { - if (startStepBeat != float.MaxValue) return; + if (startStepBeat != double.MaxValue) return; if (!gameObject.activeInHierarchy) return; - startJumpTime = float.MinValue; + startJumpTime = double.MinValue; // DisableResponse(beat, length + 0.5f); // DisableBop(beat, length + 0.5f); // DisableCall(beat, length + 0.5f); @@ -223,7 +223,7 @@ namespace HeavenStudio.Games.Scripts_FanClub public void PlayAnimState(string state) { - if (startStepBeat != float.MaxValue) return; + if (startStepBeat != double.MaxValue) return; if (!gameObject.activeInHierarchy) return; anim.Play(state, -1, 0); } diff --git a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs index f9ab74e3..4038c9d7 100644 --- a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs +++ b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs @@ -21,14 +21,14 @@ namespace HeavenStudio.Games.Scripts_FanClub [Header("Properties")] [NonSerialized] public bool player = false; - public float jumpStartTime = Single.MinValue; + public double jumpStartTime = double.MinValue; bool stopBeat = false; bool stopCharge = false; bool hasJumped = false; - float clappingStartTime = Single.MinValue; + double clappingStartTime = double.MinValue; - public void AddHit(float beat, int type = 0) + public void AddHit(double beat, int type = 0) { if (player) { @@ -114,7 +114,7 @@ namespace HeavenStudio.Games.Scripts_FanClub } if (PlayerInput.Pressing()) { - if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && !stopCharge) + if (clappingStartTime != double.MinValue && cond.songPositionInBeatsAsDouble > clappingStartTime + 2f && !stopCharge) { animator.speed = 1f; animator.Play("FanClapCharge", -1, 0); @@ -123,7 +123,7 @@ namespace HeavenStudio.Games.Scripts_FanClub } if (PlayerInput.PressedUp()) { - if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && stopCharge && !FanClub.instance.IsExpectingInputNow(InputType.STANDARD_UP)) + if (clappingStartTime != double.MinValue && cond.songPositionInBeatsAsDouble > clappingStartTime + 2f && stopCharge && !FanClub.instance.IsExpectingInputNow(InputType.STANDARD_UP)) { if (FanClub.instance.JudgementPaused) { @@ -140,13 +140,13 @@ namespace HeavenStudio.Games.Scripts_FanClub animator.speed = 1f; animator.Play("FanFree", -1, 0); stopBeat = false; - clappingStartTime = Single.MinValue; + clappingStartTime = double.MinValue; } } } float jumpPos = cond.GetPositionFromBeat(jumpStartTime, 1f); - if (cond.songPositionInBeats >= jumpStartTime && cond.songPositionInBeats < jumpStartTime + 1f) + if (cond.songPositionInBeatsAsDouble >= jumpStartTime && cond.songPositionInBeatsAsDouble < jumpStartTime + 1f) { hasJumped = true; float yMul = jumpPos * 2f - 1f; @@ -161,7 +161,7 @@ namespace HeavenStudio.Games.Scripts_FanClub shadow.transform.localScale = new Vector3(1.4f, 1.4f, 1f); if (hasJumped) { - Jukebox.PlayOneShotGame("fanClub/landing_impact", pitch: UnityEngine.Random.Range(0.95f, 1f), volume: 1f/4); + SoundByte.PlayOneShotGame("fanClub/landing_impact", pitch: UnityEngine.Random.Range(0.95f, 1f), volume: 1f/4); if (player) { animator.Play("FanPrepare", -1, 0); @@ -191,14 +191,14 @@ namespace HeavenStudio.Games.Scripts_FanClub jumpStartTime = -99f; animator.speed = 1f; animator.Play("FanClap", -1, 0); - Jukebox.PlayOneShotGame("fanClub/play_clap"); - Jukebox.PlayOneShotGame("fanClub/crap_impact"); - clappingStartTime = cond.songPositionInBeats; + SoundByte.PlayOneShotGame("fanClub/play_clap"); + SoundByte.PlayOneShotGame("fanClub/crap_impact"); + clappingStartTime = cond.songPositionInBeatsAsDouble; if (doCharge) BeatAction.New(this.gameObject, new List() { - new BeatAction.Action(cond.songPositionInBeats + 0.1f, delegate { + new BeatAction.Action(cond.songPositionInBeatsAsDouble + 0.1f, delegate { if (PlayerInput.Pressing() || autoplayRelease > 0f) { animator.Play("FanClapCharge", -1, 0); @@ -211,7 +211,7 @@ namespace HeavenStudio.Games.Scripts_FanClub { BeatAction.New(this.gameObject, new List() { - new BeatAction.Action(cond.songPositionInBeats + autoplayRelease, delegate { + new BeatAction.Action(cond.songPositionInBeatsAsDouble + autoplayRelease, delegate { animator.Play("FanFree", -1, 0); stopBeat = false; }), @@ -229,16 +229,16 @@ namespace HeavenStudio.Games.Scripts_FanClub var cond = Conductor.instance; animator.Play("FanJump", -1, 0); - Jukebox.PlayOneShotGame("fanClub/play_jump"); - jumpStartTime = cond.songPositionInBeats; - clappingStartTime = Single.MinValue; + SoundByte.PlayOneShotGame("fanClub/play_jump"); + jumpStartTime = cond.songPositionInBeatsAsDouble; + clappingStartTime = double.MinValue; stopCharge = false; } public bool IsJumping() { var cond = Conductor.instance; - return (cond.songPositionInBeats >= jumpStartTime && cond.songPositionInBeats < jumpStartTime + 1f); + return (cond.songPositionInBeatsAsDouble >= jumpStartTime && cond.songPositionInBeatsAsDouble < jumpStartTime + 1f); } public void Bop() diff --git a/Assets/Scripts/Games/Fireworks/Fireworks.cs b/Assets/Scripts/Games/Fireworks/Fireworks.cs index 83b43cea..b859826d 100644 --- a/Assets/Scripts/Games/Fireworks/Fireworks.cs +++ b/Assets/Scripts/Games/Fireworks/Fireworks.cs @@ -91,7 +91,7 @@ namespace HeavenStudio.Games } public struct QueuedFirework { - public float beat; + public double beat; public bool isSparkler; public int whereToSpawn; public bool practice; @@ -166,7 +166,7 @@ namespace HeavenStudio.Games stars.SetActive(!doIt); } - public static void CountIn(float beat, int count) + public static void CountIn(double beat, int count) { switch (count) { @@ -197,7 +197,7 @@ namespace HeavenStudio.Games } } - public static void PreSpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset) + public static void PreSpawnFirework(double beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset) { if (isSparkler) { @@ -230,7 +230,7 @@ namespace HeavenStudio.Games } - void SpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset) + void SpawnFirework(double beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset) { if (isSparkler && practice) { @@ -270,9 +270,9 @@ namespace HeavenStudio.Games spawnedRocket.Init(beat, explosionType); } - public void SpawnBomb(float beat, bool practice, bool applause) + public void SpawnBomb(double beat, bool practice, bool applause) { - Jukebox.PlayOneShotGame("fireworks/tamaya_4"); + SoundByte.PlayOneShotGame("fireworks/tamaya_4"); if (practice) { MultiSound.Play(new MultiSound.Sound[] diff --git a/Assets/Scripts/Games/Fireworks/FireworksBomb.cs b/Assets/Scripts/Games/Fireworks/FireworksBomb.cs index 5e03e4f3..a1864997 100644 --- a/Assets/Scripts/Games/Fireworks/FireworksBomb.cs +++ b/Assets/Scripts/Games/Fireworks/FireworksBomb.cs @@ -12,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks public bool applause; private bool exploded; private Fireworks game; - private float startBeat; + private double startBeat; private Animator anim; void Awake() @@ -21,7 +21,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks anim = GetComponent(); } - public void Init(float beat) + public void Init(double beat) { game.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, Just, Out, Out); startBeat = beat; @@ -46,7 +46,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks }); if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("fireworks/miss"); + SoundByte.PlayOneShotGame("fireworks/miss"); return; } @@ -55,9 +55,9 @@ namespace HeavenStudio.Games.Scripts_Fireworks void Success(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("fireworks/taikoExplode"); + SoundByte.PlayOneShotGame("fireworks/taikoExplode"); game.FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f); - if (applause) Jukebox.PlayOneShot("applause", caller.timer + caller.startBeat + 1f); + if (applause) SoundByte.PlayOneShot("applause", caller.timer + caller.startBeat + 1f); } void Out(PlayerActionEvent caller) { } diff --git a/Assets/Scripts/Games/Fireworks/Rocket.cs b/Assets/Scripts/Games/Fireworks/Rocket.cs index 41737a37..266df034 100644 --- a/Assets/Scripts/Games/Fireworks/Rocket.cs +++ b/Assets/Scripts/Games/Fireworks/Rocket.cs @@ -14,7 +14,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks [SerializeField] Animator anim; public bool isSparkler; private Fireworks game; - public float startBeat; + public double startBeat; public bool applause; private bool exploded; private float startY; @@ -63,7 +63,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks } } - public void Init(float beat, int explosionToChoose) + public void Init(double beat, int explosionToChoose) { startBeat = beat; startY = transform.position.y - offSet; @@ -89,7 +89,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks { if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("fireworks/miss"); + SoundByte.PlayOneShotGame("fireworks/miss"); particleBarelyEffect.Play(); anim.gameObject.SetActive(false); return; @@ -99,10 +99,10 @@ namespace HeavenStudio.Games.Scripts_Fireworks void Success(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("fireworks/explode_5"); + SoundByte.PlayOneShotGame("fireworks/explode_5"); selectedParticleEffect.Play(); anim.gameObject.SetActive(false); - if (applause) Jukebox.PlayOneShot("applause", caller.timer + caller.startBeat + 1f); + if (applause) SoundByte.PlayOneShot("applause", caller.timer + caller.startBeat + 1f); } void Out(PlayerActionEvent caller) { } diff --git a/Assets/Scripts/Games/FirstContact/FirstContact.cs b/Assets/Scripts/Games/FirstContact/FirstContact.cs index 1b9c6436..706aa6a8 100644 --- a/Assets/Scripts/Games/FirstContact/FirstContact.cs +++ b/Assets/Scripts/Games/FirstContact/FirstContact.cs @@ -1,3 +1,4 @@ +using System; using System.Text; using System.Collections.Generic; using UnityEngine; @@ -99,7 +100,7 @@ namespace HeavenStudio.Games public int alienSpeakCount; public int translatorSpeakCount; public bool hasMissed; - private float lastReportedBeat = 0; + private double lastReportedBeat = 0; [Header("Components")] [SerializeField] GameObject alien; @@ -119,7 +120,7 @@ namespace HeavenStudio.Games [Header("Variables")] int currentVoicelineIndex = -1; public bool intervalStarted; - float intervalStartBeat; + double intervalStartBeat; public float beatInterval = 4f; public bool noHitOnce, isSpeaking; //public int version; @@ -137,7 +138,7 @@ namespace HeavenStudio.Games static List queuedInputs = new List(); struct QueuedSecondContactInput { - public float beatAwayFromStart; + public double beatAwayFromStart; public string dialogue; } @@ -189,7 +190,7 @@ namespace HeavenStudio.Games translateFailTextbox.SetActive(false); } - public void SetIntervalStart(float beat, float interval, string outDialogue) + public void SetIntervalStart(double beat, float interval, string outDialogue) { translator.GetComponent().Play("translator_lookAtAlien", 0, 0); if (!intervalStarted) @@ -231,9 +232,9 @@ namespace HeavenStudio.Games { liveBar.GetComponent().Play("liveBar", 0, 0); } - else if (Conductor.instance.songPositionInBeats < lastReportedBeat) + else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat) { - lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats); + lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble); } if (PlayerInput.Pressed(true) && !IsExpectingInputNow(InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN)) @@ -248,7 +249,7 @@ namespace HeavenStudio.Games } else if (!noHitOnce && !missionControl.activeInHierarchy) { - Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_MISS2_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-2, 1), false)); + SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_MISS2_A", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-2, 1), false)); } } } @@ -291,7 +292,7 @@ namespace HeavenStudio.Games } - public void AlienSpeak(float beat, string dialogue, int spaceNum) + public void AlienSpeak(double beat, string dialogue, int spaceNum) { queuedInputs.Add(new QueuedSecondContactInput() { @@ -302,8 +303,8 @@ namespace HeavenStudio.Games if (voiceline == currentVoicelineIndex) voiceline++; if (voiceline > 10) voiceline = 1; currentVoicelineIndex = voiceline; - Jukebox.PlayOneShotGame("firstContact/Bob" + voiceline, beat, Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-100, 0), false)); - Jukebox.PlayOneShotGame("firstContact/BobB"); + SoundByte.PlayOneShotGame("firstContact/Bob" + voiceline, beat, SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-100, 0), false)); + SoundByte.PlayOneShotGame("firstContact/BobB"); alien.GetComponent().DoScaledAnimationAsync("alien_talk", 0.5f); if (UnityEngine.Random.Range(0, 5) == 0) translator.GetComponent().DoScaledAnimationAsync("translator_lookAtAlien_nod", 0.5f); callDiagList.Add(dialogue); @@ -317,10 +318,10 @@ namespace HeavenStudio.Games UpdateAlienTextbox(); } - public void AlienTurnOver(float beat, float length) + public void AlienTurnOver(double beat, float length) { if (queuedInputs.Count == 0) return; - Jukebox.PlayOneShotGame("firstContact/turnover"); + SoundByte.PlayOneShotGame("firstContact/turnover"); alienTextbox.SetActive(false); alien.GetComponent().Play("alien_point", 0, 0); @@ -341,10 +342,9 @@ namespace HeavenStudio.Games queuedInputs.Clear(); } - public void AlienSuccess(float beat) + public void AlienSuccess(double beat) { string animString = ""; - float secondSoundOffset = 0f; List sound = new List(); if (!(hasMissed || noHitOnce)) { @@ -353,8 +353,8 @@ namespace HeavenStudio.Games new MultiSound.Sound("firstContact/successCrowd", beat), new MultiSound.Sound("firstContact/nod", beat), new MultiSound.Sound("firstContact/nod", beat + 0.5f), - new MultiSound.Sound("firstContact/successExtra" + UnityEngine.Random.Range(1, 3), beat + 0.5f, Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-50, 50), false)), - new MultiSound.Sound("firstContact/whistle", beat + UnityEngine.Random.Range(0.5f, 1.5f), Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-50, 100), false), UnityEngine.Random.Range(0.4f, 1f)), + new MultiSound.Sound("firstContact/successExtra" + UnityEngine.Random.Range(1, 3), beat + 0.5f, SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-50, 50), false)), + new MultiSound.Sound("firstContact/whistle", beat + UnityEngine.Random.Range(0.5f, 1.5f), SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-50, 100), false), UnityEngine.Random.Range(0.4f, 1f)), }; animString = "alien_success"; } @@ -410,7 +410,7 @@ namespace HeavenStudio.Games translateFailText.text = respDiagBuffer; } - public void MissionControlDisplay(float beat, bool stay, float length) + public void MissionControlDisplay(double beat, bool stay, float length) { missionControl.SetActive(true); @@ -452,7 +452,7 @@ namespace HeavenStudio.Games void FailContact() { - Jukebox.PlayOneShotGame("firstContact/failContact"); + SoundByte.PlayOneShotGame("firstContact/failContact"); translator.GetComponent().DoScaledAnimationAsync("translator_speak", 0.5f); if (!hasMissed && callDiagIndex == 0) { @@ -466,7 +466,7 @@ namespace HeavenStudio.Games void TrailingContact() { - Jukebox.PlayOneShotGame("firstContact/slightlyFail"); + SoundByte.PlayOneShotGame("firstContact/slightlyFail"); translator.GetComponent().Play("translator_eh", 0, 0); if (!hasMissed) { @@ -494,7 +494,7 @@ namespace HeavenStudio.Games if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false)); + SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false)); translator.GetComponent().DoScaledAnimationAsync("translator_speak", 0.5f); if (callDiagIndex == 0) return; TrailingContact(); @@ -502,8 +502,8 @@ namespace HeavenStudio.Games } translator.GetComponent().DoScaledAnimationAsync("translator_speak", 0.5f); - Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false)); - Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_B"); + SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false)); + SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_B"); if (hasMissed) { caller.isEligible = false; @@ -522,7 +522,7 @@ namespace HeavenStudio.Games { if (!noHitOnce) { - Jukebox.PlayOneShotGame("firstContact/alienNoHit"); + SoundByte.PlayOneShotGame("firstContact/alienNoHit"); noHitOnce = true; } diff --git a/Assets/Scripts/Games/FirstContact/Translator.cs b/Assets/Scripts/Games/FirstContact/Translator.cs index 6e583abe..f45c358d 100644 --- a/Assets/Scripts/Games/FirstContact/Translator.cs +++ b/Assets/Scripts/Games/FirstContact/Translator.cs @@ -37,11 +37,11 @@ namespace HeavenStudio.Games.Scripts_FirstContact //{ // Jukebox.PlayOneShotGame("firstContact/citrusRemix/1_r"); //} - Jukebox.PlayOneShotGame("firstContact/" + RandomizerLines()); + SoundByte.PlayOneShotGame("firstContact/" + RandomizerLines()); } else { - Jukebox.PlayOneShotGame("firstContact/failContact"); + SoundByte.PlayOneShotGame("firstContact/failContact"); } BeatAction.New(this.gameObject, new List() @@ -52,7 +52,7 @@ namespace HeavenStudio.Games.Scripts_FirstContact public void EhTranslation() { - Jukebox.PlayOneShotGame("firstContact/slightlyFail"); + SoundByte.PlayOneShotGame("firstContact/slightlyFail"); BeatAction.New(this.gameObject, new List() { new BeatAction.Action(.5f, delegate { anim.Play("translator_eh", 0, 0);}), diff --git a/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs b/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs index 711ab0b3..3ed17c09 100644 --- a/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs +++ b/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs @@ -118,9 +118,9 @@ namespace HeavenStudio.Games static List queuedInputs = new List(); [SerializeField] FlipperFlopFlipper flipperPlayer; [SerializeField] List flippers = new List(); - List queuedMovements = new List(); + List queuedMovements = new(); static List queuedAttentions = new List(); - static List queuedFlipperRollVoiceLines = new List(); + static List queuedFlipperRollVoiceLines = new(); float lastXPos; float currentXPos; float lastCameraXPos; @@ -130,12 +130,12 @@ namespace HeavenStudio.Games bool goBopFlip; bool goBopTuck; EasingFunction.Ease lastEase; - float walkStartBeat; + double walkStartBeat; float walkLength; CaptainTuckBopType currentCaptainBop; public struct QueuedFlip { - public float beat; + public double beat; public float length; public bool roll; public int uh; @@ -146,7 +146,7 @@ namespace HeavenStudio.Games } public struct QueuedAttention { - public float beat; + public double beat; public bool mute; public bool remix5; } @@ -245,7 +245,7 @@ namespace HeavenStudio.Games } if (queuedMovements.Count > 0) { - if (cond.songPositionInBeats >= queuedMovements[0]) + if (cond.songPositionInBeatsAsDouble >= queuedMovements[0]) { if (!isMoving) { @@ -310,7 +310,7 @@ namespace HeavenStudio.Games } } - public void Bop(float beat, float length, int whoBops, int whoBopsAuto) + public void Bop(double beat, float length, int whoBops, int whoBopsAuto) { goBopFlip = whoBopsAuto == (int)WhoBops.Flippers || whoBopsAuto == (int)WhoBops.Both; goBopTuck = whoBopsAuto == (int)WhoBops.CaptainTuck || whoBopsAuto == (int)WhoBops.Both; @@ -373,7 +373,7 @@ namespace HeavenStudio.Games } } - public void CaptainWalk(float beat, float length, int ease) + public void CaptainWalk(double beat, float length, int ease) { captainTuckAnim.gameObject.SetActive(true); isWalking = true; @@ -382,7 +382,7 @@ namespace HeavenStudio.Games walkLength = length; } - public static void Flipping(float beat, float length, bool roll, int uh = 0, bool thatsIt = false, int appreciation = 0, bool heart = false, bool thatsItBarberShop = false) + public static void Flipping(double beat, float length, bool roll, int uh = 0, bool thatsIt = false, int appreciation = 0, bool heart = false, bool thatsItBarberShop = false) { if (GameManager.instance.currentGame == "flipperFlop") { @@ -394,7 +394,7 @@ namespace HeavenStudio.Games } } - public void QueueFlips(float beat, float length, bool roll, int uh = 0, bool thatsIt = false, int appreciation = 0, bool heart = false, bool thatsItBarberShop = false) + public void QueueFlips(double beat, float length, bool roll, int uh = 0, bool thatsIt = false, int appreciation = 0, bool heart = false, bool thatsItBarberShop = false) { int flopCount = 1; int recounts = 0; @@ -446,12 +446,12 @@ namespace HeavenStudio.Games { new BeatAction.Action(beat + i, delegate { - Jukebox.PlayOneShotGame("flipperFlop/appreciation/thatsit1"); - Jukebox.PlayOneShotGame(soundToPlay); + SoundByte.PlayOneShotGame("flipperFlop/appreciation/thatsit1"); + SoundByte.PlayOneShotGame(soundToPlay); captainTuckAnim.DoScaledAnimationAsync("CaptainBop", 0.5f); captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f); }), - new BeatAction.Action(beat + i + 0.5f, delegate { Jukebox.PlayOneShotGame("flipperFlop/appreciation/thatsit2"); captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f); }), + new BeatAction.Action(beat + i + 0.5f, delegate { SoundByte.PlayOneShotGame("flipperFlop/appreciation/thatsit2"); captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f); }), }); } else @@ -460,14 +460,14 @@ namespace HeavenStudio.Games { new BeatAction.Action(beat + i - 0.5f, delegate { - Jukebox.PlayOneShotGame("flipperFlop/appreciation/thatsit1"); + SoundByte.PlayOneShotGame("flipperFlop/appreciation/thatsit1"); captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f); }), new BeatAction.Action(beat + i, delegate { - Jukebox.PlayOneShotGame("flipperFlop/appreciation/thatsit2"); + SoundByte.PlayOneShotGame("flipperFlop/appreciation/thatsit2"); captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f); - Jukebox.PlayOneShotGame(soundToPlay); + SoundByte.PlayOneShotGame(soundToPlay); captainTuckAnim.DoScaledAnimationAsync("CaptainBop", 0.5f); }), }); @@ -494,7 +494,7 @@ namespace HeavenStudio.Games } CaptainTuckBop(); - Jukebox.PlayOneShotGame(voiceLine); + SoundByte.PlayOneShotGame(voiceLine); }), }); } @@ -586,7 +586,7 @@ namespace HeavenStudio.Games } CaptainTuckBop(); - Jukebox.PlayOneShotGame(voiceLineToPlay); + SoundByte.PlayOneShotGame(voiceLineToPlay); }), }); } @@ -650,7 +650,7 @@ namespace HeavenStudio.Games } } - public static void AppreciationVoiceLine(float beat, int appreciation, bool heart) + public static void AppreciationVoiceLine(double beat, int appreciation, bool heart) { if (FlipperFlop.instance.missed) return; if (appreciation == (int)AppreciationType.Random) appreciation = UnityEngine.Random.Range(1, 6); @@ -659,7 +659,7 @@ namespace HeavenStudio.Games case (int)AppreciationType.None: break; case (int)AppreciationType.Good: - Jukebox.PlayOneShotGame("flipperFlop/appreciation/good"); + SoundByte.PlayOneShotGame("flipperFlop/appreciation/good"); if (heart) { BeatAction.New(instance.gameObject, new List() @@ -676,7 +676,7 @@ namespace HeavenStudio.Games } break; case (int)AppreciationType.GoodJob: - Jukebox.PlayOneShotGame("flipperFlop/appreciation/goodjob"); + SoundByte.PlayOneShotGame("flipperFlop/appreciation/goodjob"); if (heart) { BeatAction.New(instance.gameObject, new List() @@ -694,7 +694,7 @@ namespace HeavenStudio.Games } break; case (int)AppreciationType.Nice: - Jukebox.PlayOneShotGame("flipperFlop/appreciation/nice"); + SoundByte.PlayOneShotGame("flipperFlop/appreciation/nice"); if (heart) { BeatAction.New(instance.gameObject, new List() @@ -711,7 +711,7 @@ namespace HeavenStudio.Games } break; case (int)AppreciationType.WellDone: - Jukebox.PlayOneShotGame("flipperFlop/appreciation/welldone"); + SoundByte.PlayOneShotGame("flipperFlop/appreciation/welldone"); if (heart) { BeatAction.New(instance.gameObject, new List() @@ -729,7 +729,7 @@ namespace HeavenStudio.Games } break; case (int)AppreciationType.Yes: - Jukebox.PlayOneShotGame("flipperFlop/appreciation/yes"); + SoundByte.PlayOneShotGame("flipperFlop/appreciation/yes"); if (heart) { BeatAction.New(instance.gameObject, new List() @@ -750,7 +750,7 @@ namespace HeavenStudio.Games } } - public void TripleFlip(float beat) + public void TripleFlip(double beat) { MultiSound.Play(new MultiSound.Sound[] { @@ -778,7 +778,7 @@ namespace HeavenStudio.Games }); } - public static void AttentionCompany(float beat, bool mute, bool remix5 = false) + public static void AttentionCompany(double beat, bool mute, bool remix5 = false) { if (mute) { @@ -810,7 +810,7 @@ namespace HeavenStudio.Games } } - public void AttentionCompanyAnimation(float beat, bool mute, bool remix5) + public void AttentionCompanyAnimation(double beat, bool mute, bool remix5) { List speaks = new List() { @@ -872,7 +872,7 @@ namespace HeavenStudio.Games foreach (var speak in speaks) { - if (Conductor.instance.songPositionInBeats > speak.beat) + if (Conductor.instance.songPositionInBeatsAsDouble > speak.beat) { speaksToRemove.Add(speak); } @@ -889,7 +889,7 @@ namespace HeavenStudio.Games BeatAction.New(instance.gameObject, speaks); } - public static void FlipperRollVoiceLine(float beat, int amount, bool now) + public static void FlipperRollVoiceLine(double beat, int amount, bool now) { if (now) { @@ -1012,7 +1012,7 @@ namespace HeavenStudio.Games } } - public void FlipperRollVoiceLineAnimation(float beat) + public void FlipperRollVoiceLineAnimation(double beat) { List speaks = new List() { @@ -1026,7 +1026,7 @@ namespace HeavenStudio.Games foreach (var speak in speaks) { - if (Conductor.instance.songPositionInBeats > speak.beat) speaksToRemove.Add(speak); + if (Conductor.instance.songPositionInBeatsAsDouble > speak.beat) speaksToRemove.Add(speak); } if (speaksToRemove.Count > 0) diff --git a/Assets/Scripts/Games/FlipperFlop/FlipperFlopFlipper.cs b/Assets/Scripts/Games/FlipperFlop/FlipperFlopFlipper.cs index 2a76b325..0f754711 100644 --- a/Assets/Scripts/Games/FlipperFlop/FlipperFlopFlipper.cs +++ b/Assets/Scripts/Games/FlipperFlop/FlipperFlopFlipper.cs @@ -44,8 +44,8 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop faceAnim.Play("FaceAngry", 0, 0); BeatAction.New(game.gameObject, new List() { - new BeatAction.Action(Conductor.instance.songPositionInBeats + 0.1f, delegate { leftImpact.SetActive(false); rightImpact.SetActive(false); }), - new BeatAction.Action(Conductor.instance.songPositionInBeats + 0.3f, delegate { faceAnim.Play("FaceAnnoyed", 0, 0); }) + new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 0.1f, delegate { leftImpact.SetActive(false); rightImpact.SetActive(false); }), + new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 0.3f, delegate { faceAnim.Play("FaceAnnoyed", 0, 0); }) }); } @@ -60,13 +60,13 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop { if (player && hit && !barely) { - Jukebox.PlayOneShotGame("flipperFlop/roll" + (left ? "L" : "R")); + SoundByte.PlayOneShotGame("flipperFlop/roll" + (left ? "L" : "R")); faceAnim.Play("FaceNormal", 0, 0); canBlink = true; } else if (player && barely && hit) { - Jukebox.PlayOneShotGame("flipperFlop/tink"); + SoundByte.PlayOneShotGame("flipperFlop/tink"); faceAnim.Play("FaceBarely", 0, 0); canBlink = false; } @@ -74,11 +74,11 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop { faceAnim.Play("FaceOw"); canBlink = false; - Jukebox.PlayOneShotGame("flipperFlop/failgroan"); + SoundByte.PlayOneShotGame("flipperFlop/failgroan"); game.BumpIntoOtherSeal(!left); BeatAction.New(this.gameObject, new List() { - new BeatAction.Action(Conductor.instance.songPositionInBeats + 0.3f, delegate { faceAnim.Play("FaceGoofy"); }), + new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 0.3f, delegate { faceAnim.Play("FaceGoofy"); }), }); } @@ -91,18 +91,18 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop if (up && !barely) { faceAnim.Play("FaceNormal", 0, 0); - Jukebox.PlayOneShotGame($"flipperFlop/flipB{UnityEngine.Random.Range(1, 3)}"); + SoundByte.PlayOneShotGame($"flipperFlop/flipB{UnityEngine.Random.Range(1, 3)}"); canBlink = true; } else if (!barely) { - Jukebox.PlayOneShotGame($"flipperFlop/flip{UnityEngine.Random.Range(1, 3)}"); + SoundByte.PlayOneShotGame($"flipperFlop/flip{UnityEngine.Random.Range(1, 3)}"); faceAnim.Play("FaceNormal", 0, 0); canBlink = true; } else { - Jukebox.PlayOneShotGame("flipperFlop/tink"); + SoundByte.PlayOneShotGame("flipperFlop/tink"); faceAnim.Play("FaceBarely", 0, 0); canBlink = false; } @@ -114,13 +114,13 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop string shouldReverse = up ? "Reverse" : ""; string leftOrRight = left ? "Left" : "Right"; - Jukebox.PlayOneShotGame("flipperFlop/failgroan", -1, 1, 0.5f); - Jukebox.PlayOneShotGame("flipperFlop/punch", -1, 1, 0.5f); + SoundByte.PlayOneShotGame("flipperFlop/failgroan", -1, 1, 0.5f); + SoundByte.PlayOneShotGame("flipperFlop/punch", -1, 1, 0.5f); anim.DoScaledAnimationAsync(shouldReverse + "MissFlop" + leftOrRight, 0.5f); game.BumpIntoOtherSeal(!left); BeatAction.New(this.gameObject, new List() { - new BeatAction.Action(Conductor.instance.songPositionInBeats + 0.3f, delegate { faceAnim.Play("FaceGoofy"); }), + new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 0.3f, delegate { faceAnim.Play("FaceGoofy"); }), }); } } diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs index cc8be3ea..a426f049 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs @@ -35,7 +35,7 @@ namespace HeavenStudio.Games.Loaders new GameAction("sigh", "Sigh") { - function = delegate { Jukebox.PlayOneShot("games/forkLifter/sigh"); } + function = delegate { SoundByte.PlayOneShot("games/forkLifter/sigh"); } }, new GameAction("color", "Background Color") { @@ -137,15 +137,15 @@ namespace HeavenStudio.Games instance = this; } - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { base.OnGameSwitch(beat); ForkLifterHand.CheckNextFlick(); } - public void Flick(float beat, int type) + public void Flick(double beat, int type) { - Jukebox.PlayOneShotGame("forkLifter/flick"); + SoundByte.PlayOneShotGame("forkLifter/flick"); handAnim.Play("Hand_Flick", 0, 0); ForkLifterHand.currentFlickIndex++; GameObject fo = Instantiate(flickedObject); diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs b/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs index 9117b795..087f7279 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs @@ -4,6 +4,8 @@ using System.Linq; using UnityEngine; using HeavenStudio.Util; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Games.Scripts_ForkLifter { @@ -13,17 +15,17 @@ namespace HeavenStudio.Games.Scripts_ForkLifter public Sprite[] fastSprites; - private List allFlickEntities = new List(); + private List allFlickEntities = new List(); public int currentFlickIndex; private void Awake() { var flickEntities = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "flick" }); - List tempEvents = new List(); + List tempEvents = new List(); for (int i = 0; i < flickEntities.Count; i++) { - if (flickEntities[i].beat >= Conductor.instance.songPositionInBeats) + if (flickEntities[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { tempEvents.Add(flickEntities[i]); } @@ -63,7 +65,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter public void Prepare() { - Jukebox.PlayOneShotGame("forkLifter/flickPrepare"); + SoundByte.PlayOneShotGame("forkLifter/flickPrepare"); GetComponent().Play("Hand_Prepare", 0, 0); } } diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs b/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs index 9440ba4e..5415950b 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs @@ -72,17 +72,17 @@ namespace HeavenStudio.Games.Scripts_ForkLifter { if (topbun && middleburger && bottombun) { - Jukebox.PlayOneShotGame("forkLifter/burger"); + SoundByte.PlayOneShotGame("forkLifter/burger"); } else { if (currentEarlyPeasOnFork > 0 || currentLatePeasOnFork > 0) { - Jukebox.PlayOneShotGame($"forkLifter/cough_{Random.Range(1, 3)}"); + SoundByte.PlayOneShotGame($"forkLifter/cough_{Random.Range(1, 3)}"); } else { - Jukebox.PlayOneShotGame("forkLifter/gulp"); + SoundByte.PlayOneShotGame("forkLifter/gulp"); } } @@ -118,7 +118,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter if (p == null) { - Jukebox.PlayOneShotGame("forkLifter/stabnohit"); + SoundByte.PlayOneShotGame("forkLifter/stabnohit"); } anim.Play("Player_Stab", 0, 0); diff --git a/Assets/Scripts/Games/ForkLifter/Pea.cs b/Assets/Scripts/Games/ForkLifter/Pea.cs index 0d3afb35..e5148c01 100644 --- a/Assets/Scripts/Games/ForkLifter/Pea.cs +++ b/Assets/Scripts/Games/ForkLifter/Pea.cs @@ -13,7 +13,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter ForkLifter game; private Animator anim; - public float startBeat; + public double startBeat; public int type; @@ -25,8 +25,8 @@ namespace HeavenStudio.Games.Scripts_ForkLifter // SCHEDULING zoom sound so it lines up with when it meets the fork. var currentDspTime = AudioSettings.dspTime; var cond = Conductor.instance; - var zoomStartTime = currentDspTime + (double)(cond.pitchedSecPerBeat * 2) - 0.317; - Jukebox.PlayOneShotScheduledGame("forkLifter/zoomFast", (double)zoomStartTime); + var zoomStartTime = currentDspTime + (cond.pitchedSecPerBeatAsDouble * 2) - 0.317; + SoundByte.PlayOneShotScheduledGame("forkLifter/zoomFast", zoomStartTime); GetComponentInChildren().sprite = game.peaSprites[type]; @@ -91,7 +91,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter ForkLifterPlayer.instance.FastEffectHit(type); - Jukebox.PlayOneShotGame("forkLifter/stab"); + SoundByte.PlayOneShotGame("forkLifter/stab"); ForkLifterPlayer.instance.currentPerfectPeasOnFork++; @@ -136,7 +136,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter ForkLifterPlayer.instance.FastEffectHit(type); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); ForkLifterPlayer.instance.currentEarlyPeasOnFork++; @@ -167,7 +167,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter ForkLifterPlayer.instance.FastEffectHit(type); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); ForkLifterPlayer.instance.currentLatePeasOnFork++; Destroy(this.gameObject); @@ -198,7 +198,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter private void Miss(PlayerActionEvent caller) { - Jukebox.PlayOneShot("forkLifter/disappointed"); + SoundByte.PlayOneShot("forkLifter/disappointed"); BeatAction.New(game.gameObject, new List() { new BeatAction.Action(startBeat+ 2.45f, delegate { diff --git a/Assets/Scripts/Games/GleeClub/ChorusKid.cs b/Assets/Scripts/Games/GleeClub/ChorusKid.cs index 48a5fbba..6ebfb6d0 100644 --- a/Assets/Scripts/Games/GleeClub/ChorusKid.cs +++ b/Assets/Scripts/Games/GleeClub/ChorusKid.cs @@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_GleeClub void OnDestroy() { - if (currentSound != null) Jukebox.KillLoop(currentSound, gameSwitchFadeOutTime); + if (currentSound != null) SoundByte.KillLoop(currentSound, gameSwitchFadeOutTime); } public void TogglePresence(bool disappear) @@ -74,12 +74,12 @@ namespace HeavenStudio.Games.Scripts_GleeClub anim.SetBool("Mega", true); anim.Play("OpenMouth", 0, 0); shouldMegaClose = true; - if (currentSound != null) Jukebox.KillLoop(currentSound, 0f); - Jukebox.PlayOneShotGame("gleeClub/LoudWailStart"); - currentSound = Jukebox.PlayOneShotGame("gleeClub/LoudWailLoop", -1, currentPitch, 1f, true); + if (currentSound != null) SoundByte.KillLoop(currentSound, 0f); + SoundByte.PlayOneShotGame("gleeClub/LoudWailStart"); + currentSound = SoundByte.PlayOneShotGame("gleeClub/LoudWailLoop", -1, currentPitch, 1f, true); BeatAction.New(game.gameObject, new List() { - new BeatAction.Action(Conductor.instance.songPositionInBeats + 1f, delegate { UnYell(); }) + new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 1f, delegate { UnYell(); }) }); } @@ -95,8 +95,8 @@ namespace HeavenStudio.Games.Scripts_GleeClub anim.SetBool("Mega", false); shouldMegaClose = false; anim.Play("OpenMouth", 0, 0); - if (currentSound != null) Jukebox.KillLoop(currentSound, 0f); - currentSound = Jukebox.PlayOneShotGame("gleeClub/WailLoop", -1, currentPitch, 1f, true); + if (currentSound != null) SoundByte.KillLoop(currentSound, 0f); + currentSound = SoundByte.PlayOneShotGame("gleeClub/WailLoop", -1, currentPitch, 1f, true); } public void StopSinging(bool mega = false, bool playSound = true) @@ -104,8 +104,8 @@ namespace HeavenStudio.Games.Scripts_GleeClub if (!singing || disappeared) return; singing = false; anim.Play(mega ? "MegaCloseMouth" : "CloseMouth", 0, 0); - if (currentSound != null) Jukebox.KillLoop(currentSound, 0f); - if (playSound) Jukebox.PlayOneShotGame("gleeClub/StopWail"); + if (currentSound != null) SoundByte.KillLoop(currentSound, 0f); + if (playSound) SoundByte.PlayOneShotGame("gleeClub/StopWail"); } } } diff --git a/Assets/Scripts/Games/GleeClub/GleeClub.cs b/Assets/Scripts/Games/GleeClub/GleeClub.cs index 7b7fbc8f..fdc78bbb 100644 --- a/Assets/Scripts/Games/GleeClub/GleeClub.cs +++ b/Assets/Scripts/Games/GleeClub/GleeClub.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -113,7 +114,7 @@ namespace HeavenStudio.Games } public struct QueuedSinging { - public float startBeat; + public double startBeat; public float length; public int semiTones; public int semiTonesPlayer; @@ -133,9 +134,9 @@ namespace HeavenStudio.Games public ChorusKid playerChorusKid; [Header("Variables")] static List queuedSingings = new List(); - static List queuedBatons = new List(); + static List queuedBatons = new(); bool intervalStarted; - float intervalStartBeat; + double intervalStartBeat; float beatInterval = 4f; public bool missed; public static GleeClub instance; @@ -143,16 +144,16 @@ namespace HeavenStudio.Games int startIntervalIndex; - private List allIntervalEvents = new List(); + private List allIntervalEvents = new List(); void Awake() { instance = this; var camEvents = EventCaller.GetAllInGameManagerList("gleeClub", new string[] { "intervalStart" }); - List tempEvents = new List(); + List tempEvents = new List(); for (int i = 0; i < camEvents.Count; i++) { - if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats) + if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { tempEvents.Add(camEvents[i]); } @@ -223,9 +224,9 @@ namespace HeavenStudio.Games { if (startIntervalIndex < allIntervalEvents.Count && startIntervalIndex >= 0) { - if (Conductor.instance.songPositionInBeats >= allIntervalEvents[startIntervalIndex].beat) + if (Conductor.instance.songPositionInBeatsAsDouble >= allIntervalEvents[startIntervalIndex].beat) { - StartInterval(allIntervalEvents[startIntervalIndex].beat, allIntervalEvents[startIntervalIndex].length); + StartInterval((float)allIntervalEvents[startIntervalIndex].beat, allIntervalEvents[startIntervalIndex].length); startIntervalIndex++; } } @@ -256,22 +257,22 @@ namespace HeavenStudio.Games public void ForceSing(int semiTones, int semiTones1, int semiTonesPlayer) { - leftChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTones, true); - middleChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTones1, true); - playerChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTonesPlayer, true); + leftChorusKid.currentPitch = SoundByte.GetPitchFromSemiTones(semiTones, true); + middleChorusKid.currentPitch = SoundByte.GetPitchFromSemiTones(semiTones1, true); + playerChorusKid.currentPitch = SoundByte.GetPitchFromSemiTones(semiTonesPlayer, true); leftChorusKid.StartSinging(true); middleChorusKid.StartSinging(true); if (!PlayerInput.Pressing() || GameManager.instance.autoplay) playerChorusKid.StartSinging(true); else missed = true; } - public void TogetherNow(float beat, int semiTones, int semiTones1, int semiTonesPlayer, float conductorPitch) + public void TogetherNow(double beat, int semiTones, int semiTones1, int semiTonesPlayer, float conductorPitch) { if (!playerChorusKid.disappeared) ScheduleInput(beat, 2.5f, InputType.STANDARD_UP, JustTogetherNow, Out, Out); if (!playerChorusKid.disappeared) ScheduleInput(beat, 3.5f, InputType.STANDARD_DOWN, JustTogetherNowClose, MissBaton, Out); - float pitch = Jukebox.GetPitchFromSemiTones(semiTones, true); - float pitch1 = Jukebox.GetPitchFromSemiTones(semiTones1, true); - currentYellPitch = Jukebox.GetPitchFromSemiTones(semiTonesPlayer, true); + float pitch = SoundByte.GetPitchFromSemiTones(semiTones, true); + float pitch1 = SoundByte.GetPitchFromSemiTones(semiTones1, true); + currentYellPitch = SoundByte.GetPitchFromSemiTones(semiTonesPlayer, true); MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("gleeClub/togetherEN-01", beat + 0.5f, conductorPitch), @@ -318,16 +319,16 @@ namespace HeavenStudio.Games playerChorusKid.StopSinging(true); } - public void StartInterval(float beat, float length) + public void StartInterval(double beat, float length) { intervalStartBeat = beat; beatInterval = length; intervalStarted = true; } - public void Sing(float beat, float length, int semiTones, int semiTones1, int semiTonesPlayer, int closeMouth, bool repeating, int semiTonesLeft2, int semiTonesLeft3, int semiTonesMiddle2) + public void Sing(double beat, float length, int semiTones, int semiTones1, int semiTonesPlayer, int closeMouth, bool repeating, int semiTonesLeft2, int semiTonesLeft3, int semiTonesMiddle2) { - float pitch = Jukebox.GetPitchFromSemiTones(semiTones, true); + float pitch = SoundByte.GetPitchFromSemiTones(semiTones, true); if (!intervalStarted) { StartInterval(beat, length); @@ -351,7 +352,7 @@ namespace HeavenStudio.Games }); } - public void PassTurn(float beat, float length) + public void PassTurn(double beat, float length) { if (queuedSingings.Count == 0) return; intervalStarted = false; @@ -359,17 +360,17 @@ namespace HeavenStudio.Games if (!playerChorusKid.disappeared) ShowHeart(beat + length + beatInterval * 2 + 1); foreach (var sing in queuedSingings) { - float playerPitch = Jukebox.GetPitchFromSemiTones(sing.semiTonesPlayer, true); + float playerPitch = SoundByte.GetPitchFromSemiTones(sing.semiTonesPlayer, true); if (!playerChorusKid.disappeared) { GleeClubSingInput spawnedInput = Instantiate(singInputPrefab, transform); spawnedInput.pitch = playerPitch; spawnedInput.Init(beat + length + sing.startBeat + beatInterval, sing.length, sing.closeMouth); } - float pitch = Jukebox.GetPitchFromSemiTones(sing.semiTones, true); - float pitchLeft2 = Jukebox.GetPitchFromSemiTones(sing.semiTonesLeft2, true); - float pitchLeft3 = Jukebox.GetPitchFromSemiTones(sing.semiTonesLeft3, true); - float pitchMiddle2 = Jukebox.GetPitchFromSemiTones(sing.semiTonesMiddle2, true); + float pitch = SoundByte.GetPitchFromSemiTones(sing.semiTones, true); + float pitchLeft2 = SoundByte.GetPitchFromSemiTones(sing.semiTonesLeft2, true); + float pitchLeft3 = SoundByte.GetPitchFromSemiTones(sing.semiTonesLeft3, true); + float pitchMiddle2 = SoundByte.GetPitchFromSemiTones(sing.semiTonesMiddle2, true); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + length + sing.startBeat, delegate @@ -416,7 +417,7 @@ namespace HeavenStudio.Games queuedSingings.Clear(); } - public static void PreBaton(float beat) + public static void PreBaton(double beat) { MultiSound.Play(new MultiSound.Sound[] { @@ -433,7 +434,7 @@ namespace HeavenStudio.Games } } - public void Baton(float beat) + public void Baton(double beat) { missed = false; if (!playerChorusKid.disappeared) ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustBaton, MissBaton, Out); @@ -469,7 +470,7 @@ namespace HeavenStudio.Games void Out(PlayerActionEvent caller) { } - public void ShowHeart(float beat) + public void ShowHeart(double beat) { BeatAction.New(instance.gameObject, new List() diff --git a/Assets/Scripts/Games/GleeClub/GleeClubSingInput.cs b/Assets/Scripts/Games/GleeClub/GleeClubSingInput.cs index 11bdebeb..96856446 100644 --- a/Assets/Scripts/Games/GleeClub/GleeClubSingInput.cs +++ b/Assets/Scripts/Games/GleeClub/GleeClubSingInput.cs @@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Scripts_GleeClub game = GleeClub.instance; } - public void Init(float beat, float length, int close) + public void Init(double beat, float length, int close) { shouldClose = close != (int)GleeClub.MouthOpenClose.OnlyOpen; shouldOpen = close != (int)GleeClub.MouthOpenClose.OnlyClose; diff --git a/Assets/Scripts/Games/Global/Filter.cs b/Assets/Scripts/Games/Global/Filter.cs index 87e43e5a..b409a80e 100644 --- a/Assets/Scripts/Games/Global/Filter.cs +++ b/Assets/Scripts/Games/Global/Filter.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.IO; using Starpelly; using UnityEngine; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Games.Global { public class Filter : MonoBehaviour { - private List allFilterEvents = new List(); + private List allFilterEvents = new List(); private int lastFilterIndexesCount = 0; // Optimization private List amplifies = new List(); // keeps memory of all the filters on the main camera @@ -92,14 +94,14 @@ namespace HeavenStudio.Games.Global #region Filter - private void OnBeatChanged(float beat) + private void OnBeatChanged(double beat) { allFilterEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "filter" }); } private void Update() { - var songPosBeat = Conductor.instance.songPositionInBeats; + var songPosBeat = Conductor.instance.songPositionInBeatsAsDouble; var filterIndexes = new List(); for (int i = 0; i < allFilterEvents.Count; i++) @@ -138,17 +140,17 @@ namespace HeavenStudio.Games.Global intensity = Mathf.Lerp(1, 0, Mathp.Normalize(intensity, 0, 100)); var blendAmount = intensity; - var endFadeInTime = Mathf.Lerp(filter.beat, filter.beat + filter.length, fadeInTime); - var startFadeOutTime = filter.beat + (Mathf.Lerp(0, filter.length, Mathf.Lerp(1, 0, fadeOutTime))); + var endFadeInTime = Mathf.Lerp((float) filter.beat, (float) filter.beat + filter.length, fadeInTime); + var startFadeOutTime = (float) filter.beat + (Mathf.Lerp(0, filter.length, Mathf.Lerp(1, 0, fadeOutTime))); if (songPosBeat < endFadeInTime) { - var normalizedFadeIn = Mathp.Normalize(songPosBeat, filter.beat, endFadeInTime); + var normalizedFadeIn = Mathp.Normalize((float) songPosBeat, (float) filter.beat, endFadeInTime); blendAmount = Mathf.Lerp(1f, intensity, normalizedFadeIn); } else if (songPosBeat >= startFadeOutTime) { - var normalizedFadeOut = Mathf.Clamp01(Mathp.Normalize(songPosBeat, startFadeOutTime, filter.beat + filter.length)); + var normalizedFadeOut = Mathf.Clamp01(Mathp.Normalize((float) songPosBeat, startFadeOutTime, (float) filter.beat + filter.length)); blendAmount = Mathf.Lerp(intensity, 1f, normalizedFadeOut); } diff --git a/Assets/Scripts/Games/Global/Flash.cs b/Assets/Scripts/Games/Global/Flash.cs index e46a9bcd..33c15fc1 100644 --- a/Assets/Scripts/Games/Global/Flash.cs +++ b/Assets/Scripts/Games/Global/Flash.cs @@ -6,35 +6,37 @@ using UnityEngine.UI; using HeavenStudio.Util; using System.Linq; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Games.Global { public class Flash : MonoBehaviour { - [NonSerialized] public float startBeat; + [NonSerialized] public double startBeat; [NonSerialized] public float length; [NonSerialized] public Color startColor; [NonSerialized] public Color endColor; - [NonSerialized] public EasingFunction.Ease ease; - [NonSerialized] private EasingFunction.Function func; + [NonSerialized] public Util.EasingFunction.Ease ease; + [NonSerialized] private Util.EasingFunction.Function func; [NonSerialized] private Image spriteRenderer; [SerializeField] private Color currentCol; - [NonSerialized] private List allFadeEvents = new List(); + [NonSerialized] private List allFadeEvents = new List(); private void Awake() { spriteRenderer = GetComponent(); spriteRenderer.color = currentCol; - func = EasingFunction.GetEasingFunction(EasingFunction.Ease.Linear); + func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.Linear); GameManager.instance.onBeatChanged += OnBeatChanged; } - public void OnBeatChanged(float beat) + public void OnBeatChanged(double beat) { allFadeEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "flash" }); // backwards-compatibility baybee @@ -44,7 +46,7 @@ namespace HeavenStudio.Games.Global FindFadeFromBeat(beat); } - private void FindFadeFromBeat(float beat) + private void FindFadeFromBeat(double beat) { Color startCol = Color.white; Color endCol = Color.white; @@ -53,7 +55,7 @@ namespace HeavenStudio.Games.Global if (allFadeEvents.Count > 0) { - DynamicBeatmap.DynamicEntity startEntity = null; + RiqEntity startEntity = default(RiqEntity); for (int i = 0; i < allFadeEvents.Count; i++) { @@ -70,7 +72,7 @@ namespace HeavenStudio.Games.Global } } - if (startEntity != null) + if (!string.IsNullOrEmpty(startEntity.datamodel)) { if (!override_) { @@ -81,24 +83,24 @@ namespace HeavenStudio.Games.Global endCol = new Color(colB.r, colB.g, colB.b, startEntity["valB"]); } - SetFade(startEntity.beat, startEntity.length, startCol, endCol, (EasingFunction.Ease) startEntity["ease"]); + SetFade(startEntity.beat, startEntity.length, startCol, endCol, (Util.EasingFunction.Ease) startEntity["ease"]); } } } - public void SetFade(float beat, float length, Color startCol, Color endCol, EasingFunction.Ease ease) + public void SetFade(double beat, float length, Color startCol, Color endCol, Util.EasingFunction.Ease ease) { this.startBeat = beat; this.length = length; this.startColor = startCol; this.endColor = endCol; this.ease = ease; - func = EasingFunction.GetEasingFunction(ease); + func = Util.EasingFunction.GetEasingFunction(ease); } private void Update() { - FindFadeFromBeat(Conductor.instance.songPositionInBeats); + FindFadeFromBeat(Conductor.instance.songPositionInBeatsAsDouble); float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, length); // normalizedBeat = Mathf.Clamp01(normalizedBeat); diff --git a/Assets/Scripts/Games/Global/Textbox.cs b/Assets/Scripts/Games/Global/Textbox.cs index f66a3b11..4e89dd65 100644 --- a/Assets/Scripts/Games/Global/Textbox.cs +++ b/Assets/Scripts/Games/Global/Textbox.cs @@ -5,6 +5,8 @@ using UnityEngine.UI; using TMPro; using HeavenStudio.TextboxUtilities; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Games.Global { @@ -27,10 +29,10 @@ namespace HeavenStudio.Games.Global Bottom, } - private List textboxEvents = new List(); - private List openCaptionsEvents = new List(); - private List idolEvents = new List(); - private List closedCaptionsEvents = new List(); + private List textboxEvents = new List(); + private List openCaptionsEvents = new List(); + private List idolEvents = new List(); + private List closedCaptionsEvents = new List(); public static Textbox instance { get; private set; } @@ -83,7 +85,7 @@ namespace HeavenStudio.Games.Global UpdateClosedCaptionsDisplay(); } - public void OnBeatChanged(float beat) + public void OnBeatChanged(double beat) { TextboxEnabler.SetActive(false); OpenCaptionsEnabler.SetActive(false); diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs index e2818c54..1737b32d 100644 --- a/Assets/Scripts/Games/KarateMan/KarateMan.cs +++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -367,8 +368,8 @@ namespace HeavenStudio.Games [Header("Camera Positions")] public Transform[] CameraPosition; Vector3 cameraPosition; - static float startCamSpecial = Single.MinValue; - static float wantsReturn = Single.MinValue; + static double startCamSpecial = double.MinValue; + static double wantsReturn = double.MinValue; static float cameraReturnLength = 0f; static CameraAngle cameraAngle = CameraAngle.Normal; @@ -388,13 +389,13 @@ namespace HeavenStudio.Games [Header("Word")] public Animator Word; - static float wordClearTime = Single.MinValue; + static double wordClearTime = double.MinValue; const float hitVoiceOffset = 0.042f; [Header("Backgrounds")] static int bgType = (int) BackgroundType.Yellow; public static int currentBgEffect = (int) BackgroundFXType.None; - static float bgFadeTime = Single.MinValue; + static double bgFadeTime = double.MinValue; static float bgFadeDuration = 0f; static Color bgColour = Color.white; public SpriteRenderer BGPlane; @@ -438,7 +439,7 @@ namespace HeavenStudio.Games public static bool WantBop = true; public static bool WantNori = true; public static int WantNoriType = (int) NoriMode.None; - public static float WantBgChangeStart = Single.MinValue; + public static double WantBgChangeStart = double.MinValue; public static float WantBgChangeLength = 0f; private void Awake() @@ -448,7 +449,7 @@ namespace HeavenStudio.Games cameraPosition = CameraPosition[0].position; } - public override void OnPlay(float beat) + public override void OnPlay(double beat) { var cond = Conductor.instance; if (!cond.isPlaying) @@ -474,7 +475,7 @@ namespace HeavenStudio.Games bgBloodRenderer = BGBlood.GetComponent(); bgRadialRenderer = BGRadial.GetComponent(); - SetBgEffectsToLast(cond.songPositionInBeats); + SetBgEffectsToLast(cond.songPositionInBeatsAsDouble); SetBgAndShadowCol(WantBgChangeStart, WantBgChangeLength, bgType, (int) currentShadowType, bgColour, customShadowColour, (int)currentBgEffect); SetBgTexture(textureType, textureFilterType, filterColour, filterColour); UpdateMaterialColour(BodyColor, HighlightColor, ItemColor); @@ -485,7 +486,7 @@ namespace HeavenStudio.Games { var cond = Conductor.instance; if (!cond.isPlaying) - SetBgEffectsToLast(cond.songPositionInBeats); + SetBgEffectsToLast(cond.songPositionInBeatsAsDouble); switch (currentBgEffect) { @@ -499,30 +500,30 @@ namespace HeavenStudio.Games bgEffectAnimator.Play("NoPose", -1, 0); break; } - if (cond.songPositionInBeats >= wordClearTime) + if (cond.songPositionInBeatsAsDouble >= wordClearTime) { Word.Play("NoPose"); } - if (cond.songPositionInBeats >= startCamSpecial && cond.songPositionInBeats <= wantsReturn) + if (cond.songPositionInBeatsAsDouble >= startCamSpecial && cond.songPositionInBeatsAsDouble <= wantsReturn) { float camX = 0f; float camY = 0f; float camZ = 0f; - if (cond.songPositionInBeats <= startCamSpecial + cameraReturnLength) + if (cond.songPositionInBeatsAsDouble <= startCamSpecial + cameraReturnLength) { float prog = cond.GetPositionFromBeat(startCamSpecial, cameraReturnLength); - camX = EasingFunction.EaseOutCubic(CameraPosition[0].position.x, CameraPosition[1].position.x, prog); - camY = EasingFunction.EaseOutCubic(CameraPosition[0].position.y, CameraPosition[1].position.y, prog); - camZ = EasingFunction.EaseOutCubic(CameraPosition[0].position.z, CameraPosition[1].position.z, prog); + camX = Util.EasingFunction.EaseOutCubic(CameraPosition[0].position.x, CameraPosition[1].position.x, prog); + camY = Util.EasingFunction.EaseOutCubic(CameraPosition[0].position.y, CameraPosition[1].position.y, prog); + camZ = Util.EasingFunction.EaseOutCubic(CameraPosition[0].position.z, CameraPosition[1].position.z, prog); cameraPosition = new Vector3(camX, camY, camZ); } - else if (cond.songPositionInBeats >= wantsReturn - cameraReturnLength) + else if (cond.songPositionInBeatsAsDouble >= wantsReturn - cameraReturnLength) { float prog = cond.GetPositionFromBeat(wantsReturn - cameraReturnLength, cameraReturnLength); - camX = EasingFunction.EaseOutQuad(CameraPosition[1].position.x, CameraPosition[0].position.x, prog); - camY = EasingFunction.EaseOutQuad(CameraPosition[1].position.y, CameraPosition[0].position.y, prog); - camZ = EasingFunction.EaseOutQuad(CameraPosition[1].position.z, CameraPosition[0].position.z, prog); + camX = Util.EasingFunction.EaseOutQuad(CameraPosition[1].position.x, CameraPosition[0].position.x, prog); + camY = Util.EasingFunction.EaseOutQuad(CameraPosition[1].position.y, CameraPosition[0].position.y, prog); + camZ = Util.EasingFunction.EaseOutQuad(CameraPosition[1].position.z, CameraPosition[0].position.z, prog); cameraPosition = new Vector3(camX, camY, camZ); } else @@ -538,11 +539,11 @@ namespace HeavenStudio.Games } float fadeProg = cond.GetPositionFromBeat(bgFadeTime, bgFadeDuration); - if (bgFadeTime != Single.MinValue && fadeProg >= 0) + if (bgFadeTime != double.MinValue && fadeProg >= 0) { if (fadeProg >= 1f) { - bgFadeTime = Single.MinValue; + bgFadeTime = double.MinValue; bgFadeDuration = 0f; BGPlane.color = bgColour; filterColour = filterColourNext; @@ -561,16 +562,16 @@ namespace HeavenStudio.Games BGEffect.transform.position = new Vector3(GameCamera.instance.transform.position.x, GameCamera.instance.transform.position.y, 0); } - static List allHits = new List(); - static List allEnds = new List(); - public static int CountHitsToEnd(float fromBeat) + static List allHits = new List(); + static List allEnds = new List(); + public static int CountHitsToEnd(double fromBeat) { allHits = EventCaller.GetAllInGameManagerList("karateman", new string[] { "hit", "bulb", "kick", "combo" }); allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" }); allHits.Sort((x, y) => x.beat.CompareTo(y.beat)); allEnds.Sort((x, y) => x.beat.CompareTo(y.beat)); - float endBeat = Single.MaxValue; + double endBeat = double.MaxValue; //get the beat of the closest end event foreach (var end in allEnds) @@ -604,26 +605,26 @@ namespace HeavenStudio.Games return count; } - public static void DoSpecialCamera(float beat, float length, bool returns) + public static void DoSpecialCamera(double beat, float length, bool returns) { if (cameraAngle == CameraAngle.Normal) { startCamSpecial = beat; cameraAngle = CameraAngle.Special; } - wantsReturn = returns ? beat + length - 0.001f : Single.MaxValue; + wantsReturn = returns ? beat + length - 0.001f : double.MaxValue; cameraReturnLength = Mathf.Min(2f, length*0.5f); } - public void DoWord(float beat, int type, bool doSound = true) + public void DoWord(double beat, int type, bool doSound = true) { Word.Play(DoWordSound(beat, type, doSound)); } - public static string DoWordSound(float beat, int type, bool doSound = true) + public static string DoWordSound(double beat, int type, bool doSound = true) { String word = "NoPose"; - float clear = 0f; + double clear = 0f; switch (type) { case (int) HitThree.HitTwo: @@ -689,18 +690,18 @@ namespace HeavenStudio.Games }, forcePlay: true); break; } - if (Conductor.instance.songPositionInBeats <= clear && Conductor.instance.songPositionInBeats >= beat) + if (Conductor.instance.songPositionInBeatsAsDouble <= clear && Conductor.instance.songPositionInBeatsAsDouble >= beat) { wordClearTime = clear; } return word; } - public void CreateItem(float beat, int type, int expression, bool muteSound = false) + public void CreateItem(double beat, int type, int expression, bool muteSound = false) { string outSound; - if (Starpelly.Mathp.GetDecimalFromFloat(beat + 0.5f) == 0f) + if ((beat + 0.5f) % 1.0 == 0f) outSound = "karateman/offbeatObjectOut"; else outSound = "karateman/objectOut"; @@ -711,7 +712,7 @@ namespace HeavenStudio.Games CreateItemInstance(beat, "Item00", expression); break; case (int) HitType.Lightbulb: - if (Starpelly.Mathp.GetDecimalFromFloat(beat + 0.5f) == 0f) + if ((beat + 0.5f) % 1.0 == 0f) outSound = "karateman/offbeatLightbulbOut"; else outSound = "karateman/lightbulbOut"; @@ -740,13 +741,13 @@ namespace HeavenStudio.Games CreateItemInstance(beat, "Item00", expression); break; } - if (!muteSound) Jukebox.PlayOneShotGame(outSound, forcePlay: true); + if (!muteSound) SoundByte.PlayOneShotGame(outSound, forcePlay: true); } - public void CreateBulbSpecial(float beat, int type, Color c, int expression) + public void CreateBulbSpecial(double beat, int type, Color c, int expression) { string outSound; - if (Starpelly.Mathp.GetDecimalFromFloat(beat + 0.5f) == 0f) + if (beat + 0.5f % 1.0 == 0f) outSound = "karateman/offbeatLightbulbOut"; else outSound = "karateman/lightbulbOut"; @@ -756,12 +757,12 @@ namespace HeavenStudio.Games mobj.GetComponent().SetBulbColor(c); else mobj.GetComponent().SetBulbColor(LightBulbColors[type]); - Jukebox.PlayOneShotGame(outSound, forcePlay: true); + SoundByte.PlayOneShotGame(outSound, forcePlay: true); } - public void Combo(float beat, int expression) + public void Combo(double beat, int expression) { - Jukebox.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true); int comboId = KarateManPot.GetNewCombo(); @@ -786,9 +787,9 @@ namespace HeavenStudio.Games }, forcePlay: true); } - public void Kick(float beat, bool ball, int expression) + public void Kick(double beat, bool ball, int expression) { - Jukebox.PlayOneShotGame("karateman/barrelOutKicks", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/barrelOutKicks", forcePlay: true); CreateItemInstance(beat, "Item05", expression, KarateManPot.ItemType.KickBarrel, content: ball); @@ -801,7 +802,7 @@ namespace HeavenStudio.Games }, forcePlay: true); } - public GameObject CreateItemInstance(float beat, string awakeAnim, int successExpression, KarateManPot.ItemType type = KarateManPot.ItemType.Pot, int comboId = -1, bool content = false) + public GameObject CreateItemInstance(double beat, string awakeAnim, int successExpression, KarateManPot.ItemType type = KarateManPot.ItemType.Pot, int comboId = -1, bool content = false) { GameObject mobj = GameObject.Instantiate(Item, ItemHolder); KarateManPot mobjDat = mobj.GetComponent(); @@ -817,9 +818,9 @@ namespace HeavenStudio.Games return mobj; } - void SetBgEffectsToLast(float beat) + void SetBgEffectsToLast(double beat) { - var bgfx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/set background effects"); + var bgfx = GameManager.instance.Beatmap.Entities.FindAll(en => en.datamodel == "karateman/set background effects"); for (int i = 0; i < bgfx.Count; i++) { var e = bgfx[i]; @@ -827,7 +828,7 @@ namespace HeavenStudio.Games break; SetBgEffectsUnloaded(e.beat, e.length, e["type"], e["type2"], e["colorA"], e["colorB"], e["type3"], e["type4"], e["type5"], e["colorC"], e["colorD"]); } - var camfx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/special camera"); + var camfx = GameManager.instance.Beatmap.Entities.FindAll(en => en.datamodel == "karateman/special camera"); DoSpecialCamera(0, 0, true); for (int i = 0; i < camfx.Count; i++) { @@ -836,7 +837,7 @@ namespace HeavenStudio.Games break; DoSpecialCamera(e.beat, e.length, e["toggle"]); } - var objfx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/set object colors"); + var objfx = GameManager.instance.Beatmap.Entities.FindAll(en => en.datamodel == "karateman/set object colors"); for (int i = 0; i < objfx.Count; i++) { var e = objfx[i]; @@ -848,7 +849,7 @@ namespace HeavenStudio.Games SetBgTexture(textureType, textureFilterType, filterColour, filterColour); } - public static void SetBgEffectsUnloaded(float beat, float length, int newBgType, int newShadowType, Color bgCol, Color shadowCol, int bgFx, int texture, int textureFilter, Color filterCol, Color filterColNext) + public static void SetBgEffectsUnloaded(double beat, float length, int newBgType, int newShadowType, Color bgCol, Color shadowCol, int bgFx, int texture, int textureFilter, Color filterCol, Color filterColNext) { WantBgChangeStart = beat; WantBgChangeLength = length; @@ -863,7 +864,7 @@ namespace HeavenStudio.Games filterColourNext = filterColNext; } - public void SetBgAndShadowCol(float beat, float length, int newBgType, int shadowType, Color a, Color b, int fx) + public void SetBgAndShadowCol(double beat, float length, int newBgType, int shadowType, Color a, Color b, int fx) { SetBgFx(fx, beat, length); UpdateShadowColour(shadowType, b); @@ -886,7 +887,7 @@ namespace HeavenStudio.Games filterColour = Color.LerpUnclamped(bgColour, ShadowBlendColor, 0.45f); } - public void SetBgFx(int fx, float beat, float length) + public void SetBgFx(int fx, double beat, float length) { switch (fx) { @@ -938,7 +939,7 @@ namespace HeavenStudio.Games UpdateFilterColour(bgColour, filterColour); } - public void SetGameplayMods(float beat, int mode, bool combo) + public void SetGameplayMods(double beat, int mode, bool combo) { NoriGO.SetActive(true); Nori.SetNoriMode(beat, mode); @@ -1003,7 +1004,7 @@ namespace HeavenStudio.Games ItemColor = objectCol; } - public void SetParticleEffect(float beat, int type, float windStrength, float particleStrength) + public void SetParticleEffect(double beat, int type, float windStrength, float particleStrength) { ParticleSystem.EmissionModule emm; switch (type) @@ -1035,10 +1036,10 @@ namespace HeavenStudio.Games Wind.windMain = windStrength; } - public void ToggleBop(float beat, float length, bool toggle, bool autoBop) + public void ToggleBop(double beat, float length, bool toggle, bool autoBop) { if (autoBop) - Joe.bop.length = Single.MaxValue; + Joe.bop.length = float.MaxValue; else Joe.bop.length = 0; if (toggle) @@ -1061,7 +1062,7 @@ namespace HeavenStudio.Games WantBop = toggle; } - public void Prepare(float beat, float length) + public void Prepare(double beat, float length) { Joe.Prepare(beat, length); } diff --git a/Assets/Scripts/Games/KarateMan/KarateManJoe.cs b/Assets/Scripts/Games/KarateMan/KarateManJoe.cs index ddabb181..704ef821 100644 --- a/Assets/Scripts/Games/KarateMan/KarateManJoe.cs +++ b/Assets/Scripts/Games/KarateMan/KarateManJoe.cs @@ -16,14 +16,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan public SpriteRenderer[] Shadows; public Color BombGlowTint; - float bombGlowStart = Single.MinValue; + double bombGlowStart = double.MinValue; float bombGlowLength = 0f; float bombGlowIntensity; const float bombGlowRatio = 1f; - float lastPunchTime = Single.MinValue; - float lastComboMissTime = Single.MinValue; - float lastUpperCutTime = Single.MinValue; + double lastPunchTime = double.MinValue; + double lastComboMissTime = double.MinValue; + double lastUpperCutTime = double.MinValue; public bool inCombo = false; public bool lockedInCombo = false; public bool comboWaiting = false; @@ -36,15 +36,15 @@ namespace HeavenStudio.Games.Scripts_KarateMan public bool wantKick = false; public bool inKick = false; - float lastChargeTime = Single.MinValue; - float unPrepareTime = Single.MinValue; - float noNuriJabTime = Single.MinValue; + double lastChargeTime = double.MinValue; + double unPrepareTime = double.MinValue; + double noNuriJabTime = double.MinValue; bool canEmote = false; public int wantFace = 0; public bool inSpecial { get { return inCombo || lockedInCombo || Conductor.instance.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.25f || inNuriLock; } } - public bool inNuriLock { get { return (Conductor.instance.songPositionInBeats >= noNuriJabTime && Conductor.instance.songPositionInBeats < noNuriJabTime + 1f); } } + public bool inNuriLock { get { return (Conductor.instance.songPositionInBeatsAsDouble >= noNuriJabTime && Conductor.instance.songPositionInBeatsAsDouble < noNuriJabTime + 1f); } } private void Awake() { @@ -54,7 +54,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { var cond = Conductor.instance; - if (cond.songPositionInBeats < bombGlowStart) + if (cond.songPositionInBeatsAsDouble < bombGlowStart) { bombGlowIntensity = 1f; } @@ -62,9 +62,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan { float glowProg = cond.GetPositionFromBeat(bombGlowStart, bombGlowLength); bombGlowIntensity = 1f - glowProg; - if (cond.songPositionInBeats >= bombGlowStart + bombGlowLength) + if (cond.songPositionInBeatsAsDouble >= bombGlowStart + bombGlowLength) { - bombGlowStart = Single.MinValue; + bombGlowStart = double.MinValue; bombGlowLength = 0f; } } @@ -76,25 +76,25 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (wantFace == (int) KarateMan.KarateManFaces.Surprise) wantFace = -1; } - if (cond.songPositionInBeats >= noNuriJabTime && cond.songPositionInBeats < noNuriJabTime + 1f) + if (cond.songPositionInBeatsAsDouble >= noNuriJabTime && cond.songPositionInBeatsAsDouble < noNuriJabTime + 1f) { anim.DoScaledAnimation("JabNoNuri", noNuriJabTime, 1f); bop.startBeat = noNuriJabTime + 1f; } - else if (cond.songPositionInBeats >= noNuriJabTime + 1f && noNuriJabTime != Single.MinValue) + else if (cond.songPositionInBeatsAsDouble >= noNuriJabTime + 1f && noNuriJabTime != double.MinValue) { bop.startBeat = noNuriJabTime + 1f; - noNuriJabTime = Single.MinValue; + noNuriJabTime = double.MinValue; } - if (unPrepareTime != Single.MinValue && cond.songPositionInBeats >= unPrepareTime) + if (unPrepareTime != double.MinValue && cond.songPositionInBeatsAsDouble >= unPrepareTime) { - unPrepareTime = Single.MinValue; + unPrepareTime = double.MinValue; anim.speed = 1f; anim.Play("Beat", -1, 0); } - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeats > bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length && cond.songPositionInBeats >= unPrepareTime && !inCombo) + if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeatsAsDouble > bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length && cond.songPositionInBeatsAsDouble >= unPrepareTime && !inCombo) { Bop(); } @@ -111,7 +111,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { anim.speed = 1f; bop.startBeat = lastComboMissTime + 3f; - lastComboMissTime = Single.MinValue; + lastComboMissTime = double.MinValue; inCombo = false; inComboId = -1; shouldComboId = -1; @@ -130,7 +130,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { anim.speed = 1f; bop.startBeat = lastChargeTime + 1.75f; - lastChargeTime = Single.MinValue; + lastChargeTime = double.MinValue; inKick = false; } } @@ -140,7 +140,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (!KarateMan.instance.IsExpectingInputNow(InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN)) { Punch(1); - Jukebox.PlayOneShotGame("karateman/swingNoHit", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/swingNoHit", forcePlay: true); } } @@ -149,7 +149,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (!KarateMan.instance.IsExpectingInputNow(InputType.STANDARD_ALT_DOWN)) { //start a forced-fail combo sequence - ForceFailCombo(cond.songPositionInBeats); + ForceFailCombo(cond.songPositionInBeatsAsDouble); KarateMan.instance.ScoreMiss(2); } } @@ -173,8 +173,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan } else if (inKick && cond.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.5f && !KarateMan.instance.IsExpectingInputNow(InputType.STANDARD_UP | InputType.DIRECTION_UP)) { - Kick(cond.songPositionInBeats); - Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true); + Kick(cond.songPositionInBeatsAsDouble); + SoundByte.PlayOneShotGame("karateman/swingKick", forcePlay: true); } } @@ -184,7 +184,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { anim.speed = 1f; anim.Play("Beat", -1, 0); - lastChargeTime = Single.MinValue; + lastChargeTime = double.MinValue; } public bool Punch(int forceHand = 0) @@ -194,22 +194,22 @@ namespace HeavenStudio.Games.Scripts_KarateMan bool straight = false; anim.speed = 1f; - unPrepareTime = Single.MinValue; - lastChargeTime = Single.MinValue; + unPrepareTime = double.MinValue; + lastChargeTime = double.MinValue; inKick = false; switch (forceHand) { case 0: - if (cond.songPositionInBeats - lastPunchTime < 0.25f + (Minigame.LateTime() - 1f)) + if (cond.songPositionInBeatsAsDouble - lastPunchTime < 0.25f + (Minigame.LateTime() - 1f)) { - lastPunchTime = Single.MinValue; + lastPunchTime = double.MinValue; anim.DoScaledAnimationAsync("Straight", 0.5f); straight = true; } else { - lastPunchTime = cond.songPositionInBeats; + lastPunchTime = cond.songPositionInBeatsAsDouble; anim.DoScaledAnimationAsync("Jab", 0.5f); } break; @@ -221,12 +221,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan straight = true; break; case 3: - lastPunchTime = Single.MinValue; + lastPunchTime = double.MinValue; anim.DoNormalizedAnimation("JabNoNuri"); - noNuriJabTime = cond.songPositionInBeats; + noNuriJabTime = cond.songPositionInBeatsAsDouble; break; } - bop.startBeat = cond.songPositionInBeats + 0.5f; + bop.startBeat = cond.songPositionInBeatsAsDouble + 0.5f; return straight; //returns what hand was used to punch the object } @@ -234,8 +234,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan { if (GameManager.instance.currentGame != "karateman") return; var cond = Conductor.instance; - bop.startBeat = cond.songPositionInBeats + 1f; - unPrepareTime = Single.MinValue; + bop.startBeat = cond.songPositionInBeatsAsDouble + 1f; + unPrepareTime = double.MinValue; switch (seq) { case 0: @@ -255,7 +255,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan break; case 4: anim.Play("ToReady", -1, 0); - bop.startBeat = cond.songPositionInBeats + 0.5f; + bop.startBeat = cond.songPositionInBeatsAsDouble + 0.5f; lockedInCombo = false; comboWaiting = false; break; @@ -264,16 +264,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan } } - public void ComboMiss(float beat) + public void ComboMiss(double beat) { var cond = Conductor.instance; lastComboMissTime = beat; bop.startBeat = beat + 3f; - unPrepareTime = Single.MinValue; + unPrepareTime = double.MinValue; anim.DoNormalizedAnimation("LowKickMiss"); } - public void ForceFailCombo(float beat) + public void ForceFailCombo(double beat) { if (inCombo) return; BeatAction.New(gameObject, new List() @@ -293,10 +293,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan }, forcePlay: true); } - public void StartKickCharge(float beat) + public void StartKickCharge(double beat) { wantKick = true; - unPrepareTime = Single.MinValue; + unPrepareTime = double.MinValue; BeatAction.New(gameObject, new List() { new BeatAction.Action(beat, delegate { @@ -311,14 +311,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan }); } - public void Kick(float beat) + public void Kick(double beat) { if (!inKick) return; //play the kick animation and reset stance anim.speed = 1f; bop.startBeat = beat + 1f; - unPrepareTime = Single.MinValue; - lastChargeTime = Single.MinValue; + unPrepareTime = double.MinValue; + lastChargeTime = double.MinValue; inKick = false; anim.DoScaledAnimationAsync("ManKick", 0.5f); @@ -355,7 +355,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan KarateMan.instance.MappingMaterial.SetColor("_ColorDelta", highlightCol); } - public void Prepare(float beat, float length) + public void Prepare(double beat, float length) { anim.speed = 0f; anim.Play("Beat", -1, 0); @@ -376,12 +376,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan public void ApplyBombGlow() { - bombGlowStart = Single.MaxValue; + bombGlowStart = double.MaxValue; bombGlowLength = 0f; bombGlowIntensity = 1f; } - public void RemoveBombGlow(float beat, float length = 0.5f) + public void RemoveBombGlow(double beat, float length = 0.5f) { bombGlowStart = beat; bombGlowLength = length; diff --git a/Assets/Scripts/Games/KarateMan/KarateManNoriController.cs b/Assets/Scripts/Games/KarateMan/KarateManNoriController.cs index 04e1cfa1..5c9633d6 100644 --- a/Assets/Scripts/Games/KarateMan/KarateManNoriController.cs +++ b/Assets/Scripts/Games/KarateMan/KarateManNoriController.cs @@ -49,7 +49,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan } - public void SetNoriMode(float fromBeat, int mode, int startingNori = 0) + public void SetNoriMode(double fromBeat, int mode, int startingNori = 0) { float scaleFactor = 0f; //clear all children of the holder @@ -143,7 +143,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (KarateMan.instance.NoriPerformance >= 0.6f && oldNori / MaxNori < 0.6f && !playedJust) { playedJust = true; - Jukebox.PlayOneShotGame("karateman/nori_just"); + SoundByte.PlayOneShotGame("karateman/nori_just"); } UpdateHeartColours(); } @@ -182,7 +182,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (KarateMan.instance.NoriPerformance < 0.6f && oldNori / MaxNori >= 0.6f) { playedJust = false; - Jukebox.PlayOneShotGame("karateman/nori_ng"); + SoundByte.PlayOneShotGame("karateman/nori_ng"); } UpdateHeartColours(); } @@ -194,7 +194,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (noriMode == (int) KarateMan.NoriMode.Tengoku) { if (Nori >= MaxNori) - Jukebox.PlayOneShotGame("karateman/nori_through"); + SoundByte.PlayOneShotGame("karateman/nori_through"); playedJust = false; Nori = 0; foreach (Animator anim in NoriHeartAnimators) diff --git a/Assets/Scripts/Games/KarateMan/KarateManPot.cs b/Assets/Scripts/Games/KarateMan/KarateManPot.cs index 83819477..f7827e71 100644 --- a/Assets/Scripts/Games/KarateMan/KarateManPot.cs +++ b/Assets/Scripts/Games/KarateMan/KarateManPot.cs @@ -10,7 +10,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { public class KarateManPot : MonoBehaviour { - public float startBeat; + public double startBeat; public ItemType type; public int path = 1; @@ -288,7 +288,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan transform.position = CurrentCurve.GetPoint(Mathf.Min(prog, 1f)); } - if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + 2f) + if (type == ItemType.Bomb && cond.songPositionInBeatsAsDouble >= startBeat + 2f) { ParticleSystem p = Instantiate(HitParticles[7], transform.position, Quaternion.identity, KarateMan.instance.ItemHolder); p.Play(); @@ -317,7 +317,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan break; case FlyStatus.Hit: prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat); - if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + curveTargetBeat) + if (type == ItemType.Bomb && cond.songPositionInBeatsAsDouble >= startBeat + curveTargetBeat) { ParticleSystem p = Instantiate(HitParticles[7], CurrentCurve.GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder); p.Play(); @@ -325,17 +325,17 @@ namespace HeavenStudio.Games.Scripts_KarateMan GameObject.Destroy(ShadowInstance.gameObject); GameObject.Destroy(gameObject); - Jukebox.PlayOneShotGame("karateman/bombBreak", volume: 0.25f); + SoundByte.PlayOneShotGame("karateman/bombBreak", volume: 0.25f); return; } - else if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || CurrentCurve == null) { + else if (cond.songPositionInBeatsAsDouble >= startBeat + Mathf.Max(2f, curveTargetBeat) || CurrentCurve == null) { if (type == ItemType.KickBomb) { ParticleSystem p = Instantiate(HitParticles[6], ItemCurves[7].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder); p.Play(); } - else if (type == ItemType.KickBall && cond.songPositionInBeats < startBeat + curveTargetBeat + 1f) + else if (type == ItemType.KickBall && cond.songPositionInBeatsAsDouble < startBeat + curveTargetBeat + 1f) return; GameObject.Destroy(ShadowInstance.gameObject); @@ -357,7 +357,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan case FlyStatus.NG: prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat); - if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + curveTargetBeat) + if (type == ItemType.Bomb && cond.songPositionInBeatsAsDouble >= startBeat + curveTargetBeat) { KarateMan.instance.Joe.RemoveBombGlow(startBeat + curveTargetBeat, 1f); ParticleSystem p = Instantiate(HitParticles[7], CurrentCurve.GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder); @@ -367,7 +367,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan GameObject.Destroy(gameObject); return; } - else if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || (ItemKickable() && prog >= 1f) || CurrentCurve == null) { + else if (cond.songPositionInBeatsAsDouble >= startBeat + Mathf.Max(2f, curveTargetBeat) || (ItemKickable() && prog >= 1f) || CurrentCurve == null) { if (type == ItemType.KickBomb) { ParticleSystem p = Instantiate(HitParticles[7], ItemCurves[8].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder); @@ -393,7 +393,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan prog = cond.GetPositionFromBeat(startBeat, 1f); Vector3 pos = new Vector3(HitPosition[1].position.x + 0.25f, HitPosition[0].position.y, HitPosition[1].position.z); - if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + 1f) + if (type == ItemType.Bomb && cond.songPositionInBeatsAsDouble >= startBeat + 1f) { KarateMan.instance.Joe.RemoveBombGlow(startBeat + 1f, 1f); @@ -404,7 +404,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan GameObject.Destroy(gameObject); return; } - else if (cond.songPositionInBeats >= startBeat + 3f) + else if (cond.songPositionInBeatsAsDouble >= startBeat + 3f) { GameObject.Destroy(ShadowInstance.gameObject); GameObject.Destroy(gameObject); @@ -444,7 +444,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan case ItemType.Bulb: CurrentCurve = ItemCurves[straight ? 1 : 0]; curveTargetBeat = straight ? 1f : 1.5f;; - Jukebox.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true); p = Instantiate(HitParticles[5], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); if (effectTint.a == 0) @@ -468,101 +468,101 @@ namespace HeavenStudio.Games.Scripts_KarateMan case ItemType.Rock: CurrentCurve = ItemCurves[1]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/rockHit", forcePlay: true); p = Instantiate(HitParticles[4], HitPosition[1].position, Quaternion.identity, game.ItemHolder); p.Play(); if (game.IsNoriActive && game.NoriPerformance >= 1f) - Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); break; case ItemType.Ball: CurrentCurve = ItemCurves[1]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/soccerHit", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/soccerHit", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); break; case ItemType.Cooking: CurrentCurve = ItemCurves[1]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/cookingPot", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/cookingPot", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); game.CreateItemInstance(startBeat + 1f, "Item09", 0, ItemType.CookingLid); GetComponent().Play("Item08", -1, 0); if (game.IsNoriActive && game.NoriPerformance >= 1f) - Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); break; case ItemType.Alien: CurrentCurve = ItemCurves[1]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/alienHit", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/alienHit", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); if (game.IsNoriActive && game.NoriPerformance >= 1f) - Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); break; case ItemType.Bomb: CurrentCurve = ItemCurves[1]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/bombHit", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/bombHit", forcePlay: true); p = Instantiate(HitParticles[2], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); game.Joe.RemoveBombGlow(startBeat + 1f, 1f); if (game.IsNoriActive && game.NoriPerformance >= 1f) - Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); break; case ItemType.TacoBell: CurrentCurve = ItemCurves[1]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true); - Jukebox.PlayOneShotGame("karateman/tacobell", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/rockHit", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/tacobell", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); if (game.IsNoriActive && game.NoriPerformance >= 1f) - Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true); break; case ItemType.ComboPot1: CurrentCurve = ItemCurves[straight ? 1 : 0]; curveTargetBeat = 1.5f; - Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/comboHit1", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); break; case ItemType.ComboPot2: CurrentCurve = ItemCurves[0]; curveTargetBeat = 1.5f; - Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/comboHit1", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); break; case ItemType.ComboPot3: CurrentCurve = ItemCurves[2]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/comboHit2", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/comboHit2", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[2].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); break; case ItemType.ComboPot4: CurrentCurve = ItemCurves[3]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/comboHit3", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[3].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); break; case ItemType.ComboPot5: CurrentCurve = ItemCurves[4]; curveTargetBeat = 1f; - Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/comboHit3", forcePlay: true); p = Instantiate(HitParticles[1], HitPosition[4].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); p.Play(); break; case ItemType.ComboBarrel: - Jukebox.PlayOneShotGame("karateman/comboHit4", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/comboHit4", forcePlay: true); p = Instantiate(HitParticles[0], HitPosition[5].position, Quaternion.identity, game.ItemHolder); p.Play(); p = Instantiate(HitParticles[1], HitPosition[5].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); @@ -576,7 +576,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan game.Joe.ApplyBombGlow(); game.CreateItemInstance(startBeat + 1f, "Item04", OnHitExpression, ItemType.KickBomb); } - Jukebox.PlayOneShotGame("karateman/barrelBreak", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/barrelBreak", forcePlay: true); p = Instantiate(HitParticles[0], HitPosition[1].position, Quaternion.Euler(0, 0, -5f), game.ItemHolder); p.Play(); p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder); @@ -584,14 +584,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan break; case ItemType.KickBomb: - Jukebox.PlayOneShotGame("karateman/bombKick", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/bombKick", forcePlay: true); p = Instantiate(HitParticles[2], ItemCurves[6].GetPoint(0.5f), Quaternion.identity, game.ItemHolder); p.Play(); game.Joe.RemoveBombGlow(startBeat + 0.75f); break; case ItemType.KickBall: - Jukebox.PlayOneShotGame("karateman/bombKick", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/bombKick", forcePlay: true); p = Instantiate(HitParticles[1], ItemCurves[6].GetPoint(0.5f), Quaternion.identity, game.ItemHolder); p.Play(); break; @@ -600,18 +600,18 @@ namespace HeavenStudio.Games.Scripts_KarateMan curveTargetBeat = straight ? 1f : 1.5f; if (game.IsNoriActive && game.NoriPerformance < 0.6f) { - Jukebox.PlayOneShotGame("karateman/potHit_lowNori", forcePlay: true); - Jukebox.PlayOneShotGame("karateman/potHit", volume: 0.66f, forcePlay: true); + SoundByte.PlayOneShotGame("karateman/potHit_lowNori", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/potHit", volume: 0.66f, forcePlay: true); } else - Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/potHit", forcePlay: true); p = Instantiate(HitParticles[3], HitPosition[1].position, Quaternion.identity, game.ItemHolder); p.Play(); break; } - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; status = FlyStatus.Hit; } @@ -669,7 +669,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan case ItemType.ComboPot2: joe.Punch(2); if (joe.GetComboId() != comboId) - Jukebox.PlayOneShotGame("karateman/swingNoHit_Alt", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/swingNoHit_Alt", forcePlay: true); else { ItemHitEffect(); @@ -687,7 +687,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan //if the button isn't held anymore make Joe spin if (joe.GetComboId() != comboId) { joe.ComboMiss(startBeat + 1f); - Jukebox.PlayOneShotGame("karateman/comboMiss", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/comboMiss", forcePlay: true); joe.SetShouldComboId(-2); } else @@ -710,7 +710,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan } } - void DoHitExpression(float offset) + void DoHitExpression(double offset) { if (OnHitExpression == (int) KarateMan.KarateManFaces.Normal) return; @@ -733,10 +733,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) { if (state <= -1f || state >= 1f) { bool straight = joe.Punch(ItemPunchHand()); - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; CurrentCurve = ItemCurves[6]; curveTargetBeat = 1f; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); status = FlyStatus.NG; joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad); @@ -755,9 +755,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (ItemNeedNori() && KarateMan.instance.NoriPerformance < 0.6f) { CreateHitMark(false); - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; status = FlyStatus.HitWeak; - Jukebox.PlayOneShotGame("karateman/hitNoNori", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/hitNoNori", forcePlay: true); joe.Punch(3); transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z - 30f); KarateMan.instance.Nori.DoNG(); @@ -783,12 +783,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan //WHEN SCORING THIS IS A MISS var joe = KarateMan.instance.Joe; if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) { - joe.ForceFailCombo(Conductor.instance.songPositionInBeats); + joe.ForceFailCombo(Conductor.instance.songPositionInBeatsAsDouble); if (state <= -1f || state >= 1f) { - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; CurrentCurve = ItemCurves[6]; curveTargetBeat = 1f; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); status = FlyStatus.NG; } else { @@ -821,7 +821,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { new BeatAction.Action(startBeat + 2f, delegate { joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise); - Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/karate_through", forcePlay: true); }), new BeatAction.Action(startBeat + 5f, delegate { if (joe.wantFace == -1) @@ -843,10 +843,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan joe.SetComboId(comboId); joe.SetShouldComboId(comboId); if (state <= -1f || state >= 1f) { - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; CurrentCurve = ItemCurves[6]; curveTargetBeat = 1f; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); status = FlyStatus.NG; KarateMan.instance.Nori.DoNG(); @@ -870,7 +870,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { new BeatAction.Action(startBeat + 2f, delegate { joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise); - Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/karate_through", forcePlay: true); }), new BeatAction.Action(startBeat + 5f, delegate { if (joe.wantFace == -1) @@ -891,10 +891,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) { bool straight = joe.Punch(ItemPunchHand()); if (state <= -1f || state >= 1f) { - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; CurrentCurve = ItemCurves[6]; curveTargetBeat = 1f; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); status = FlyStatus.NG; } else { @@ -916,10 +916,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan joe.SetShouldComboId(-1); joe.ComboSequence(3); if (state <= -1f || state >= 1f) { - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; CurrentCurve = ItemCurves[5]; curveTargetBeat = 1f; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); status = FlyStatus.NG; BeatAction.New(joe.gameObject, new List() @@ -952,7 +952,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan joe.SetComboId(-1); joe.SetShouldComboId(-1); joe.ComboSequence(3); - Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/swingKick", forcePlay: true); } OnHit.CanHit(false); } @@ -1009,7 +1009,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { if (GameManager.instance.currentGame != "karateman") return; if (KarateMan.IsComboEnable && !(KarateMan.instance.Joe.inCombo || KarateMan.instance.Joe.inNuriLock)) - KarateMan.instance.Joe.ForceFailCombo(Conductor.instance.songPositionInBeats); + KarateMan.instance.Joe.ForceFailCombo(Conductor.instance.songPositionInBeatsAsDouble); } public void KickChargeJustOrNg(PlayerActionEvent caller, float state) @@ -1019,10 +1019,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo || joe.inNuriLock)) { joe.Punch(ItemPunchHand()); if (state <= -1f || state >= 1f) { - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; CurrentCurve = ItemCurves[6]; curveTargetBeat = 1f; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); status = FlyStatus.NG; joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad); @@ -1056,7 +1056,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan { new BeatAction.Action(startBeat + 2f, delegate { joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise); - Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true); + SoundByte.PlayOneShotGame("karateman/karate_through", forcePlay: true); }), new BeatAction.Action(startBeat + 5f, delegate { if (joe.wantFace == -1) @@ -1073,12 +1073,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan if (GameManager.instance.currentGame != "karateman") return; var joe = KarateMan.instance.Joe; if (status == FlyStatus.Fly && joe.inKick) { - joe.Kick(Conductor.instance.songPositionInBeats); + joe.Kick(Conductor.instance.songPositionInBeatsAsDouble); if (state <= -1f || state >= 1f) { - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; CurrentCurve = ItemCurves[8]; curveTargetBeat = 1f; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); status = FlyStatus.NG; BeatAction.New(joe.gameObject, new List() @@ -1100,7 +1100,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan ItemHitEffect(); status = FlyStatus.Hit; CurrentCurve = ItemCurves[7]; - startBeat = Conductor.instance.songPositionInBeats; + startBeat = Conductor.instance.songPositionInBeatsAsDouble; curveTargetBeat = 3f; KarateMan.instance.Nori.DoHit(); } diff --git a/Assets/Scripts/Games/Kitties/CtrTeppanPlayer.cs b/Assets/Scripts/Games/Kitties/CtrTeppanPlayer.cs index 9661d292..d709d82d 100644 --- a/Assets/Scripts/Games/Kitties/CtrTeppanPlayer.cs +++ b/Assets/Scripts/Games/Kitties/CtrTeppanPlayer.cs @@ -36,7 +36,7 @@ namespace HeavenStudio.Games.Scripts_Kitties if (PlayerInput.Pressed() && canClap && !Kitties.instance.IsExpectingInputNow(InputType.STANDARD_DOWN)) { - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); if (spawnType != 3) anim.Play("ClapFail", 0, 0); else @@ -50,26 +50,26 @@ namespace HeavenStudio.Games.Scripts_Kitties } } - public void ScheduleClap(float beat, int type) + public void ScheduleClap(double beat, int type) { spawnType = type; Kitties.instance.ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, ClapSuccessOne, ClapMissOne, ClapEmpty); Kitties.instance.ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, ClapSuccessTwo, ClapMissTwo, ClapEmpty); } - public void ScheduleRoll(float beat) + public void ScheduleRoll(double beat) { Kitties.instance.ScheduleInput(beat, 2f, InputType.STANDARD_ALT_DOWN, SpinSuccessOne, SpinMissOne, SpinEmpty); } - public void ScheduleRollFinish(float beat) + public void ScheduleRollFinish(double beat) { Debug.Log(hasSpun); if (hasSpun) Kitties.instance.ScheduleInput(beat, 2.75f, InputType.STANDARD_ALT_UP, SpinSuccessTwo, SpinMissTwo, SpinEmpty); } - public void ScheduleFish(float beat) + public void ScheduleFish(double beat) { Kitties.instance.ScheduleInput(beat, 2.75f, InputType.STANDARD_DOWN, FishSuccess, FishMiss, FishEmpty); } @@ -80,13 +80,13 @@ namespace HeavenStudio.Games.Scripts_Kitties { if (state >= 1f || state <= -1f) { //todo: proper near miss feedback - Jukebox.PlayOneShotGame("kitties/ClapMiss1"); - Jukebox.PlayOneShotGame("kitties/tink"); + SoundByte.PlayOneShotGame("kitties/ClapMiss1"); + SoundByte.PlayOneShotGame("kitties/tink"); anim.Play("ClapMiss", 0, 0); } else { - Jukebox.PlayOneShotGame("kitties/clap1"); + SoundByte.PlayOneShotGame("kitties/clap1"); anim.Play("Clap1", 0, 0); } } @@ -94,18 +94,18 @@ namespace HeavenStudio.Games.Scripts_Kitties { if (state >= 1f || state <= -1f) { //todo: proper near miss feedback - Jukebox.PlayOneShotGame("kitties/ClapMiss1"); - Jukebox.PlayOneShotGame("kitties/tink"); + SoundByte.PlayOneShotGame("kitties/ClapMiss1"); + SoundByte.PlayOneShotGame("kitties/tink"); anim.Play("FaceClapFail", 0, 0); } - Jukebox.PlayOneShotGame("kitties/clap1"); + SoundByte.PlayOneShotGame("kitties/clap1"); anim.Play("FaceClap", 0, 0); } } public void ClapMissOne(PlayerActionEvent Caller) { - Jukebox.PlayOneShotGame("kitties/ClapMiss1"); + SoundByte.PlayOneShotGame("kitties/ClapMiss1"); } public void ClapEmpty(PlayerActionEvent Caller) { @@ -118,13 +118,13 @@ namespace HeavenStudio.Games.Scripts_Kitties { if (state >= 1f || state <= -1f) { //todo: proper near miss feedback - Jukebox.PlayOneShotGame("kitties/ClapMiss2"); - Jukebox.PlayOneShotGame("kitties/tink"); + SoundByte.PlayOneShotGame("kitties/ClapMiss2"); + SoundByte.PlayOneShotGame("kitties/tink"); anim.Play("ClapMiss", 0, 0); } else { - Jukebox.PlayOneShotGame("kitties/clap2"); + SoundByte.PlayOneShotGame("kitties/clap2"); anim.Play("Clap2", 0, 0); } } @@ -132,31 +132,31 @@ namespace HeavenStudio.Games.Scripts_Kitties { if (state >= 1f || state <= -1f) { //todo: proper near miss feedback - Jukebox.PlayOneShotGame("kitties/ClapMiss2"); - Jukebox.PlayOneShotGame("kitties/tink"); + SoundByte.PlayOneShotGame("kitties/ClapMiss2"); + SoundByte.PlayOneShotGame("kitties/tink"); anim.Play("FaceClapFail", 0, 0); } - Jukebox.PlayOneShotGame("kitties/clap2"); + SoundByte.PlayOneShotGame("kitties/clap2"); anim.Play("FaceClap", 0, 0); } } public void ClapMissTwo(PlayerActionEvent Caller) { - Jukebox.PlayOneShotGame("kitties/ClapMiss2"); + SoundByte.PlayOneShotGame("kitties/ClapMiss2"); } public void SpinSuccessOne(PlayerActionEvent caller, float beat) { hasSpun = true; - Jukebox.PlayOneShotGame("kitties/roll5"); + SoundByte.PlayOneShotGame("kitties/roll5"); anim.Play("Rolling", 0, 0); } public void SpinSuccessTwo(PlayerActionEvent caller, float beat) { - Jukebox.PlayOneShotGame("kitties/roll6"); + SoundByte.PlayOneShotGame("kitties/roll6"); anim.Play("RollEnd", 0, 0); } @@ -164,8 +164,8 @@ namespace HeavenStudio.Games.Scripts_Kitties { hasSpun = false; var cond = Conductor.instance; - Jukebox.PlayOneShotGame("kitties/roll5", -1f, 1, .1f); - Jukebox.PlayOneShotGame("kitties/roll6", cond.songPositionInBeats + .75f, 1, .1f); + SoundByte.PlayOneShotGame("kitties/roll5", -1f, 1, .1f); + SoundByte.PlayOneShotGame("kitties/roll6", cond.songPositionInBeatsAsDouble + .75f, 1, .1f); } public void SpinMissTwo(PlayerActionEvent caller) @@ -174,7 +174,7 @@ namespace HeavenStudio.Games.Scripts_Kitties { RollFail(); } - Jukebox.PlayOneShotGame("kitties/roll6", -1f, 1, .3f); + SoundByte.PlayOneShotGame("kitties/roll6", -1f, 1, .3f); } public void SpinEmpty(PlayerActionEvent caller) @@ -184,7 +184,7 @@ namespace HeavenStudio.Games.Scripts_Kitties public void RollFail() { - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); anim.Play("RollFail", 0, 0); hasSpun = false; } @@ -192,14 +192,14 @@ namespace HeavenStudio.Games.Scripts_Kitties public void FishSuccess(PlayerActionEvent caller, float beat) { Kitties.instance.RemoveCats(false); - Jukebox.PlayOneShotGame("kitties/fish4"); + SoundByte.PlayOneShotGame("kitties/fish4"); fish.Play("CaughtSuccess", 0, 0); } public void FishMiss(PlayerActionEvent caller) { Kitties.instance.RemoveCats(false); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); fish.Play("CaughtFail", 0, 0); } diff --git a/Assets/Scripts/Games/Kitties/Kitties.cs b/Assets/Scripts/Games/Kitties/Kitties.cs index 66ed138a..319d7334 100644 --- a/Assets/Scripts/Games/Kitties/Kitties.cs +++ b/Assets/Scripts/Games/Kitties/Kitties.cs @@ -127,7 +127,7 @@ namespace HeavenStudio.Games } - public void Clap(bool isMice, bool isInverse, bool keepSpawned, float beat, int type) + public void Clap(bool isMice, bool isInverse, bool keepSpawned, double beat, int type) { player.ScheduleClap(beat, type); MultiSound.Play(new MultiSound.Sound[] { @@ -215,7 +215,7 @@ namespace HeavenStudio.Games } } - public void Roll(bool keepSpawned, float beat) + public void Roll(bool keepSpawned, double beat) { if (!player.canClap) return; @@ -265,7 +265,7 @@ namespace HeavenStudio.Games } } - public void CatchFish(float beat) + public void CatchFish(double beat) { //if (!player.canClap) // return; @@ -438,7 +438,7 @@ namespace HeavenStudio.Games player.canClap = false; } - public void InstantSpawn(bool isMice, bool isInverse, float beat, int pos) + public void InstantSpawn(bool isMice, bool isInverse, double beat, int pos) { BeatAction.New(Cats[0], new List() { diff --git a/Assets/Scripts/Games/LaunchParty/LaunchParty.cs b/Assets/Scripts/Games/LaunchParty/LaunchParty.cs index 6cd8aa12..483b5a7b 100644 --- a/Assets/Scripts/Games/LaunchParty/LaunchParty.cs +++ b/Assets/Scripts/Games/LaunchParty/LaunchParty.cs @@ -10,6 +10,7 @@ using System.Diagnostics; using UnityEngine; using UnityEngine.Rendering; using static HeavenStudio.EntityTypes; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -101,7 +102,7 @@ namespace HeavenStudio.Games.Loaders new Param("xPos", new EntityTypes.Float(-40f, 40f, 0f), "X Position", "Which position on the X axis should the Launch Pad travel to?"), new Param("yPos", new EntityTypes.Float(-30f, 30f, 0f), "Y Position", "Which position on the Y axis should the Launch Pad travel to?"), new Param("zPos", new EntityTypes.Float(-90f, 90f, 0f), "Z Position", "Which position on the Z axis should the Launch Pad travel to?"), - new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?") + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?") } }, new GameAction("rotMove", "Change Launch Pad Rotation") @@ -111,7 +112,7 @@ namespace HeavenStudio.Games.Loaders parameters = new List() { new Param("rot", new EntityTypes.Float(-360, 360, 0), "Angle", "Which angle of rotation should the Launch Pad rotate towards?"), - new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?") + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?") } }, new GameAction("toggleStars", "Toggle Falling Stars") @@ -174,8 +175,8 @@ namespace HeavenStudio.Games private Vector3 currentPadPos = new Vector3(0, -2.4f, 0); private float lastPadRotation; private float currentPadRotation; - private EasingFunction.Ease lastPosEase; - private EasingFunction.Ease lastRotEase; + private Util.EasingFunction.Ease lastPosEase; + private Util.EasingFunction.Ease lastRotEase; public enum RocketType { Family = 0, @@ -186,7 +187,7 @@ namespace HeavenStudio.Games public struct QueuedRocket { public RocketType type; - public float beat; + public double beat; public float offSet; public List notes; } @@ -196,9 +197,9 @@ namespace HeavenStudio.Games private int currentRotIndex; - private List allPosEvents = new List(); + private List allPosEvents = new List(); - private List allRotEvents = new List(); + private List allRotEvents = new List(); public static LaunchParty instance; @@ -216,10 +217,10 @@ namespace HeavenStudio.Games instance = this; lensFlareAnim.Play("Flashing", 0, 0); var posEvents = EventCaller.GetAllInGameManagerList("launchParty", new string[] { "posMove" }); - List tempPosEvents = new List(); + List tempPosEvents = new List(); for (int i = 0; i < posEvents.Count; i++) { - if (posEvents[i].beat + posEvents[i].beat >= Conductor.instance.songPositionInBeats) + if (posEvents[i].beat + posEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { tempPosEvents.Add(posEvents[i]); } @@ -228,10 +229,10 @@ namespace HeavenStudio.Games allPosEvents = tempPosEvents; var rotEvents = EventCaller.GetAllInGameManagerList("launchParty", new string[] { "rotMove" }); - List tempRotEvents = new List(); + List tempRotEvents = new List(); for (int i = 0; i < rotEvents.Count; i++) { - if (rotEvents[i].beat + rotEvents[i].beat >= Conductor.instance.songPositionInBeats) + if (rotEvents[i].beat + rotEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { tempRotEvents.Add(rotEvents[i]); } @@ -261,7 +262,7 @@ namespace HeavenStudio.Games { if (currentPosIndex < allPosEvents.Count && currentPosIndex >= 0) { - if (cond.songPositionInBeats >= allPosEvents[currentPosIndex].beat) + if (cond.songPositionInBeatsAsDouble >= allPosEvents[currentPosIndex].beat) { UpdateLaunchPadPos(); currentPosIndex++; @@ -284,7 +285,7 @@ namespace HeavenStudio.Games } else { - EasingFunction.Function func = EasingFunction.GetEasingFunction(lastPosEase); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastPosEase); float newPosX = func(lastPadPos.x, currentPadPos.x, normalizedBeat); float newPosY = func(lastPadPos.y, currentPadPos.y, normalizedBeat); @@ -298,7 +299,7 @@ namespace HeavenStudio.Games { if (currentRotIndex < allRotEvents.Count && currentRotIndex >= 0) { - if (cond.songPositionInBeats >= allRotEvents[currentRotIndex].beat) + if (cond.songPositionInBeatsAsDouble >= allRotEvents[currentRotIndex].beat) { UpdateLaunchPadRot(); currentRotIndex++; @@ -321,7 +322,7 @@ namespace HeavenStudio.Games } else { - EasingFunction.Function func = EasingFunction.GetEasingFunction(lastRotEase); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastRotEase); float newRotZ = func(lastPadRotation, currentPadRotation, normalizedBeat); launchPadRotatable.rotation = Quaternion.Euler(0, 0, newRotZ); @@ -341,10 +342,10 @@ namespace HeavenStudio.Games if (currentPosIndex < allPosEvents.Count && currentPosIndex >= 0) { lastPadPos = launchPad.position; - currentPosBeat = allPosEvents[currentPosIndex].beat; + currentPosBeat = (float)allPosEvents[currentPosIndex].beat; currentPosLength = allPosEvents[currentPosIndex].length; currentPadPos = new Vector3(allPosEvents[currentPosIndex]["xPos"], allPosEvents[currentPosIndex]["yPos"], allPosEvents[currentPosIndex]["zPos"]); - lastPosEase = (EasingFunction.Ease)allPosEvents[currentPosIndex]["ease"]; + lastPosEase = (Util.EasingFunction.Ease)allPosEvents[currentPosIndex]["ease"]; } } @@ -353,14 +354,14 @@ namespace HeavenStudio.Games if (currentRotIndex < allRotEvents.Count && currentRotIndex >= 0) { lastPadRotation = launchPadRotatable.rotation.eulerAngles.z; - currentRotBeat = allRotEvents[currentRotIndex].beat; + currentRotBeat = (float)allRotEvents[currentRotIndex].beat; currentRotLength = allRotEvents[currentRotIndex].length; currentPadRotation = allRotEvents[currentRotIndex]["rot"]; - lastRotEase = (EasingFunction.Ease)allRotEvents[currentRotIndex]["ease"]; + lastRotEase = (Util.EasingFunction.Ease)allRotEvents[currentRotIndex]["ease"]; } } - public void SpawnRocket(float beat, float beatOffset, RocketType type, List notes) + public void SpawnRocket(double beat, float beatOffset, RocketType type, List notes) { GameObject rocketToSpawn = rocket; switch (type) @@ -383,7 +384,7 @@ namespace HeavenStudio.Games List pitchedNotes = new List(); foreach (var note in notes) { - pitchedNotes.Add(Jukebox.GetPitchFromSemiTones(note, true)); + pitchedNotes.Add(SoundByte.GetPitchFromSemiTones(note, true)); } rocketScript.pitches.AddRange(pitchedNotes); switch (type) @@ -407,7 +408,7 @@ namespace HeavenStudio.Games }); } - public static void LaunchRocket(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour) + public static void LaunchRocket(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour) { List pitches = new List() { @@ -426,7 +427,7 @@ namespace HeavenStudio.Games } } - public static void LaunchPartyCracker(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix) + public static void LaunchPartyCracker(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix) { List pitches = new List() { @@ -447,7 +448,7 @@ namespace HeavenStudio.Games } } - public static void LaunchBell(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven, int noteEight, int noteNine) + public static void LaunchBell(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven, int noteEight, int noteNine) { List pitches = new List() { @@ -471,7 +472,7 @@ namespace HeavenStudio.Games } } - public static void LaunchBowlingPin(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven, + public static void LaunchBowlingPin(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven, int noteEight, int noteNine, int noteTen, int noteEleven, int noteTwelve, int noteThirteen, int noteFourteen, int noteFifteen) { List pitches = new List() @@ -502,7 +503,7 @@ namespace HeavenStudio.Games } } - public void CreateParticles(float beat, bool toggle, float starDensity, float starSpeed, float starSpeedBack) + public void CreateParticles(double beat, bool toggle, float starDensity, float starSpeed, float starSpeedBack) { ParticleSystem.EmissionModule emm; ParticleSystem.EmissionModule emm2; diff --git a/Assets/Scripts/Games/LaunchParty/LaunchPartyRocket.cs b/Assets/Scripts/Games/LaunchParty/LaunchPartyRocket.cs index 5f5b3939..966f4907 100644 --- a/Assets/Scripts/Games/LaunchParty/LaunchPartyRocket.cs +++ b/Assets/Scripts/Games/LaunchParty/LaunchPartyRocket.cs @@ -34,8 +34,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty if (GameManager.instance.currentGame != "launchParty") Destroy(gameObject); if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN) && !noInput) { - Jukebox.PlayOneShotGame("launchParty/miss"); - Jukebox.PlayOneShotGame("launchParty/rocket_endBad"); + SoundByte.PlayOneShotGame("launchParty/miss"); + SoundByte.PlayOneShotGame("launchParty/rocket_endBad"); string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right"; if (!anim.IsPlayingAnimationName("RocketBarelyLeft") && !anim.IsPlayingAnimationName("RocketBarelyRight")) anim.Play("RocketBarely" + leftOrRight, 0, 0); game.ScoreMiss(0.5); @@ -48,7 +48,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty noInput = false; } - public void InitFamilyRocket(float beat) + public void InitFamilyRocket(double beat) { game.ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, JustFamilyRocket, Miss, Nothing); @@ -72,7 +72,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty }); } - public void InitPartyCracker(float beat) + public void InitPartyCracker(double beat) { game.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustPartyCracker, Miss, Nothing); @@ -100,7 +100,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty }); } - public void InitBell(float beat) + public void InitBell(double beat) { game.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustBell, Miss, Nothing); @@ -132,7 +132,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty }); } - public void InitBowlingPin(float beat) + public void InitBowlingPin(double beat) { game.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustBowlingPin, Miss, Nothing); @@ -181,8 +181,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty if (state >= 1f || state <= -1f) { number.SetActive(false); - Jukebox.PlayOneShotGame("launchParty/miss"); - Jukebox.PlayOneShotGame("launchParty/rocket_endBad"); + SoundByte.PlayOneShotGame("launchParty/miss"); + SoundByte.PlayOneShotGame("launchParty/rocket_endBad"); string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right"; anim.Play("RocketBarely" + leftOrRight, 0, 0); BeatAction.New(gameObject, new List() @@ -227,8 +227,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty { string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right"; anim.Play("RocketBarely" + leftOrRight, 0, 0); - Jukebox.PlayOneShotGame("launchParty/miss"); - Jukebox.PlayOneShotGame("launchParty/rocket_endBad"); + SoundByte.PlayOneShotGame("launchParty/miss"); + SoundByte.PlayOneShotGame("launchParty/rocket_endBad"); BeatAction.New(gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { GameObject.Destroy(gameObject); }), @@ -271,8 +271,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty { string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right"; anim.Play("RocketBarely" + leftOrRight, 0, 0); - Jukebox.PlayOneShotGame("launchParty/miss"); - Jukebox.PlayOneShotGame("launchParty/rocket_endBad"); + SoundByte.PlayOneShotGame("launchParty/miss"); + SoundByte.PlayOneShotGame("launchParty/rocket_endBad"); BeatAction.New(gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { GameObject.Destroy(gameObject); }), @@ -315,8 +315,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty { string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right"; anim.Play("RocketBarely" + leftOrRight, 0, 0); - Jukebox.PlayOneShotGame("launchParty/miss"); - Jukebox.PlayOneShotGame("launchParty/rocket_endBad"); + SoundByte.PlayOneShotGame("launchParty/miss"); + SoundByte.PlayOneShotGame("launchParty/rocket_endBad"); BeatAction.New(gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { GameObject.Destroy(gameObject); }), @@ -346,7 +346,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty void Miss(PlayerActionEvent caller) { noInput = true; - Jukebox.PlayOneShotGame("launchParty/miss"); + SoundByte.PlayOneShotGame("launchParty/miss"); number.SetActive(false); anim.Play("RocketMiss", 0, 0); BeatAction.New(gameObject, new List() diff --git a/Assets/Scripts/Games/Lockstep/Lockstep.cs b/Assets/Scripts/Games/Lockstep/Lockstep.cs index f9816369..99f1c8aa 100644 --- a/Assets/Scripts/Games/Lockstep/Lockstep.cs +++ b/Assets/Scripts/Games/Lockstep/Lockstep.cs @@ -155,7 +155,7 @@ namespace HeavenStudio.Games [SerializeField] Material stepperMaterial; [Header("Properties")] - static List queuedInputs = new List(); + static List queuedInputs = new(); Sprite masterSprite; HowMissed currentMissStage; bool lessSteppers = false; @@ -238,7 +238,7 @@ namespace HeavenStudio.Games { foreach (var input in queuedInputs) { - ScheduleInput(cond.songPositionInBeats, input - cond.songPositionInBeats, InputType.STANDARD_DOWN, Just, Miss, Nothing); + ScheduleInput(cond.songPositionInBeatsAsDouble, input - cond.songPositionInBeats, InputType.STANDARD_DOWN, Just, Miss, Nothing); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(input, delegate { EvaluateMarch(); }), @@ -258,7 +258,7 @@ namespace HeavenStudio.Games { stepswitcherPlayer.DoScaledAnimationAsync("OffbeatMarch", 0.5f); } - Jukebox.PlayOneShotGame("lockstep/miss"); + SoundByte.PlayOneShotGame("lockstep/miss"); ScoreMiss(); } } @@ -269,7 +269,7 @@ namespace HeavenStudio.Games } } - public void Bop(float beat, float length, bool shouldBop, bool autoBop) + public void Bop(double beat, float length, bool shouldBop, bool autoBop) { goBop = autoBop; if (shouldBop) @@ -287,17 +287,17 @@ namespace HeavenStudio.Games } } - public void Hai(float beat) + public void Hai(double beat) { - Jukebox.PlayOneShotGame("lockstep/switch1"); + SoundByte.PlayOneShotGame("lockstep/switch1", beat); } - public void Ho(float beat) + public void Ho(double beat) { - Jukebox.PlayOneShotGame("lockstep/switch4"); + SoundByte.PlayOneShotGame("lockstep/switch4", beat); } - public static void OnbeatSwitch(float beat) + public static void OnbeatSwitch(double beat) { MultiSound.Play(new MultiSound.Sound[] { @@ -317,7 +317,7 @@ namespace HeavenStudio.Games }); } - public static void OffbeatSwitch(float beat) + public static void OffbeatSwitch(double beat) { MultiSound.Play(new MultiSound.Sound[] { @@ -338,7 +338,7 @@ namespace HeavenStudio.Games }); } - public static void Marching(float beat, float length) + public static void Marching(double beat, float length) { if (GameManager.instance.currentGame == "lockstep") { @@ -362,7 +362,7 @@ namespace HeavenStudio.Games public void EvaluateMarch() { var cond = Conductor.instance; - var beatAnimCheck = Math.Round(cond.songPositionInBeats * 2); + var beatAnimCheck = Math.Round(cond.songPositionInBeatsAsDouble * 2); if (beatAnimCheck % 2 != 0) { PlayStepperAnim("OffbeatMarch", false, 0.5f); @@ -382,12 +382,12 @@ namespace HeavenStudio.Games double beatAnimCheck = cond.songPositionInBeatsAsDouble - 0.25; if (beatAnimCheck % 1.0 >= 0.5) { - Jukebox.PlayOneShotGame("lockstep/tink"); + SoundByte.PlayOneShotGame("lockstep/tink"); stepswitcherPlayer.DoScaledAnimationAsync("OnbeatMarch", 0.5f); } else { - Jukebox.PlayOneShotGame("lockstep/tink"); + SoundByte.PlayOneShotGame("lockstep/tink"); stepswitcherPlayer.DoScaledAnimationAsync("OffbeatMarch", 0.5f); } return; @@ -400,12 +400,12 @@ namespace HeavenStudio.Games double beatAnimCheck = beat - 0.25; if (beatAnimCheck % 1.0 >= 0.5) { - Jukebox.PlayOneShotGame($"lockstep/marchOnbeat{UnityEngine.Random.Range(1, 3)}"); + SoundByte.PlayOneShotGame($"lockstep/marchOnbeat{UnityEngine.Random.Range(1, 3)}"); stepswitcherPlayer.DoScaledAnimationAsync("OnbeatMarch", 0.5f); } else { - Jukebox.PlayOneShotGame($"lockstep/marchOffbeat{UnityEngine.Random.Range(1, 3)}"); + SoundByte.PlayOneShotGame($"lockstep/marchOffbeat{UnityEngine.Random.Range(1, 3)}"); stepswitcherPlayer.DoScaledAnimationAsync("OffbeatMarch", 0.5f); } } @@ -417,13 +417,13 @@ namespace HeavenStudio.Games if (beatAnimCheck % 2 != 0 && currentMissStage != HowMissed.MissedOff) { stepswitcherPlayer.Play("OffbeatMiss", 0, 0); - Jukebox.PlayOneShotGame("lockstep/wayOff"); + SoundByte.PlayOneShotGame("lockstep/wayOff"); currentMissStage = HowMissed.MissedOff; } else if (beatAnimCheck % 2 == 0 && currentMissStage != HowMissed.MissedOn) { stepswitcherPlayer.Play("OnbeatMiss", 0, 0); - Jukebox.PlayOneShotGame("lockstep/wayOff"); + SoundByte.PlayOneShotGame("lockstep/wayOff"); currentMissStage = HowMissed.MissedOn; } } diff --git a/Assets/Scripts/Games/MarchingOrders/MarchingOrders.cs b/Assets/Scripts/Games/MarchingOrders/MarchingOrders.cs index 3114e23e..4fe92e82 100644 --- a/Assets/Scripts/Games/MarchingOrders/MarchingOrders.cs +++ b/Assets/Scripts/Games/MarchingOrders/MarchingOrders.cs @@ -174,7 +174,7 @@ namespace HeavenStudio.Games { public static MarchingOrders instance; - static List queuedMarches = new List(); + static List queuedMarches = new(); [Header("Animators")] [SerializeField] Animator Sarge; @@ -198,9 +198,9 @@ namespace HeavenStudio.Games bool keepMarching; private int marchOtherCount; private int marchPlayerCount; - private float lastMissBeat; - private float lastReportedBeat; - public static float wantMarch = float.MinValue; + private double lastMissBeat; + private double lastReportedBeat; + public static double wantMarch = double.MinValue; public enum Direction @@ -233,12 +233,12 @@ namespace HeavenStudio.Games { for (int i = 0; i < BackgroundRecolorable.Length; i++) BackgroundRecolorable[i].color = i == 0 ? BGColor1 : BGColor2; - if (wantMarch != float.MinValue) { + if (wantMarch != double.MinValue) { queuedMarches.Add(wantMarch); marchOtherCount = marchPlayerCount = 0; keepMarching = true; - wantMarch = float.MinValue; + wantMarch = double.MinValue; } if (goBop && Conductor.instance.ReportBeat(ref lastReportedBeat)) { @@ -256,7 +256,7 @@ namespace HeavenStudio.Games new BeatAction.Action(march + 1, delegate { marchOtherCount++; foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f); - Jukebox.PlayOneShotGame("marchingOrders/stepOther"); + SoundByte.PlayOneShotGame("marchingOrders/stepOther"); if (keepMarching) queuedMarches.Add(march + 1); }), }); @@ -317,8 +317,8 @@ namespace HeavenStudio.Games void TurnSuccess(float state, string dir, bool shouldPoint = false) { - if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss"); - else Jukebox.PlayOneShotGame("marchingOrders/turnActionPlayer"); + if (state <= -1f || state >= 1f) SoundByte.PlayOneShot("nearMiss"); + else SoundByte.PlayOneShotGame("marchingOrders/turnActionPlayer"); CadetHeadPlayer.DoScaledAnimationAsync("Face"+dir, 0.5f); if (shouldPoint) CadetPlayer.DoScaledAnimationAsync("Point"+dir, 0.5f); @@ -326,35 +326,35 @@ namespace HeavenStudio.Games public void GenericMiss(PlayerActionEvent caller) { - if (Conductor.instance.songPositionInBeats - lastMissBeat <= 1.1f) return; + if (Conductor.instance.songPositionInBeatsAsDouble - lastMissBeat <= 1.1f) return; Miss(); } public void Miss() { - lastMissBeat = Conductor.instance.songPositionInBeats; - Jukebox.PlayOneShot("miss"); + lastMissBeat = Conductor.instance.songPositionInBeatsAsDouble; + SoundByte.PlayOneShot("miss"); Sarge.DoScaledAnimationAsync("Anger", 0.5f); Steam.DoScaledAnimationAsync("Steam", 0.5f); } public void MarchHit(PlayerActionEvent caller, float state) { - if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss"); - else Jukebox.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f); + if (state <= -1f || state >= 1f) SoundByte.PlayOneShot("nearMiss"); + else SoundByte.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f); marchPlayerCount++; CadetPlayer.DoScaledAnimationAsync(marchPlayerCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f); } public void HaltHit(PlayerActionEvent caller, float state) { - if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss"); - else Jukebox.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f); + if (state <= -1f || state >= 1f) SoundByte.PlayOneShot("nearMiss"); + else SoundByte.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f); CadetPlayer.DoScaledAnimationAsync("Halt", 0.5f); } - public void BopAction(float beat, float length, bool shouldBop, bool autoBop, bool clap) + public void BopAction(double beat, float length, bool shouldBop, bool autoBop, bool clap) { goBop = autoBop; shouldClap = clap; @@ -370,16 +370,16 @@ namespace HeavenStudio.Games } } - public void SargeAttention(float beat) + public void SargeAttention(double beat) { BeatAction.New(gameObject, new List() { new BeatAction.Action(beat + 0.25f, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}), }); } - public static void SargeMarch(float beat, bool noVoice) + public static void SargeMarch(double beat, bool noVoice) { - if (MarchingOrders.wantMarch != float.MinValue) return; + if (MarchingOrders.wantMarch != double.MinValue) return; MarchingOrders.wantMarch = beat + 1; if (!noVoice) PlaySoundSequence("marchingOrders", "susume", beat); @@ -390,7 +390,7 @@ namespace HeavenStudio.Games } } - public void ForceMarching(float beat, float length) + public void ForceMarching(double beat, float length) { for (int i = 0; i < length; i++) { ScheduleInput(beat + i - 1, 1f, InputType.STANDARD_DOWN, MarchHit, GenericMiss, Empty); @@ -398,13 +398,13 @@ namespace HeavenStudio.Games new BeatAction.Action(beat + i, delegate { marchOtherCount++; foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f); - Jukebox.PlayOneShotGame("marchingOrders/stepOther"); + SoundByte.PlayOneShotGame("marchingOrders/stepOther"); }), }); } } - public void PreMarch(float beat) + public void PreMarch(double beat) { BeatAction.New(gameObject, new List() { @@ -415,7 +415,7 @@ namespace HeavenStudio.Games }); } - public void Halt(float beat) + public void Halt(double beat) { keepMarching = false; HaltSound(beat); @@ -428,7 +428,7 @@ namespace HeavenStudio.Games }); } - public void FaceTurn(float beat, int direction, bool isFast, bool shouldPoint) + public void FaceTurn(double beat, int direction, bool isFast, bool shouldPoint) { // x is true if the direction is right bool x = (direction == 0); @@ -491,12 +491,12 @@ namespace HeavenStudio.Games } } - public static void AttentionSound(float beat) + public static void AttentionSound(double beat) { PlaySoundSequence("marchingOrders", "zentai", beat - 1); } - public static void HaltSound(float beat) + public static void HaltSound(double beat) { PlaySoundSequence("marchingOrders", "tomare", beat); } diff --git a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs index 6f6fe012..60e8b498 100644 --- a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs +++ b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs @@ -74,11 +74,11 @@ namespace HeavenStudio.Games using Scripts_MeatGrinder; public class MeatGrinder : Minigame { - static List queuedInputs = new List(); + static List queuedInputs = new(); static List queuedIntervals = new List(); struct QueuedInterval { - public float beat; + public double beat; public float length; } @@ -91,11 +91,11 @@ namespace HeavenStudio.Games [Header("Variables")] bool intervalStarted; - float intervalStartBeat; + double intervalStartBeat; bool bossBop = true; public float beatInterval = 4f; public bool bossAnnoyed = false; - private float lastReportedBeat = 0f; + private double lastReportedBeat = 0f; const string sfxName = "meatGrinder/"; public static MeatGrinder instance; @@ -130,7 +130,7 @@ namespace HeavenStudio.Games if (PlayerInput.Pressed(true) && (!IsExpectingInputNow(InputType.STANDARD_DOWN) || !IsExpectingInputNow(InputType.DIRECTION_DOWN))) { TackAnim.DoScaledAnimationAsync("TackEmptyHit", 0.5f); TackAnim.SetBool("tackMeated", false); - Jukebox.PlayOneShotGame(sfxName+"whiff"); + SoundByte.PlayOneShotGame(sfxName+"whiff"); if (bossAnnoyed) BossAnim.DoScaledAnimationAsync("Bop", 0.5f); } @@ -153,7 +153,7 @@ namespace HeavenStudio.Games } } - public void Bop(float beat, float length, bool doesBop, bool autoBop) + public void Bop(double beat, float length, bool doesBop, bool autoBop) { bossBop = autoBop; if (doesBop) { @@ -169,7 +169,7 @@ namespace HeavenStudio.Games } } - public static void PreInterval(float beat, float length) + public static void PreInterval(double beat, float length) { if (MeatGrinder.instance.intervalStarted || MeatGrinder.queuedIntervals.Count > 0) return; @@ -191,7 +191,7 @@ namespace HeavenStudio.Games } } - public void StartInterval(float beat, float length) + public void StartInterval(double beat, float length) { if (MeatGrinder.instance.intervalStarted) return; @@ -204,9 +204,9 @@ namespace HeavenStudio.Games }); } - public void MeatToss(float beat) + public void MeatToss(double beat) { - Jukebox.PlayOneShotGame(sfxName+"toss"); + SoundByte.PlayOneShotGame(sfxName+"toss"); MeatToss Meat = Instantiate(MeatBase, gameObject.transform).GetComponent(); Meat.startBeat = beat; @@ -215,17 +215,17 @@ namespace HeavenStudio.Games Meat.meatType = "DarkMeat"; } - public void MeatCall(float beat) + public void MeatCall(double beat) { BossAnim.DoScaledAnimationAsync("BossCall", 0.5f); - Jukebox.PlayOneShotGame(sfxName+"signal"); + SoundByte.PlayOneShotGame(sfxName+"signal"); StartInterval(beat, beatInterval); queuedInputs.Add(beat - intervalStartBeat); } - public void PassTurn(float beat) + public void PassTurn(double beat) { intervalStarted = false; foreach (var input in queuedInputs) diff --git a/Assets/Scripts/Games/MeatGrinder/MeatToss.cs b/Assets/Scripts/Games/MeatGrinder/MeatToss.cs index f110c1d8..b504f976 100644 --- a/Assets/Scripts/Games/MeatGrinder/MeatToss.cs +++ b/Assets/Scripts/Games/MeatGrinder/MeatToss.cs @@ -9,8 +9,8 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder { public class MeatToss : MonoBehaviour { - public float startBeat; - public float cueLength; + public double startBeat; + public double cueLength; public bool cueBased; public string meatType; @@ -44,7 +44,7 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder private void InputActions(bool annoyBoss, string whichSfx, string whichAnim) { game.bossAnnoyed = annoyBoss; - Jukebox.PlayOneShotGame("meatGrinder/"+whichSfx); + SoundByte.PlayOneShotGame("meatGrinder/"+whichSfx); game.TackAnim.DoScaledAnimationAsync(whichAnim, 0.5f); } diff --git a/Assets/Scripts/Games/Minigame.cs b/Assets/Scripts/Games/Minigame.cs index 084f323f..d1ae707b 100644 --- a/Assets/Scripts/Games/Minigame.cs +++ b/Assets/Scripts/Games/Minigame.cs @@ -40,8 +40,8 @@ namespace HeavenStudio.Games /// Method to run whenever there's an Input while this is Scheduled (Shouldn't be used too much) /// public PlayerActionEvent ScheduleInput( - float startBeat, - float timer, + double startBeat, + double timer, InputType inputType, PlayerActionEvent.ActionEventCallbackState OnHit, PlayerActionEvent.ActionEventCallback OnMiss, @@ -74,8 +74,8 @@ namespace HeavenStudio.Games return evt; } - public PlayerActionEvent ScheduleAutoplayInput(float startBeat, - float timer, + public PlayerActionEvent ScheduleAutoplayInput(double startBeat, + double timer, InputType inputType, PlayerActionEvent.ActionEventCallbackState OnHit, PlayerActionEvent.ActionEventCallback OnMiss, @@ -86,8 +86,8 @@ namespace HeavenStudio.Games return evt; } - public PlayerActionEvent ScheduleUserInput(float startBeat, - float timer, + public PlayerActionEvent ScheduleUserInput(double startBeat, + double timer, InputType inputType, PlayerActionEvent.ActionEventCallbackState OnHit, PlayerActionEvent.ActionEventCallback OnMiss, @@ -124,8 +124,8 @@ namespace HeavenStudio.Games closest = toCompare; } else { - float t1 = closest.startBeat + closest.timer; - float t2 = toCompare.startBeat + toCompare.timer; + double t1 = closest.startBeat + closest.timer; + double t2 = toCompare.startBeat + toCompare.timer; // Debug.Log("t1=" + t1 + " -- t2=" + t2); @@ -194,12 +194,12 @@ namespace HeavenStudio.Games public int firstEnable = 0; - public virtual void OnGameSwitch(float beat) + public virtual void OnGameSwitch(double beat) { //Below is a template that can be used for handling previous entities. //section below is if you only want to look at entities that overlap the game switch /* - List prevEntities = GameManager.instance.Beatmap.entities.FindAll(c => c.beat <= beat && c.datamodel.Split(0) == [insert game name]); + List prevEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.beat <= beat && c.datamodel.Split(0) == [insert game name]); foreach(Beatmap.Entity entity in prevEntities) { if(entity.beat + entity.length >= beat) @@ -215,12 +215,12 @@ namespace HeavenStudio.Games } - public virtual void OnPlay(float beat) + public virtual void OnPlay(double beat) { } - public virtual void OnStop(float beat) + public virtual void OnStop(double beat) { foreach (var evt in scheduledInputs) { @@ -246,7 +246,7 @@ namespace HeavenStudio.Games return sameTime; } - public static MultiSound PlaySoundSequence(string game, string name, float startBeat, params SoundSequence.SequenceParams[] args) + public static MultiSound PlaySoundSequence(string game, string name, double startBeat, params SoundSequence.SequenceParams[] args) { Minigames.Minigame gameInfo = GameManager.instance.GetGameInfo(game); foreach (SoundSequence.SequenceKeyValue pair in gameInfo.LoadedSoundSequences) diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index dca733a9..778f1489 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -125,7 +125,7 @@ namespace HeavenStudio.Games public class MrUpbeat : Minigame { - static List queuedInputs = new List(); + static List queuedInputs = new(); [Header("References")] [SerializeField] Animator metronomeAnim; @@ -180,7 +180,7 @@ namespace HeavenStudio.Games BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(input, delegate { instance.metronomeAnim.DoScaledAnimationAsync("MetronomeGo" + dir, 0.5f); - Jukebox.PlayOneShotGame("mrUpbeat/metronome" + dir); + SoundByte.PlayOneShotGame("mrUpbeat/metronome" + dir); ScheduleInput(input, 0.5f, InputType.STANDARD_DOWN, Success, Miss, Nothing); if (MrUpbeat.shouldntStop) queuedInputs.Add(input + 1); }), @@ -196,20 +196,20 @@ namespace HeavenStudio.Games } } - public static void Ding(float beat, bool applause, bool stopBlipping) + public static void Ding(double beat, bool applause, bool stopBlipping) { MrUpbeat.shouldntStop = false; BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat, delegate { MrUpbeat.isStepping = false; - Jukebox.PlayOneShotGame("mrUpbeat/ding"); - if (applause) Jukebox.PlayOneShot("applause"); + SoundByte.PlayOneShotGame("mrUpbeat/ding"); + if (applause) SoundByte.PlayOneShot("applause"); if (stopBlipping) MrUpbeat.shouldBlip = false; }), }); } - public static void StartStepping(float beat, float length) + public static void StartStepping(double beat, float length) { if (MrUpbeat.isStepping) return; MrUpbeat.isStepping = true; @@ -218,17 +218,17 @@ namespace HeavenStudio.Games MrUpbeat.shouldBlip = true; } else { BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(MathF.Floor(beat), delegate { + new BeatAction.Action(Math.Floor(beat), delegate { MrUpbeat.shouldBlip = true; }), }); } MrUpbeat.shouldntStop = true; - queuedInputs.Add(MathF.Floor(beat+length)); + queuedInputs.Add(Math.Floor(beat+length)); } - public static void Blipping(float beat, float length) + public static void Blipping(double beat, float length) { List blips = new List(); var switchGames = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }); @@ -242,8 +242,8 @@ namespace HeavenStudio.Games } } - for (int i = 0; i < switchGames[whichSwitch].beat - MathF.Floor(beat) - 0.5f; i++) { - blips.Add(new MultiSound.Sound("mrUpbeat/blip", MathF.Floor(beat) + 0.5f + i)); + for (int i = 0; i < switchGames[whichSwitch].beat - Math.Floor(beat) - 0.5f; i++) { + blips.Add(new MultiSound.Sound("mrUpbeat/blip", Math.Floor(beat) + 0.5f + i)); } MultiSound.Play(blips.ToArray(), forcePlay: true); diff --git a/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs b/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs index a0f23aa5..57667fe8 100644 --- a/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs +++ b/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs @@ -25,17 +25,17 @@ namespace HeavenStudio.Games.Scripts_MrUpbeat public void Blip() { - float c = Conductor.instance.songPositionInBeats; + double c = Conductor.instance.songPositionInBeatsAsDouble; BeatAction.New(gameObject, new List() { - new BeatAction.Action(MathF.Floor(c) + 0.5f, delegate { + new BeatAction.Action(Math.Floor(c) + 0.5f, delegate { if (MrUpbeat.shouldBlip) { - Jukebox.PlayOneShotGame("mrUpbeat/blip"); + SoundByte.PlayOneShotGame("mrUpbeat/blip"); blipAnim.Play("Blip"+(blipSize+1), 0, 0); blipText.text = (blipSize == 4 && blipString != "") ? blipString : ""; if (shouldGrow && blipSize < 4) blipSize++; } }), - new BeatAction.Action(MathF.Floor(c) + 1f, delegate { + new BeatAction.Action(Math.Floor(c) + 1f, delegate { Blip(); }), }); @@ -52,7 +52,7 @@ namespace HeavenStudio.Games.Scripts_MrUpbeat anim.DoScaledAnimationAsync("Step", 0.5f); letterAnim.DoScaledAnimationAsync(x ? "StepRight" : "StepLeft", 0.5f); - Jukebox.PlayOneShotGame("mrUpbeat/step"); + SoundByte.PlayOneShotGame("mrUpbeat/step"); } public void Fall() @@ -62,7 +62,7 @@ namespace HeavenStudio.Games.Scripts_MrUpbeat blipText.text = ""; anim.DoScaledAnimationAsync("Fall", 0.5f); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); shadows[0].SetActive(false); shadows[1].SetActive(false); } diff --git a/Assets/Scripts/Games/MunchyMonk/Dumpling.cs b/Assets/Scripts/Games/MunchyMonk/Dumpling.cs index a54a5d30..c18ad462 100644 --- a/Assets/Scripts/Games/MunchyMonk/Dumpling.cs +++ b/Assets/Scripts/Games/MunchyMonk/Dumpling.cs @@ -10,7 +10,7 @@ namespace HeavenStudio.Games.Scripts_MunchyMonk public class Dumpling : MonoBehaviour { public Color dumplingColor; - public float startBeat; + public double startBeat; const string sfxName = "munchyMonk/"; public bool canDestroy; @@ -47,14 +47,14 @@ namespace HeavenStudio.Games.Scripts_MunchyMonk { smearSr.color = dumplingColor; game.MonkArmsAnim.DoScaledAnimationAsync("WristSlap", 0.5f); - Jukebox.PlayOneShotGame(sfxName+"slap"); + SoundByte.PlayOneShotGame(sfxName+"slap"); game.isStaring = false; if (state >= 1f || state <= -1f) { game.MonkAnim.DoScaledAnimationAsync("Barely", 0.5f); anim.DoScaledAnimationAsync("HitHead", 0.5f); - Jukebox.PlayOneShotGame(sfxName+"barely"); + SoundByte.PlayOneShotGame(sfxName+"barely"); canDestroy = true; game.needBlush = false; } else { @@ -62,7 +62,7 @@ namespace HeavenStudio.Games.Scripts_MunchyMonk game.dumplings[0].anim.DoScaledAnimationAsync("FollowHand", 0.5f); smearAnim.Play("SmearAppear", 0, 0); game.needBlush = true; - Jukebox.PlayOneShotGame(sfxName+"gulp"); + SoundByte.PlayOneShotGame(sfxName+"gulp"); MunchyMonk.howManyGulps++; for (int i = 1; i <= 4; i++) { @@ -89,8 +89,8 @@ namespace HeavenStudio.Games.Scripts_MunchyMonk smearAnim.Play("SmearAppear", 0, 0); anim.DoScaledAnimationAsync("HitHead", 0.5f); MultiSound.Play(new MultiSound.Sound[] { - new MultiSound.Sound(sfxName+"slap", Conductor.instance.songPositionInBeats), - new MultiSound.Sound(sfxName+"miss", Conductor.instance.songPositionInBeats), + new MultiSound.Sound(sfxName+"slap", Conductor.instance.songPositionInBeatsAsDouble), + new MultiSound.Sound(sfxName+"miss", Conductor.instance.songPositionInBeatsAsDouble), }); canDestroy = true; game.needBlush = false; diff --git a/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs b/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs index d8243f72..68dd85f5 100644 --- a/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs +++ b/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs @@ -153,7 +153,7 @@ namespace HeavenStudio.Games static List queuedThrees = new List(); struct QueuedDumpling { - public float beat; + public double beat; public Color color1; public Color color2; public Color color3; @@ -189,7 +189,7 @@ namespace HeavenStudio.Games [Header("Variables")] [SerializeField] Sprite[] dumplingSprites; - public float lastReportedBeat = 0f; + public double lastReportedBeat = 0f; public bool needBlush; public bool isStaring; bool monkBop = true; @@ -203,7 +203,7 @@ namespace HeavenStudio.Games // the variables for scroll bool scrollRampUp; - float scrollBeat; + double scrollBeat; float scrollLength; float scrollMod; static float scrollModCurrent = 0; @@ -211,7 +211,7 @@ namespace HeavenStudio.Games // the variables for the monk moving bool isMoving; - float movingStartBeat; + double movingStartBeat; float movingLength; string moveAnim; EasingFunction.Ease lastEase; @@ -256,7 +256,7 @@ namespace HeavenStudio.Games // input stuff if (PlayerInput.Pressed(true) && (!IsExpectingInputNow(InputType.STANDARD_DOWN) || !IsExpectingInputNow(InputType.DIRECTION_DOWN))) { MonkArmsAnim.DoScaledAnimationAsync("WristSlap", 0.5f); - Jukebox.PlayOneShotGame(sfxName+"slap"); + SoundByte.PlayOneShotGame(sfxName+"slap"); isStaring = false; // early input stuff if (dumplings.Count != 0) InputFunctions(3); @@ -338,7 +338,7 @@ namespace HeavenStudio.Games } } - public void Bop(float beat, bool bop, bool autoBop) + public void Bop(double beat, bool bop, bool autoBop) { monkBop = autoBop; if (bop) { @@ -378,7 +378,7 @@ namespace HeavenStudio.Games public void Early(PlayerActionEvent caller) { } - public static void PreOneGoCue(float beat, Color firstColor) + public static void PreOneGoCue(double beat, Color firstColor) { PlaySoundSequence("munchyMonk", "one_go", beat); @@ -386,7 +386,7 @@ namespace HeavenStudio.Games { beat = beat, color1 = firstColor, }); } - public void OneGoCue(float beat, Color firstColor) + public void OneGoCue(double beat, Color firstColor) { BeatAction.New(gameObject, new List() { new BeatAction.Action(beat, delegate { @@ -405,7 +405,7 @@ namespace HeavenStudio.Games }); } - public static void PreTwoTwoCue(float beat, Color firstColor, Color secondColor) + public static void PreTwoTwoCue(double beat, Color firstColor, Color secondColor) { PlaySoundSequence("munchyMonk", "two_go", beat); @@ -416,7 +416,7 @@ namespace HeavenStudio.Games }); } - public void TwoTwoCue(float beat, Color firstColor, Color secondColor) + public void TwoTwoCue(double beat, Color firstColor, Color secondColor) { BeatAction.New(gameObject, new List() { new BeatAction.Action(beat-0.5f, delegate { @@ -443,7 +443,7 @@ namespace HeavenStudio.Games }); } - public static void PreThreeGoCue(float beat, Color firstColor, Color secondColor, Color thirdColor) + public static void PreThreeGoCue(double beat, Color firstColor, Color secondColor, Color thirdColor) { PlaySoundSequence("munchyMonk", "three_go", beat); @@ -455,7 +455,7 @@ namespace HeavenStudio.Games }); } - public void ThreeGoCue(float beat, Color firstColor, Color secondColor, Color thirdColor) + public void ThreeGoCue(double beat, Color firstColor, Color secondColor, Color thirdColor) { BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat, delegate { @@ -505,7 +505,7 @@ namespace HeavenStudio.Games }); } - public void PlayMonkAnim(float beat, int whichAnim, bool vineBoom) + public void PlayMonkAnim(double beat, int whichAnim, bool vineBoom) { switch (whichAnim) { @@ -520,15 +520,15 @@ namespace HeavenStudio.Games } // it's in zeo's video; no reason not to include it :) - if (vineBoom) Jukebox.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true); + if (vineBoom) SoundByte.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true); } public void PlayMonkAnimInactive(bool vineBoom) { - if (vineBoom) Jukebox.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true); + if (vineBoom) SoundByte.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true); } - public void MonkMove(float beat, float length, int goToSide, int ease) + public void MonkMove(double beat, float length, int goToSide, int ease) { movingStartBeat = beat; movingLength = length; @@ -537,7 +537,7 @@ namespace HeavenStudio.Games lastEase = (EasingFunction.Ease)ease; } - public static void Modifiers(float beat, int inputsTilGrow, bool resetLevel, int setLevel, bool disableBaby, bool shouldBlush) + public static void Modifiers(double beat, int inputsTilGrow, bool resetLevel, int setLevel, bool disableBaby, bool shouldBlush) { if (MunchyMonk.inputsTilGrow != inputsTilGrow) MunchyMonk.howManyGulps = inputsTilGrow * MunchyMonk.growLevel; if (setLevel != 0) MunchyMonk.growLevel = setLevel; @@ -555,7 +555,7 @@ namespace HeavenStudio.Games MunchyMonk.instance.Baby.SetActive(!disableBaby); } - public void ScrollBG(float beat, float length, float scrollSpeed, int ease) + public void ScrollBG(double beat, float length, float scrollSpeed, int ease) { scrollBeat = beat; scrollLength = length; diff --git a/Assets/Scripts/Games/OctopusMachine/Octopus.cs b/Assets/Scripts/Games/OctopusMachine/Octopus.cs index d6632b87..b210ef72 100644 --- a/Assets/Scripts/Games/OctopusMachine/Octopus.cs +++ b/Assets/Scripts/Games/OctopusMachine/Octopus.cs @@ -16,8 +16,8 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine public bool isSqueezed; public bool isPreparing; public bool queuePrepare; - public float lastReportedBeat = 0f; - float lastSqueezeBeat; + public double lastReportedBeat = 0f; + double lastSqueezeBeat; bool isActive = true; private OctopusMachine game; @@ -42,13 +42,13 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine { if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN)) { OctoAction("Squeeze"); - Jukebox.PlayOneShotGame("nearMiss"); + SoundByte.PlayOneShotGame("nearMiss"); game.hasMissed = true; } if (PlayerInput.PressedUp() && !game.IsExpectingInputNow(InputType.STANDARD_UP)) { OctoAction(PlayerInput.Pressing(true) ? "Pop" : "Release"); - Jukebox.PlayOneShotGame("nearMiss"); + SoundByte.PlayOneShotGame("nearMiss"); game.hasMissed = true; } } @@ -79,6 +79,7 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine 1 => "Happy", 2 => "Angry", 3 => "Oops", + _ => "Bop" }, 0.5f); isPreparing = isSqueezed = false; @@ -99,8 +100,8 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine public void OctoAction(string action) { - if (action != "Release" || (Conductor.instance.songPositionInBeats - lastSqueezeBeat) > 0.15f) Jukebox.PlayOneShotGame($"octopusMachine/{action.ToLower()}"); - if (action == "Squeeze") lastSqueezeBeat = Conductor.instance.songPositionInBeats; + if (action != "Release" || (Conductor.instance.songPositionInBeatsAsDouble - lastSqueezeBeat) > 0.15f) SoundByte.PlayOneShotGame($"octopusMachine/{action.ToLower()}"); + if (action == "Squeeze") lastSqueezeBeat = Conductor.instance.songPositionInBeatsAsDouble; anim.DoScaledAnimationAsync(action, 0.5f); isSqueezed = (action == "Squeeze"); diff --git a/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs b/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs index 13f2416b..b6153f52 100644 --- a/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs +++ b/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs @@ -188,13 +188,13 @@ namespace HeavenStudio.Games int bopIterate = 0; bool intervalStarted; bool autoAction; - float intervalStartBeat; + double intervalStartBeat; float beatInterval = 1f; - float lastReportedBeat; + double lastReportedBeat; - static List queuedSqueezes = new List(); - static List queuedReleases = new List(); - static List queuedPops = new List(); + static List queuedSqueezes = new(); + static List queuedReleases = new(); + static List queuedPops = new(); public static OctopusMachine instance; @@ -257,7 +257,7 @@ namespace HeavenStudio.Games } } - public static void Prepare(float beat, float prepBeats) + public static void Prepare(double beat, float prepBeats) { if (GameManager.instance.currentGame != "octopusMachine") { OctopusMachine.queuePrepare = true; @@ -306,7 +306,7 @@ namespace HeavenStudio.Games } } - public void OctoAction(float beat, float length, string action) + public void OctoAction(double beat, float length, string action) { if (action != "Squeeze" && !octopodes[0].isSqueezed) return; if (!intervalStarted) StartInterval(beat, length); @@ -319,7 +319,7 @@ namespace HeavenStudio.Games queuedList.Add(beat - intervalStartBeat); } - public void Bop(float length, int whichBop, bool singleBop, bool keepBop) + public void Bop(double length, int whichBop, bool singleBop, bool keepBop) { foreach (var octo in octopodes) { if (singleBop) octo.PlayAnimation(whichBop); @@ -349,7 +349,7 @@ namespace HeavenStudio.Games foreach (var octo in octopodes) octo.AnimationColor(octo.isSqueezed ? 1 : 0); } - public void OctopusModifiers(float beat, float oct1x, float oct2x, float oct3x, float oct1y, float oct2y, float oct3y, bool oct1, bool oct2, bool oct3) + public void OctopusModifiers(double beat, float oct1x, float oct2x, float oct3x, float oct1y, float oct2y, float oct3y, bool oct1, bool oct2, bool oct3) { octopodes[0].OctopusModifiers(oct1x, oct1y, oct1); octopodes[1].OctopusModifiers(oct2x, oct2y, oct2); @@ -361,7 +361,7 @@ namespace HeavenStudio.Games foreach (var octo in octopodes) octo.ForceSqueeze(); } - public void StartInterval(float beat, float length) + public void StartInterval(double beat, float length) { intervalStartBeat = beat; beatInterval = length; @@ -373,7 +373,7 @@ namespace HeavenStudio.Games }); } - public void PassTurn(float beat) + public void PassTurn(double beat) { intervalStarted = false; var queuedInputs = new List(); @@ -402,19 +402,19 @@ namespace HeavenStudio.Games private void SqueezeHit(PlayerActionEvent caller, float state) { octopodes[2].OctoAction("Squeeze"); - if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss"); + if (state <= -1f || state >= 1f) SoundByte.PlayOneShotGame("nearMiss"); } private void ReleaseHit(PlayerActionEvent caller, float state) { octopodes[2].OctoAction("Release"); - if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss"); + if (state <= -1f || state >= 1f) SoundByte.PlayOneShotGame("nearMiss"); } private void PopHit(PlayerActionEvent caller, float state) { octopodes[2].OctoAction("Pop"); - if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss"); + if (state <= -1f || state >= 1f) SoundByte.PlayOneShotGame("nearMiss"); } private void Miss(PlayerActionEvent caller) { } diff --git a/Assets/Scripts/Games/PajamaParty/CtrPillowMonkey.cs b/Assets/Scripts/Games/PajamaParty/CtrPillowMonkey.cs index 6f82b1c3..176b8560 100644 --- a/Assets/Scripts/Games/PajamaParty/CtrPillowMonkey.cs +++ b/Assets/Scripts/Games/PajamaParty/CtrPillowMonkey.cs @@ -19,14 +19,14 @@ namespace HeavenStudio.Games.Scripts_PajamaParty public int row; public int col; - float startJumpTime = Single.MinValue; + double startJumpTime = double.MinValue; float jumpLength = 1f; float jumpHeight = 4f; int jumpAlt; private bool hasJumped = false; - float startThrowTime = Single.MinValue; + double startThrowTime = double.MinValue; float throwLength = 4f; float throwHeight = 12f; private bool hasThrown = false; @@ -73,7 +73,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty Monkey.transform.rotation = Quaternion.Euler(0, 0, 0); jumpAlt = 0; } - startJumpTime = Single.MinValue; + startJumpTime = double.MinValue; Monkey.transform.localPosition = new Vector3(0, 0); Shadow.transform.localScale = new Vector3(1.2f, 0.8f, 1f); } @@ -90,7 +90,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } else { - startThrowTime = Single.MinValue; + startThrowTime = double.MinValue; if (hasThrown) { Projectile.transform.localPosition = new Vector3(0, 0); @@ -102,7 +102,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } } - public void Jump(float beat, int alt = 1) + public void Jump(double beat, int alt = 1) { startJumpTime = beat; jumpAlt = 0; @@ -112,22 +112,22 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } } - public void Charge(float beat) + public void Charge(double beat) { anim.DoUnscaledAnimation("MonkeyReady"); } - public void Throw(float beat) + public void Throw(double beat) { anim.DoUnscaledAnimation("MonkeyThrow"); startThrowTime = beat; Projectile.SetActive(true); } - public void ReadySleep(float beat, int action) + public void ReadySleep(double beat, int action) { var cond = Conductor.instance; - startThrowTime = Single.MinValue; + startThrowTime = double.MinValue; Projectile.transform.localPosition = new Vector3(0, 0); Projectile.transform.rotation = Quaternion.Euler(0, 0, 0); if (hasThrown) @@ -136,7 +136,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty hasThrown = false; } - startJumpTime = Single.MinValue; + startJumpTime = double.MinValue; Monkey.transform.localPosition = new Vector3(0, 0); Shadow.transform.localScale = new Vector3(1.2f, 0.8f, 1f); diff --git a/Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs b/Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs index aa6106be..b82c15d1 100644 --- a/Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs +++ b/Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs @@ -16,7 +16,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty public GameObject Projectile_Root; public Animator anim; - float startJumpTime = Single.MinValue; + double startJumpTime = double.MinValue; float jumpLength = 0; float jumpHeight = 0; bool jumpNg = false; @@ -27,7 +27,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty private bool charging = false; private bool canCharge = true; - float startThrowTime = Single.MinValue; + double startThrowTime = double.MinValue; float throwLength = 0; float throwHeight = 0; // true = throw, false = dropped ("Out") @@ -51,8 +51,8 @@ namespace HeavenStudio.Games.Scripts_PajamaParty if (PlayerInput.Pressed() && canJump && !PajamaParty.instance.IsExpectingInputNow(InputType.STANDARD_DOWN)) { - Jukebox.PlayOneShot("miss"); - PlayerJump(cond.songPositionInBeats, true, false); + SoundByte.PlayOneShot("miss"); + PlayerJump(cond.songPositionInBeatsAsDouble, true, false); PajamaParty.instance.ScoreMiss(); } if (PlayerInput.AltPressed() && canCharge) @@ -61,8 +61,8 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } if (PlayerInput.AltPressedUp() && charging && !PajamaParty.instance.IsExpectingInputNow(InputType.STANDARD_ALT_UP)) { - Jukebox.PlayOneShot("miss"); - EndCharge(cond.songPositionInBeats, false, false); + SoundByte.PlayOneShot("miss"); + EndCharge(cond.songPositionInBeatsAsDouble, false, false); PajamaParty.instance.ScoreMiss(); } @@ -94,7 +94,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty anim.DoScaledAnimationAsync("MakoLand"); jumpNg = false; } - startJumpTime = Single.MinValue; + startJumpTime = double.MinValue; Player.transform.localPosition = new Vector3(0, 0); Shadow.transform.localScale = new Vector3(1.65f, 1f, 1f); } @@ -118,7 +118,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } else { - startThrowTime = Single.MinValue; + startThrowTime = double.MinValue; Projectile_Root.transform.localPosition = new Vector3(0, 0); if (hasThrown) { @@ -133,7 +133,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty anim.DoUnscaledAnimation("MakoCatch"); } //TODO: change when locales are a thing - Jukebox.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh + SoundByte.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh Projectile.SetActive(false); hasThrown = false; @@ -145,7 +145,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } } - public void ProjectileThrow(float beat, bool drop = false, bool ng = false) + public void ProjectileThrow(double beat, bool drop = false, bool ng = false) { throwNg = ng; Projectile.SetActive(true); @@ -165,7 +165,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } } - public void PlayerJump(float beat, bool pressout = false, bool ng = false) + public void PlayerJump(double beat, bool pressout = false, bool ng = false) { startJumpTime = beat; canCharge = false; @@ -184,7 +184,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty charging = true; } - public void EndCharge(float beat, bool hit = true, bool ng = false) + public void EndCharge(double beat, bool hit = true, bool ng = false) { ProjectileThrow(beat, !hit, ng); var cond = Conductor.instance; @@ -201,7 +201,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty beat + 0.5f, delegate { anim.DoScaledAnimationAsync("MakoPickUp"); - Jukebox.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh + SoundByte.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh Projectile.SetActive(false); canCharge = true; canJump = true; @@ -211,7 +211,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } } - public void PlayerThrough(float beat) + public void PlayerThrough(double beat) { var cond = Conductor.instance; anim.DoScaledAnimationAsync("MakoThrough", 0.5f); @@ -231,7 +231,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } // jumping cues (timings for both are the same) - public void ScheduleJump(float beat) + public void ScheduleJump(double beat) { PajamaParty.instance.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JumpJustOrNg, JumpThrough, JumpOut); } @@ -243,13 +243,13 @@ namespace HeavenStudio.Games.Scripts_PajamaParty var cond = Conductor.instance; if (state <= -1f || state >= 1f) { - Jukebox.PlayOneShot("miss"); - PlayerJump(cond.songPositionInBeats, false, true); + SoundByte.PlayOneShot("miss"); + PlayerJump(cond.songPositionInBeatsAsDouble, false, true); } else { - Jukebox.PlayOneShotGame("pajamaParty/jumpJust"); - PlayerJump(cond.songPositionInBeats, false, false); + SoundByte.PlayOneShotGame("pajamaParty/jumpJust"); + PlayerJump(cond.songPositionInBeatsAsDouble, false, false); } caller.CanHit(false); } @@ -262,13 +262,13 @@ namespace HeavenStudio.Games.Scripts_PajamaParty if (canJump) { var cond = Conductor.instance; - PlayerThrough(cond.songPositionInBeats); + PlayerThrough(cond.songPositionInBeatsAsDouble); } } ////// // throw cue - public void ScheduleThrow(float beat) + public void ScheduleThrow(double beat) { PajamaParty.instance.ScheduleInput(beat, 2f, InputType.STANDARD_ALT_DOWN, ChargeJustOrNg, ThrowThrough, JumpOut); PajamaParty.instance.ScheduleInput(beat, 3f, InputType.STANDARD_ALT_UP, ThrowJustOrNg, ThrowThrough, JumpOut); @@ -277,7 +277,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty public void ChargeJustOrNg(PlayerActionEvent caller, float state) { StartCharge(); throwNg = (state <= -1f || state >= 1f); - Jukebox.PlayOneShotGame("pajamaParty/throw4"); + SoundByte.PlayOneShotGame("pajamaParty/throw4"); } public void ThrowJustOrNg(PlayerActionEvent caller, float state) @@ -287,13 +287,13 @@ namespace HeavenStudio.Games.Scripts_PajamaParty var cond = Conductor.instance; if (state <= -1f || state >= 1f) { - Jukebox.PlayOneShot("miss"); - EndCharge(cond.songPositionInBeats, true, true); + SoundByte.PlayOneShot("miss"); + EndCharge(cond.songPositionInBeatsAsDouble, true, true); } else { - Jukebox.PlayOneShotGame("pajamaParty/throw5"); - EndCharge(cond.songPositionInBeats, true, (throwNg || false)); + SoundByte.PlayOneShotGame("pajamaParty/throw5"); + EndCharge(cond.songPositionInBeatsAsDouble, true, (throwNg || false)); } caller.CanHit(false); } @@ -304,13 +304,13 @@ namespace HeavenStudio.Games.Scripts_PajamaParty if (canCharge) { var cond = Conductor.instance; - PlayerThrough(cond.songPositionInBeats); + PlayerThrough(cond.songPositionInBeatsAsDouble); } } // // sleep cue - public void StartSleepSequence(float beat, bool alt, int action) + public void StartSleepSequence(double beat, bool alt, int action) { if (hasJumped) { @@ -318,12 +318,12 @@ namespace HeavenStudio.Games.Scripts_PajamaParty PajamaParty.instance.DoBedImpact(); jumpNg = false; } - startJumpTime = Single.MinValue; + startJumpTime = double.MinValue; Player.transform.localPosition = new Vector3(0, 0); Shadow.transform.localScale = new Vector3(1.65f, 1f, 1f); Projectile.GetComponent().Play("NoPose", -1, 0); - startThrowTime = Single.MinValue; + startThrowTime = double.MinValue; Projectile_Root.transform.localPosition = new Vector3(0, 0); Projectile.transform.rotation = Quaternion.Euler(0, 0, 0); if (hasThrown) @@ -347,7 +347,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty anim.DoScaledAnimationAsync("MakoLand"); } - startJumpTime = Single.MinValue; + startJumpTime = double.MinValue; Player.transform.localPosition = new Vector3(0, 0); Shadow.transform.localScale = new Vector3(1.65f, 1f, 1f); @@ -400,7 +400,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty anim.DoUnscaledAnimation("MakoSleepNg"); else { - Jukebox.PlayOneShotGame("pajamaParty/siesta4"); + SoundByte.PlayOneShotGame("pajamaParty/siesta4"); anim.DoScaledAnimationAsync("MakoSleepJust"); if (!longSleep) @@ -411,7 +411,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty caller.startBeat + 7f, delegate { anim.DoScaledAnimationAsync("MakoAwake"); - Jukebox.PlayOneShotGame("pajamaParty/siestaDone"); + SoundByte.PlayOneShotGame("pajamaParty/siestaDone"); } ), }); @@ -438,7 +438,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty if (canSleep) { anim.DoScaledAnimationAsync("MakoSleepOut", 0.5f); - Jukebox.PlayOneShotGame("pajamaParty/siestaBad"); + SoundByte.PlayOneShotGame("pajamaParty/siestaBad"); caller.CanHit(false); canSleep = false; } diff --git a/Assets/Scripts/Games/PajamaParty/PajamaParty.cs b/Assets/Scripts/Games/PajamaParty/PajamaParty.cs index 28aa65a8..b2ab6029 100644 --- a/Assets/Scripts/Games/PajamaParty/PajamaParty.cs +++ b/Assets/Scripts/Games/PajamaParty/PajamaParty.cs @@ -75,10 +75,10 @@ namespace HeavenStudio.Games CtrPillowMonkey[,] monkeys; //cues while unoaded - static float WantThreeJump = Single.MinValue; - static float WantFiveJump = Single.MinValue; - static float WantThrowSequence = Single.MinValue; - static float WantSleepSequence = Single.MinValue; + static double WantThreeJump = double.MinValue; + static double WantFiveJump = double.MinValue; + static double WantThrowSequence = double.MinValue; + static double WantSleepSequence = double.MinValue; static bool WantSleepType = false; static int WantSleepAction = (int) PajamaParty.SleepType.Normal; @@ -129,31 +129,31 @@ namespace HeavenStudio.Games } } - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { - if (WantThreeJump != Single.MinValue) + if (WantThreeJump != double.MinValue) { DoThreeJump(WantThreeJump, false); - WantThreeJump = Single.MinValue; + WantThreeJump = double.MinValue; } - if (WantFiveJump != Single.MinValue) + if (WantFiveJump != double.MinValue) { DoFiveJump(WantFiveJump, false); - WantFiveJump = Single.MinValue; + WantFiveJump = double.MinValue; } - if (WantThrowSequence != Single.MinValue) + if (WantThrowSequence != double.MinValue) { DoThrowSequence(WantThrowSequence, false); - WantThrowSequence = Single.MinValue; + WantThrowSequence = double.MinValue; } - if (WantSleepSequence != Single.MinValue) + if (WantSleepSequence != double.MinValue) { DoSleepSequence(WantSleepSequence, WantSleepType, WantSleepAction, false); - WantSleepSequence = Single.MinValue; + WantSleepSequence = double.MinValue; } } - public void DoThreeJump(float beat, bool doSound = true) + public void DoThreeJump(double beat, bool doSound = true) { Mako.ScheduleJump(beat); if (doSound) @@ -188,7 +188,7 @@ namespace HeavenStudio.Games }); } - public static void WarnThreeJump(float beat) + public static void WarnThreeJump(double beat) { MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("pajamaParty/three1", beat), @@ -198,7 +198,7 @@ namespace HeavenStudio.Games WantThreeJump = beat; } - public void DoFiveJump(float beat, bool doSound = true) + public void DoFiveJump(double beat, bool doSound = true) { Mako.ScheduleJump(beat); if (doSound) @@ -220,7 +220,7 @@ namespace HeavenStudio.Games }); } - public static void WarnFiveJump(float beat) + public static void WarnFiveJump(double beat) { MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("pajamaParty/five1", beat), @@ -232,7 +232,7 @@ namespace HeavenStudio.Games WantFiveJump = beat; } - public void DoThrowSequence(float beat, bool doSound = true) + public void DoThrowSequence(double beat, bool doSound = true) { Mako.ScheduleThrow(beat); if (doSound) @@ -245,13 +245,13 @@ namespace HeavenStudio.Games }); } - public static void WarnThrowSequence(float beat) + public static void WarnThrowSequence(double beat) { PlayThrowSequenceSound(beat, true); WantThrowSequence = beat; } - public static void PlayThrowSequenceSound(float beat, bool force = false) + public static void PlayThrowSequenceSound(double beat, bool force = false) { MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("pajamaParty/throw1", beat), @@ -265,7 +265,7 @@ namespace HeavenStudio.Games }, forcePlay: force); } - public void DoSleepSequence(float beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal, bool doSound = true) + public void DoSleepSequence(double beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal, bool doSound = true) { var cond = Conductor.instance; Mako.StartSleepSequence(beat, alt, action); @@ -280,7 +280,7 @@ namespace HeavenStudio.Games }); } - public static void WarnSleepSequence(float beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal) + public static void WarnSleepSequence(double beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal) { MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("pajamaParty/siesta1", beat), @@ -299,7 +299,7 @@ namespace HeavenStudio.Games Bed.GetComponent().Play("BedImpact", -1, 0); } - public void JumpRow(int row, float beat, int alt = 1) + public void JumpRow(int row, double beat, int alt = 1) { if (row > 4 || row < 0) { @@ -314,7 +314,7 @@ namespace HeavenStudio.Games } } - public void JumpCol(int col, float beat, int alt = 1) + public void JumpCol(int col, double beat, int alt = 1) { if (col > 4 || col < 0) { @@ -329,7 +329,7 @@ namespace HeavenStudio.Games } } - public void MonkeyCharge(float beat) + public void MonkeyCharge(double beat) { foreach (CtrPillowMonkey monkey in monkeys) { @@ -340,7 +340,7 @@ namespace HeavenStudio.Games } } - public void MonkeyThrow(float beat) + public void MonkeyThrow(double beat) { foreach (CtrPillowMonkey monkey in monkeys) { @@ -351,7 +351,7 @@ namespace HeavenStudio.Games } } - public void MonkeySleep(float beat, int action) + public void MonkeySleep(double beat, int action) { foreach (CtrPillowMonkey monkey in monkeys) { diff --git a/Assets/Scripts/Games/PlayerActionEvent.cs b/Assets/Scripts/Games/PlayerActionEvent.cs index 79ac4daf..662122db 100644 --- a/Assets/Scripts/Games/PlayerActionEvent.cs +++ b/Assets/Scripts/Games/PlayerActionEvent.cs @@ -25,8 +25,8 @@ namespace HeavenStudio.Games public ActionEventCallback OnDestroy; //Function to trigger whenever this event gets destroyed. /!\ Shouldn't be used for a minigame! Use OnMiss instead /!\ - public float startBeat; - public float timer; + public double startBeat; + public double timer; public bool isEligible = true; public bool canHit = true; //Indicates if you can still hit the cue or not. If set to false, it'll guarantee a miss diff --git a/Assets/Scripts/Games/QuizShow/QuizShow.cs b/Assets/Scripts/Games/QuizShow/QuizShow.cs index b8ef10d3..e49594ce 100644 --- a/Assets/Scripts/Games/QuizShow/QuizShow.cs +++ b/Assets/Scripts/Games/QuizShow/QuizShow.cs @@ -170,8 +170,8 @@ namespace HeavenStudio.Games bool intervalStarted; bool shouldResetCount; bool doingConsectiveIntervals; - float intervalStartBeat; - float playerIntervalStartBeat; + double intervalStartBeat; + double playerIntervalStartBeat; float playerBeatInterval; float beatInterval = 8f; int currentStage; @@ -181,7 +181,7 @@ namespace HeavenStudio.Games bool signExploded; struct QueuedInput { - public float beat; + public double beat; public bool dpad; } static List queuedInputs = new List(); @@ -237,7 +237,7 @@ namespace HeavenStudio.Games currentStage = stage; } - public void RandomPress(float beat, float length, int min, int max, int whichButtons, bool consecutive) + public void RandomPress(double beat, float length, int min, int max, int whichButtons, bool consecutive) { if (min > max) return; int pressAmount = UnityEngine.Random.Range(min, max + 1); @@ -265,7 +265,7 @@ namespace HeavenStudio.Games dpad = i % 2 != 0; break; } - float spawnBeat = beat + i * length; + double spawnBeat = beat + i * length; buttonEvents.Add(new BeatAction.Action(spawnBeat, delegate { HostPressButton(spawnBeat, dpad); })); } } @@ -293,7 +293,7 @@ namespace HeavenStudio.Games dpad = i % 2 != 0; break; } - float spawnBeat = beat + i * length; + double spawnBeat = beat + i * length; buttonEvents.Add(new BeatAction.Action(spawnBeat, delegate { HostPressButton(spawnBeat, dpad); })); pressAmount--; } @@ -302,7 +302,7 @@ namespace HeavenStudio.Games BeatAction.New(instance.gameObject, buttonEvents); } - public void HostPressButton(float beat, bool dpad) + public void HostPressButton(double beat, bool dpad) { if (!intervalStarted) { @@ -317,7 +317,7 @@ namespace HeavenStudio.Games { hostHead.DoScaledAnimationAsync("HostStage" + currentStage.ToString(), 0.5f); } - Jukebox.PlayOneShotGame( dpad ? "quizShow/hostDPad" : "quizShow/hostA"); + SoundByte.PlayOneShotGame( dpad ? "quizShow/hostDPad" : "quizShow/hostA"); if (dpad) { hostRightArmAnim.DoScaledAnimationAsync("HostRightHit", 0.5f); @@ -339,7 +339,7 @@ namespace HeavenStudio.Games instance.hostRightArmAnim.DoScaledAnimationAsync("HostPrepare", 0.5f); } - public void StartInterval(float beat, float interval) + public void StartInterval(double beat, float interval) { if (!intervalStarted) { @@ -360,7 +360,7 @@ namespace HeavenStudio.Games intervalStarted = true; } - public void PassTurn(float beat, float length, bool timeUpSound, bool consecutive, bool visualClock, int audioClock) + public void PassTurn(double beat, float length, bool timeUpSound, bool consecutive, bool visualClock, int audioClock) { if (queuedInputs.Count == 0) return; if (shouldPrepareArms) @@ -392,7 +392,7 @@ namespace HeavenStudio.Games float timeUpBeat = 0f; if (audioClock == (int)ClockAudio.Both || audioClock == (int)ClockAudio.Start) { - Jukebox.PlayOneShotGame("quizShow/timerStart"); + SoundByte.PlayOneShotGame("quizShow/timerStart"); timeUpBeat = 0.5f; } if (audioClock == (int)ClockAudio.End) timeUpBeat = 0.5f; @@ -403,7 +403,7 @@ namespace HeavenStudio.Games { if (!consecutive) { - if (audioClock == (int)ClockAudio.Both || audioClock == (int)ClockAudio.End) Jukebox.PlayOneShotGame("quizShow/timerStop"); + if (audioClock == (int)ClockAudio.Both || audioClock == (int)ClockAudio.End) SoundByte.PlayOneShotGame("quizShow/timerStop"); contesteeLeftArmAnim.DoScaledAnimationAsync("LeftRest", 0.5f); contesteeRightArmAnim.DoScaledAnimationAsync("RightRest", 0.5f); shouldPrepareArms = true; @@ -411,7 +411,7 @@ namespace HeavenStudio.Games } } ), - new BeatAction.Action(beat + length + beatInterval + timeUpBeat, delegate { if (timeUpSound && !consecutive) Jukebox.PlayOneShotGame("quizShow/timeUp"); }) + new BeatAction.Action(beat + length + beatInterval + timeUpBeat, delegate { if (timeUpSound && !consecutive) SoundByte.PlayOneShotGame("quizShow/timeUp"); }) }); foreach (var input in queuedInputs) { @@ -443,12 +443,12 @@ namespace HeavenStudio.Games } if (dpad) { - Jukebox.PlayOneShotGame("quizShow/contestantDPad"); + SoundByte.PlayOneShotGame("quizShow/contestantDPad"); contesteeLeftArmAnim.DoScaledAnimationAsync("LeftArmPress", 0.5f); } else { - Jukebox.PlayOneShotGame("quizShow/contestantA"); + SoundByte.PlayOneShotGame("quizShow/contestantA"); contesteeRightArmAnim.DoScaledAnimationAsync("RightArmHit", 0.5f); } pressCount++; @@ -477,7 +477,7 @@ namespace HeavenStudio.Games { case (int)ShouldExplode.Contestant: if (contExploded) return; - Jukebox.PlayOneShotGame("quizShow/contestantExplode"); + SoundByte.PlayOneShotGame("quizShow/contestantExplode"); firstDigitSr.color = new Color(1, 1, 1, 0); secondDigitSr.color = new Color(1, 1, 1, 0); contCounter.sprite = explodedCounter; @@ -486,7 +486,7 @@ namespace HeavenStudio.Games break; case (int)ShouldExplode.Host: if (hostExploded) return; - Jukebox.PlayOneShotGame("quizShow/hostExplode"); + SoundByte.PlayOneShotGame("quizShow/hostExplode"); hostFirstDigitSr.color = new Color(1, 1, 1, 0); hostSecondDigitSr.color = new Color(1, 1, 1, 0); hostCounter.sprite = explodedCounter; @@ -495,7 +495,7 @@ namespace HeavenStudio.Games break; case (int)ShouldExplode.Sign: if (signExploded) return; - Jukebox.PlayOneShotGame("quizShow/signExplode"); + SoundByte.PlayOneShotGame("quizShow/signExplode"); signExploded = true; signExplosion.Play(); signAnim.Play("Exploded", 0, 0); @@ -503,14 +503,14 @@ namespace HeavenStudio.Games } } - public void RevealAnswer(float beat, float length) + public void RevealAnswer(double beat, float length) { blackOut.SetActive(true); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + length, delegate { - Jukebox.PlayOneShotGame("quizShow/answerReveal"); + SoundByte.PlayOneShotGame("quizShow/answerReveal"); hostFirstDigitSr.sprite = hostNumberSprites[GetSpecificDigit(countToMatch, 1)]; hostSecondDigitSr.sprite = hostNumberSprites[GetSpecificDigit(countToMatch, 2)]; }) @@ -523,26 +523,26 @@ namespace HeavenStudio.Games blackOut.SetActive(false); if (revealAnswer) { - Jukebox.PlayOneShotGame("quizShow/answerReveal"); + SoundByte.PlayOneShotGame("quizShow/answerReveal"); hostFirstDigitSr.sprite = hostNumberSprites[GetSpecificDigit(countToMatch, 1)]; hostSecondDigitSr.sprite = hostNumberSprites[GetSpecificDigit(countToMatch, 2)]; } if (pressCount == countToMatch) { - Jukebox.PlayOneShotGame("quizShow/correct"); + SoundByte.PlayOneShotGame("quizShow/correct"); contesteeHead.Play("ContesteeSmile", -1, 0); hostHead.Play("HostSmile", -1, 0); - if (audience) Jukebox.PlayOneShotGame("quizShow/audienceCheer"); - if (jingle) Jukebox.PlayOneShotGame("quizShow/correctJingle"); + if (audience) SoundByte.PlayOneShotGame("quizShow/audienceCheer"); + if (jingle) SoundByte.PlayOneShotGame("quizShow/correctJingle"); } else { ScoreMiss(); - Jukebox.PlayOneShotGame("quizShow/incorrect"); + SoundByte.PlayOneShotGame("quizShow/incorrect"); contesteeHead.Play("ContesteeSad", -1, 0); hostHead.Play("HostSad", -1, 0); - if (audience) Jukebox.PlayOneShotGame("quizShow/audienceSad"); - if (jingle) Jukebox.PlayOneShotGame("quizShow/incorrectJingle"); + if (audience) SoundByte.PlayOneShotGame("quizShow/audienceSad"); + if (jingle) SoundByte.PlayOneShotGame("quizShow/incorrectJingle"); } } diff --git a/Assets/Scripts/Games/RhythmRally/Paddlers.cs b/Assets/Scripts/Games/RhythmRally/Paddlers.cs index 9a48b2a4..3a98ec0e 100644 --- a/Assets/Scripts/Games/RhythmRally/Paddlers.cs +++ b/Assets/Scripts/Games/RhythmRally/Paddlers.cs @@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Scripts_RhythmRally { game.served = false; - var hitBeat = cond.songPositionInBeats; + var hitBeat = cond.songPositionInBeatsAsDouble; var bounceBeat = game.serveBeat + game.targetBeat + 1f; @@ -60,12 +60,12 @@ namespace HeavenStudio.Games.Scripts_RhythmRally void NearMiss(float state) { MissBall(); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); playerAnim.DoScaledAnimationAsync("Swing", 0.5f); ; game.missCurve.KeyPoints[0].Position = game.ball.transform.position; game.missCurve.transform.localScale = new Vector3(-state, 1f, 1f); - game.missBeat = cond.songPositionInBeats; + game.missBeat = cond.songPositionInBeatsAsDouble; game.ball.SetActive(true); } @@ -88,7 +88,7 @@ namespace HeavenStudio.Games.Scripts_RhythmRally MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("rhythmRally/Whistle", whistleBeat) }); } - public void BounceFX(float bounceBeat) + public void BounceFX(double bounceBeat) { BeatAction.New(this.gameObject, new List() { diff --git a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs index 2e3071ef..8cc63ffa 100644 --- a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs +++ b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs @@ -141,10 +141,10 @@ namespace HeavenStudio.Games public bool missed; public bool served; public bool tossing; - public float serveBeat; - public float targetBeat; - public float tossBeat; - public float missBeat; + public double serveBeat; + public double targetBeat; + public double tossBeat; + public double missBeat; public float tossLength; private bool inPose; @@ -169,7 +169,7 @@ namespace HeavenStudio.Games void Update() { var cond = Conductor.instance; - var currentBeat = cond.songPositionInBeats; + var currentBeat = cond.songPositionInBeatsAsDouble; var hitBeat = serveBeat; // Beat when the last paddler hit the ball var beatDur1 = 1f; // From paddle to table @@ -280,7 +280,7 @@ namespace HeavenStudio.Games // Check if the opponent should swing. if (!served && timeBeforeNextHit <= 0f) { - var rallies = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "rhythmRally/rally" || c.datamodel == "rhythmRally/slow rally"); + var rallies = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel == "rhythmRally/rally" || c.datamodel == "rhythmRally/slow rally"); for (int i = 0; i < rallies.Count; i++) { var rally = rallies[i]; @@ -367,7 +367,7 @@ namespace HeavenStudio.Games GameCamera.additionalFoV = cameraFOV; } - public void Bop(float beat, float length, bool bop, bool bopAuto) + public void Bop(double beat, float length, bool bop, bool bopAuto) { goBop = bopAuto; if (bop) @@ -399,7 +399,7 @@ namespace HeavenStudio.Games opponentAnim.DoScaledAnimationAsync("Beat", 0.5f); } - public void Serve(float beat, RallySpeed speed) + public void Serve(double beat, RallySpeed speed) { if (!ball.activeSelf) ball.SetActive(true); @@ -416,7 +416,7 @@ namespace HeavenStudio.Games serveBeat = beat; rallySpeed = speed; - var bounceBeat = 0f; + double bounceBeat = 0f; switch (rallySpeed) { @@ -442,7 +442,7 @@ namespace HeavenStudio.Games ScheduleInput(serveBeat, targetBeat, InputType.STANDARD_DOWN, paddlers.Just, paddlers.Miss, paddlers.Out); } - public void Toss(float beat, float length, float height, bool firstToss = false) + public void Toss(double beat, float length, float height, bool firstToss = false) { // Hide trail while tossing to prevent weirdness while teleporting ball. ballTrail.gameObject.SetActive(false); @@ -464,7 +464,7 @@ namespace HeavenStudio.Games ball.SetActive(true); } - private void TossUpdate(float beat, float duration) + private void TossUpdate(double beat, float duration) { var tossPosition = Conductor.instance.GetPositionFromBeat(beat, duration); ball.transform.position = tossCurve.GetPoint(Mathf.Clamp(tossPosition, 0, 1)); @@ -473,7 +473,7 @@ namespace HeavenStudio.Games ball.SetActive(false); } - public static void PlayWhistle(float beat) + public static void PlayWhistle(double beat) { MultiSound.Play(new MultiSound.Sound[] { @@ -496,7 +496,7 @@ namespace HeavenStudio.Games cameraPivot.DOScale(camZoom, len).SetEase(ease); } - public void PrepareFastRally(float beat, RallySpeed speedChange, bool muteAudio = false) + public void PrepareFastRally(double beat, RallySpeed speedChange, bool muteAudio = false) { if (speedChange == RallySpeed.Fast) { @@ -517,7 +517,7 @@ namespace HeavenStudio.Games } } - public static void TonkTinkTonkStretchable(float beat, float length) + public static void TonkTinkTonkStretchable(double beat, float length) { List soundsToPlay = new List(); bool tink = false; @@ -529,13 +529,13 @@ namespace HeavenStudio.Games MultiSound.Play(soundsToPlay.ToArray(), forcePlay: true); } - public void SuperFastRallyStretchable(float beat, float length) + public void SuperFastRallyStretchable(double beat, float length) { List servesToPerform = new List(); for (int i = 0; i < length; i += 2) { - float beatToSpawn = beat + i; + double beatToSpawn = beat + i; servesToPerform.Add( new BeatAction.Action(beatToSpawn, delegate { Serve(beatToSpawn, RallySpeed.SuperFast); }) ); } BeatAction.New(gameObject, servesToPerform); diff --git a/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs b/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs index 5aef8934..24597755 100644 --- a/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs +++ b/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs @@ -95,7 +95,7 @@ namespace HeavenStudio.Games if (PlayerInput.Pressed() && !IsExpectingInputNow()) { - Jukebox.PlayOneShotGame("rhythmSomen/somen_mistake"); + SoundByte.PlayOneShotGame("rhythmSomen/somen_mistake"); FrontArm.Play("ArmPluck", -1, 0); backArm.Play("BackArmNothing", 0, 0); hasSlurped = false; @@ -104,7 +104,7 @@ namespace HeavenStudio.Games } } - public void Slurp(float beat) + public void Slurp(double beat) { if (!missed) { @@ -125,7 +125,7 @@ namespace HeavenStudio.Games } } - public void ToggleBop(float beat, float length, bool bopOrNah, bool autoBop) + public void ToggleBop(double beat, float length, bool bopOrNah, bool autoBop) { shouldBop = autoBop; if (bopOrNah) @@ -143,7 +143,7 @@ namespace HeavenStudio.Games } } - public void DoFarCrane(float beat) + public void DoFarCrane(double beat) { //Far Drop Multisound ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty); @@ -162,7 +162,7 @@ namespace HeavenStudio.Games } - public void DoCloseCrane(float beat) + public void DoCloseCrane(double beat) { //Close Drop Multisound ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty); @@ -181,7 +181,7 @@ namespace HeavenStudio.Games } - public void DoBothCrane(float beat) + public void DoBothCrane(double beat) { //Both Drop Multisound ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty); @@ -205,10 +205,10 @@ namespace HeavenStudio.Games } - public void DoBell(float beat) + public void DoBell(double beat) { //Bell Sound lol - Jukebox.PlayOneShotGame("rhythmSomen/somen_bell"); + SoundByte.PlayOneShotGame("rhythmSomen/somen_bell"); BeatAction.New(Player, new List() { @@ -224,14 +224,14 @@ namespace HeavenStudio.Games splashEffect.Play(); if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("rhythmSomen/somen_splash"); + SoundByte.PlayOneShotGame("rhythmSomen/somen_splash"); FrontArm.Play("ArmPluckNG", -1, 0); EffectSweat.Play("BlobSweating", -1, 0); missed = true; return; } - Jukebox.PlayOneShotGame("rhythmSomen/somen_catch"); - Jukebox.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f); + SoundByte.PlayOneShotGame("rhythmSomen/somen_catch"); + SoundByte.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f); FrontArm.Play("ArmPluckOK", -1, 0); EffectHit.Play("HitAppear", -1, 0); missed = false; diff --git a/Assets/Scripts/Games/RhythmTweezers/Hair.cs b/Assets/Scripts/Games/RhythmTweezers/Hair.cs index 5af20973..6e7e4af7 100644 --- a/Assets/Scripts/Games/RhythmTweezers/Hair.cs +++ b/Assets/Scripts/Games/RhythmTweezers/Hair.cs @@ -7,7 +7,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers { public class Hair : MonoBehaviour { - public float createBeat; + public double createBeat; public GameObject hairSprite; public GameObject stubbleSprite; public GameObject missedSprite; @@ -21,7 +21,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers tweezers = game.Tweezers; } - public void StartInput(float beat, float length) + public void StartInput(double beat, double length) { game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, Just, Miss, Out); } diff --git a/Assets/Scripts/Games/RhythmTweezers/LongHair.cs b/Assets/Scripts/Games/RhythmTweezers/LongHair.cs index f6d787a7..d94f7094 100644 --- a/Assets/Scripts/Games/RhythmTweezers/LongHair.cs +++ b/Assets/Scripts/Games/RhythmTweezers/LongHair.cs @@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers { public class LongHair : MonoBehaviour { - public float createBeat; + public double createBeat; public GameObject hairSprite; public GameObject stubbleSprite; private RhythmTweezers game; @@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers private Sound pullSound; - private float inputBeat; + private double inputBeat; PlayerActionEvent endEvent; @@ -33,7 +33,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers tweezers = game.Tweezers; } - public void StartInput(float beat, float length) + public void StartInput(double beat, double length) { inputBeat = beat + length; game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, StartJust, StartMiss, Out); @@ -94,7 +94,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers pluckState = -1; return; } - pullSound = Jukebox.PlayOneShotGame($"rhythmTweezers/longPull{UnityEngine.Random.Range(1, 5)}"); + pullSound = SoundByte.PlayOneShotGame($"rhythmTweezers/longPull{UnityEngine.Random.Range(1, 5)}"); pluckState = 1; endEvent = game.ScheduleInput(inputBeat, 0.5f, InputType.STANDARD_UP | InputType.DIRECTION_DOWN_UP, EndJust, Out, Out); } diff --git a/Assets/Scripts/Games/RhythmTweezers/NoPeekingSign.cs b/Assets/Scripts/Games/RhythmTweezers/NoPeekingSign.cs index 864fa288..087fb2be 100644 --- a/Assets/Scripts/Games/RhythmTweezers/NoPeekingSign.cs +++ b/Assets/Scripts/Games/RhythmTweezers/NoPeekingSign.cs @@ -7,7 +7,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers { public class NoPeekingSign : MonoBehaviour { - private float peekBeat = -1; + private double peekBeat = -1; private bool peekRising; private bool shouldDelete; private Animator anim; @@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers sr = GetComponent(); } - public void Init(float beat, float length, int type) + public void Init(double beat, float length, int type) { peekBeat = beat - 1; peekRising = true; diff --git a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs index e43679f7..9d2122d9 100644 --- a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs +++ b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs @@ -152,7 +152,7 @@ namespace HeavenStudio.Games private struct QueuedPeek { - public float beat; + public double beat; public float length; public int type; } @@ -174,8 +174,8 @@ namespace HeavenStudio.Games [NonSerialized] public int hairsLeft = 0; [Header("Variables")] - private float passTurnBeat; - private float passTurnEndBeat = 2; + private double passTurnBeat; + private double passTurnEndBeat = 2; private static List queuedPeeks = new List(); [Header("Sprites")] @@ -226,7 +226,7 @@ namespace HeavenStudio.Games private List spawnedHairs = new List(); private List spawnedLongs = new List(); - private static List passedTurns = new List(); + private static List passedTurns = new(); private void Awake() { @@ -245,7 +245,7 @@ namespace HeavenStudio.Games spawnedHairs.Add(hair); hair.gameObject.SetActive(true); hair.GetComponent().Play("SmallAppear", 0, 1); - float rot = -58f + 116 * Mathp.Normalize(crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1); + float rot = -58f + 116 * Mathp.Normalize((float)crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1); hair.transform.eulerAngles = new Vector3(0, 0, rot); hair.createBeat = crEvent.beat; } @@ -255,7 +255,7 @@ namespace HeavenStudio.Games spawnedLongs.Add(hair); hair.gameObject.SetActive(true); hair.GetComponent().Play("LongAppear", 0, 1); - float rot = -58f + 116 * Mathp.Normalize(crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1); + float rot = -58f + 116 * Mathp.Normalize((float)crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1); hair.transform.eulerAngles = new Vector3(0, 0, rot); hair.createBeat = crEvent.beat; } @@ -275,7 +275,7 @@ namespace HeavenStudio.Games } } - public static void SpawnHairInactive(float beat) + public static void SpawnHairInactive(double beat) { if (crHandlerInstance == null) { @@ -285,7 +285,7 @@ namespace HeavenStudio.Games crHandlerInstance.AddEvent(beat, 0, "Hair"); } - public static void SpawnLongHairInactive(float beat) + public static void SpawnLongHairInactive(double beat) { if (crHandlerInstance == null) { @@ -295,7 +295,7 @@ namespace HeavenStudio.Games crHandlerInstance.AddEvent(beat, 0.5f, "Long"); } - public void SpawnHair(float beat) + public void SpawnHair(double beat) { if (crHandlerInstance.queuedEvents.Count > 0 && crHandlerInstance.queuedEvents.Find(x => x.beat == beat || (beat >= x.beat && beat <= x.beat + x.length)) != null) return; // End transition early if the next hair is a lil early. @@ -303,7 +303,7 @@ namespace HeavenStudio.Games crHandlerInstance.AddEvent(beat, 0, "Hair"); - Jukebox.PlayOneShotGame("rhythmTweezers/shortAppear", beat); + SoundByte.PlayOneShotGame("rhythmTweezers/shortAppear", beat); Hair hair = Instantiate(hairBase, HairsHolder.transform).GetComponent(); spawnedHairs.Add(hair); hair.gameObject.SetActive(true); @@ -314,14 +314,14 @@ namespace HeavenStudio.Games hair.createBeat = beat; } - public void SpawnLongHair(float beat) + public void SpawnLongHair(double beat) { if (crHandlerInstance.queuedEvents.Count > 0 && crHandlerInstance.queuedEvents.Find(x => x.beat == beat || (beat >= x.beat && beat <= x.beat + x.length)) != null) return; StopTransitionIfActive(); crHandlerInstance.AddEvent(beat, 0.5f, "Long"); - Jukebox.PlayOneShotGame("rhythmTweezers/longAppear", beat); + SoundByte.PlayOneShotGame("rhythmTweezers/longAppear", beat); LongHair hair = Instantiate(longHairBase, HairsHolder.transform).GetComponent(); spawnedLongs.Add(hair); hair.gameObject.SetActive(true); @@ -332,7 +332,7 @@ namespace HeavenStudio.Games hair.createBeat = beat; } - public void SetIntervalStart(float beat, float interval = 4f) + public void SetIntervalStart(double beat, float interval = 4f) { StopTransitionIfActive(); hairsLeft = 0; @@ -340,7 +340,7 @@ namespace HeavenStudio.Games crHandlerInstance.StartInterval(beat, interval); } - public static void InactiveInterval(float beat, float interval) + public static void InactiveInterval(double beat, float interval) { if (crHandlerInstance == null) { @@ -349,7 +349,7 @@ namespace HeavenStudio.Games crHandlerInstance.StartInterval(beat, interval); } - public void PassTurn(float beat, float length) + public void PassTurn(double beat, float length) { if (crHandlerInstance.queuedEvents.Count > 0) { @@ -371,7 +371,7 @@ namespace HeavenStudio.Games } } - public static void PrePassTurn(float beat, float length) + public static void PrePassTurn(double beat, float length) { if (GameManager.instance.currentGame == "rhythmTweezers") { @@ -383,7 +383,7 @@ namespace HeavenStudio.Games } } - private void SetPassTurnValues(float startBeat) + private void SetPassTurnValues(double startBeat) { if (crHandlerInstance.intervalLength <= 0) return; passTurnBeat = startBeat - 1f; @@ -391,11 +391,11 @@ namespace HeavenStudio.Games } const float vegDupeOffset = 16.7f; - public void NextVegetable(float beat, int type, Color onionColor, Color potatoColor) + public void NextVegetable(double beat, int type, Color onionColor, Color potatoColor) { transitioning = true; - Jukebox.PlayOneShotGame("rhythmTweezers/register", beat); + SoundByte.PlayOneShotGame("rhythmTweezers/register", beat); Sprite nextVeggieSprite = type == 0 ? onionSprite : potatoSprite; Color nextColor = type == 0 ? onionColor : potatoColor; @@ -456,7 +456,7 @@ namespace HeavenStudio.Games ChangeBackgroundColor(end, beats); } - public static void PreNoPeeking(float beat, float length, int type) + public static void PreNoPeeking(double beat, float length, int type) { if (GameManager.instance.currentGame == "rhythmTweezers") { @@ -473,7 +473,7 @@ namespace HeavenStudio.Games } } - public void NoPeeking(float beat, float length, int type) + public void NoPeeking(double beat, float length, int type) { NoPeekingSign spawnedNoPeekingSign = Instantiate(noPeekingRef, transform); spawnedNoPeekingSign.gameObject.SetActive(true); @@ -509,7 +509,7 @@ namespace HeavenStudio.Games var tweezerAngle = -180f; var tweezerTime = Conductor.instance.songPositionInBeats; - var unclampedAngle = -58f + 116 * Mathp.Normalize(tweezerTime, passTurnBeat + 1f, passTurnEndBeat - 1f); + var unclampedAngle = -58f + 116 * Mathp.Normalize(tweezerTime, (float)passTurnBeat + 1f, (float)passTurnEndBeat - 1f); tweezerAngle = Mathf.Clamp(unclampedAngle, -180f, 180f); Tweezers.transform.eulerAngles = new Vector3(0, 0, tweezerAngle); diff --git a/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs b/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs index 4addd786..6bb18390 100644 --- a/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs +++ b/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs @@ -46,7 +46,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers if (ace) { - Jukebox.PlayOneShotGame($"rhythmTweezers/shortPluck{UnityEngine.Random.Range(1, 21)}"); + SoundByte.PlayOneShotGame($"rhythmTweezers/shortPluck{UnityEngine.Random.Range(1, 21)}"); hair.hairSprite.SetActive(false); hair.stubbleSprite.SetActive(true); @@ -63,8 +63,8 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers } else { - Jukebox.PlayOneShotGame($"rhythmTweezers/shortPluck{UnityEngine.Random.Range(1, 21)}"); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShotGame($"rhythmTweezers/shortPluck{UnityEngine.Random.Range(1, 21)}"); + SoundByte.PlayOneShot("miss"); hair.hairSprite.SetActive(false); hair.missedSprite.SetActive(true); @@ -84,7 +84,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers if (ace) { - Jukebox.PlayOneShotGame("rhythmTweezers/longPullEnd"); + SoundByte.PlayOneShotGame("rhythmTweezers/longPullEnd"); hair.hairSprite.SetActive(false); hair.stubbleSprite.SetActive(true); diff --git a/Assets/Scripts/Games/Ringside/Ringside.cs b/Assets/Scripts/Games/Ringside/Ringside.cs index 778f5208..bf1a6986 100644 --- a/Assets/Scripts/Games/Ringside/Ringside.cs +++ b/Assets/Scripts/Games/Ringside/Ringside.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using UnityEngine; using DG.Tweening; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -41,7 +42,7 @@ namespace HeavenStudio.Games.Loaders new Param("variant", Ringside.PoseForTheFansVariant.Random, "Variant", "Which variant of the cue do you wish to play."), new Param("keepZoomedOut", false, "Keep Zoomed Out", "Whether the camera should keep being zoomed out after the event has completed."), new Param("newspaperBeats", new EntityTypes.Float(0, 80, 0), "Newspaper Beats", "How many beats should the newspaper stay for?"), - new Param("ease", EasingFunction.Ease.EaseOutQuad, "Camera Ease", "What ease should the camera use?"), + new Param("ease", Util.EasingFunction.Ease.EaseOutQuad, "Camera Ease", "What ease should the camera use?"), }, defaultLength = 4f }, @@ -119,7 +120,7 @@ namespace HeavenStudio.Games public static List queuedPoses = new List(); public struct QueuedPose { - public float beat; + public double beat; public bool keepZoomedOut; public float newspaperBeats; } @@ -149,12 +150,12 @@ namespace HeavenStudio.Games private bool keepZoomOut; private Sound kidsLaugh; private int currentPose; - private EasingFunction.Ease lastEase; + private Util.EasingFunction.Ease lastEase; private GameObject currentNewspaper; private int currentZoomIndex; - private List allCameraEvents = new List(); + private List allCameraEvents = new List(); public GameEvent bop = new GameEvent(); @@ -163,7 +164,7 @@ namespace HeavenStudio.Games void OnDestroy() { if (queuedPoses.Count > 0) queuedPoses.Clear(); - Jukebox.KillLoop(kidsLaugh, 2f); + SoundByte.KillLoop(kidsLaugh, 2f); foreach (var evt in scheduledInputs) { evt.Disable(); @@ -179,10 +180,10 @@ namespace HeavenStudio.Games { instance = this; var camEvents = EventCaller.GetAllInGameManagerList("ringside", new string[] { "poseForTheFans" }); - List tempEvents = new List(); + List tempEvents = new List(); for (int i = 0; i < camEvents.Count; i++) { - if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats) + if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { tempEvents.Add(camEvents[i]); } @@ -220,7 +221,7 @@ namespace HeavenStudio.Games Ringside.instance.ScoreMiss(0.5); wrestlerAnim.DoScaledAnimationAsync("YeMiss", 0.25f); - Jukebox.PlayOneShotGame($"ringside/confusedanswer"); + SoundByte.PlayOneShotGame($"ringside/confusedanswer"); if (reporterAnim.IsPlayingAnimationName("IdleReporter")) reporterAnim.Play("IdleLate", 0, 0); } if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN) && !shouldNotInput) @@ -230,12 +231,12 @@ namespace HeavenStudio.Games int randomPose = UnityEngine.Random.Range(1, 7); wrestlerAnim.Play($"Pose{randomPose}", 0, 0); reporterAnim.Play("FlinchReporter", 0, 0); - Jukebox.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw"); - Jukebox.PlayOneShotGame("ringside/barely"); + SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw"); + SoundByte.PlayOneShotGame("ringside/barely"); wrestlerTransform.localScale = new Vector3(1.1f, 1.1f, 1f); BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(cond.songPositionInBeats + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }), + new BeatAction.Action(cond.songPositionInBeatsAsDouble + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }), }); } } @@ -243,7 +244,7 @@ namespace HeavenStudio.Games { if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0) { - if (Conductor.instance.songPositionInBeats >= allCameraEvents[currentZoomIndex].beat) + if (Conductor.instance.songPositionInBeatsAsDouble >= allCameraEvents[currentZoomIndex].beat) { UpdateCameraZoom(); currentZoomIndex++; @@ -265,7 +266,7 @@ namespace HeavenStudio.Games } else { - EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase); float newPosX = func(lastCamPos.x, currentCamPos.x, normalizedBeat); float newPosY = func(lastCamPos.y, currentCamPos.y, normalizedBeat); float newPosZ = func(lastCamPos.z + 10, currentCamPos.z + 10, normalizedBeat); @@ -292,7 +293,7 @@ namespace HeavenStudio.Games } - public void ToggleBop(float beat, float length, bool startBopping, bool autoBop) + public void ToggleBop(double beat, float length, bool startBopping, bool autoBop) { shouldBop = autoBop; if (startBopping) @@ -332,7 +333,7 @@ namespace HeavenStudio.Games } } - public void Question(float beat, bool alt, int questionVariant, float length = 4f) + public void Question(double beat, bool alt, int questionVariant, float length = 4f) { if (length <= 2f) return; int currentQuestion = questionVariant; @@ -366,7 +367,7 @@ namespace HeavenStudio.Games ThatTrue(beat + totalExtend, currentQuestion); } - public void PreQuestion(float beat, int questionVariant, float length = 4f) + public void PreQuestion(double beat, int questionVariant, float length = 4f) { if (GameManager.instance.currentGame != "ringside") return; if (instance == null) return; @@ -382,7 +383,7 @@ namespace HeavenStudio.Games } } - public void ThatTrue(float beat, int currentQuestion) + public void ThatTrue(double beat, int currentQuestion) { MultiSound.Play(new MultiSound.Sound[] { @@ -396,7 +397,7 @@ namespace HeavenStudio.Games }); } - public void BigGuy(float beat, int questionVariant) + public void BigGuy(double beat, int questionVariant) { int currentQuestion = questionVariant; if (currentQuestion == (int)QuestionVariant.Random) currentQuestion = UnityEngine.Random.Range(1, 4); @@ -420,7 +421,7 @@ namespace HeavenStudio.Games }); } - public static void PoseForTheFans(float beat, bool and, int variant, bool keepZoomedOut, float newspaperBeats) + public static void PoseForTheFans(double beat, bool and, int variant, bool keepZoomedOut, float newspaperBeats) { if (and) { @@ -448,7 +449,7 @@ namespace HeavenStudio.Games } } - public void QueuePose(float beat, bool keepZoomedOut, float newspaperBeats) + public void QueuePose(double beat, bool keepZoomedOut, float newspaperBeats) { if (newspaperBeats > 0) { @@ -496,7 +497,7 @@ namespace HeavenStudio.Games { wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0); reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0); - kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true); + kidsLaugh = SoundByte.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true); } else { @@ -510,7 +511,7 @@ namespace HeavenStudio.Games blackVoid.color = new Color(1f, 1f, 1f, 0); Destroy(currentNewspaper); currentNewspaper = null; lastCamPos = new Vector3(0, 0, -10); - Jukebox.KillLoop(kidsLaugh, 0.25f); + SoundByte.KillLoop(kidsLaugh, 0.25f); keepZoomOut = false; }) }); @@ -562,7 +563,7 @@ namespace HeavenStudio.Games { wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0); reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0); - kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true); + kidsLaugh = SoundByte.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true); } else { @@ -575,7 +576,7 @@ namespace HeavenStudio.Games { blackVoid.color = new Color(1f, 1f, 1f, 0); Destroy(currentNewspaper); currentNewspaper = null; - Jukebox.KillLoop(kidsLaugh, 0.25f); + SoundByte.KillLoop(kidsLaugh, 0.25f); }) }); } @@ -586,13 +587,13 @@ namespace HeavenStudio.Games { if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0) { - currentZoomCamBeat = allCameraEvents[currentZoomIndex].beat; + currentZoomCamBeat = (float)allCameraEvents[currentZoomIndex].beat; currentCamPos = new Vector3(poseFlash.transform.position.x, poseFlash.transform.position.y, -21.5f); - lastEase = (EasingFunction.Ease)allCameraEvents[currentZoomIndex]["ease"]; + lastEase = (Util.EasingFunction.Ease)allCameraEvents[currentZoomIndex]["ease"]; } } - public void PoseCheck(float beat) + public void PoseCheck(double beat) { ScheduleInput(beat, 2f, InputType.STANDARD_ALT_DOWN, JustPoseForTheFans, MissPose, Nothing); } @@ -658,9 +659,9 @@ namespace HeavenStudio.Games if (state >= 1f || state <= -1f) { wrestlerAnim.DoScaledAnimationAsync("Cough", 0.5f); - Jukebox.PlayOneShotGame($"ringside/cough"); + SoundByte.PlayOneShotGame($"ringside/cough"); reporterAnim.Play("ExtendMiss", 0, 0); - Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); + SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleMiss", 0, 0); }), @@ -675,10 +676,10 @@ namespace HeavenStudio.Games { wrestlerAnim.DoScaledAnimationAsync("Ye", 0.5f); reporterAnim.Play("ExtendSmile", 0, 0); - Jukebox.PlayOneShotGame($"ringside/ye{UnityEngine.Random.Range(1, 4)}"); + SoundByte.PlayOneShotGame($"ringside/ye{UnityEngine.Random.Range(1, 4)}"); BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { Jukebox.PlayOneShotGame("ringside/yeCamera"); }), + new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { SoundByte.PlayOneShotGame("ringside/yeCamera"); }), new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f); }), new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { flashObject.SetActive(true); }), new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("SmileReporter", 0, 0); }), @@ -692,7 +693,7 @@ namespace HeavenStudio.Games if (state >= 1f || state <= -1f) { missedBigGuy = true; - Jukebox.PlayOneShotGame($"ringside/muscles1"); + SoundByte.PlayOneShotGame($"ringside/muscles1"); wrestlerAnim.DoScaledAnimationAsync("BigGuyOne", 0.5f); return; } @@ -702,7 +703,7 @@ namespace HeavenStudio.Games public void SuccessBigGuyFirst() { missedBigGuy = false; - Jukebox.PlayOneShotGame($"ringside/muscles1"); + SoundByte.PlayOneShotGame($"ringside/muscles1"); wrestlerAnim.DoScaledAnimationAsync("BigGuyOne", 0.5f); } @@ -710,7 +711,7 @@ namespace HeavenStudio.Games { if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame($"ringside/muscles2"); + SoundByte.PlayOneShotGame($"ringside/muscles2"); wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f); if (!missedBigGuy) { @@ -722,7 +723,7 @@ namespace HeavenStudio.Games else { reporterAnim.Play("ExtendMiss", 0, 0); - Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); + SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleMiss", 0, 0); }), @@ -757,14 +758,14 @@ namespace HeavenStudio.Games public void SuccessBigGuySecond(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame($"ringside/muscles2"); + SoundByte.PlayOneShotGame($"ringside/muscles2"); wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f); if (!missedBigGuy) { reporterAnim.Play("ExtendSmile", 0, 0); BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { Jukebox.PlayOneShotGame("ringside/musclesCamera"); }), + new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { SoundByte.PlayOneShotGame("ringside/musclesCamera"); }), new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("SmileReporter", 0, 0); }), new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f); }), new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { flashObject.SetActive(true); }), @@ -813,9 +814,9 @@ namespace HeavenStudio.Games wrestlerTransform.localScale = new Vector3(1.2f, 1.2f, 1f); int randomPose = UnityEngine.Random.Range(1, 7); wrestlerAnim.Play($"Pose{randomPose}", 0, 0); - Jukebox.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw"); + SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw"); reporterAnim.Play("IdleMiss", 0, 0); - Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); + SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }), @@ -840,14 +841,14 @@ namespace HeavenStudio.Games reporterAnim.Play("ExcitedReporter", 0, 0); } hitPose = true; - Jukebox.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}"); + SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}"); FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 1f); FadeBGColor(Color.black, defaultBGColorLight, 1f); flashParticles.Play(); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }), - new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { Jukebox.PlayOneShotGame("ringside/poseCamera"); }), + new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { SoundByte.PlayOneShotGame("ringside/poseCamera"); }), new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { flashParticles.Stop(); }), new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { poseFlash.SetActive(true); poseFlash.GetComponent().Play("PoseFlashing", 0, 0); }), new BeatAction.Action(caller.startBeat + caller.timer + 1.99f, delegate { poseFlash.SetActive(false); }), @@ -857,7 +858,7 @@ namespace HeavenStudio.Games public void Miss(PlayerActionEvent caller) { reporterAnim.Play("ExtendMiss", 0, 0); - Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); + SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleMiss", 0, 0); }), @@ -873,7 +874,7 @@ namespace HeavenStudio.Games public void MissBigGuyTwo(PlayerActionEvent caller) { reporterAnim.Play("ExtendMiss", 0, 0); - Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); + SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleMiss", 0, 0); }), @@ -886,7 +887,7 @@ namespace HeavenStudio.Games { shouldNotInput = true; reporterAnim.Play("IdleMiss", 0, 0); - Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); + SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}"); } public void Nothing(PlayerActionEvent caller){} diff --git a/Assets/Scripts/Games/Rockers/RockerBendInput.cs b/Assets/Scripts/Games/Rockers/RockerBendInput.cs index 6355afef..7948fb5a 100644 --- a/Assets/Scripts/Games/Rockers/RockerBendInput.cs +++ b/Assets/Scripts/Games/Rockers/RockerBendInput.cs @@ -11,7 +11,7 @@ namespace HeavenStudio.Games.Scripts_Rockers private Rockers game; - public void Init(int pitch, float beat, float length) + public void Init(int pitch, double beat, double length) { game = Rockers.instance; this.pitch = pitch; diff --git a/Assets/Scripts/Games/Rockers/Rockers.cs b/Assets/Scripts/Games/Rockers/Rockers.cs index 6630b24e..19d634a3 100644 --- a/Assets/Scripts/Games/Rockers/Rockers.cs +++ b/Assets/Scripts/Games/Rockers/Rockers.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using Jukebox; + namespace HeavenStudio.Games.Loaders { using static Minigames; @@ -233,7 +235,7 @@ namespace HeavenStudio.Games.Loaders offSet = 0.034f; break; } - Jukebox.PlayOneShot($"games/rockers/count/{e["count"]}", e.beat, 1, 1, false, null, offSet); + SoundByte.PlayOneShot($"games/rockers/count/{e["count"]}", e.beat, 1, 1, false, null, offSet); } }, new GameAction("voiceLine", "Together Voice Line") @@ -244,7 +246,7 @@ namespace HeavenStudio.Games.Loaders }, preFunction = delegate { - Jukebox.PlayOneShot(eventCaller.currentEntity["cmon"] ? "games/rockers/Cmon" : "games/rockers/LastOne", eventCaller.currentEntity.beat); + SoundByte.PlayOneShot(eventCaller.currentEntity["cmon"] ? "games/rockers/Cmon" : "games/rockers/LastOne", eventCaller.currentEntity.beat); } }, new GameAction("prepareTogether", "Custom Together Prepare") @@ -396,20 +398,20 @@ namespace HeavenStudio.Games private float lastTargetCameraX = 0; private float targetCameraX = 0; - private float cameraMoveBeat = -1; - private float endBeat = Single.MaxValue; - private static List queuedCameraEvents = new List(); - private static List queuedPreInterval = new List(); + private double cameraMoveBeat = -1; + private double endBeat = double.MaxValue; + private static List queuedCameraEvents = new(); + private static List queuedPreInterval = new(); - private List riffEvents = new List(); + private List riffEvents = new List(); - private static List riffUsedBeats = new List(); + private static List riffUsedBeats = new(); - private List bendEvents = new List(); + private List bendEvents = new List(); - private static List bendUsedBeats = new List(); + private static List bendUsedBeats = new(); - private List prepareBeatsJJ = new List(); + private List prepareBeatsJJ = new(); private void Awake() { @@ -427,14 +429,14 @@ namespace HeavenStudio.Games bendEvents = GrabAllBendEvents(); } - private static List GrabAllRiffEvents() + private static List GrabAllRiffEvents() { var tempEvents = EventCaller.GetAllInGameManagerList("rockers", new string[] { "riff" }); if (tempEvents.Count > 1) { tempEvents.Sort((s1, s2) => s1.beat.CompareTo(s2.beat)); - float forbiddenLength = tempEvents[0].beat + tempEvents[0].length; - List tempEvents2 = new List(); + double forbiddenLength = tempEvents[0].beat + tempEvents[0].length; + List tempEvents2 = new List(); for (int i = 1; i < tempEvents.Count; i++) { if (tempEvents[i].beat > forbiddenLength) @@ -452,14 +454,14 @@ namespace HeavenStudio.Games } } - private static List GrabAllBendEvents() + private static List GrabAllBendEvents() { var tempEvents = EventCaller.GetAllInGameManagerList("rockers", new string[] { "bend" }); if (tempEvents.Count > 1) { tempEvents.Sort((s1, s2) => s1.beat.CompareTo(s2.beat)); - float forbiddenLength = tempEvents[0].beat + tempEvents[0].length; - List tempEvents2 = new List(); + double forbiddenLength = tempEvents[0].beat + tempEvents[0].length; + List tempEvents2 = new List(); for (int i = 1; i < tempEvents.Count; i++) { if (tempEvents[i].beat > forbiddenLength) @@ -477,7 +479,7 @@ namespace HeavenStudio.Games } } - private List GrabAllTogetherEvents(float beat) + private List GrabAllTogetherEvents(double beat) { var tempEvents = EventCaller.GetAllInGameManagerList("rockers", new string[] { "riffTogether", "riffTogetherEnd" }); var allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }); @@ -496,7 +498,7 @@ namespace HeavenStudio.Games if (tempEvents.Count > 0) { tempEvents.Sort((s1, s2) => s1.beat.CompareTo(s2.beat)); - List tempEvents2 = new List(); + List tempEvents2 = new List(); for (int i = 0; i < tempEvents.Count; i++) { if (tempEvents[i].beat > beat) @@ -504,8 +506,8 @@ namespace HeavenStudio.Games tempEvents2.Add(tempEvents[i]); } } - List tempEvents3 = new List(); - float forbiddenLength = tempEvents2[0].beat + tempEvents2[0].length; + List tempEvents3 = new List(); + double forbiddenLength = tempEvents2[0].beat + tempEvents2[0].length; tempEvents3.Add(tempEvents2[0]); for (int i = 1; i < tempEvents2.Count; i++) { @@ -514,7 +516,7 @@ namespace HeavenStudio.Games tempEvents3.Add(tempEvents2[i]); } } - List tempEvents4 = new List(); + List tempEvents4 = new List(); for (int i = 0; i < tempEvents3.Count; i++) { if (tempEvents3[i].beat < endBeat) @@ -595,7 +597,7 @@ namespace HeavenStudio.Games if (normalizedBeat >= 0f && normalizedBeat <= 1f) { - EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInOutQuad); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuad); float newX = func(lastTargetCameraX, targetCameraX, normalizedBeat); GameCamera.additionalPosition = new Vector3(newX, 0, 0); @@ -609,9 +611,9 @@ namespace HeavenStudio.Games } } - public void DefaultLastOne(float beat, int[] JJSamples, int[] JJPitches, int[] SoshiSamples, int[] SoshiPitches, bool moveCamera) + public void DefaultLastOne(double beat, int[] JJSamples, int[] JJPitches, int[] SoshiSamples, int[] SoshiPitches, bool moveCamera) { - Jukebox.PlayOneShotGame("rockers/lastOne"); + SoundByte.PlayOneShotGame("rockers/lastOne"); if (moveCamera) { lastTargetCameraX = GameCamera.additionalPosition.x; @@ -665,9 +667,9 @@ namespace HeavenStudio.Games ScheduleInput(beat, 6.5f, InputType.STANDARD_DOWN, JustMute, MuteMiss, Empty); } - public void DefaultCmon(float beat, int[] JJSamples, int[] JJPitches, int[] SoshiSamples, int[] SoshiPitches, bool moveCamera) + public void DefaultCmon(double beat, int[] JJSamples, int[] JJPitches, int[] SoshiSamples, int[] SoshiPitches, bool moveCamera) { - Jukebox.PlayOneShotGame("rockers/cmon"); + SoundByte.PlayOneShotGame("rockers/cmon"); if (moveCamera) { lastTargetCameraX = GameCamera.additionalPosition.x; @@ -732,11 +734,11 @@ namespace HeavenStudio.Games ScheduleInput(beat, 10, InputType.STANDARD_DOWN, JustMute, MuteMiss, Empty); } - public void TogetherPrepare(float beat, bool cmon, bool muteSound, float muteBeat, float goToMiddleBeat, bool moveCamera) + public void TogetherPrepare(double beat, bool cmon, bool muteSound, float muteBeat, float goToMiddleBeat, bool moveCamera) { - List togetherEvents = GrabAllTogetherEvents(beat); + List togetherEvents = GrabAllTogetherEvents(beat); if (togetherEvents.Count == 0 || crHandlerInstance.IntervalIsActive()) return; - if (!muteSound) Jukebox.PlayOneShotGame(cmon ? "rockers/Cmon" : "rockers/LastOne"); + if (!muteSound) SoundByte.PlayOneShotGame(cmon ? "rockers/Cmon" : "rockers/LastOne"); List actions = new List(); if (moveCamera) { @@ -807,7 +809,7 @@ namespace HeavenStudio.Games BeatAction.New(instance.gameObject, actions); } - public static void PreMoveCamera(float beat, bool moveCamera) + public static void PreMoveCamera(double beat, bool moveCamera) { if (GameManager.instance.currentGame == "rockers") { @@ -818,7 +820,7 @@ namespace HeavenStudio.Games queuedPreInterval.Add(beat - 1); } - private void MoveCamera(float beat) + private void MoveCamera(double beat) { lastTargetCameraX = GameCamera.additionalPosition.x; targetCameraX = JJ.transform.localPosition.x; @@ -826,7 +828,7 @@ namespace HeavenStudio.Games } - private void PreInterval(float beat) + private void PreInterval(double beat) { BeatAction.New(instance.gameObject, new List() { @@ -842,7 +844,7 @@ namespace HeavenStudio.Games }); } - public static void InactiveInterval(float beat, float length) + public static void InactiveInterval(double beat, float length) { if (crHandlerInstance == null) { @@ -851,20 +853,20 @@ namespace HeavenStudio.Games crHandlerInstance.StartInterval(beat, length); } - public void StartInterval(float beat, float length) + public void StartInterval(double beat, float length) { crHandlerInstance.StartInterval(beat, length); if (GameManager.instance.autoplay) Soshi.UnHold(); } - public static void InactiveRiff(float beat, float length, int[] pitchesPlayer, bool gleeClubPlayer, int sampleSoshi, int sampleTonesSoshi) + public static void InactiveRiff(double beat, float length, int[] pitchesPlayer, bool gleeClubPlayer, int sampleSoshi, int sampleTonesSoshi) { if (crHandlerInstance == null) { crHandlerInstance = new CallAndResponseHandler(8); } - List foundRiffEvents = GrabAllRiffEvents(); - DynamicBeatmap.DynamicEntity foundEvent = foundRiffEvents.Find(x => x.beat == beat); + List foundRiffEvents = GrabAllRiffEvents(); + RiqEntity foundEvent = foundRiffEvents.Find(x => x.beat == beat); if ((foundEvent == null || (riffUsedBeats.Count > 0 && riffUsedBeats.Contains(foundEvent.beat))) && foundRiffEvents.Count > 1) return; riffUsedBeats.Add(beat); crHandlerInstance.AddEvent(beat, length, "riff", new List() @@ -881,7 +883,7 @@ namespace HeavenStudio.Games }); } - public static void InactiveBend(float beat, float length, int pitchSoshi) + public static void InactiveBend(double beat, float length, int pitchSoshi) { if (crHandlerInstance == null) { @@ -890,9 +892,9 @@ namespace HeavenStudio.Games var bendEventsToCheck = GrabAllBendEvents(); var riffEventsToCheck = GrabAllRiffEvents(); if (riffEventsToCheck.Count == 0) return; - DynamicBeatmap.DynamicEntity foundEvent = bendEventsToCheck.Find(x => x.beat == beat); - if ((foundEvent == null || (bendUsedBeats.Count > 0 && bendUsedBeats.Contains(foundEvent.beat))) && bendEventsToCheck.Count > 1) return; - DynamicBeatmap.DynamicEntity riffEventToCheck = riffEventsToCheck.Find(x => beat >= x.beat && beat < x.beat + x.length); + RiqEntity foundEvent = bendEventsToCheck.Find(x => x.beat == beat); + if ((foundEvent == null || (bendUsedBeats.Count > 0 && bendUsedBeats.Contains((float)foundEvent.beat))) && bendEventsToCheck.Count > 1) return; + RiqEntity riffEventToCheck = riffEventsToCheck.Find(x => beat >= x.beat && beat < x.beat + x.length); if (riffEventToCheck == null) return; bendUsedBeats.Add(beat); crHandlerInstance.AddEvent(beat, length, "bend", new List() @@ -901,10 +903,10 @@ namespace HeavenStudio.Games }); } - public void Riff(float beat, float length, int[] pitches, bool gleeClubJJ, int[] pitchesPlayer, bool gleeClubPlayer, int sampleJJ, int sampleTonesJJ, int sampleSoshi, int sampleTonesSoshi, bool noRespond) + public void Riff(double beat, float length, int[] pitches, bool gleeClubJJ, int[] pitchesPlayer, bool gleeClubPlayer, int sampleJJ, int sampleTonesJJ, int sampleSoshi, int sampleTonesSoshi, bool noRespond) { - DynamicBeatmap.DynamicEntity foundEvent = riffEvents.Find(x => x.beat == beat); - if ((foundEvent == null || (riffUsedBeats.Count > 0 && riffUsedBeats.Contains(foundEvent.beat))) && riffEvents.Count > 1) return; + RiqEntity foundEvent = riffEvents.Find(x => x.beat == beat); + if ((foundEvent == null || (riffUsedBeats.Count > 0 && riffUsedBeats.Contains((float)foundEvent.beat))) && riffEvents.Count > 1) return; riffUsedBeats.Add(beat); JJ.StrumStrings(gleeClubJJ, pitches, (PremadeSamples)sampleJJ, sampleTonesJJ, noRespond); BeatAction.New(instance.gameObject, new List() @@ -926,12 +928,12 @@ namespace HeavenStudio.Games }); } - public void Bend(float beat, float length, int pitchJJ, int pitchSoshi, bool noRespond) + public void Bend(double beat, float length, int pitchJJ, int pitchSoshi, bool noRespond) { if (riffEvents.Count == 0) return; - DynamicBeatmap.DynamicEntity foundEvent = bendEvents.Find(x => x.beat == beat); - if ((foundEvent == null || (bendUsedBeats.Count > 0 && bendUsedBeats.Contains(foundEvent.beat))) && bendEvents.Count > 1) return; - DynamicBeatmap.DynamicEntity riffEventToCheck = riffEvents.Find(x => beat >= x.beat && beat < x.beat + x.length); + RiqEntity foundEvent = bendEvents.Find(x => x.beat == beat); + if ((foundEvent == null || (bendUsedBeats.Count > 0 && bendUsedBeats.Contains((float)foundEvent.beat))) && bendEvents.Count > 1) return; + RiqEntity riffEventToCheck = riffEvents.Find(x => beat >= x.beat && beat < x.beat + x.length); if (riffEventToCheck == null) return; bendUsedBeats.Add(beat); JJ.BendUp(pitchJJ); @@ -970,7 +972,7 @@ namespace HeavenStudio.Games } } - public void PassTurn(float beat, float length, bool moveCamera) + public void PassTurn(double beat, float length, bool moveCamera) { if (crHandlerInstance.queuedEvents.Count > 0) { diff --git a/Assets/Scripts/Games/Rockers/RockersInput.cs b/Assets/Scripts/Games/Rockers/RockersInput.cs index e5cb29d4..75c989d0 100644 --- a/Assets/Scripts/Games/Rockers/RockersInput.cs +++ b/Assets/Scripts/Games/Rockers/RockersInput.cs @@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Scripts_Rockers private Rockers game; - public void Init(bool gleeClub, int[] pitches, float beat, float length, Rockers.PremadeSamples sample, int sampleTones, bool jump = false) + public void Init(bool gleeClub, int[] pitches, double beat, double length, Rockers.PremadeSamples sample, int sampleTones, bool jump = false) { game = Rockers.instance; this.gleeClub = gleeClub; diff --git a/Assets/Scripts/Games/Rockers/RockersRocker.cs b/Assets/Scripts/Games/Rockers/RockersRocker.cs index 3d4445f0..d90abd59 100644 --- a/Assets/Scripts/Games/Rockers/RockersRocker.cs +++ b/Assets/Scripts/Games/Rockers/RockersRocker.cs @@ -111,16 +111,16 @@ namespace HeavenStudio.Games.Scripts_Rockers for (int i = 0; i < pitches.Length; i++) { if (pitches[i] == -1) continue; - float pitch = Jukebox.GetPitchFromSemiTones(pitches[i], true); + float pitch = SoundByte.GetPitchFromSemiTones(pitches[i], true); float volume = GetVolumeBasedOnAmountOfStrings(pitches.Length); string soundName = "rockers/strings/" + (gleeClub ? "gleeClub/" : "normal/" + (i + 1)); Debug.Log("Pitch: " + pitch + " Volume: " + volume + " Name: " + soundName); - stringSounds[i] = Jukebox.PlayOneShotGame(soundName, -1, pitch, volume, true); + stringSounds[i] = SoundByte.PlayOneShotGame(soundName, -1, pitch, volume, true); } } else { - float pitch = Jukebox.GetPitchFromSemiTones(sampleTones, true); + float pitch = SoundByte.GetPitchFromSemiTones(sampleTones, true); string soundName = sample switch { Rockers.PremadeSamples.None => "", @@ -162,7 +162,7 @@ namespace HeavenStudio.Games.Scripts_Rockers Rockers.PremadeSamples.DoremiNoteE2 => "rockers/doremi/NoteE2", _ => throw new System.NotImplementedException(), }; - chordSound = Jukebox.PlayOneShotGame(soundName, -1, pitch, 1, true); + chordSound = SoundByte.PlayOneShotGame(soundName, -1, pitch, 1, true); } if (together) @@ -210,7 +210,7 @@ namespace HeavenStudio.Games.Scripts_Rockers lastBendPitch = pitch; if (chordSound != null) { - chordSound.BendUp(0.05f, Jukebox.GetPitchFromSemiTones(Jukebox.GetSemitonesFromPitch(chordSound.pitch, true) + pitch, true)); + chordSound.BendUp(0.05f, SoundByte.GetPitchFromSemiTones(SoundByte.GetSemitonesFromPitch(chordSound.pitch, true) + pitch, true)); } else { @@ -218,12 +218,12 @@ namespace HeavenStudio.Games.Scripts_Rockers { if (stringSounds[i] != null) { - stringSounds[i].BendUp(0.05f, Jukebox.GetPitchFromSemiTones(Jukebox.GetSemitonesFromPitch(stringSounds[i].pitch, true) + pitch, true)); + stringSounds[i].BendUp(0.05f, SoundByte.GetPitchFromSemiTones(SoundByte.GetSemitonesFromPitch(stringSounds[i].pitch, true) + pitch, true)); } } } - Jukebox.PlayOneShotGame("rockers/bendUp"); + SoundByte.PlayOneShotGame("rockers/bendUp"); DoScaledAnimationAsync("Bend", 0.5f); } @@ -243,7 +243,7 @@ namespace HeavenStudio.Games.Scripts_Rockers { chordSound.BendDown(0.05f); } - Jukebox.PlayOneShotGame("rockers/bendDown"); + SoundByte.PlayOneShotGame("rockers/bendDown"); DoScaledAnimationAsync("Unbend", 0.5f); } @@ -271,7 +271,7 @@ namespace HeavenStudio.Games.Scripts_Rockers strumEffect.SetActive(false); bending = false; StopSounds(); - if (soundExists) Jukebox.PlayOneShotGame("rockers/mute"); + if (soundExists) SoundByte.PlayOneShotGame("rockers/mute"); if (!noAnim) DoScaledAnimationAsync(together ? "ComeOnMute" : "Crouch", 0.5f); muted = true; } diff --git a/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiChild.cs b/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiChild.cs index ae08a51e..bafc474f 100644 --- a/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiChild.cs +++ b/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiChild.cs @@ -19,7 +19,7 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai [Header("Objects")] public Animator anim; - public float startBeat = Single.MinValue; + public double startBeat = double.MinValue; public bool isMain = true; // Update is called once per frame diff --git a/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiObject.cs b/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiObject.cs index 014e1ebe..8ae00633 100644 --- a/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiObject.cs +++ b/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiObject.cs @@ -19,7 +19,7 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai public Transform doubleLaunchPos; public Transform heldPos; - public float startBeat; + public double startBeat; public int type; public bool isDebris = false; public int holdingCash = 1; @@ -89,7 +89,7 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 1.75f, InputType.STANDARD_ALT_UP, DoUnStepAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; currentCurve = SamuraiSliceNtr.instance.InCurve; - transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * startBeat)); + transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * (float) startBeat)); var cond = Conductor.instance; float flyPos = cond.GetPositionFromBeat(launchProg.startBeat, 3f); @@ -133,7 +133,7 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai if (flyPos > 1f) { - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_catch"); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_catch"); if (!isDebris) { NtrSamuraiChild child = SamuraiSliceNtr.instance.CreateChild(startBeat + 1f); @@ -210,7 +210,7 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 4f, 2f, InputType.STANDARD_DOWN, DoSliceAutoplay, LaunchThrough, LaunchThrough); currentCurve = SamuraiSliceNtr.instance.LaunchCurve; - Jukebox.PlayOneShotGame("samuraiSliceNtr/holy_mackerel" + UnityEngine.Random.Range(1, 4), pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 1f/4); + SoundByte.PlayOneShotGame("samuraiSliceNtr/holy_mackerel" + UnityEngine.Random.Range(1, 4), pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 1f/4); } else { @@ -221,7 +221,7 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 1.75f, InputType.STANDARD_ALT_UP, DoUnStepAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; currentCurve = null; - Jukebox.PlayOneShotGame("samuraiSliceNtr/holy_mackerel" + UnityEngine.Random.Range(1, 4), pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.8f); + SoundByte.PlayOneShotGame("samuraiSliceNtr/holy_mackerel" + UnityEngine.Random.Range(1, 4), pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.8f); } break; case (int) SamuraiSliceNtr.ObjectType.Demon: @@ -264,13 +264,13 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai startBeat = launchProg.startBeat + 2f; currentCurve = SamuraiSliceNtr.instance.NgLaunchCurve; flyProg = -3; - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_launchImpact", pitch: 2f); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_launchImpact", pitch: 2f); launchProg.Disable(); return; } launchProg.Disable(); DoLaunch(); - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_launchImpact", pitch: UnityEngine.Random.Range(0.85f, 1.05f)); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_launchImpact", pitch: UnityEngine.Random.Range(0.85f, 1.05f)); } @@ -288,16 +288,16 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai startBeat = hitProg.startBeat + hitProg.timer; currentCurve = SamuraiSliceNtr.instance.NgDebrisCurve; flyProg = -3; - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_ng"); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_ng"); hitProg.Disable(); return; } flyProg = -1; hitProg.Disable(); if (UnityEngine.Random.Range(0f, 1f) >= 0.5f) - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_just00", pitch: UnityEngine.Random.Range(0.95f, 1.05f)); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_just00", pitch: UnityEngine.Random.Range(0.95f, 1.05f)); else - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_just01", pitch: UnityEngine.Random.Range(0.95f, 1.05f)); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_just01", pitch: UnityEngine.Random.Range(0.95f, 1.05f)); currentCurve = SamuraiSliceNtr.instance.DebrisRightCurve; @@ -320,7 +320,7 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai anim.Play("ObjDemonDebris01"); else if (type == (int) SamuraiSliceNtr.ObjectType.Melon2B2T) { - Jukebox.PlayOneShotGame("samuraiSliceNtr/melon_dig"); + SoundByte.PlayOneShotGame("samuraiSliceNtr/melon_dig"); pickelBurst.Play(); anim.Play("ObjMelonPickelDebris01"); } @@ -328,7 +328,7 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai if (holdingCash > 0) { moneyBurst.Emit(holdingCash); - Jukebox.PlayOneShotGame((holdingCash > 2) ? "samuraiSliceNtr/ntrSamurai_scoreMany" : "samuraiSliceNtr/ntrSamurai_ng", pitch: UnityEngine.Random.Range(0.95f, 1.05f)); + SoundByte.PlayOneShotGame((holdingCash > 2) ? "samuraiSliceNtr/ntrSamurai_scoreMany" : "samuraiSliceNtr/ntrSamurai_ng", pitch: UnityEngine.Random.Range(0.95f, 1.05f)); } } diff --git a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs index 408cd98e..81ef8c6d 100644 --- a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs +++ b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs @@ -154,7 +154,7 @@ namespace HeavenStudio.Games DoSlice(); } - public void Bop(float beat, float length, int whoBops, int whoBopsAuto) + public void Bop(double beat, float length, int whoBops, int whoBopsAuto) { goBopSamurai = whoBopsAuto == (int)WhoBops.Samurai || whoBopsAuto == (int)WhoBops.Both; goBopChild = whoBopsAuto == (int)WhoBops.Children || whoBopsAuto == (int)WhoBops.Both; @@ -188,7 +188,7 @@ namespace HeavenStudio.Games public void DoStep() { - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_launchThrough"); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_launchThrough"); player.Step(false); launcher.GetComponent().Play("Launch", -1, 0); } @@ -205,17 +205,17 @@ namespace HeavenStudio.Games { launcher.GetComponent().Play("UnStep", -1, 0); } - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_through"); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_through"); player.Slash(); } - public void Bop(float beat, float length) + public void Bop(double beat, float length) { bop.length = length; bop.startBeat = beat; } - public void ObjectIn(float beat, int type = (int) ObjectType.Melon, int value = 1, bool funnyMinecraft = false) + public void ObjectIn(double beat, int type = (int) ObjectType.Melon, int value = 1, bool funnyMinecraft = false) { var mobj = GameObject.Instantiate(objectPrefab, objectHolder); var mobjDat = mobj.GetComponent(); @@ -225,10 +225,10 @@ namespace HeavenStudio.Games mobj.SetActive(true); - Jukebox.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_in00"); + SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_in00"); } - public NtrSamuraiChild CreateChild(float beat) + public NtrSamuraiChild CreateChild(double beat) { var mobj = GameObject.Instantiate(childParent, objectHolder); var mobjDat = mobj.GetComponent(); diff --git a/Assets/Scripts/Games/SeeSaw/SeeSaw.cs b/Assets/Scripts/Games/SeeSaw/SeeSaw.cs index 9ec72ef2..c1d8bd29 100644 --- a/Assets/Scripts/Games/SeeSaw/SeeSaw.cs +++ b/Assets/Scripts/Games/SeeSaw/SeeSaw.cs @@ -1,6 +1,7 @@ using HeavenStudio.Util; using System.Collections.Generic; using UnityEngine; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -67,7 +68,7 @@ namespace HeavenStudio.Games.Loaders new Param("colorTo", SeeSaw.defaultBGColor, "End Color (Top)", "The color the background will end at."), new Param("colorFrom2", SeeSaw.defaultBGColorBottom, "Start Color (Bottom)", "The color the background will start at."), new Param("colorTo2", SeeSaw.defaultBGColorBottom, "End Color (Bottom)", "The color the background will end at."), - new Param("ease", EasingFunction.Ease.Linear, "Ease", "The ease of the fade.") + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "The ease of the fade.") } }, new GameAction("bop", "Bop") @@ -170,9 +171,9 @@ namespace HeavenStudio.Games [NonSerialized] public bool sawShouldBop; [NonSerialized] public bool seeShouldBop; GameEvent bop = new GameEvent(); - float bgColorStartBeat; + double bgColorStartBeat; float bgColorLength; - EasingFunction.Ease lastEase; + Util.EasingFunction.Ease lastEase; Color colorFrom; Color colorTo; Color colorFrom2; @@ -187,7 +188,7 @@ namespace HeavenStudio.Games private int currentJumpIndex; - private List allJumpEvents = new List(); + private List allJumpEvents = new List(); public static SeeSaw instance; @@ -195,10 +196,10 @@ namespace HeavenStudio.Games { instance = this; if (allJumpEvents.Count > 0) return; - GrabJumpEvents(Conductor.instance.songPositionInBeats); + GrabJumpEvents(Conductor.instance.songPositionInBeatsAsDouble); } - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { GrabJumpEvents(beat); } @@ -230,11 +231,11 @@ namespace HeavenStudio.Games } } - private void GrabJumpEvents(float beat) + private void GrabJumpEvents(double beat) { Debug.Log("Beat: " + beat); var jumpEvents = EventCaller.GetAllInGameManagerList("seeSaw", new string[] { "longLong", "longShort", "shortLong", "shortShort" }); - List tempEvents = new List(); + List tempEvents = new List(); for (int i = 0; i < jumpEvents.Count; i++) { if (jumpEvents[i].beat >= beat) @@ -243,10 +244,10 @@ namespace HeavenStudio.Games } } tempEvents.Sort((s1, s2) => s1.beat.CompareTo(s2.beat)); - List tempEvents2 = new List(); + List tempEvents2 = new List(); if (tempEvents.Count > 1) { - float goodBeat = tempEvents[0].beat + tempEvents[0].length; + double goodBeat = tempEvents[0].beat + tempEvents[0].length; for (int i = 1; i < tempEvents.Count; i++) { if (tempEvents[i].beat != goodBeat) @@ -278,7 +279,7 @@ namespace HeavenStudio.Games float normalizedBeat = cond.GetPositionFromBeat(bgColorStartBeat, bgColorLength); if (normalizedBeat > 0 && normalizedBeat <= 1) { - EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase); float newColorR = func(colorFrom.r, colorTo.r, normalizedBeat); float newColorG = func(colorFrom.g, colorTo.g, normalizedBeat); float newColorB = func(colorFrom.b, colorTo.b, normalizedBeat); @@ -297,13 +298,13 @@ namespace HeavenStudio.Games || allJumpEvents[currentJumpIndex].beat > allJumpEvents[currentJumpIndex - 1].length + ((allJumpEvents[currentJumpIndex].datamodel is "seeSaw/longShort" or "seeSaw/shortShort") ? 1 : 2)) { bool inJump = DetermineStartLandInOrOut(); - if (cond.songPositionInBeats >= allJumpEvents[currentJumpIndex].beat - (inJump ? 1 : 2)) + if (cond.songPositionInBeatsAsDouble >= allJumpEvents[currentJumpIndex].beat - (inJump ? 1 : 2)) { - if (canPrepare && cond.songPositionInBeats < allJumpEvents[currentJumpIndex].beat) + if (canPrepare && cond.songPositionInBeatsAsDouble < allJumpEvents[currentJumpIndex].beat) { - float beatToJump = allJumpEvents[currentJumpIndex].beat - (inJump ? 1 : 2); - Jukebox.PlayOneShotGame("seeSaw/prepareHigh", beatToJump); + float beatToJump = (float)allJumpEvents[currentJumpIndex].beat - (inJump ? 1 : 2); + SoundByte.PlayOneShotGame("seeSaw/prepareHigh", beatToJump); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beatToJump, delegate { see.SetState(inJump ? SeeSawGuy.JumpState.StartJumpIn : SeeSawGuy.JumpState.StartJump, beatToJump); see.canBop = false; }) @@ -349,13 +350,13 @@ namespace HeavenStudio.Games } } - public void Choke(float beat, float length, bool seeChoke, bool sawChoke) + public void Choke(double beat, float length, bool seeChoke, bool sawChoke) { if (seeChoke) see.Choke(beat, length); if (sawChoke) saw.Choke(beat, length); } - public void Bop(float beat, float length, bool bopSee, bool bopSaw, bool autoSee, bool autoSaw, bool strumSee, bool strumSaw) + public void Bop(double beat, float length, bool bopSee, bool bopSaw, bool autoSee, bool autoSaw, bool strumSee, bool strumSaw) { seeShouldBop = autoSee; sawShouldBop = autoSaw; @@ -382,7 +383,7 @@ namespace HeavenStudio.Games } } - public void ChangeColor(float beat, float length, Color color1, Color color2, Color color3, Color color4, int ease) + public void ChangeColor(double beat, float length, Color color1, Color color2, Color color3, Color color4, int ease) { bgColorStartBeat = beat; bgColorLength = length; @@ -390,10 +391,10 @@ namespace HeavenStudio.Games colorTo = color2; colorFrom2 = color3; colorTo2 = color4; - lastEase = (EasingFunction.Ease)ease; + lastEase = (Util.EasingFunction.Ease)ease; } - public void LongLong(float beat, bool high, float height) + public void LongLong(double beat, bool high, float height) { if (see.dead || saw.dead) return; if (currentJumpIndex != 0) @@ -443,7 +444,7 @@ namespace HeavenStudio.Games if (currentJumpIndex >= allJumpEvents.Count || allJumpEvents[currentJumpIndex].beat != beat + 4) { saw.canBop = true; - Jukebox.PlayOneShotGame("seeSaw/otherLand", beat + 4); + SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + 4); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + 3.75f, delegate { see.canBop = true; }), @@ -453,7 +454,7 @@ namespace HeavenStudio.Games } } - public void LongShort(float beat, bool high, float height) + public void LongShort(double beat, bool high, float height) { if (see.dead || saw.dead) return; if (currentJumpIndex != 0) @@ -503,7 +504,7 @@ namespace HeavenStudio.Games { saw.canBop = true; float beatLength = see.ShouldEndJumpOut() ? 4 : 3; - Jukebox.PlayOneShotGame("seeSaw/otherLand", beat + beatLength); + SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + beatLength); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + beatLength - 0.25f, delegate { see.canBop = true; }), @@ -513,7 +514,7 @@ namespace HeavenStudio.Games } } - public void ShortLong(float beat, bool high, float height) + public void ShortLong(double beat, bool high, float height) { if (see.dead || saw.dead) return; if (currentJumpIndex != 0) @@ -563,7 +564,7 @@ namespace HeavenStudio.Games { saw.canBop = true; float beatLength = see.ShouldEndJumpOut() ? 3 : 2; - Jukebox.PlayOneShotGame("seeSaw/otherLand", beat + beatLength); + SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + beatLength); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + beatLength - 0.25f, delegate { see.canBop = true; }), @@ -573,7 +574,7 @@ namespace HeavenStudio.Games } } - public void ShortShort(float beat, bool high, float height) + public void ShortShort(double beat, bool high, float height) { if (see.dead || saw.dead) return; if (currentJumpIndex != 0) @@ -622,7 +623,7 @@ namespace HeavenStudio.Games if (currentJumpIndex >= allJumpEvents.Count || allJumpEvents[currentJumpIndex].beat != beat + 2) { saw.canBop = true; - Jukebox.PlayOneShotGame("seeSaw/otherLand", beat + 2); + SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + 2); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + 1.75f, delegate { see.canBop = true; }), @@ -664,7 +665,7 @@ namespace HeavenStudio.Games return default(SuperCurveObject.Path); } - void DetermineSeeJump(float beat, bool miss = false, bool high = false, float height = 0) + void DetermineSeeJump(double beat, bool miss = false, bool high = false, float height = 0) { if (currentJumpIndex >= 0 && (allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/longLong" || allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/shortLong")) @@ -721,7 +722,7 @@ namespace HeavenStudio.Games } } - void DetermineSawJump(float beat, bool high, float height) + void DetermineSawJump(double beat, bool high, float height) { if (currentJumpIndex >= 0) { @@ -769,7 +770,7 @@ namespace HeavenStudio.Games return currentJumpIndex < allJumpEvents.Count && allJumpEvents[currentJumpIndex].beat == allJumpEvents[currentJumpIndex - 1].beat + allJumpEvents[currentJumpIndex - 1].length; } - public void SpawnOrbs(bool white, float beat) + public void SpawnOrbs(bool white, double beat) { ParticleSystem ps = null; if (white) @@ -793,7 +794,7 @@ namespace HeavenStudio.Games if (state <= -1f || state >= 1f) { seeSawAnim.DoScaledAnimationAsync("Bad", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/ow"); + SoundByte.PlayOneShotGame("seeSaw/ow"); saw.Land(SeeSawGuy.LandType.Barely, true); DetermineSeeJump(caller.timer + caller.startBeat, true); return; @@ -805,15 +806,15 @@ namespace HeavenStudio.Games && allJumpEvents[currentJumpIndex].beat == allJumpEvents[currentJumpIndex - 1].beat + allJumpEvents[currentJumpIndex - 1].length && allJumpEvents[currentJumpIndex]["high"]) { - Jukebox.PlayOneShotGame("seeSaw/playerHighJump"); + SoundByte.PlayOneShotGame("seeSaw/playerHighJump"); } else { - Jukebox.PlayOneShotGame("seeSaw/playerLongJump"); + SoundByte.PlayOneShotGame("seeSaw/playerLongJump"); } - Jukebox.PlayOneShotGame("seeSaw/playerVoiceLong1"); - Jukebox.PlayOneShotGame("seeSaw/just"); - Jukebox.PlayOneShotGame("seeSaw/playerVoiceLong2", caller.timer + caller.startBeat + 1f, 1, 1, false, false, 0.0104166666f); + SoundByte.PlayOneShotGame("seeSaw/playerVoiceLong1"); + SoundByte.PlayOneShotGame("seeSaw/just"); + SoundByte.PlayOneShotGame("seeSaw/playerVoiceLong2", caller.timer + caller.startBeat + 1f, 1, 1, false, false, 0.0104166666f); } public void JustLongHigh(PlayerActionEvent caller, float state) @@ -822,36 +823,36 @@ namespace HeavenStudio.Games if (state <= -1f || state >= 1f) { seeSawAnim.DoScaledAnimationAsync("Bad", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/ow"); + SoundByte.PlayOneShotGame("seeSaw/ow"); saw.Land(SeeSawGuy.LandType.Barely, true); DetermineSeeJump(caller.timer + caller.startBeat, true, true, allJumpEvents[currentJumpIndex - 1]["height"]); return; } DetermineSeeJump(caller.timer + caller.startBeat, false, true, allJumpEvents[currentJumpIndex - 1]["height"]); seeSawAnim.DoScaledAnimationAsync("Lightning", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/explosionBlack"); + SoundByte.PlayOneShotGame("seeSaw/explosionBlack"); saw.Land(SeeSawGuy.LandType.Big, true); if (currentJumpIndex >= 0 && currentJumpIndex != allJumpEvents.Count && allJumpEvents[currentJumpIndex].beat == allJumpEvents[currentJumpIndex - 1].beat + allJumpEvents[currentJumpIndex - 1].length && allJumpEvents[currentJumpIndex]["high"]) { - Jukebox.PlayOneShotGame("seeSaw/playerHighJump"); + SoundByte.PlayOneShotGame("seeSaw/playerHighJump"); } else { - Jukebox.PlayOneShotGame("seeSaw/playerLongJump"); + SoundByte.PlayOneShotGame("seeSaw/playerLongJump"); } - Jukebox.PlayOneShotGame("seeSaw/playerVoiceLong1"); - Jukebox.PlayOneShotGame("seeSaw/just"); - Jukebox.PlayOneShotGame("seeSaw/playerVoiceLong2", caller.timer + caller.startBeat + 1f, 1, 1, false, false, 0.0104166666f); + SoundByte.PlayOneShotGame("seeSaw/playerVoiceLong1"); + SoundByte.PlayOneShotGame("seeSaw/just"); + SoundByte.PlayOneShotGame("seeSaw/playerVoiceLong2", caller.timer + caller.startBeat + 1f, 1, 1, false, false, 0.0104166666f); } public void MissLong(PlayerActionEvent caller) { seeSawAnim.transform.localScale = new Vector3(1, 1, 1); seeSawAnim.DoScaledAnimationAsync("Bad", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/miss"); + SoundByte.PlayOneShotGame("seeSaw/miss"); saw.Land(SeeSawGuy.LandType.Miss, true); DetermineSeeJump(caller.timer + caller.startBeat, true, allJumpEvents[currentJumpIndex - 1]["high"], allJumpEvents[currentJumpIndex - 1]["height"]); } @@ -862,7 +863,7 @@ namespace HeavenStudio.Games if (state <= -1f || state >= 1f) { seeSawAnim.DoScaledAnimationAsync("Bad", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/ow"); + SoundByte.PlayOneShotGame("seeSaw/ow"); saw.Land(SeeSawGuy.LandType.Barely, false); DetermineSeeJump(caller.timer + caller.startBeat, true); return; @@ -874,15 +875,15 @@ namespace HeavenStudio.Games && allJumpEvents[currentJumpIndex].beat == allJumpEvents[currentJumpIndex - 1].beat + allJumpEvents[currentJumpIndex - 1].length && allJumpEvents[currentJumpIndex]["high"]) { - Jukebox.PlayOneShotGame("seeSaw/playerHighJump"); + SoundByte.PlayOneShotGame("seeSaw/playerHighJump"); } else { - Jukebox.PlayOneShotGame("seeSaw/playerShortJump"); + SoundByte.PlayOneShotGame("seeSaw/playerShortJump"); } - Jukebox.PlayOneShotGame("seeSaw/playerVoiceShort1"); - Jukebox.PlayOneShotGame("seeSaw/just"); - Jukebox.PlayOneShotGame("seeSaw/playerVoiceShort2", caller.timer + caller.startBeat + 0.5f); + SoundByte.PlayOneShotGame("seeSaw/playerVoiceShort1"); + SoundByte.PlayOneShotGame("seeSaw/just"); + SoundByte.PlayOneShotGame("seeSaw/playerVoiceShort2", caller.timer + caller.startBeat + 0.5f); } public void JustShortHigh(PlayerActionEvent caller, float state) @@ -891,36 +892,36 @@ namespace HeavenStudio.Games if (state <= -1f || state >= 1f) { seeSawAnim.DoScaledAnimationAsync("Bad", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/ow"); + SoundByte.PlayOneShotGame("seeSaw/ow"); saw.Land(SeeSawGuy.LandType.Barely, false); DetermineSeeJump(caller.timer + caller.startBeat, true, true, allJumpEvents[currentJumpIndex - 1]["height"]); return; } DetermineSeeJump(caller.timer + caller.startBeat, false, true, allJumpEvents[currentJumpIndex - 1]["height"]); seeSawAnim.DoScaledAnimationAsync("Lightning", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/explosionWhite"); + SoundByte.PlayOneShotGame("seeSaw/explosionWhite"); saw.Land(SeeSawGuy.LandType.Big, false); if (currentJumpIndex >= 0 && currentJumpIndex != allJumpEvents.Count && allJumpEvents[currentJumpIndex].beat == allJumpEvents[currentJumpIndex - 1].beat + allJumpEvents[currentJumpIndex - 1].length && allJumpEvents[currentJumpIndex]["high"]) { - Jukebox.PlayOneShotGame("seeSaw/playerHighJump"); + SoundByte.PlayOneShotGame("seeSaw/playerHighJump"); } else { - Jukebox.PlayOneShotGame("seeSaw/playerShortJump"); + SoundByte.PlayOneShotGame("seeSaw/playerShortJump"); } - Jukebox.PlayOneShotGame("seeSaw/playerVoiceShort1"); - Jukebox.PlayOneShotGame("seeSaw/just"); - Jukebox.PlayOneShotGame("seeSaw/playerVoiceShort2", caller.timer + caller.startBeat + 0.5f); + SoundByte.PlayOneShotGame("seeSaw/playerVoiceShort1"); + SoundByte.PlayOneShotGame("seeSaw/just"); + SoundByte.PlayOneShotGame("seeSaw/playerVoiceShort2", caller.timer + caller.startBeat + 0.5f); } public void MissShort(PlayerActionEvent caller) { seeSawAnim.transform.localScale = new Vector3(1, 1, 1); seeSawAnim.DoScaledAnimationAsync("Bad", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/miss"); + SoundByte.PlayOneShotGame("seeSaw/miss"); saw.Land(SeeSawGuy.LandType.Miss, false); DetermineSeeJump(caller.timer + caller.startBeat, true, allJumpEvents[currentJumpIndex - 1]["high"], allJumpEvents[currentJumpIndex - 1]["height"]); } diff --git a/Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs b/Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs index d08d272f..9a107916 100644 --- a/Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs +++ b/Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs @@ -42,15 +42,15 @@ namespace HeavenStudio.Games.Scripts_SeeSaw Path currentPath; Path cameraPath; SeeSaw game; - float startBeat; - float heightLastFrame; + double startBeat; + double heightLastFrame; [NonSerialized] public bool canBop = true; [SerializeField] Transform landOutTrans; public Transform landInTrans; [SerializeField] Transform groundTrans; bool hasChangedAnimMidAir; [SerializeField] ParticleSystem deathParticle; - float wantChoke = -1; + double wantChoke = -1; float wantChokeLength; [SerializeField] private Animator invertAnim; @@ -67,7 +67,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw { var cond = Conductor.instance; - float currentBeat = cond.songPositionInBeats; + double currentBeat = cond.songPositionInBeatsAsDouble; if (cond.isPlaying && !cond.isPaused) { @@ -76,7 +76,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw default: return; case JumpState.StartJump: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, currentBeat), out float height, startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), out double height, startBeat); if (height < heightLastFrame && !hasChangedAnimMidAir) { anim.Play("Jump_OutOut_Fall", 0, 0); @@ -86,7 +86,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw heightLastFrame = height; break; case JumpState.StartJumpIn: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, currentBeat), out float heightIn, startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), out double heightIn, startBeat); if (heightIn < heightLastFrame && !hasChangedAnimMidAir) { anim.Play("Jump_InIn_Fall", 0, 0); @@ -96,7 +96,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw heightLastFrame = heightIn; break; case JumpState.OutOut: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, currentBeat), startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat); if (currentBeat >= startBeat + 1 && !hasChangedAnimMidAir) { anim.Play("Jump_OutOut_Fall", 0, 0); @@ -105,7 +105,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw break; case JumpState.InIn: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, currentBeat), startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat); if (currentBeat >= startBeat + 0.5f && !hasChangedAnimMidAir) { anim.Play("Jump_InIn_Fall", 0, 0); @@ -113,7 +113,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw } break; case JumpState.InOut: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, currentBeat), startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat); if (currentBeat >= startBeat + 0.5f) { if (!hasChangedAnimMidAir) anim.Play("Jump_InOut_Tuck", 0, 0); @@ -122,7 +122,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw } break; case JumpState.OutIn: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, currentBeat), startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat); if (currentBeat >= startBeat + 1f) { if (!hasChangedAnimMidAir) anim.Play("Jump_OutIn_Tuck", 0, 0); @@ -132,13 +132,13 @@ namespace HeavenStudio.Games.Scripts_SeeSaw break; case JumpState.EndJumpOut: case JumpState.EndJumpIn: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, currentBeat), startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat); break; case JumpState.HighOutOut: case JumpState.HighOutIn: case JumpState.HighInOut: case JumpState.HighInIn: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, currentBeat), startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat); break; } } @@ -148,7 +148,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw { var cond = Conductor.instance; - float currentBeat = cond.songPositionInBeats; + double currentBeat = cond.songPositionInBeatsAsDouble; if (!see && game.cameraMove && cond.isPlaying && !cond.isPaused) { @@ -160,7 +160,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw case JumpState.HighOutIn: case JumpState.HighInOut: case JumpState.HighInIn: - float newCamY = Mathf.Max(GetPathPositionFromBeat(cameraPath, Mathf.Max(startBeat, currentBeat), startBeat).y, 0); + float newCamY = Math.Max(GetPathPositionFromBeat(cameraPath, Math.Max(startBeat, currentBeat), startBeat).y, 0); GameCamera.additionalPosition = new Vector3(0, newCamY, 0); break; } @@ -168,7 +168,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw } - public void Choke(float beat, float length) + public void Choke(double beat, float length) { if (!canBop || currentState != JumpState.None || dead) { @@ -178,7 +178,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw } dead = true; anim.DoScaledAnimationAsync("Choke_" + (see ? "See" : "Saw") + "_Intro", 0.5f); - Jukebox.PlayOneShotGame("seeSaw/explosion" + (see ? "Black" : "White"), beat + length); + SoundByte.PlayOneShotGame("seeSaw/explosion" + (see ? "Black" : "White"), beat + length); BeatAction.New(gameObject, new List() { new BeatAction.Action(beat + length - 1, delegate { invertAnim.DoScaledAnimationAsync("Invert", 0.5f); }), @@ -212,7 +212,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw case JumpState.EndJumpIn: transform.position = groundTrans.position; SetState(JumpState.None, 0); - if (wantChoke >= Conductor.instance.songPositionInBeats - 0.25f && wantChoke <= Conductor.instance.songPositionInBeats + 0.25f) + if (wantChoke >= Conductor.instance.songPositionInBeatsAsDouble - 0.25f && wantChoke <= Conductor.instance.songPositionInBeatsAsDouble + 0.25f) { Choke(wantChoke, wantChokeLength); } @@ -228,7 +228,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw } if (landType is LandType.Big && !see) { - game.SpawnOrbs(!landedOut, Conductor.instance.songPositionInBeats); + game.SpawnOrbs(!landedOut, Conductor.instance.songPositionInBeatsAsDouble); } string landOut = landedOut ? "Out" : "In"; string typeOfLanding = ""; @@ -253,7 +253,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw string getUpAnim = "GetUp_" + landOut + typeOfLanding; BeatAction.New(gameObject, new List() { - new BeatAction.Action(Conductor.instance.songPositionInBeats + (getUpOut ? 1f : 0.5f), delegate { anim.DoScaledAnimationAsync(getUpAnim, 0.5f); }) + new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + (getUpOut ? 1f : 0.5f), delegate { anim.DoScaledAnimationAsync(getUpAnim, 0.5f); }) }); } transform.position = landedOut ? landOutTrans.position : landInTrans.position; @@ -275,7 +275,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw } } - public void SetState(JumpState state, float beat, bool miss = false, float height = 0) + public void SetState(JumpState state, double beat, bool miss = false, float height = 0) { lastState = currentState; currentState = state; diff --git a/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs b/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs index 2adb2f95..05373567 100644 --- a/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs +++ b/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs @@ -61,7 +61,7 @@ namespace HeavenStudio.Games { public struct QueuedGhost { - public float beat; + public double beat; public float length; public bool slowDown; public List volumes; @@ -83,7 +83,7 @@ namespace HeavenStudio.Games private static List queuedGhosts = new List(); private bool hasArrowLoaded; float movingLength; - float movingStartBeat; + double movingStartBeat; bool isMoving; string moveAnim; EasingFunction.Ease lastEase; @@ -121,7 +121,7 @@ namespace HeavenStudio.Games } if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN) && hasArrowLoaded) { - WhiffArrow(cond.songPositionInBeats); + WhiffArrow(cond.songPositionInBeatsAsDouble); } if (isMoving) { @@ -149,7 +149,7 @@ namespace HeavenStudio.Games hasArrowLoaded = true; } - public void MoveBow(float beat, float length, bool enter, int ease) + public void MoveBow(double beat, float length, bool enter, int ease) { movingStartBeat = beat; movingLength = length; @@ -158,7 +158,7 @@ namespace HeavenStudio.Games lastEase = (EasingFunction.Ease)ease; } - public static void PreSpawnGhost(float beat, float length, bool slowDown, int volume1, int volume2, int volume3, int volume4, int volume5, int volume6, int volume7) + public static void PreSpawnGhost(double beat, float length, bool slowDown, int volume1, int volume2, int volume3, int volume4, int volume5, int volume6, int volume7) { MultiSound.Play(new MultiSound.Sound[] { @@ -192,7 +192,7 @@ namespace HeavenStudio.Games } } - public void SpawnGhost(float beat, float length, bool slowDown, List volumes) + public void SpawnGhost(double beat, float length, bool slowDown, List volumes) { if (slowDown) { @@ -210,8 +210,8 @@ namespace HeavenStudio.Games List ghostSpawns = new List(); for(int i = 0; i < 7; i++) { - float spawnBeat = beat + length * i; - if (spawnBeat >= Conductor.instance.songPositionInBeats) + double spawnBeat = beat + length * i; + if (spawnBeat >= Conductor.instance.songPositionInBeatsAsDouble) { SneakySpiritsGhost spawnedGhost = Instantiate(movingGhostPrefab, ghostPositions[i], false); spawnedGhost.transform.position = new Vector3(spawnedGhost.transform.position.x, spawnedGhost.transform.position.y - (1 - volumes[i] * 0.01f) * 2.5f, spawnedGhost.transform.position.z); @@ -220,14 +220,14 @@ namespace HeavenStudio.Games } } - void WhiffArrow(float beat) + void WhiffArrow(double beat) { GameObject spawnedArrow = Instantiate(arrowMissPrefab, transform); spawnedArrow.SetActive(true); spawnedArrow.GetComponent().DoScaledAnimationAsync("ArrowRecoil", 0.5f); bowAnim.DoScaledAnimationAsync("BowRecoil", 0.25f); hasArrowLoaded = false; - Jukebox.PlayOneShotGame("sneakySpirits/arrowMiss", -1, 2); + SoundByte.PlayOneShotGame("sneakySpirits/arrowMiss", -1, 2); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + 3f, delegate { @@ -244,7 +244,7 @@ namespace HeavenStudio.Games if (!hasArrowLoaded) return; if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("sneakySpirits/ghostScared"); + SoundByte.PlayOneShotGame("sneakySpirits/ghostScared"); WhiffArrow(caller.startBeat + caller.timer); GameObject spawnedGhost = Instantiate(ghostMissPrefab, transform); spawnedGhost.SetActive(true); @@ -268,7 +268,7 @@ namespace HeavenStudio.Games if (!hasArrowLoaded) return; if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("sneakySpirits/ghostScared"); + SoundByte.PlayOneShotGame("sneakySpirits/ghostScared"); WhiffArrow(caller.startBeat + caller.timer); GameObject spawnedGhost = Instantiate(ghostMissPrefab, transform); spawnedGhost.SetActive(true); @@ -311,7 +311,7 @@ namespace HeavenStudio.Games spawnedDeath.startBeat = caller.startBeat + caller.timer; spawnedDeath.length = 1f; spawnedDeath.gameObject.SetActive(true); - Jukebox.PlayOneShotGame("sneakySpirits/hit"); + SoundByte.PlayOneShotGame("sneakySpirits/hit"); bowAnim.DoScaledAnimationAsync("BowRecoil", 0.25f); if (slowDown) { @@ -339,7 +339,7 @@ namespace HeavenStudio.Games void Miss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("sneakySpirits/ghostEscape"); + SoundByte.PlayOneShotGame("sneakySpirits/ghostEscape"); GameObject spawnedGhost = Instantiate(ghostMissPrefab, transform); spawnedGhost.SetActive(true); spawnedGhost.GetComponent().DoScaledAnimationAsync("GhostMiss", 0.5f); @@ -348,7 +348,7 @@ namespace HeavenStudio.Games new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { if (GameManager.instance.currentGame == "sneakySpirits") { - Jukebox.PlayOneShotGame("sneakySpirits/laugh", -1, 1.2f); + SoundByte.PlayOneShotGame("sneakySpirits/laugh", -1, 1.2f); spawnedGhost.GetComponent().DoScaledAnimationAsync("GhostLaugh", 0.25f); } }), diff --git a/Assets/Scripts/Games/SneakySpirits/SneakySpiritsGhost.cs b/Assets/Scripts/Games/SneakySpirits/SneakySpiritsGhost.cs index a4223740..f8b61d89 100644 --- a/Assets/Scripts/Games/SneakySpirits/SneakySpiritsGhost.cs +++ b/Assets/Scripts/Games/SneakySpirits/SneakySpiritsGhost.cs @@ -16,7 +16,7 @@ namespace HeavenStudio.Games.Scripts_SneakySpirits game = SneakySpirits.instance; } - public void Init(float spawnBeat, float length) + public void Init(double spawnBeat, float length) { BeatAction.New(game.gameObject, new List() { diff --git a/Assets/Scripts/Games/SneakySpirits/SneakySpiritsGhostDeath.cs b/Assets/Scripts/Games/SneakySpirits/SneakySpiritsGhostDeath.cs index 283f5ce1..ca8c825c 100644 --- a/Assets/Scripts/Games/SneakySpirits/SneakySpiritsGhostDeath.cs +++ b/Assets/Scripts/Games/SneakySpirits/SneakySpiritsGhostDeath.cs @@ -8,7 +8,7 @@ namespace HeavenStudio.Games.Scripts_SneakySpirits public class SneakySpiritsGhostDeath : MonoBehaviour { public string animToPlay; - public float startBeat; + public double startBeat; public float length; [SerializeField] Animator anim; diff --git a/Assets/Scripts/Games/SoundEffects.cs b/Assets/Scripts/Games/SoundEffects.cs index 9665c4b6..8beffb07 100644 --- a/Assets/Scripts/Games/SoundEffects.cs +++ b/Assets/Scripts/Games/SoundEffects.cs @@ -18,7 +18,7 @@ namespace HeavenStudio.Games sound += "1"; else sound += "2"; - Jukebox.PlayOneShot("count-ins/" + sound); + SoundByte.PlayOneShot("count-ins/" + sound); } public enum CountInType { Normal, Alt, Cowbell } @@ -41,7 +41,7 @@ namespace HeavenStudio.Games } return sounds; } - public static void FourBeatCountIn(float beat, float length, int type) + public static void FourBeatCountIn(double beat, float length, int type) { string[] sounds = { "one", "two", "three", "four" }; sounds = GetCountInSounds(sounds, (CountInType)type); @@ -55,7 +55,7 @@ namespace HeavenStudio.Games }, false); } - public static void EightBeatCountIn(float beat, float length, int type) + public static void EightBeatCountIn(double beat, float length, int type) { string[] sounds = { "one", "two", "one", "two", "three", "four" }; sounds = GetCountInSounds(sounds, (CountInType)type); @@ -73,10 +73,10 @@ namespace HeavenStudio.Games public static void Cowbell() { - Jukebox.PlayOneShot("count-ins/cowbell"); + SoundByte.PlayOneShot("count-ins/cowbell"); } - public static void Ready(float beat, float length) + public static void Ready(double beat, float length) { MultiSound.Play(new MultiSound.Sound[] { @@ -87,7 +87,7 @@ namespace HeavenStudio.Games public static void And() { - Jukebox.PlayOneShot("count-ins/and"); + SoundByte.PlayOneShot("count-ins/and"); } public static void Go(bool alt) @@ -97,7 +97,7 @@ namespace HeavenStudio.Games sound += "1"; else sound += "2"; - Jukebox.PlayOneShot(sound); + SoundByte.PlayOneShot(sound); } } diff --git a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs index 46d77257..beef9b92 100644 --- a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs +++ b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs @@ -148,7 +148,7 @@ namespace HeavenStudio.Games bool grampsCanBop = true; public bool spaceGrampsShouldBop = false; float shootingStarLength; - float shootingStarStartBeat; + double shootingStarStartBeat; EasingFunction.Ease lastEase; bool isShootingStar; bool grampsLoopingAnim; @@ -213,7 +213,7 @@ namespace HeavenStudio.Games { if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) { - Jukebox.PlayOneShotGame("spaceDance/inputBad"); + SoundByte.PlayOneShotGame("spaceDance/inputBad"); DancerP.DoScaledAnimationAsync("PunchDo", 0.5f); Gramps.Play("GrampsOhFuck", 0, 0); // Look at this later, sound effect has some weird clipping on it sometimes?? popping. like. fucking popopop idk why its doing that its fine theres no sample weirdness ughh @@ -221,13 +221,13 @@ namespace HeavenStudio.Games if (PlayerInput.GetSpecificDirectionDown(1) && !IsExpectingInputNow(InputType.DIRECTION_RIGHT_DOWN)) { DancerP.DoScaledAnimationAsync("TurnRightDo", 0.5f); - Jukebox.PlayOneShotGame("spaceDance/inputBad"); + SoundByte.PlayOneShotGame("spaceDance/inputBad"); Gramps.Play("GrampsOhFuck", 0, 0); } if (PlayerInput.GetSpecificDirectionDown(2) && !IsExpectingInputNow(InputType.DIRECTION_DOWN_DOWN)) { DancerP.DoScaledAnimationAsync("SitDownDo", 0.5f); - Jukebox.PlayOneShotGame("spaceDance/inputBad"); + SoundByte.PlayOneShotGame("spaceDance/inputBad"); Gramps.Play("GrampsOhFuck", 0, 0); } } @@ -243,7 +243,7 @@ namespace HeavenStudio.Games scrollBeat = Time.realtimeSinceStartup; } - public void GrampsAnimations(float beat, int type, bool looping) + public void GrampsAnimations(double beat, int type, bool looping) { switch (type) { @@ -283,7 +283,7 @@ namespace HeavenStudio.Games } } - void GrampsSniffLoop(float beat) + void GrampsSniffLoop(double beat) { if (!grampsLoopingAnim || !grampsSniffing) return; spaceGrampsShouldBop = false; @@ -317,7 +317,7 @@ namespace HeavenStudio.Games }); } - void GrampsTalkLoop(float beat) + void GrampsTalkLoop(double beat) { if (!grampsLoopingAnim || grampsSniffing) return; spaceGrampsShouldBop = false; @@ -365,15 +365,15 @@ namespace HeavenStudio.Games }); } - public void UpdateShootingStar(float beat, float length, int ease) + public void UpdateShootingStar(double beat, float length, EasingFunction.Ease ease) { - lastEase = (EasingFunction.Ease)ease; + lastEase = ease; shootingStarLength = length; shootingStarStartBeat = beat; isShootingStar = true; } - public void DoTurnRight(float beat, int whoSpeaks, bool grampsTurns) + public void DoTurnRight(double beat, int whoSpeaks, bool grampsTurns) { canBop = false; if (grampsTurns) grampsCanBop = false; @@ -435,7 +435,7 @@ namespace HeavenStudio.Games } - public void DoSitDown(float beat, int whoSpeaks, bool grampsSits) + public void DoSitDown(double beat, int whoSpeaks, bool grampsSits) { canBop = false; if (grampsSits) grampsCanBop = false; @@ -500,7 +500,7 @@ namespace HeavenStudio.Games } - public void DoPunch(float beat, int whoSpeaks, bool grampsPunches) + public void DoPunch(double beat, int whoSpeaks, bool grampsPunches) { canBop = false; if (grampsPunches) grampsCanBop = false; @@ -586,7 +586,7 @@ namespace HeavenStudio.Games } - public void EpicBop(float beat, float length, bool autoDancers, bool dancers, bool autoGramps, bool gramps) + public void EpicBop(double beat, float length, bool autoDancers, bool dancers, bool autoGramps, bool gramps) { shouldBop = autoDancers; spaceGrampsShouldBop = autoGramps; @@ -650,7 +650,7 @@ namespace HeavenStudio.Games { if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("spaceDance/inputBad"); + SoundByte.PlayOneShotGame("spaceDance/inputBad"); DancerP.DoScaledAnimationAsync("TurnRightDo", 0.5f); Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); return; @@ -660,13 +660,13 @@ namespace HeavenStudio.Games public void RightSuccess() { - Jukebox.PlayOneShotGame("spaceDance/inputGood"); + SoundByte.PlayOneShotGame("spaceDance/inputGood"); DancerP.DoScaledAnimationAsync("TurnRightDo", 0.5f); } public void RightMiss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("spaceDance/inputBad2"); + SoundByte.PlayOneShotGame("spaceDance/inputBad2"); DancerP.DoScaledAnimationAsync("Ouch", 0.5f); Hit.Play("HitTurn", -1, 0); Gramps.DoScaledAnimationAsync("GrampsMiss", 0.5f); @@ -676,7 +676,7 @@ namespace HeavenStudio.Games { if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("spaceDance/inputBad"); + SoundByte.PlayOneShotGame("spaceDance/inputBad"); DancerP.DoScaledAnimationAsync("SitDownDo", 0.5f); Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); return; @@ -686,13 +686,13 @@ namespace HeavenStudio.Games public void SitSuccess() { - Jukebox.PlayOneShotGame("spaceDance/inputGood"); + SoundByte.PlayOneShotGame("spaceDance/inputGood"); DancerP.DoScaledAnimationAsync("SitDownDo", 0.5f); } public void SitMiss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("spaceDance/inputBad2"); + SoundByte.PlayOneShotGame("spaceDance/inputBad2"); DancerP.DoScaledAnimationAsync("Ouch", 0.5f); Hit.Play("HitSit", -1, 0); Gramps.DoScaledAnimationAsync("GrampsMiss", 0.5f); @@ -702,7 +702,7 @@ namespace HeavenStudio.Games { if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("spaceDance/inputBad"); + SoundByte.PlayOneShotGame("spaceDance/inputBad"); DancerP.DoScaledAnimationAsync("PunchDo", 0.5f); Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); return; @@ -712,13 +712,13 @@ namespace HeavenStudio.Games public void PunchSuccess() { - Jukebox.PlayOneShotGame("spaceDance/inputGood"); + SoundByte.PlayOneShotGame("spaceDance/inputGood"); DancerP.DoScaledAnimationAsync("PunchDo", 0.5f); } public void PunchMiss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("spaceDance/inputBad2"); + SoundByte.PlayOneShotGame("spaceDance/inputBad2"); DancerP.DoScaledAnimationAsync("Ouch", 0.5f); Hit.Play("HitPunch", -1, 0); Gramps.DoScaledAnimationAsync("GrampsMiss", 0.5f); diff --git a/Assets/Scripts/Games/SpaceSoccer/Ball.cs b/Assets/Scripts/Games/SpaceSoccer/Ball.cs index 237f5be6..55edff2e 100644 --- a/Assets/Scripts/Games/SpaceSoccer/Ball.cs +++ b/Assets/Scripts/Games/SpaceSoccer/Ball.cs @@ -1,11 +1,7 @@ -using System.Collections; -using System.Collections.Generic; +using System; using UnityEngine; -using NaughtyBezierCurves; using HeavenStudio.Util; -using UnityEngine.UIElements; -using DG.Tweening; namespace HeavenStudio.Games.Scripts_SpaceSoccer { @@ -23,9 +19,9 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer //[SerializeField] private BezierCurve3D toeCurve; [Header("Properties")] - public float startBeat; + public double startBeat; public State state; - public float nextAnimBeat; + public double nextAnimBeat; public float highKickSwing = 0f; private float lastSpriteRot; public bool canKick; @@ -41,12 +37,12 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer { lastRealPos = transform.localPosition; } - public void Init(Kicker kicker, float dispensedBeat) + public void Init(Kicker kicker, double dispensedBeat) { this.kicker = kicker; kicker.ball = this; kicker.dispenserBeat = dispensedBeat; - float currentBeat = Conductor.instance.songPositionInBeats; + double currentBeat = Conductor.instance.songPositionInBeatsAsDouble; kickPath = SpaceSoccer.instance.GetPath("Kick"); dispensePath = SpaceSoccer.instance.GetPath("Dispense"); highKickPath = SpaceSoccer.instance.GetPath("HighKick"); @@ -63,7 +59,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer return; } - var highKicks = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!"); + var highKicks = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!"); int numHighKicks = 0; //determine what state the ball was in for the previous kick. for(int i = 0; i < highKicks.Count; i++) @@ -77,7 +73,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer { //Debug.Log("Setting state to kicked"); state = State.Kicked; - float relativeBeat = currentBeat - dispensedBeat; + double relativeBeat = currentBeat - dispensedBeat; startBeat = dispensedBeat + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation. nextAnimBeat = startBeat + GetAnimLength(State.Kicked); kicker.kickTimes = (int)(relativeBeat - 0.1) - numHighKicks - 1; //every high kick has 2 kicks in the same time a regular keep-up does 3 kicks. @@ -85,7 +81,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer } else { - highKickSwing = highKicks[i].swing; + highKickSwing = highKicks[i]["swing"]; if (highKickSwing == 0f) highKickSwing = 0.5f; @@ -93,17 +89,17 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer { //Debug.Log("Setting state to high kick"); state = State.HighKicked; - float relativeBeat = highKicks[i].beat - dispensedBeat; - startBeat = dispensedBeat + Mathf.Ceil(relativeBeat); //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. + double relativeBeat = highKicks[i].beat - dispensedBeat; + startBeat = dispensedBeat + Math.Ceiling(relativeBeat); //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. nextAnimBeat = startBeat + GetAnimLength(State.HighKicked); - kicker.kickTimes = Mathf.CeilToInt(relativeBeat) - numHighKicks - 1; + kicker.kickTimes = (int)Math.Ceiling(relativeBeat) - numHighKicks - 1; break; } else { //Debug.Log("Setting state to toe"); state = State.Toe; - float relativeBeat = Mathf.Ceil(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. + 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. startBeat = dispensedBeat + relativeBeat; nextAnimBeat = startBeat + GetAnimLength(State.Toe); kicker.kickTimes = (int)(relativeBeat - GetAnimLength(State.HighKicked)) - numHighKicks; @@ -115,7 +111,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer { //Debug.Log("Defaulting to kicked state"); state = State.Kicked; - float relativeBeat = currentBeat - dispensedBeat; + double relativeBeat = currentBeat - dispensedBeat; startBeat = dispensedBeat + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation. nextAnimBeat = startBeat + GetAnimLength(State.Kicked); kicker.kickTimes = (int)(relativeBeat - 0.1) - numHighKicks - 1; @@ -126,7 +122,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer public void Kick(bool player) { if (player) - Jukebox.PlayOneShotGame("spaceSoccer/ballHit", -1, Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-38, 39), false)); + SoundByte.PlayOneShotGame("spaceSoccer/ballHit", -1, SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-38, 39), false)); lastSpriteRot = spriteHolder.transform.eulerAngles.z; @@ -184,7 +180,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer private void Update() { - float beat = Conductor.instance.songPositionInBeats; + double beat = Conductor.instance.songPositionInBeatsAsDouble; switch (state) //handle animations { case State.None: //the only time any ball should ever have this state is if it's the unused offscreen ball (which is the only reason this state exists) @@ -199,7 +195,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer //dispenseCurve.KeyPoints[0].transform.position = new Vector3(kicker.transform.GetChild(0).position.x - 6f, kicker.transform.GetChild(0).position.y - 6f); //dispenseCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.GetChild(0).position.x - 1f, kicker.transform.GetChild(0).position.y - 6f); //holder.transform.localPosition = dispenseCurve.GetPoint(normalizedBeatAnim); - holder.transform.localPosition = GetPathPositionFromBeat(dispensePath, Mathf.Max(beat, startBeat), out float height, startBeat); + holder.transform.localPosition = GetPathPositionFromBeat(dispensePath, Math.Max(beat, startBeat), out double height, startBeat); spriteHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(0f, -1440f, normalizedBeatAnim)); break; } @@ -221,7 +217,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer } //holder.transform.localPosition = kickCurve.GetPoint(normalizedBeatAnim); - holder.transform.localPosition = GetPathPositionFromBeat(kickPath, Mathf.Max(beat, startBeat), out float height, startBeat); + holder.transform.localPosition = GetPathPositionFromBeat(kickPath, Math.Max(beat, startBeat), out double height, startBeat); break; } case State.HighKicked: @@ -232,7 +228,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer //highKickCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.GetChild(0).position.x - 3.5f, kicker.transform.GetChild(0).position.y - 6f); //holder.transform.localPosition = highKickCurve.GetPoint(normalizedBeatAnim); - holder.transform.localPosition = GetPathPositionFromBeat(highKickPath, Mathf.Max(beat, startBeat), out float height, startBeat); + holder.transform.localPosition = GetPathPositionFromBeat(highKickPath, Math.Max(beat, startBeat), out double height, startBeat); spriteHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastSpriteRot, lastSpriteRot + 360f, normalizedBeatAnim)); break; } @@ -253,7 +249,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer } //holder.transform.localPosition = toeCurve.GetPoint(normalizedBeatAnim); - holder.transform.localPosition = GetPathPositionFromBeat(toePath, Mathf.Max(beat, startBeat), out float height, startBeat); + holder.transform.localPosition = GetPathPositionFromBeat(toePath, Math.Max(beat, startBeat), out double height, startBeat); break; } } diff --git a/Assets/Scripts/Games/SpaceSoccer/Kicker.cs b/Assets/Scripts/Games/SpaceSoccer/Kicker.cs index 652649a4..0f07d5a9 100644 --- a/Assets/Scripts/Games/SpaceSoccer/Kicker.cs +++ b/Assets/Scripts/Games/SpaceSoccer/Kicker.cs @@ -16,12 +16,12 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer private bool kickPrepare = false; public bool kickLeft; bool kickLeftWhiff; - public float dispenserBeat; //unused + public double dispenserBeat; //unused public int kickTimes = 0; public bool player; private string animName = "Enter"; private float animLength; - private float animStartBeat; + private double animStartBeat; private EasingFunction.Ease ease; bool stopBall; @@ -39,7 +39,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer anim = GetComponent(); } - public void SetAnimParams(float beat, float length, string anim, int easeToPut) + public void SetAnimParams(double beat, float length, string anim, int easeToPut) { animStartBeat = beat; animLength = length; @@ -50,7 +50,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer enterExitAnim.DoNormalizedAnimation(animName, newAnimPos); } - public void DispenseBall(float beat) + public void DispenseBall(double beat) { if (player) { @@ -58,8 +58,8 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer } else { - float beatToKick = beat + ball.GetAnimLength(Ball.State.Dispensing); - if (beatToKick < Conductor.instance.songPositionInBeats) beatToKick = ball.nextAnimBeat; + double beatToKick = beat + ball.GetAnimLength(Ball.State.Dispensing); + if (beatToKick < Conductor.instance.songPositionInBeatsAsDouble) beatToKick = ball.nextAnimBeat; if (ball.state == Ball.State.HighKicked) { BeatAction.New(this.gameObject, new List() @@ -85,7 +85,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer if (player) { - Jukebox.PlayOneShotGame("spaceSoccer/kick"); + SoundByte.PlayOneShotGame("spaceSoccer/kick"); } if (hit) @@ -183,12 +183,12 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer kickLeftWhiff = !kickLeftWhiff; } - if (player) Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1"); + if (player) SoundByte.PlayOneShotGame("spaceSoccer/highkicktoe1"); if (hit && ball) { ball.HighKick(); - if (player) Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1_hit"); + if (player) SoundByte.PlayOneShotGame("spaceSoccer/highkicktoe1_hit"); } } @@ -207,10 +207,10 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer if (player) { - Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3"); + SoundByte.PlayOneShotGame("spaceSoccer/highkicktoe3"); if (hit && ball) { - Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3_hit"); + SoundByte.PlayOneShotGame("spaceSoccer/highkicktoe3_hit"); } } @@ -239,17 +239,17 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer kickLeft = true; } - var highKicks = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!"); + var highKicks = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!"); for (int i = 0; i < highKicks.Count; i++) { - if ((highKicks[i].beat - 0.15f) <= Conductor.instance.songPositionInBeats && highKicks[i].beat + 1f > Conductor.instance.songPositionInBeats) + if ((highKicks[i].beat - 0.15f) <= Conductor.instance.songPositionInBeatsAsDouble && highKicks[i].beat + 1f > Conductor.instance.songPositionInBeatsAsDouble) { canHighKick = true; canKick = false; if (ball) { - ball.highKickSwing = highKicks[i].swing; + ball.highKickSwing = highKicks[i]["swing"]; if (ball.highKickSwing == 0f) ball.highKickSwing = 0.5f; } @@ -288,7 +288,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer } } - private void KickCheck(bool hit, bool overrideState = false, float beat = 0f) + private void KickCheck(bool hit, bool overrideState = false, double beat = 0f) { if (stopBall) return; if (canHighKick) @@ -336,7 +336,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer if (ball != null && stop) Destroy(ball.gameObject); } - void MissBall(float targetBeat) + void MissBall(double targetBeat) { if (stopBall) return; @@ -344,7 +344,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer ball = null; // queue the miss sound MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("spaceSoccer/missNeutral", targetBeat + (float)cond.SecsToBeats(Minigame.EndTime()-1, - cond.GetBpmAtBeat(targetBeat)), Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-75, 75), false)) }); + cond.GetBpmAtBeat(targetBeat)), SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-75, 75), false)) }); } private void KickJust(PlayerActionEvent caller, float state) diff --git a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs index 6d396588..bddff566 100644 --- a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs +++ b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs @@ -201,7 +201,7 @@ namespace HeavenStudio.Games [Header("Properties")] [SerializeField] SuperCurveObject.Path[] ballPaths; public bool ballDispensed; - float lastDispensedBeat; + double lastDispensedBeat; float scrollBeat; float scrollOffsetX; float scrollOffsetY; @@ -278,7 +278,7 @@ namespace HeavenStudio.Games } } - public void NPCKickersEnterOrExit(float beat, float length, int animToPut, int easeToPut, int amount, float xDistance, float yDistance, float zDistance, bool overrideEasing, int preset) + public void NPCKickersEnterOrExit(double beat, float length, int animToPut, int easeToPut, int amount, float xDistance, float yDistance, float zDistance, bool overrideEasing, int preset) { switch (preset) { @@ -310,9 +310,9 @@ namespace HeavenStudio.Games } } - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { - foreach(var entity in GameManager.instance.Beatmap.entities) + foreach(var entity in GameManager.instance.Beatmap.Entities) { if(entity.beat > beat) //the list is sorted based on the beat of the entity, so this should work fine. { @@ -348,9 +348,9 @@ namespace HeavenStudio.Games scrollBeat = Time.realtimeSinceStartup; } - public void EaseSpaceKickersPositions(float beat, float length, int ease, float xDistance, float yDistance, float zDistance) + public void EaseSpaceKickersPositions(double beat, float length, int ease, float xDistance, float yDistance, float zDistance) { - easeBeat = beat; + easeBeat = (float)beat; easeLength = length; lastEase = (EasingFunction.Ease)ease; lastPos = currentPos; @@ -368,7 +368,7 @@ namespace HeavenStudio.Games } } - public void MovePlayerKicker(float beat, float length, int ease, float xPos, float yPos, float zPos, int soundToPlay, int preset) + public void MovePlayerKicker(double beat, float length, int ease, float xPos, float yPos, float zPos, int soundToPlay, int preset) { switch (preset) { @@ -389,7 +389,7 @@ namespace HeavenStudio.Games soundToPlay = (int)LaunchSoundToPlay.LaunchEnd; break; } - easeBeatP = beat; + easeBeatP = (float)beat; easeLengthP = length; lastEaseP = (EasingFunction.Ease)ease; lastPosP = currentPosP; @@ -399,10 +399,10 @@ namespace HeavenStudio.Games case (int)LaunchSoundToPlay.None: break; case (int)LaunchSoundToPlay.LaunchStart: - Jukebox.PlayOneShotGame("spaceSoccer/jet1"); + SoundByte.PlayOneShotGame("spaceSoccer/jet1"); break; case (int)LaunchSoundToPlay.LaunchEnd: - Jukebox.PlayOneShotGame("spaceSoccer/jet2"); + SoundByte.PlayOneShotGame("spaceSoccer/jet2"); break; } } @@ -448,7 +448,7 @@ namespace HeavenStudio.Games if (ballDispensed) Dispense(lastDispensedBeat, false, true); } - public void Dispense(float beat, bool playSound = true, bool ignorePlayer = false, bool playDown = false) + public void Dispense(double beat, bool playSound = true, bool ignorePlayer = false, bool playDown = false) { if (!ballDispensed) lastDispensedBeat = beat; ballDispensed = true; @@ -462,20 +462,20 @@ namespace HeavenStudio.Games GameObject ball = Instantiate(ballRef, kicker.transform.GetChild(0)); ball.SetActive(true); Ball ball_ = ball.GetComponent(); - ball_.Init(kicker, beat); + ball_.Init(kicker, (float)beat); if (kicker.player && playSound) { - DispenseSound(beat, playDown); + DispenseSound((float)beat, playDown); } - kicker.DispenseBall(beat); + kicker.DispenseBall((float)beat); kicker.canKick = true; } } - public static void DispenseSound(float beat, bool playDown) + public static void DispenseSound(double beat, bool playDown) { - if (playDown) Jukebox.PlayOneShot("games/spaceSoccer/down", beat); + if (playDown) SoundByte.PlayOneShot("games/spaceSoccer/down", beat); MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("spaceSoccer/dispenseNoise", beat), diff --git a/Assets/Scripts/Games/Spaceball/Alien.cs b/Assets/Scripts/Games/Spaceball/Alien.cs index 50ba2191..8fbcfa47 100644 --- a/Assets/Scripts/Games/Spaceball/Alien.cs +++ b/Assets/Scripts/Games/Spaceball/Alien.cs @@ -6,7 +6,7 @@ namespace HeavenStudio.Games.Scripts_Spaceball { private Animator anim; - private float showBeat = 0; + private double showBeat = 0; private bool isShowing = false; private bool isHiding = false; @@ -45,7 +45,7 @@ namespace HeavenStudio.Games.Scripts_Spaceball } } - public void Show(float showBeat, bool hide) + public void Show(double showBeat, bool hide) { isShowing = true; this.showBeat = showBeat; diff --git a/Assets/Scripts/Games/Spaceball/Spaceball.cs b/Assets/Scripts/Games/Spaceball/Spaceball.cs index 17475062..ac8e4003 100644 --- a/Assets/Scripts/Games/Spaceball/Spaceball.cs +++ b/Assets/Scripts/Games/Spaceball/Spaceball.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -57,7 +58,7 @@ namespace HeavenStudio.Games.Loaders parameters = new List() { new Param("valA", new EntityTypes.Integer(1, 320, 10), "Zoom", "The camera's zoom level (Lower value = Zoomed in)"), - new Param("ease", EasingFunction.Ease.Linear, "Ease", "The easing function to use while zooming") + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "The easing function to use while zooming") } }, new GameAction("prepare dispenser", "Dispenser Prepare") @@ -108,15 +109,15 @@ namespace HeavenStudio.Games [SerializeField] Sprite[] BallSprites; [SerializeField] Material[] CostumeColors; - private List _allCameraEvents = new List(); + private List _allCameraEvents = new List(); public Alien alien; - private EasingFunction.Ease lastEase; + private Util.EasingFunction.Ease lastEase; public static Spaceball instance { get; set; } - public override void OnGameSwitch(float beat) + public override void OnGameSwitch(double beat) { for (int i = 1; i < BallsHolder.transform.childCount; i++) Destroy(BallsHolder.transform.GetChild(i).gameObject); @@ -135,10 +136,10 @@ namespace HeavenStudio.Games { instance = this; var camEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "camera" }); - List tempEvents = new List(); + List tempEvents = new List(); for (int i = 0; i < camEvents.Count; i++) { - if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats) + if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { tempEvents.Add(camEvents[i]); } @@ -155,7 +156,7 @@ namespace HeavenStudio.Games { if (currentZoomIndex < _allCameraEvents.Count && currentZoomIndex >= 0) { - if (Conductor.instance.songPositionInBeats >= _allCameraEvents[currentZoomIndex].beat) + if (Conductor.instance.songPositionInBeatsAsDouble >= _allCameraEvents[currentZoomIndex].beat) { UpdateCameraZoom(); currentZoomIndex++; @@ -178,7 +179,7 @@ namespace HeavenStudio.Games } else { - EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase); float newPosZ = func(lastCamDistance + 10, currentZoomCamDistance + 10, normalizedBeat); GameCamera.additionalPosition = new Vector3(0, 0, newPosZ); @@ -210,7 +211,7 @@ namespace HeavenStudio.Games lastCamDistance = _allCameraEvents[0]["valA"] * -1; } - currentZoomCamBeat = _allCameraEvents[currentZoomIndex].beat; + currentZoomCamBeat = (float)_allCameraEvents[currentZoomIndex].beat; currentZoomCamLength = _allCameraEvents[currentZoomIndex].length; float dist = _allCameraEvents[currentZoomIndex]["valA"] * -1; @@ -220,11 +221,11 @@ namespace HeavenStudio.Games else currentZoomCamDistance = dist; - lastEase = (EasingFunction.Ease) _allCameraEvents[currentZoomIndex]["ease"]; + lastEase = (Util.EasingFunction.Ease) _allCameraEvents[currentZoomIndex]["ease"]; } } - public void Shoot(float beat, bool high, int type) + public void Shoot(double beat, bool high, int type) { GameObject ball = Instantiate(Ball); ball.transform.parent = Ball.transform.parent; @@ -234,11 +235,11 @@ namespace HeavenStudio.Games if (high) { ball.GetComponent().high = true; - Jukebox.PlayOneShotGame("spaceball/longShoot"); + SoundByte.PlayOneShotGame("spaceball/longShoot"); } else { - Jukebox.PlayOneShotGame("spaceball/shoot"); + SoundByte.PlayOneShotGame("spaceball/shoot"); } ball.GetComponent().Sprite.sprite = BallSprites[type]; diff --git a/Assets/Scripts/Games/Spaceball/SpaceballBall.cs b/Assets/Scripts/Games/Spaceball/SpaceballBall.cs index 0cdeb7d5..15770cfc 100644 --- a/Assets/Scripts/Games/Spaceball/SpaceballBall.cs +++ b/Assets/Scripts/Games/Spaceball/SpaceballBall.cs @@ -13,7 +13,7 @@ namespace HeavenStudio.Games.Scripts_Spaceball { #region Public - public float startBeat; + public double startBeat; public bool high; public bool isTacobell; @@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_Spaceball [SerializeField] private BezierCurve3D pitchHighCurve; private bool hit; - private float hitBeat; + private double hitBeat; private Vector3 hitPos; private float hitRot; private float randomEndPosX; @@ -84,20 +84,20 @@ namespace HeavenStudio.Games.Scripts_Spaceball private void Hit() { hit = true; - hitBeat = Conductor.instance.songPositionInBeats; + hitBeat = Conductor.instance.songPositionInBeatsAsDouble; hitPos = Holder.localPosition; hitRot = Holder.eulerAngles.z; if (isTacobell) { - Jukebox.PlayOneShotGame("spaceball/tacobell"); + SoundByte.PlayOneShotGame("spaceball/tacobell"); } - Jukebox.PlayOneShotGame("spaceball/hit"); + SoundByte.PlayOneShotGame("spaceball/hit"); // jank fix for a bug with autoplay - freeform if (GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput) { - Jukebox.PlayOneShotGame("spaceball/swing"); + SoundByte.PlayOneShotGame("spaceball/swing"); } randomEndPosX = Random.Range(4f, 16f); @@ -119,7 +119,7 @@ namespace HeavenStudio.Games.Scripts_Spaceball rb.AddForce(transform.right * 400); rb.gravityScale = 9; - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); Destroy(gameObject, 5f); @@ -138,7 +138,7 @@ namespace HeavenStudio.Games.Scripts_Spaceball private void Miss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("spaceball/fall"); + SoundByte.PlayOneShotGame("spaceball/fall"); Instantiate(Spaceball.instance.Dust, Spaceball.instance.Dust.transform.parent).SetActive(true); Destroy(this.gameObject); diff --git a/Assets/Scripts/Games/Spaceball/SpaceballPlayer.cs b/Assets/Scripts/Games/Spaceball/SpaceballPlayer.cs index 8603ad0c..0732b460 100644 --- a/Assets/Scripts/Games/Spaceball/SpaceballPlayer.cs +++ b/Assets/Scripts/Games/Spaceball/SpaceballPlayer.cs @@ -52,7 +52,7 @@ namespace HeavenStudio.Games.Scripts_Spaceball { if (b == null) { - Jukebox.PlayOneShotGame("spaceball/swing"); + SoundByte.PlayOneShotGame("spaceball/swing"); } else { diff --git a/Assets/Scripts/Games/Tambourine/Tambourine.cs b/Assets/Scripts/Games/Tambourine/Tambourine.cs index 0963ffb4..53a8660c 100644 --- a/Assets/Scripts/Games/Tambourine/Tambourine.cs +++ b/Assets/Scripts/Games/Tambourine/Tambourine.cs @@ -114,7 +114,7 @@ namespace HeavenStudio.Games [Header("Variables")] bool intervalStarted; - float intervalStartBeat; + double intervalStartBeat; float beatInterval = 8f; float misses; bool frogPresent; @@ -136,7 +136,7 @@ namespace HeavenStudio.Games struct QueuedTambourineInput { public bool hit; - public float beatAwayFromStart; + public double beatAwayFromStart; } public static Tambourine instance; @@ -186,7 +186,7 @@ namespace HeavenStudio.Games if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) { handsAnimator.Play("Shake", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}"); sweatAnimator.Play("Sweating", 0, 0); SummonFrog(); ScoreMiss(); @@ -198,7 +198,7 @@ namespace HeavenStudio.Games else if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN)) { handsAnimator.Play("Smack", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}"); sweatAnimator.Play("Sweating", 0, 0); SummonFrog(); ScoreMiss(); @@ -209,7 +209,7 @@ namespace HeavenStudio.Games } } - public void StartInterval(float beat, float interval) + public void StartInterval(double beat, float interval) { intervalStartBeat = beat; beatInterval = interval; @@ -223,7 +223,7 @@ namespace HeavenStudio.Games } } - public void MonkeyInput(float beat, bool hit) + public void MonkeyInput(double beat, bool hit) { if (!intervalStarted) { @@ -232,12 +232,12 @@ namespace HeavenStudio.Games if (hit) { monkeyAnimator.Play("MonkeySmack", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/monkey/hit/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame($"tambourine/monkey/hit/{UnityEngine.Random.Range(1, 6)}"); } else { monkeyAnimator.Play("MonkeyShake", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/monkey/shake/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame($"tambourine/monkey/shake/{UnityEngine.Random.Range(1, 6)}"); } queuedInputs.Add(new QueuedTambourineInput() { @@ -246,11 +246,11 @@ namespace HeavenStudio.Games }); } - public void PassTurn(float beat, float length) + public void PassTurn(double beat, float length) { if (queuedInputs.Count == 0) return; monkeyAnimator.Play("MonkeyPassTurn", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/monkey/turnPass/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame($"tambourine/monkey/turnPass/{UnityEngine.Random.Range(1, 6)}"); happyFace.SetActive(true); intervalStarted = false; BeatAction.New(instance.gameObject, new List() @@ -275,7 +275,7 @@ namespace HeavenStudio.Games queuedInputs.Clear(); } - public void Bop(float beat, float length, int whoBops, int whoBopsAuto) + public void Bop(double beat, float length, int whoBops, int whoBopsAuto) { monkeyGoBop = whoBopsAuto == (int)WhoBops.Monkey || whoBopsAuto == (int)WhoBops.Both; handsGoBop = whoBopsAuto == (int)WhoBops.Player || whoBopsAuto == (int)WhoBops.Both; @@ -306,12 +306,12 @@ namespace HeavenStudio.Games } - public void SuccessFace(float beat) + public void SuccessFace(double beat) { DesummonFrog(); if (misses > 0) return; flowerParticles.Play(); - Jukebox.PlayOneShotGame($"tambourine/player/turnPass/sweep"); + SoundByte.PlayOneShotGame($"tambourine/player/turnPass/sweep"); MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("tambourine/player/turnPass/note1", beat), @@ -331,8 +331,8 @@ namespace HeavenStudio.Games if (state >= 1f || state <= -1f) { handsAnimator.Play("Smack", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}"); - Jukebox.PlayOneShotGame("tambourine/miss"); + SoundByte.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame("tambourine/miss"); sweatAnimator.Play("Sweating", 0, 0); misses++; if (!intervalStarted) @@ -349,8 +349,8 @@ namespace HeavenStudio.Games if (state >= 1f || state <= -1f) { handsAnimator.Play("Shake", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}"); - Jukebox.PlayOneShotGame("tambourine/miss"); + SoundByte.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame("tambourine/miss"); sweatAnimator.Play("Sweating", 0, 0); misses++; if (!intervalStarted) @@ -368,12 +368,12 @@ namespace HeavenStudio.Games if (hit) { handsAnimator.Play("Smack", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}"); } else { handsAnimator.Play("Shake", 0, 0); - Jukebox.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}"); } } @@ -414,7 +414,7 @@ namespace HeavenStudio.Games public void SummonFrog() { if (frogPresent) return; - Jukebox.PlayOneShotGame("tambourine/frog"); + SoundByte.PlayOneShotGame("tambourine/frog"); frogAnimator.Play("FrogEnter", 0, 0); frogPresent = true; } diff --git a/Assets/Scripts/Games/TapTrial/TapTrial.cs b/Assets/Scripts/Games/TapTrial/TapTrial.cs index d4e22d9e..7a156e23 100644 --- a/Assets/Scripts/Games/TapTrial/TapTrial.cs +++ b/Assets/Scripts/Games/TapTrial/TapTrial.cs @@ -112,10 +112,8 @@ namespace HeavenStudio.Games [SerializeField] GameObject giraffe; bool goBop = true, isPrep; bool hasJumped, isFinalJump; - public float jumpStartTime = Single.MinValue; + public double jumpStartTime = double.MinValue; float jumpPos; - public float time; - bool once; public bool crIsRunning; [SerializeField] GameObject bg; bool giraffeIsIn; @@ -137,7 +135,7 @@ namespace HeavenStudio.Games } jumpPos = Conductor.instance.GetPositionFromBeat(jumpStartTime, 1f); - if (Conductor.instance.songPositionInBeats >= jumpStartTime && Conductor.instance.songPositionInBeats < jumpStartTime + 1f) + if (Conductor.instance.songPositionInBeatsAsDouble >= jumpStartTime && Conductor.instance.songPositionInBeatsAsDouble < jumpStartTime + 1f) { float yMul = jumpPos * 2f - 1f; float yWeight = -(yMul * yMul) + 1f; @@ -166,7 +164,7 @@ namespace HeavenStudio.Games if (PlayerInput.Pressed() && !IsExpectingInputNow()) { player.anim.Play("Tap", 0, 0); - Jukebox.PlayOneShotGame("tapTrial/tonk"); + SoundByte.PlayOneShotGame("tapTrial/tonk"); } } } @@ -181,7 +179,7 @@ namespace HeavenStudio.Games } } - public void Bop(float beat, float length, bool isBopping, bool autoBop) + public void Bop(double beat, float length, bool isBopping, bool autoBop) { goBop = autoBop; if (isBopping) @@ -196,10 +194,10 @@ namespace HeavenStudio.Games } } - public void Tap(float beat) + public void Tap(double beat) { isPrep = true; - Jukebox.PlayOneShotGame("tapTrial/ook"); + SoundByte.PlayOneShotGame("tapTrial/ook"); player.anim.DoScaledAnimationAsync("TapPrepare", 0.5f); //Monkey Tap Prepare Anim @@ -219,7 +217,7 @@ namespace HeavenStudio.Games }); } - public void DoubleTap(float beat) + public void DoubleTap(double beat) { isPrep = true; MultiSound.Play(new MultiSound.Sound[] @@ -257,7 +255,7 @@ namespace HeavenStudio.Games ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, OnDoubleTap, OnTapMiss, OnEmpty); } - public void TripleTap(float beat) + public void TripleTap(double beat) { isPrep = true; MultiSound.Play(new MultiSound.Sound[] @@ -309,16 +307,16 @@ namespace HeavenStudio.Games }); } - public void JumpTap(float beat) + public void JumpTap(double beat) { isPrep = true; hasJumped = true; - Jukebox.PlayOneShotGame("tapTrial/jumptap1"); + SoundByte.PlayOneShotGame("tapTrial/jumptap1"); player.anim.Play("JumpTap", 0, 0); BeatAction.New(gameObject, new List() { - new BeatAction.Action(beat, delegate {jumpStartTime = Conductor.instance.songPositionInBeats;}), + new BeatAction.Action(beat, delegate {jumpStartTime = Conductor.instance.songPositionInBeatsAsDouble;}), new BeatAction.Action(beat, delegate {monkeys[0].Play("JumpTap", 0, 0); }), new BeatAction.Action(beat, delegate {monkeys[1].Play("JumpTap", 0, 0); }), new BeatAction.Action(beat + 1f, delegate { particleEffectMonkeys(); monkeys[0].Play("Jumpactualtap", 0, 0); monkeys[1].Play("Jumpactualtap", 0, 0); }), @@ -333,7 +331,7 @@ namespace HeavenStudio.Games }); } - public void JumpTapPrep(float beat) + public void JumpTapPrep(double beat) { isPrep = true; monkeys[0].Play("JumpPrepare", 0, 0); @@ -341,17 +339,17 @@ namespace HeavenStudio.Games player.anim.Play("JumpPrepare", 0, 0); } - public void FinalJumpTap(float beat) + public void FinalJumpTap(double beat) { isPrep = true; hasJumped = true; isFinalJump = true; - Jukebox.PlayOneShotGame("tapTrial/jumptap2"); + SoundByte.PlayOneShotGame("tapTrial/jumptap2"); player.anim.Play("FinalJump"); BeatAction.New(gameObject, new List() { - new BeatAction.Action(beat, delegate {jumpStartTime = Conductor.instance.songPositionInBeats;}), + new BeatAction.Action(beat, delegate {jumpStartTime = Conductor.instance.songPositionInBeatsAsDouble;}), new BeatAction.Action(beat, delegate {monkeys[0].Play("Jump", 0, 0); }), new BeatAction.Action(beat, delegate {monkeys[1].Play("Jump", 0, 0); }), new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("FinalJumpTap", 0, 0); particleEffectMonkeys(); particleEffectMonkeys_2(); }), @@ -409,31 +407,31 @@ namespace HeavenStudio.Games #region Player Action Scripts public void OnTap(PlayerActionEvent caller, float beat) { - Jukebox.PlayOneShotGame("tapTrial/tap"); + SoundByte.PlayOneShotGame("tapTrial/tap"); player.anim.DoScaledAnimationAsync("Tap", 0.6f); player_effects[0].GetComponent().Play(); } public void OnDoubleTap(PlayerActionEvent caller, float beat) { - Jukebox.PlayOneShotGame("tapTrial/tap"); + SoundByte.PlayOneShotGame("tapTrial/tap"); player.anim.DoScaledAnimationAsync("DoubleTap", 0.6f); player_effects[1].GetComponent().Play(); } public void OnTapMiss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f); + SoundByte.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f); } public void OnJumpTapMiss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f); + SoundByte.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f); player.anim.Play("JumpTap_Miss", 0, 0); } public void OnFinalJumpTapMiss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f); + SoundByte.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f); player.anim.Play("FinalJump_Miss", 0, 0); } @@ -460,18 +458,18 @@ namespace HeavenStudio.Games player.tripleOffset += 1; } player_effects[0].GetComponent().Play(); - Jukebox.PlayOneShotGame("tapTrial/tap"); + SoundByte.PlayOneShotGame("tapTrial/tap"); } public void OnJumpTap(PlayerActionEvent caller, float beat) { - Jukebox.PlayOneShotGame("tapTrial/tap"); + SoundByte.PlayOneShotGame("tapTrial/tap"); player.anim.Play("JumpTap_Success", 0, 0); player_effects[0].GetComponent().Play(); player_effects[1].GetComponent().Play(); } public void OnJumpFinalTap(PlayerActionEvent caller, float beat) { - Jukebox.PlayOneShotGame("tapTrial/tap"); + SoundByte.PlayOneShotGame("tapTrial/tap"); player.anim.Play("FinalJump_Tap"); player_effects[0].GetComponent().Play(); player_effects[1].GetComponent().Play(); diff --git a/Assets/Scripts/Games/TapTrial/TapTrialPlayer.cs b/Assets/Scripts/Games/TapTrial/TapTrialPlayer.cs index 9053d547..7d96c96b 100644 --- a/Assets/Scripts/Games/TapTrial/TapTrialPlayer.cs +++ b/Assets/Scripts/Games/TapTrial/TapTrialPlayer.cs @@ -9,7 +9,6 @@ namespace HeavenStudio.Games.Scripts_TapTrial [Header("References")] [System.NonSerialized] public Animator anim; - public float nextBeat; public int tripleOffset = 0; private void Awake() @@ -19,9 +18,6 @@ namespace HeavenStudio.Games.Scripts_TapTrial private void Update() { - float normalizedBeat = Conductor.instance.GetPositionFromMargin(nextBeat, 1f); - - if (PlayerInput.Pressed()) { Tap(false, 0); @@ -31,9 +27,9 @@ namespace HeavenStudio.Games.Scripts_TapTrial public void Tap(bool hit, int type) { if (hit) - Jukebox.PlayOneShotGame("tapTrial/tap"); + SoundByte.PlayOneShotGame("tapTrial/tap"); else - Jukebox.PlayOneShotGame("tapTrial/tonk"); + SoundByte.PlayOneShotGame("tapTrial/tonk"); switch (type) diff --git a/Assets/Scripts/Games/TapTroupe/TapTroupe.cs b/Assets/Scripts/Games/TapTroupe/TapTroupe.cs index a46c9f2e..dad87880 100644 --- a/Assets/Scripts/Games/TapTroupe/TapTroupe.cs +++ b/Assets/Scripts/Games/TapTroupe/TapTroupe.cs @@ -3,6 +3,7 @@ using System; using System.Linq; using System.Collections.Generic; using UnityEngine; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -67,7 +68,7 @@ namespace HeavenStudio.Games.Loaders resizable = true, parameters = new List() { - new Param("ease", EasingFunction.Ease.EaseOutQuad, "Camera Ease", "What ease should the camera use?"), + new Param("ease", Util.EasingFunction.Ease.EaseOutQuad, "Camera Ease", "What ease should the camera use?"), }, }, new GameAction("tutorialMissFace", "Toggle Tutorial Miss Face") @@ -105,13 +106,13 @@ namespace HeavenStudio.Games [SerializeField] GameObject darkness; private Animator zoomOutAnim; [Header("Properties")] - private float currentZoomCamBeat; + private double currentZoomCamBeat; private float currentZoomCamLength; - private EasingFunction.Ease lastEase; + private Util.EasingFunction.Ease lastEase; private int currentZoomIndex; - private List allCameraEvents = new List(); + private List allCameraEvents = new List(); private bool keepZoomOut; private static List queuedSteps = new List(); private static List queuedTaps = new List(); @@ -128,13 +129,13 @@ namespace HeavenStudio.Games public GameEvent bop = new GameEvent(); public struct QueuedSteps { - public float beat; + public double beat; public float length; public bool startTap; } public struct QueuedTaps { - public float beat; + public double beat; public float length; public bool okay; public int okayType; @@ -181,10 +182,10 @@ namespace HeavenStudio.Games instance = this; zoomOutAnim = GetComponent(); var camEvents = EventCaller.GetAllInGameManagerList("tapTroupe", new string[] { "zoomOut" }); - List tempEvents = new List(); + List tempEvents = new List(); for (int i = 0; i < camEvents.Count; i++) { - if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats) + if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { tempEvents.Add(camEvents[i]); } @@ -227,8 +228,8 @@ namespace HeavenStudio.Games } if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) { - if (canSpit && !useTutorialMissFace) Jukebox.PlayOneShotGame("tapTroupe/spit", -1, 1, 0.5f); - Jukebox.PlayOneShotGame("tapTroupe/miss"); + if (canSpit && !useTutorialMissFace) SoundByte.PlayOneShotGame("tapTroupe/spit", -1, 1, 0.5f); + SoundByte.PlayOneShotGame("tapTroupe/miss"); TapTroupe.instance.ScoreMiss(0.5f); foreach (var corner in npcCorners) { @@ -259,7 +260,7 @@ namespace HeavenStudio.Games { if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0) { - if (Conductor.instance.songPositionInBeats >= allCameraEvents[currentZoomIndex].beat) + if (Conductor.instance.songPositionInBeatsAsDouble >= allCameraEvents[currentZoomIndex].beat) { UpdateCameraZoom(); currentZoomIndex++; @@ -278,7 +279,7 @@ namespace HeavenStudio.Games } else { - EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase); if (normalizedBeat > 1) GameCamera.additionalPosition = new Vector3(0, 30, -100); else @@ -317,7 +318,7 @@ namespace HeavenStudio.Games { currentZoomCamLength = allCameraEvents[currentZoomIndex].length; currentZoomCamBeat = allCameraEvents[currentZoomIndex].beat; - lastEase = (EasingFunction.Ease)allCameraEvents[currentZoomIndex]["ease"]; + lastEase = (Util.EasingFunction.Ease)allCameraEvents[currentZoomIndex]["ease"]; } } @@ -326,7 +327,7 @@ namespace HeavenStudio.Games keepZoomOut = true; } - public static void PreStepping(float beat, float length, bool startTap) + public static void PreStepping(double beat, float length, bool startTap) { if (GameManager.instance.currentGame == "tapTroupe") { @@ -339,7 +340,7 @@ namespace HeavenStudio.Games } } - public void Stepping(float beat, float length, bool startTap) + public void Stepping(double beat, float length, bool startTap) { for (int i = 0; i < length; i++) { @@ -349,7 +350,7 @@ namespace HeavenStudio.Games new BeatAction.Action(beat + i, delegate { TapTroupe.instance.NPCStep(); - Jukebox.PlayOneShotGame("tapTroupe/other1", -1, 1, 0.75f); + SoundByte.PlayOneShotGame("tapTroupe/other1", -1, 1, 0.75f); }) }); } @@ -362,12 +363,12 @@ namespace HeavenStudio.Games TapTroupe.instance.playerTapper.Step(false, false); TapTroupe.instance.playerCorner.Bop(); }), - new BeatAction.Action(beat, delegate { if (startTap) Jukebox.PlayOneShotGame("tapTroupe/startTap"); stepping = true; }), + new BeatAction.Action(beat, delegate { if (startTap) SoundByte.PlayOneShotGame("tapTroupe/startTap"); stepping = true; }), new BeatAction.Action(beat + length + 1, delegate { stepping = false; }), }); } - public static void PreTapping(float beat, float length, bool okay, int okayType, int animType, float popperBeats, bool randomVoiceLine) + public static void PreTapping(double beat, float length, bool okay, int okayType, int animType, float popperBeats, bool randomVoiceLine) { MultiSound.Play(new MultiSound.Sound[] { @@ -389,12 +390,12 @@ namespace HeavenStudio.Games } } - public void Tapping(float beat, float length, bool okay, int okayType, int animType, float popperBeats, bool randomVoiceLine) + public void Tapping(double beat, float length, bool okay, int okayType, int animType, float popperBeats, bool randomVoiceLine) { float actualLength = length - 0.5f; actualLength -= actualLength % 0.75f; bool secondBam = false; - float finalBeatToSpawn = 0f; + double finalBeatToSpawn = 0f; if (actualLength < 2.25f) actualLength = 2.25f; List soundsToPlay = new List { @@ -404,12 +405,12 @@ namespace HeavenStudio.Games { string soundToPlay = "bamvoice1"; string otherSoundToPlay = "other3"; - float beatToSpawn = beat + i + 0.5f; + double beatToSpawn = beat + i + 0.5f; if (i + 0.75f >= actualLength) { soundToPlay = "startTap"; otherSoundToPlay = "other2"; - beatToSpawn = Mathf.Ceil(beat + i); + beatToSpawn = Math.Ceiling(beat + i); finalBeatToSpawn = beatToSpawn; BeatAction.New(instance.gameObject, new List() { @@ -564,11 +565,11 @@ namespace HeavenStudio.Games { if (!missedTaps && okay && randomVoiceLine && UnityEngine.Random.Range(1, 50) == 1) { - Jukebox.PlayOneShotGame("tapTroupe/woo"); + SoundByte.PlayOneShotGame("tapTroupe/woo"); } else if (!missedTaps && okay && randomVoiceLine && UnityEngine.Random.Range(1, 50) == 1) { - Jukebox.PlayOneShotGame("tapTroupe/laughter", -1, 1, 0.4f); + SoundByte.PlayOneShotGame("tapTroupe/laughter", -1, 1, 0.4f); } if (missedTaps || animType != (int)OkayAnimType.OkSign) return; playerCorner.OkaySign(); @@ -581,7 +582,7 @@ namespace HeavenStudio.Games MultiSound.Play(soundsToPlay.ToArray(), forcePlay: true); } - public void Bop(float beat, float length, bool shouldBop, bool autoBop) + public void Bop(double beat, float length, bool shouldBop, bool autoBop) { goBop = autoBop; if (shouldBop) @@ -669,7 +670,7 @@ namespace HeavenStudio.Games canSpit = true; playerTapper.Step(false); playerCorner.Bop(); - Jukebox.PlayOneShotGame("tapTroupe/tink"); + SoundByte.PlayOneShotGame("tapTroupe/tink"); if (stepSound == 1) { stepSound = 2; @@ -700,7 +701,7 @@ namespace HeavenStudio.Games playerTapper.Step(); playerCorner.Bop(); - Jukebox.PlayOneShotGame($"tapTroupe/step{stepSound}"); + SoundByte.PlayOneShotGame($"tapTroupe/step{stepSound}"); if (stepSound == 1) { stepSound = 2; @@ -721,7 +722,7 @@ namespace HeavenStudio.Games void MissStep(PlayerActionEvent caller) { - if (canSpit && !useTutorialMissFace) Jukebox.PlayOneShotGame("tapTroupe/spit", -1, 1, 0.5f); + if (canSpit && !useTutorialMissFace) SoundByte.PlayOneShotGame("tapTroupe/spit", -1, 1, 0.5f); foreach (var corner in npcCorners) { if (useTutorialMissFace) @@ -747,10 +748,10 @@ namespace HeavenStudio.Games switch (currentTapAnim) { case TapTroupeTapper.TapAnim.LastTap: - Jukebox.PlayOneShotGame("tapTroupe/tap3"); + SoundByte.PlayOneShotGame("tapTroupe/tap3"); break; default: - Jukebox.PlayOneShotGame("tapTroupe/tink"); + SoundByte.PlayOneShotGame("tapTroupe/tink"); break; } foreach (var corner in npcCorners) @@ -777,10 +778,10 @@ namespace HeavenStudio.Games switch (currentTapAnim) { case TapTroupeTapper.TapAnim.LastTap: - Jukebox.PlayOneShotGame("tapTroupe/tap3"); + SoundByte.PlayOneShotGame("tapTroupe/tap3"); break; default: - Jukebox.PlayOneShotGame("tapTroupe/player3"); + SoundByte.PlayOneShotGame("tapTroupe/player3"); break; } foreach (var corner in npcCorners) @@ -792,7 +793,7 @@ namespace HeavenStudio.Games void MissTap(PlayerActionEvent caller) { missedTaps = true; - if (canSpit && !useTutorialMissFace) Jukebox.PlayOneShotGame("tapTroupe/spit", -1, 1, 0.5f); + if (canSpit && !useTutorialMissFace) SoundByte.PlayOneShotGame("tapTroupe/spit", -1, 1, 0.5f); foreach (var corner in npcCorners) { if (useTutorialMissFace) diff --git a/Assets/Scripts/Games/TapTroupe/TapTroupeCorner.cs b/Assets/Scripts/Games/TapTroupe/TapTroupeCorner.cs index 53cc87aa..aa050724 100644 --- a/Assets/Scripts/Games/TapTroupe/TapTroupeCorner.cs +++ b/Assets/Scripts/Games/TapTroupe/TapTroupeCorner.cs @@ -63,13 +63,13 @@ namespace HeavenStudio.Games.Scripts_TapTroupe bodyAnim.DoScaledAnimationAsync("OkaySign", 0.25f); } - public void PartyPopper(float beat) + public void PartyPopper(double beat) { bodyAnim.Play("PartyPopperReady", 0, 0); BeatAction.New(game.gameObject, new List() { new BeatAction.Action(beat, delegate { bodyAnim.Play("PartyPopper", 0, 0); }), - new BeatAction.Action(beat + 1f, delegate { bodyAnim.DoScaledAnimationAsync("PartyPopperPop", 0.25f); Jukebox.PlayOneShotGame("tapTroupe/popper"); popperEffect.Play(); }), + new BeatAction.Action(beat + 1f, delegate { bodyAnim.DoScaledAnimationAsync("PartyPopperPop", 0.25f); SoundByte.PlayOneShotGame("tapTroupe/popper"); popperEffect.Play(); }), new BeatAction.Action(beat + 3f, delegate { bodyAnim.Play("IdleBody", 0, 0); }) }); } diff --git a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs index 573ba094..bb6ce7ea 100644 --- a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs +++ b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs @@ -125,6 +125,31 @@ namespace HeavenStudio.Games { public struct PosesToPerform : IComparable { + // override object.Equals + public override bool Equals(object obj) + { + // + // See the full list of guidelines at + // http://go.microsoft.com/fwlink/?LinkID=85237 + // and also the guidance for operator== at + // http://go.microsoft.com/fwlink/?LinkId=85238 + // + + if (obj == null || GetType() != obj.GetType()) + { + return false; + } + + // TODO: write your implementation of Equals() here + throw new System.NotImplementedException(); + } + + // override object.GetHashCode + public override int GetHashCode() + { + // TODO: write your implementation of GetHashCode() here + throw new System.NotImplementedException(); + } public int CompareTo(PosesToPerform other) { if (other == null) return 1; @@ -166,7 +191,7 @@ namespace HeavenStudio.Games } public struct QueuedPose { - public float beat; + public double beat; public float length; public float upLeftBeat; public float upMiddleBeat; @@ -178,7 +203,7 @@ namespace HeavenStudio.Games } public struct QueuedCrouch { - public float beat; + public double beat; public float length; public int countInType; } @@ -194,7 +219,7 @@ namespace HeavenStudio.Games bool canBop = true; bool doingPoses = false; bool shouldHold = false; - float crouchEndBeat; + double crouchEndBeat; public bool shouldBop = true; public GameEvent bop = new GameEvent(); static List queuedPoses = new List(); @@ -256,7 +281,7 @@ namespace HeavenStudio.Games if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) { player.Prepare(false); - Jukebox.PlayOneShotGame("theDazzles/miss"); + SoundByte.PlayOneShotGame("theDazzles/miss"); foreach (var girl in npcGirls) { if (girl.currentEmotion != TheDazzlesGirl.Emotion.Ouch) girl.currentEmotion = TheDazzlesGirl.Emotion.Angry; @@ -267,7 +292,7 @@ namespace HeavenStudio.Games if (doingPoses) { player.Pose(false); - Jukebox.PlayOneShotGame("theDazzles/miss"); + SoundByte.PlayOneShotGame("theDazzles/miss"); foreach (var girl in npcGirls) { girl.Ouch(); @@ -284,7 +309,7 @@ namespace HeavenStudio.Games if (doingPoses) { player.Pose(false); - Jukebox.PlayOneShotGame("theDazzles/miss"); + SoundByte.PlayOneShotGame("theDazzles/miss"); foreach (var girl in npcGirls) { girl.Ouch(); @@ -304,7 +329,7 @@ namespace HeavenStudio.Games } } - public void Bop(float beat, float length, bool goBop, bool autoBop) + public void Bop(double beat, float length, bool goBop, bool autoBop) { shouldBop = autoBop; if (goBop) @@ -336,7 +361,7 @@ namespace HeavenStudio.Games player.Prepare(); } - public static void PreCrouch(float beat, float length, int countInType) + public static void PreCrouch(double beat, float length, int countInType) { float actualLength = length / 3; int realCountInType = countInType; @@ -374,7 +399,7 @@ namespace HeavenStudio.Games } } - public void CrouchStretchable(float beat, float length, int countInType) + public void CrouchStretchable(double beat, float length, int countInType) { float actualLength = length / 3; crouchEndBeat = beat + length; @@ -404,7 +429,7 @@ namespace HeavenStudio.Games }); } - public static void PrePose(float beat, float length, float upLeftBeat, float upMiddleBeat, float upRightBeat, float downLeftBeat, float downMiddleBeat, float playerBeat, bool stars) + public static void PrePose(double beat, float length, float upLeftBeat, float upMiddleBeat, float upRightBeat, float downLeftBeat, float downMiddleBeat, float playerBeat, bool stars) { if (GameManager.instance.currentGame == "theDazzles") { @@ -417,7 +442,7 @@ namespace HeavenStudio.Games } } - public void Pose(float beat, float length, float upLeftBeat, float upMiddleBeat, float upRightBeat, float downLeftBeat, float downMiddleBeat, float playerBeat, bool stars) + public void Pose(double beat, float length, float upLeftBeat, float upMiddleBeat, float upRightBeat, float downLeftBeat, float downMiddleBeat, float playerBeat, bool stars) { if (stars) { @@ -427,7 +452,7 @@ namespace HeavenStudio.Games { ScheduleInput(beat, playerBeat, InputType.STANDARD_UP, JustPose, MissPose, Nothing); } - float crouchBeat = beat - 1f; + double crouchBeat = beat - 1f; if (crouchBeat < crouchEndBeat) { crouchBeat = crouchEndBeat - 1f; @@ -545,8 +570,8 @@ namespace HeavenStudio.Games void JustPose(PlayerActionEvent caller, float state) { shouldHold = false; - Jukebox.PlayOneShotGame("theDazzles/pose"); - Jukebox.PlayOneShotGame("theDazzles/posePlayer"); + SoundByte.PlayOneShotGame("theDazzles/pose"); + SoundByte.PlayOneShotGame("theDazzles/posePlayer"); if (state >= 1f || state <= -1f) { player.Pose(); @@ -558,8 +583,8 @@ namespace HeavenStudio.Games void JustPoseStars(PlayerActionEvent caller, float state) { shouldHold = false; - Jukebox.PlayOneShotGame("theDazzles/pose"); - Jukebox.PlayOneShotGame("theDazzles/posePlayer"); + SoundByte.PlayOneShotGame("theDazzles/pose"); + SoundByte.PlayOneShotGame("theDazzles/posePlayer"); if (state >= 1f || state <= -1f) { player.Pose(); @@ -571,7 +596,7 @@ namespace HeavenStudio.Games void SuccessPose(bool stars) { player.Pose(); - Jukebox.PlayOneShotGame("theDazzles/applause"); + SoundByte.PlayOneShotGame("theDazzles/applause"); foreach (var girl in npcGirls) { girl.currentEmotion = TheDazzlesGirl.Emotion.Happy; @@ -580,7 +605,7 @@ namespace HeavenStudio.Games if (stars) { starsEffect.Play(); - Jukebox.PlayOneShotGame($"theDazzles/stars{UnityEngine.Random.Range(1, 6)}"); + SoundByte.PlayOneShotGame($"theDazzles/stars{UnityEngine.Random.Range(1, 6)}"); } else poseEffect.Play(); } diff --git a/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs b/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs index 2bd117bd..0b176074 100644 --- a/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs +++ b/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs @@ -65,7 +65,7 @@ namespace HeavenStudio.Games.Scripts_TheDazzles anim.Play("Prepare", 0, 0); } - public void StartReleaseBox(float beat) + public void StartReleaseBox(double beat) { BeatAction.New(game.gameObject, new List() { diff --git a/Assets/Scripts/Games/TossBoys/TossBoys.cs b/Assets/Scripts/Games/TossBoys/TossBoys.cs index 6e3c4a45..f26e18d7 100644 --- a/Assets/Scripts/Games/TossBoys/TossBoys.cs +++ b/Assets/Scripts/Games/TossBoys/TossBoys.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; using DG.Tweening; +using Jukebox; namespace HeavenStudio.Games.Loaders { @@ -144,7 +145,7 @@ namespace HeavenStudio.Games WhichTossKid lastReceiver = WhichTossKid.None; WhichTossKid currentReceiver = WhichTossKid.None; public TossBoysBall currentBall = null; - Dictionary passBallDict = new Dictionary(); + Dictionary passBallDict = new(); string currentPassType; public static TossBoys instance; bool shouldBop = true; @@ -238,7 +239,7 @@ namespace HeavenStudio.Games kiiyan.Bop(); } - public void Bop(float beat, float length, bool auto, bool goBop) + public void Bop(double beat, float length, bool auto, bool goBop) { shouldBop = auto; if (goBop) @@ -253,13 +254,13 @@ namespace HeavenStudio.Games } #endregion - public void Dispense(float beat, float length, int who, bool call) + public void Dispense(double beat, float length, int who, bool call) { if (currentBall != null) return; SetPassBallEvents(); SetReceiver(who); GetCurrentReceiver().ShowArrow(beat, length - 1); - Jukebox.PlayOneShotGame("tossBoys/ballStart" + GetColorBasedOnTossKid(currentReceiver, true)); + SoundByte.PlayOneShotGame("tossBoys/ballStart" + GetColorBasedOnTossKid(currentReceiver, true)); hatchAnim.Play("HatchOpen", 0, 0); currentBall = Instantiate(ballPrefab, transform); currentBall.gameObject.SetActive(true); @@ -280,7 +281,7 @@ namespace HeavenStudio.Games if (call) { - float callBeat = beat; + double callBeat = beat; switch (who) { case (int)WhichTossKid.Akachan: @@ -351,7 +352,7 @@ namespace HeavenStudio.Games var passBallEvents = EventCaller.GetAllInGameManagerList("tossBoys", new string[] { "pass", "dual", "pop", "high", "lightning", "blur" }); for (int i = 0; i < passBallEvents.Count; i++) { - if (passBallEvents[i].beat >= Conductor.instance.songPositionInBeats) + if (passBallEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble) { if (passBallDict.ContainsKey(passBallEvents[i].beat)) continue; passBallDict.Add(passBallEvents[i].beat, passBallEvents[i]); @@ -359,7 +360,7 @@ namespace HeavenStudio.Games } } - void DeterminePass(float beat, bool barely) + void DeterminePass(double beat, bool barely) { var tempLastReceiver = lastReceiver; lastReceiver = currentReceiver; @@ -372,7 +373,7 @@ namespace HeavenStudio.Games else { /* - DynamicBeatmap.DynamicEntity spawnedEntity = new DynamicBeatmap.DynamicEntity(); + RiqEntity spawnedEntity = new RiqEntity(); spawnedEntity.DynamicData.Add("who", (int)tempLastReceiver); spawnedEntity.datamodel = currentPassType; passBallDict.Add(beat, spawnedEntity); @@ -413,7 +414,7 @@ namespace HeavenStudio.Games } } - void PassBall(float beat, float length) + void PassBall(double beat, float length) { string last = GetColorBasedOnTossKid(lastReceiver, false); string current = GetColorBasedOnTossKid(currentReceiver, true); @@ -468,7 +469,7 @@ namespace HeavenStudio.Games ScheduleInput(beat, length, GetInputTypeBasedOnCurrentReceiver(), JustHitBall, Miss, Empty); } - void DualToss(float beat, float length) + void DualToss(double beat, float length) { string last = GetColorBasedOnTossKid(lastReceiver, false); string current = GetColorBasedOnTossKid(currentReceiver, true); @@ -524,7 +525,7 @@ namespace HeavenStudio.Games ScheduleInput(beat, length, GetInputTypeBasedOnCurrentReceiver(), stopSpecial ? JustHitBallUnSpecial : JustHitBall, Miss, Empty); } - void HighToss(float beat, float length) + void HighToss(double beat, float length) { string last = GetColorBasedOnTossKid(lastReceiver, false); string current = GetColorBasedOnTossKid(currentReceiver, true); @@ -577,7 +578,7 @@ namespace HeavenStudio.Games ScheduleInput(beat, length, GetInputTypeBasedOnCurrentReceiver(), JustHitBall, Miss, Empty); } - void LightningToss(float beat, float length) + void LightningToss(double beat, float length) { string last = GetColorBasedOnTossKid(lastReceiver, false); string current = GetColorBasedOnTossKid(currentReceiver, true); @@ -634,7 +635,7 @@ namespace HeavenStudio.Games ScheduleInput(beat, length, GetInputTypeBasedOnCurrentReceiver(), JustHitBall, Miss, Empty); } - void BlurToss(float beat) + void BlurToss(double beat) { string current = GetColorBasedOnTossKid(currentReceiver, false); if (currentBall != null) @@ -670,13 +671,13 @@ namespace HeavenStudio.Games switch (currentReceiver) { case WhichTossKid.Akachan: - Jukebox.PlayOneShotGame("tossBoys/redPop"); + SoundByte.PlayOneShotGame("tossBoys/redPop"); break; case WhichTossKid.Aokun: - Jukebox.PlayOneShotGame("tossBoys/bluePop"); + SoundByte.PlayOneShotGame("tossBoys/bluePop"); break; case WhichTossKid.Kiiyan: - Jukebox.PlayOneShotGame("tossBoys/yellowPop"); + SoundByte.PlayOneShotGame("tossBoys/yellowPop"); break; default: break; @@ -722,13 +723,13 @@ namespace HeavenStudio.Games switch (currentReceiver) { case WhichTossKid.Akachan: - Jukebox.PlayOneShotGame("tossBoys/redPop"); + SoundByte.PlayOneShotGame("tossBoys/redPop"); break; case WhichTossKid.Aokun: - Jukebox.PlayOneShotGame("tossBoys/bluePop"); + SoundByte.PlayOneShotGame("tossBoys/bluePop"); break; case WhichTossKid.Kiiyan: - Jukebox.PlayOneShotGame("tossBoys/yellowPop"); + SoundByte.PlayOneShotGame("tossBoys/yellowPop"); break; default: break; @@ -783,9 +784,9 @@ namespace HeavenStudio.Games void JustKeepCurrent(PlayerActionEvent caller, float state) { if (currentBall == null) return; - Jukebox.PlayOneShotGame("tossBoys/" + GetColorBasedOnTossKid(currentReceiver, false) + "Keep"); + SoundByte.PlayOneShotGame("tossBoys/" + GetColorBasedOnTossKid(currentReceiver, false) + "Keep"); string current = GetColorBasedOnTossKid(currentReceiver, false); - float beat = caller.timer + caller.startBeat; + double beat = caller.timer + caller.startBeat; if (currentBall != null) { switch (current) @@ -819,7 +820,7 @@ namespace HeavenStudio.Games specialAka.SetActive(false); specialKii.SetActive(false); currentSpecialKid.crouch = false; - Jukebox.PlayOneShotGame("tossBoys/" + GetColorBasedOnTossKid(currentReceiver, false) + "Keep"); + SoundByte.PlayOneShotGame("tossBoys/" + GetColorBasedOnTossKid(currentReceiver, false) + "Keep"); if (state >= 1f || state <= -1f) { currentBall.anim.DoScaledAnimationAsync("WiggleBall", 0.5f); @@ -833,10 +834,10 @@ namespace HeavenStudio.Games void JustKeep(PlayerActionEvent caller, float state) { if (currentBall == null) return; - Jukebox.PlayOneShotGame("tossBoys/" + GetColorBasedOnTossKid(lastReceiver, false) + "Keep"); + SoundByte.PlayOneShotGame("tossBoys/" + GetColorBasedOnTossKid(lastReceiver, false) + "Keep"); string last = GetColorBasedOnTossKid(lastReceiver, false); string current = GetColorBasedOnTossKid(currentReceiver, true); - float beat = caller.timer + caller.startBeat; + double beat = caller.timer + caller.startBeat; if (currentBall != null) { switch (last + current) @@ -880,10 +881,10 @@ namespace HeavenStudio.Games specialAka.SetActive(false); specialKii.SetActive(false); currentSpecialKid.crouch = false; - Jukebox.PlayOneShotGame("tossBoys/" + GetColorBasedOnTossKid(lastReceiver, false) + "Keep"); + SoundByte.PlayOneShotGame("tossBoys/" + GetColorBasedOnTossKid(lastReceiver, false) + "Keep"); string last = GetColorBasedOnTossKid(lastReceiver, false); string current = GetColorBasedOnTossKid(currentReceiver, true); - float beat = caller.timer + caller.startBeat; + double beat = caller.timer + caller.startBeat; if (currentBall != null) { switch (last + current) @@ -933,7 +934,7 @@ namespace HeavenStudio.Games specialKii.SetActive(false); Destroy(currentBall.gameObject); currentBall = null; - Jukebox.PlayOneShotGame("tossBoys/misshit"); + SoundByte.PlayOneShotGame("tossBoys/misshit"); } void Empty(PlayerActionEvent caller) { } @@ -941,7 +942,7 @@ namespace HeavenStudio.Games #region HelperFunctions - void DoSpecialBasedOnReceiver(float beat) + void DoSpecialBasedOnReceiver(double beat) { specialAo.SetActive(false); specialAka.SetActive(false); @@ -968,7 +969,7 @@ namespace HeavenStudio.Games }); break; case WhichTossKid.Kiiyan: - Jukebox.PlayOneShotGame("tossBoys/yellowSpecial", beat); + SoundByte.PlayOneShotGame("tossBoys/yellowSpecial", beat); break; default: break; diff --git a/Assets/Scripts/Games/TossBoys/TossBoysBall.cs b/Assets/Scripts/Games/TossBoys/TossBoysBall.cs index b2930fbe..db91276d 100644 --- a/Assets/Scripts/Games/TossBoys/TossBoysBall.cs +++ b/Assets/Scripts/Games/TossBoys/TossBoysBall.cs @@ -42,7 +42,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys private State currentState; - private float startBeat; + private double startBeat; private Path currentPath; @@ -66,7 +66,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys //Do Jackshit break; default: - transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, Conductor.instance.songPositionInBeats), startBeat); + transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, Conductor.instance.songPositionInBeatsAsDouble), startBeat); float rot = GetPathValue("rot"); transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f / Conductor.instance.pitchedSecPerBeat))); break; @@ -74,7 +74,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys } } - public void SetState(State state, float beat, float length = 0) + public void SetState(State state, double beat, float length = 0) { UpdateLastRealPos(); startBeat = beat; diff --git a/Assets/Scripts/Games/TossBoys/TossKid.cs b/Assets/Scripts/Games/TossBoys/TossKid.cs index 29ce86db..98993fcb 100644 --- a/Assets/Scripts/Games/TossBoys/TossKid.cs +++ b/Assets/Scripts/Games/TossBoys/TossKid.cs @@ -33,7 +33,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys else if (!anim.IsPlayingAnimationName(prefix + "Whiff") && !anim.IsPlayingAnimationName(prefix + "Miss")) { DoAnimationScaledAsync("Whiff", 0.5f); - Jukebox.PlayOneShotGame("tossBoys/whiff"); + SoundByte.PlayOneShotGame("tossBoys/whiff"); } } @@ -72,7 +72,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys DoAnimationScaledAsync("Barely", 0.5f); } - public void ShowArrow(float startBeat, float length) + public void ShowArrow(double startBeat, float length) { BeatAction.New(game.gameObject, new List(){ new BeatAction.Action(startBeat, delegate { arrow.SetActive(true); }), diff --git a/Assets/Scripts/Games/TrickClass/MobTrickObj.cs b/Assets/Scripts/Games/TrickClass/MobTrickObj.cs index ea2229ff..2831d593 100644 --- a/Assets/Scripts/Games/TrickClass/MobTrickObj.cs +++ b/Assets/Scripts/Games/TrickClass/MobTrickObj.cs @@ -11,7 +11,7 @@ namespace HeavenStudio.Games.Scripts_TrickClass public class MobTrickObj : MonoBehaviour { public bool flyType; - public float startBeat; + public double startBeat; bool miss = false; float flyBeats; @@ -115,7 +115,7 @@ namespace HeavenStudio.Games.Scripts_TrickClass public void DodgeJustOrNg(PlayerActionEvent caller, float state) { - if (game.playerCanDodge <= Conductor.instance.songPositionInBeats) + if (game.playerCanDodge <= Conductor.instance.songPositionInBeatsAsDouble) { if (state <= -1f || state >= 1f) { @@ -124,15 +124,15 @@ namespace HeavenStudio.Games.Scripts_TrickClass MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound(GetDodgeSound(), startBeat + flyBeats, volume: 0.4f), }); - Jukebox.PlayOneShotGame(GetDodgeSound(), volume: 0.6f); - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShotGame(GetDodgeSound(), volume: 0.6f); + SoundByte.PlayOneShot("miss"); DoObjMiss(); } else { //just game.PlayerDodge(); - Jukebox.PlayOneShotGame("trickClass/player_dodge_success", volume: 0.8f, pitch: UnityEngine.Random.Range(0.85f, 1.15f)); + SoundByte.PlayOneShotGame("trickClass/player_dodge_success", volume: 0.8f, pitch: UnityEngine.Random.Range(0.85f, 1.15f)); MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound(GetDodgeSound(), startBeat + flyBeats, volume: 0.4f), }); @@ -140,7 +140,7 @@ namespace HeavenStudio.Games.Scripts_TrickClass } else { - Jukebox.PlayOneShotGame(GetDodgeSound()); + SoundByte.PlayOneShotGame(GetDodgeSound()); DoObjMiss(); game.PlayerThrough(); caller.isEligible = false; @@ -150,7 +150,7 @@ namespace HeavenStudio.Games.Scripts_TrickClass public void DodgeMiss(PlayerActionEvent caller) { - Jukebox.PlayOneShotGame(GetDodgeSound()); + SoundByte.PlayOneShotGame(GetDodgeSound()); DoObjMiss(); game.PlayerThrough(); } diff --git a/Assets/Scripts/Games/TrickClass/TrickClass.cs b/Assets/Scripts/Games/TrickClass/TrickClass.cs index 8c136844..710301f6 100644 --- a/Assets/Scripts/Games/TrickClass/TrickClass.cs +++ b/Assets/Scripts/Games/TrickClass/TrickClass.cs @@ -65,7 +65,7 @@ namespace HeavenStudio.Games } public struct QueuedObject { - public float beat; + public double beat; public int type; } public static List queuedInputs = new List(); @@ -92,9 +92,9 @@ namespace HeavenStudio.Games public GameEvent bop = new GameEvent(); bool goBop = true; - public float playerCanDodge = Single.MinValue; - float playerBopStart = Single.MinValue; - float girlBopStart = Single.MinValue; + public double playerCanDodge = double.MinValue; + double playerBopStart = double.MinValue; + double girlBopStart = double.MinValue; bool showBubble = true; @@ -117,10 +117,10 @@ namespace HeavenStudio.Games var cond = Conductor.instance; if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && goBop) { - if (cond.songPositionInBeats > playerBopStart) + if (cond.songPositionInBeatsAsDouble > playerBopStart) playerAnim.DoScaledAnimationAsync("Bop"); - if (cond.songPositionInBeats > girlBopStart) + if (cond.songPositionInBeatsAsDouble > girlBopStart) girlAnim.DoScaledAnimationAsync("Bop"); } @@ -155,14 +155,14 @@ namespace HeavenStudio.Games } } - if (PlayerInput.Pressed() && !IsExpectingInputNow() && (playerCanDodge <= Conductor.instance.songPositionInBeats)) + if (PlayerInput.Pressed() && !IsExpectingInputNow() && (playerCanDodge <= Conductor.instance.songPositionInBeatsAsDouble)) { PlayerDodge(true); - playerCanDodge = Conductor.instance.songPositionInBeats + 0.6f; + playerCanDodge = Conductor.instance.songPositionInBeatsAsDouble + 0.6f; } } - public void Bop(float beat, float length, bool shouldBop, bool autoBop) + public void Bop(double beat, float length, bool shouldBop, bool autoBop) { var cond = Conductor.instance; goBop = autoBop; @@ -174,10 +174,10 @@ namespace HeavenStudio.Games { new BeatAction.Action(beat + i, delegate { - if (cond.songPositionInBeats > playerBopStart) + if (cond.songPositionInBeatsAsDouble > playerBopStart) playerAnim.DoScaledAnimationAsync("Bop"); - if (cond.songPositionInBeats > girlBopStart) + if (cond.songPositionInBeatsAsDouble > girlBopStart) girlAnim.DoScaledAnimationAsync("Bop"); }) }); @@ -190,7 +190,7 @@ namespace HeavenStudio.Games instance.showBubble = !instance.showBubble; } - public static void PreTossObject(float beat, int type) + public static void PreTossObject(double beat, int type) { if (GameManager.instance.currentGame == "trickClass") { @@ -228,24 +228,24 @@ namespace HeavenStudio.Games } } - public void TossObject(float beat, int type) + public void TossObject(double beat, int type) { switch (type) { case (int) TrickObjType.Plane: - Jukebox.PlayOneShotGame("trickClass/girl_toss_plane"); + SoundByte.PlayOneShotGame("trickClass/girl_toss_plane"); break; default: - Jukebox.PlayOneShotGame("trickClass/girl_toss_ball"); + SoundByte.PlayOneShotGame("trickClass/girl_toss_ball"); break; } SpawnObject(beat, type); girlAnim.DoScaledAnimationAsync("Throw"); - girlBopStart = Conductor.instance.songPositionInBeats + 0.75f; + girlBopStart = Conductor.instance.songPositionInBeatsAsDouble + 0.75f; } - public void SpawnObject(float beat, int type) + public void SpawnObject(double beat, int type) { GameObject objectToSpawn; BezierCurve3D curve; @@ -275,27 +275,27 @@ namespace HeavenStudio.Games public void PlayerDodge(bool slow = false) { - if (playerCanDodge > Conductor.instance.songPositionInBeats) return; + if (playerCanDodge > Conductor.instance.songPositionInBeatsAsDouble) return; //anim - Jukebox.PlayOneShotGame("trickClass/player_dodge"); + SoundByte.PlayOneShotGame("trickClass/player_dodge"); playerAnim.DoScaledAnimationAsync("Dodge", slow ? 0.6f : 1f); - playerBopStart = Conductor.instance.songPositionInBeats + 0.75f; + playerBopStart = Conductor.instance.songPositionInBeatsAsDouble + 0.75f; } public void PlayerDodgeNg() { playerAnim.DoScaledAnimationAsync("DodgeNg"); - playerBopStart = Conductor.instance.songPositionInBeats + 0.75f; - playerCanDodge = Conductor.instance.songPositionInBeats + 0.15f; + playerBopStart = Conductor.instance.songPositionInBeatsAsDouble + 0.75f; + playerCanDodge = Conductor.instance.songPositionInBeatsAsDouble + 0.15f; } public void PlayerThrough() { playerAnim.DoScaledAnimationAsync("Through"); - playerBopStart = Conductor.instance.songPositionInBeats + 0.75f; - playerCanDodge = Conductor.instance.songPositionInBeats + 0.15f; + playerBopStart = Conductor.instance.songPositionInBeatsAsDouble + 0.75f; + playerCanDodge = Conductor.instance.songPositionInBeatsAsDouble + 0.15f; } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/Tunnel/Tunnel.cs b/Assets/Scripts/Games/Tunnel/Tunnel.cs index 9e046086..92f82d96 100644 --- a/Assets/Scripts/Games/Tunnel/Tunnel.cs +++ b/Assets/Scripts/Games/Tunnel/Tunnel.cs @@ -72,7 +72,7 @@ namespace HeavenStudio.Games public bool started; public struct QueuedCowbell { - public float beat; + public double beat; public float length; } static List queuedInputs = new List(); @@ -130,14 +130,14 @@ namespace HeavenStudio.Games public void HitCowbell() { - Jukebox.PlayOneShot("count-ins/cowbell"); + SoundByte.PlayOneShot("count-ins/cowbell"); handStart = Conductor.instance.songPositionInBeats; cowbellAnimator.Play("Shake",-1,0); } - public static void PreStartCowbell(float beat, float length) + public static void PreStartCowbell(double beat, float length) { if (GameManager.instance.currentGame == "tunnel") { @@ -149,7 +149,7 @@ namespace HeavenStudio.Games } } - public void StartCowbell(float beat, float length) + public void StartCowbell(double beat, float length) { started = true; for(int i = 0; i < length; i++) @@ -189,7 +189,7 @@ namespace HeavenStudio.Games - public static void CountIn(float beat, float length) + public static void CountIn(double beat, float length) { List cuelist = new List(); diff --git a/Assets/Scripts/Games/WizardsWaltz/Plant.cs b/Assets/Scripts/Games/WizardsWaltz/Plant.cs index 99b4daf4..85da27c9 100644 --- a/Assets/Scripts/Games/WizardsWaltz/Plant.cs +++ b/Assets/Scripts/Games/WizardsWaltz/Plant.cs @@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz { public Animator animator; public SpriteRenderer spriteRenderer; - public float createBeat; + public double createBeat; private WizardsWaltz game; private bool hit = false; diff --git a/Assets/Scripts/Games/WizardsWaltz/Wizard.cs b/Assets/Scripts/Games/WizardsWaltz/Wizard.cs index 6209f902..a9eba4fb 100644 --- a/Assets/Scripts/Games/WizardsWaltz/Wizard.cs +++ b/Assets/Scripts/Games/WizardsWaltz/Wizard.cs @@ -23,7 +23,7 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz void Update() { - songPos = Conductor.instance.songPositionInBeats - game.wizardBeatOffset; + songPos = (float)(Conductor.instance.songPositionInBeatsAsDouble - game.wizardBeatOffset); var am = game.beatInterval / 2f; var x = Mathf.Sin(Mathf.PI * songPos / am) * 6; var y = Mathf.Cos(Mathf.PI * songPos / am); @@ -43,7 +43,7 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz if (PlayerInput.Pressed(true)) { animator.Play("Magic", 0, 0); - Jukebox.PlayOneShotGame("wizardsWaltz/wand"); + SoundByte.PlayOneShotGame("wizardsWaltz/wand"); } } @@ -63,13 +63,13 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz } if (hit) { - Jukebox.PlayOneShotGame("wizardsWaltz/grow"); + SoundByte.PlayOneShotGame("wizardsWaltz/grow"); plant.Bloom(); game.girl.Happy(); } else { - Jukebox.PlayOneShot("miss"); + SoundByte.PlayOneShot("miss"); plant.Eat(); game.girl.Sad(); } diff --git a/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs b/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs index 0ae34262..4c1d170e 100644 --- a/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs +++ b/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs @@ -52,9 +52,9 @@ namespace HeavenStudio.Games private int timer = 0; public float beatInterval = 6f; - float intervalStartBeat; + double intervalStartBeat; bool intervalStarted; - public float wizardBeatOffset = 0f; + public double wizardBeatOffset = 0f; [NonSerialized] public int plantsLeft = 0; //this variable is unused @@ -65,7 +65,7 @@ namespace HeavenStudio.Games instance = this; wizard.Init(); - var nextStart = GameManager.instance.Beatmap.entities.Find(c => c.datamodel == "wizardsWaltz/start interval" && c.beat + c.length >= Conductor.instance.songPositionInBeats); + var nextStart = GameManager.instance.Beatmap.Entities.Find(c => c.datamodel == "wizardsWaltz/start interval" && c.beat + c.length >= Conductor.instance.songPositionInBeatsAsDouble); if (nextStart != null) { @@ -85,7 +85,7 @@ namespace HeavenStudio.Games { if (timer % 8 == 0 || UnityEngine.Random.Range(0,8) == 0) { - var songPos = Conductor.instance.songPositionInBeats - wizardBeatOffset; + var songPos = (float)(Conductor.instance.songPositionInBeatsAsDouble - wizardBeatOffset); var am = beatInterval / 2f; var x = Mathf.Sin(Mathf.PI * songPos / am) * 6 + UnityEngine.Random.Range(-0.5f, 0.5f); var y = Mathf.Cos(Mathf.PI * songPos / am) * 0.5f + UnityEngine.Random.Range(-0.5f, 0.5f); @@ -101,7 +101,7 @@ namespace HeavenStudio.Games timer++; } - public void SetIntervalStart(float beat, float interval = 4f) + public void SetIntervalStart(double beat, float interval = 4f) { // Don't do these things if the interval was already started. if (!intervalStarted) @@ -115,16 +115,16 @@ namespace HeavenStudio.Games beatInterval = interval; } - public void SpawnFlower(float beat) + public void SpawnFlower(double beat) { // If interval hasn't started, assume this is the first hair of the interval. if (!intervalStarted) SetIntervalStart(beat, beatInterval); - Jukebox.PlayOneShotGame("wizardsWaltz/plant", beat); + SoundByte.PlayOneShotGame("wizardsWaltz/plant", beat); Plant plant = Instantiate(plantBase, plantHolder.transform).GetComponent(); - var songPos = Conductor.instance.songPositionInBeats - wizardBeatOffset; + var songPos = (float)(Conductor.instance.songPositionInBeatsAsDouble - wizardBeatOffset); var am = (beatInterval / 2f); var x = Mathf.Sin(Mathf.PI * songPos / am) * 6; var y = -3f + Mathf.Cos(Mathf.PI * songPos / am) * 1.5f; diff --git a/Assets/Scripts/Games/WorkingDough/BGBall.cs b/Assets/Scripts/Games/WorkingDough/BGBall.cs index 3562e5cf..4dee431e 100644 --- a/Assets/Scripts/Games/WorkingDough/BGBall.cs +++ b/Assets/Scripts/Games/WorkingDough/BGBall.cs @@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough { public class BGBall : MonoBehaviour { - public float startBeat; + public double startBeat; public float firstBeatsToTravel = 3f; public float secondBeatsToTravel = 1f; public float thirdBeatsToTravel = 3f; diff --git a/Assets/Scripts/Games/WorkingDough/NPCDoughBall.cs b/Assets/Scripts/Games/WorkingDough/NPCDoughBall.cs index 7c2f2af5..0475fcc3 100644 --- a/Assets/Scripts/Games/WorkingDough/NPCDoughBall.cs +++ b/Assets/Scripts/Games/WorkingDough/NPCDoughBall.cs @@ -16,7 +16,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough } public class NPCDoughBall : MonoBehaviour { - public float startBeat; + public double startBeat; public FlyingStage currentFlyingStage = FlyingStage.EnteringUp; diff --git a/Assets/Scripts/Games/WorkingDough/PlayerEnterDoughBall.cs b/Assets/Scripts/Games/WorkingDough/PlayerEnterDoughBall.cs index bde66f00..30bfccc1 100644 --- a/Assets/Scripts/Games/WorkingDough/PlayerEnterDoughBall.cs +++ b/Assets/Scripts/Games/WorkingDough/PlayerEnterDoughBall.cs @@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough { public class PlayerEnterDoughBall : MonoBehaviour { - public float startBeat; + public double startBeat; public float firstBeatsToTravel = 0.5f; public float secondBeatsToTravel = 0.5f; public bool goingDown = false; diff --git a/Assets/Scripts/Games/WorkingDough/WorkingDough.cs b/Assets/Scripts/Games/WorkingDough/WorkingDough.cs index 37d669f5..feebb413 100644 --- a/Assets/Scripts/Games/WorkingDough/WorkingDough.cs +++ b/Assets/Scripts/Games/WorkingDough/WorkingDough.cs @@ -139,26 +139,26 @@ namespace HeavenStudio.Games [Header("Variables")] public bool intervalStarted; - float intervalStartBeat; + double intervalStartBeat; float risingLength = 4f; - float risingStartBeat; + double risingStartBeat; float liftingLength = 4f; - float liftingStartBeat; + double liftingStartBeat; public static float beatInterval = 8f; float gandMovingLength = 4f; - float gandMovingStartBeat; + double gandMovingStartBeat; public bool bigMode; public bool bigModePlayer; static List queuedBalls = new List(); struct QueuedBall { - public float beat; + public double beat; public bool isBig; } static List queuedIntervals = new List(); struct QueuedInterval { - public float beat; + public double beat; public float interval; } private List currentBalls = new List(); @@ -213,7 +213,7 @@ namespace HeavenStudio.Games doughDudesHolderAnim.Play("OnGround", 0, 0); } - public void SetIntervalStart(float beat, float interval) + public void SetIntervalStart(double beat, float interval) { Debug.Log("Start Interval"); if (!intervalStarted) @@ -262,7 +262,7 @@ namespace HeavenStudio.Games intervalStartBeat = beat; } - public void SpawnBall(float beat, bool isBig) + public void SpawnBall(double beat, bool isBig) { if (!intervalStarted && ballTriggerSetInterval) { @@ -303,7 +303,7 @@ namespace HeavenStudio.Games }); } - public void InstantExitBall(float beat, bool isBig, float offSet) + public void InstantExitBall(double beat, bool isBig, double offSet) { var objectToSpawn = isBig ? bigBallNPC : smallBallNPC; var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder); @@ -314,7 +314,7 @@ namespace HeavenStudio.Games ballComponent.enterUpCurve = npcEnterUpCurve; ballComponent.exitDownCurve = npcExitDownCurve; ballComponent.enterDownCurve = npcEnterDownCurve; - ballComponent.currentFlyingStage = (FlyingStage)(2 - Mathf.Abs(offSet)); + ballComponent.currentFlyingStage = (FlyingStage)(2 - (int)Math.Abs(offSet)); if (isBig && !bigMode) { @@ -339,9 +339,9 @@ namespace HeavenStudio.Games }); } - public static void PreSpawnBall(float beat, bool isBig) + public static void PreSpawnBall(double beat, bool isBig) { - float spawnBeat = beat - 1f; + double spawnBeat = beat - 1f; beat -= 1f; if (GameManager.instance.currentGame == "workingDough") { @@ -370,7 +370,7 @@ namespace HeavenStudio.Games } } - public void OnSpawnBall(float beat, bool isBig) + public void OnSpawnBall(double beat, bool isBig) { beat -= 1f; BeatAction.New(instance.gameObject, new List() @@ -379,7 +379,7 @@ namespace HeavenStudio.Games }); } - public void OnSpawnBallInactive(float beat, bool isBig) + public void OnSpawnBallInactive(double beat, bool isBig) { queuedBalls.Add(new QueuedBall() { @@ -388,7 +388,7 @@ namespace HeavenStudio.Games }); } - public void SpawnPlayerBall(float beat, bool isBig) + public void SpawnPlayerBall(double beat, bool isBig) { var objectToSpawn = isBig ? playerEnterBigBall : playerEnterSmallBall; var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder); @@ -427,7 +427,7 @@ namespace HeavenStudio.Games }); } - public void SpawnPlayerBallResult(float beat, bool isBig, BezierCurve3D firstCurve, BezierCurve3D secondCurve, float firstBeatsToTravel, float secondBeatsToTravel) + public void SpawnPlayerBallResult(double beat, bool isBig, BezierCurve3D firstCurve, BezierCurve3D secondCurve, float firstBeatsToTravel, float secondBeatsToTravel) { var objectToSpawn = isBig ? playerEnterBigBall : playerEnterSmallBall; var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder); @@ -442,7 +442,7 @@ namespace HeavenStudio.Games spawnedBall.SetActive(true); } - public static void PreSetIntervalStart(float beat, float interval) + public static void PreSetIntervalStart(double beat, float interval) { beat -= 1f; if (GameManager.instance.currentGame == "workingDough") @@ -516,8 +516,8 @@ namespace HeavenStudio.Games { foreach (var ball in queuedBalls) { - float offSet = ball.beat - cond.songPositionInBeats; - float spawnOffset = offSet > 1f ? offSet - 1 : 0; + double offSet = ball.beat - cond.songPositionInBeatsAsDouble; + double spawnOffset = offSet > 1f ? offSet - 1 : 0; if (ball.isBig) NPCBallTransporters.GetComponent().Play("BigMode", 0, 0); BeatAction.New(instance.gameObject, new List() { @@ -540,18 +540,18 @@ namespace HeavenStudio.Games if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) { doughDudesPlayer.GetComponent().Play("SmallDoughJump", 0, 0); - Jukebox.PlayOneShotGame("workingDough/PlayerSmallJump"); + SoundByte.PlayOneShotGame("workingDough/PlayerSmallJump"); } else if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN)) { doughDudesPlayer.GetComponent().Play("BigDoughJump", 0, 0); - Jukebox.PlayOneShotGame("workingDough/PlayerBigJump"); + SoundByte.PlayOneShotGame("workingDough/PlayerBigJump"); } } void WrongInputBig(PlayerActionEvent caller, float state) { - float beat = caller.startBeat + caller.timer; + double beat = caller.startBeat + caller.timer; shouldMiss = false; if (currentBalls.Count > 0) { @@ -560,7 +560,7 @@ namespace HeavenStudio.Games GameObject.Destroy(currentBall); } doughDudesPlayer.GetComponent().Play("SmallDoughJump", 0, 0); - Jukebox.PlayOneShotGame("workingDough/BigBallTooWeak"); + SoundByte.PlayOneShotGame("workingDough/BigBallTooWeak"); SpawnPlayerBallResult(beat, true, playerWrongInputTooWeakFirstCurve, playerWrongInputTooWeakSecondCurve, 0.5f, 1f); playerImpact.SetActive(true); BeatAction.New(instance.gameObject, new List() @@ -571,7 +571,7 @@ namespace HeavenStudio.Games void WrongInputSmall(PlayerActionEvent caller, float state) { - float beat = caller.startBeat + caller.timer; + double beat = caller.startBeat + caller.timer; shouldMiss = false; if (currentBalls.Count > 0) { @@ -581,7 +581,7 @@ namespace HeavenStudio.Games } GameObject.Instantiate(breakParticleEffect, breakParticleHolder); doughDudesPlayer.GetComponent().Play("BigDoughJump", 0, 0); - Jukebox.PlayOneShotGame("workingDough/BreakBall"); + SoundByte.PlayOneShotGame("workingDough/BreakBall"); playerImpact.SetActive(true); BeatAction.New(instance.gameObject, new List() { @@ -603,12 +603,12 @@ namespace HeavenStudio.Games GameObject.Destroy(currentBall); } - float beat = caller.startBeat + caller.timer; + double beat = caller.startBeat + caller.timer; SpawnPlayerBallResult(beat, true, playerMissCurveFirst, playerMissCurveSecond, 0.25f, 0.75f); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + 0.25f, delegate { missImpact.SetActive(true); }), - new BeatAction.Action(beat + 0.25f, delegate { Jukebox.PlayOneShotGame("workingDough/BallMiss"); }), + new BeatAction.Action(beat + 0.25f, delegate { SoundByte.PlayOneShotGame("workingDough/BallMiss"); }), new BeatAction.Action(beat + 0.35f, delegate { missImpact.SetActive(false); }), }); } @@ -626,12 +626,12 @@ namespace HeavenStudio.Games currentBalls.Remove(currentBall); GameObject.Destroy(currentBall); } - float beat = caller.startBeat + caller.timer; + double beat = caller.startBeat + caller.timer; SpawnPlayerBallResult(beat, false, playerMissCurveFirst, playerMissCurveSecond, 0.25f, 0.75f); BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + 0.25f, delegate { missImpact.SetActive(true); }), - new BeatAction.Action(beat + 0.25f, delegate { Jukebox.PlayOneShotGame("workingDough/BallMiss"); }), + new BeatAction.Action(beat + 0.25f, delegate { SoundByte.PlayOneShotGame("workingDough/BallMiss"); }), new BeatAction.Action(beat + 0.35f, delegate { missImpact.SetActive(false); }), }); } @@ -639,7 +639,7 @@ namespace HeavenStudio.Games void JustSmall(PlayerActionEvent caller, float state) { if (GameManager.instance.currentGame != "workingDough") return; - float beat = caller.startBeat + caller.timer; + double beat = caller.startBeat + caller.timer; if (currentBalls.Count > 0) { GameObject currentBall = currentBalls[0]; @@ -648,7 +648,7 @@ namespace HeavenStudio.Games } if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("workingDough/SmallBarely"); + SoundByte.PlayOneShotGame("workingDough/SmallBarely"); doughDudesPlayer.GetComponent().Play("SmallDoughJump", 0, 0); playerImpact.SetActive(true); @@ -665,7 +665,7 @@ namespace HeavenStudio.Games void JustBig(PlayerActionEvent caller, float state) { if (GameManager.instance.currentGame != "workingDough") return; - float beat = caller.startBeat + caller.timer; + double beat = caller.startBeat + caller.timer; if (currentBalls.Count > 0) { GameObject currentBall = currentBalls[0]; @@ -674,7 +674,7 @@ namespace HeavenStudio.Games } if (state >= 1f || state <= -1f) { - Jukebox.PlayOneShotGame("workingDough/BigBarely"); + SoundByte.PlayOneShotGame("workingDough/BigBarely"); doughDudesPlayer.GetComponent().Play("BigDoughJump", 0, 0); playerImpact.SetActive(true); @@ -688,17 +688,17 @@ namespace HeavenStudio.Games Success(true, beat); } - void Success(bool isBig, float beat) + void Success(bool isBig, double beat) { if (isBig) { - Jukebox.PlayOneShotGame("workingDough/rightBig"); + SoundByte.PlayOneShotGame("workingDough/rightBig"); doughDudesPlayer.GetComponent().Play("BigDoughJump", 0, 0); backgroundAnimator.Play("BackgroundFlash", 0, 0); } else { - Jukebox.PlayOneShotGame("workingDough/rightSmall"); + SoundByte.PlayOneShotGame("workingDough/rightSmall"); doughDudesPlayer.GetComponent().Play("SmallDoughJump", 0, 0); } playerImpact.SetActive(true); @@ -712,7 +712,7 @@ namespace HeavenStudio.Games }); } - void SpawnBGBall(float beat, bool isBig) + void SpawnBGBall(double beat, bool isBig) { var objectToSpawn = isBig ? bigBGBall : smallBGBall; var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder); @@ -735,7 +735,7 @@ namespace HeavenStudio.Games doughDudesHolderAnim.Play(isUp ? "InAir" : "OnGround", 0, 0); } - public void Elevate(float beat, float length, bool isUp) + public void Elevate(double beat, float length, bool isUp) { liftingAnimName = isUp ? "LiftUp" : "LiftDown"; liftingStartBeat = beat; @@ -748,7 +748,7 @@ namespace HeavenStudio.Games }); } - public void LaunchShip(float beat, float length) + public void LaunchShip(double beat, float length) { spaceshipRisen = true; if (!spaceshipLights.activeSelf) @@ -760,12 +760,12 @@ namespace HeavenStudio.Games BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + length, delegate { spaceshipAnimator.Play("SpaceshipLaunch", 0, 0); }), - new BeatAction.Action(beat + length, delegate { Jukebox.PlayOneShotGame("workingDough/LaunchRobot"); }), - new BeatAction.Action(beat + length, delegate { Jukebox.PlayOneShotGame("workingDough/Rocket"); }), + new BeatAction.Action(beat + length, delegate { SoundByte.PlayOneShotGame("workingDough/LaunchRobot"); }), + new BeatAction.Action(beat + length, delegate { SoundByte.PlayOneShotGame("workingDough/Rocket"); }), }); } - public void RiseUpShip(float beat, float length) + public void RiseUpShip(double beat, float length) { spaceshipRisen = true; spaceshipRising = true; @@ -783,7 +783,7 @@ namespace HeavenStudio.Games }); } - public void GANDWEnterOrExit(float beat, float length, bool shouldExit) + public void GANDWEnterOrExit(double beat, float length, bool shouldExit) { gandwMoving = true; gandwHasEntered = false; diff --git a/Assets/Scripts/GlobalGameManager.cs b/Assets/Scripts/GlobalGameManager.cs index 52f99844..c39284c6 100644 --- a/Assets/Scripts/GlobalGameManager.cs +++ b/Assets/Scripts/GlobalGameManager.cs @@ -14,9 +14,21 @@ namespace HeavenStudio public class GlobalGameManager : MonoBehaviour { public static GlobalGameManager instance { get; set; } + + [Header("Loading Screen")] [SerializeField] Image fadeImage; [SerializeField] TMP_Text loadingText; + [Header("Dialog Box")] + [SerializeField] GameObject messagePanel; + [SerializeField] TMP_Text messageHeader; + [SerializeField] TMP_Text messageBody; + [SerializeField] TMP_Text errorBuild; + [SerializeField] Button errorOkButton; + [SerializeField] Button errorLogButton; + [SerializeField] Slider dialogProgress; + public static bool IsShowingDialog; + public static string buildTime = "00/00/0000 00:00:00"; public static bool discordDuringTesting = false; @@ -66,6 +78,7 @@ namespace HeavenStudio { BasicCheck(); + Minigames.InitPreprocessor(); loadedScene = SceneManager.GetActiveScene().name; PersistentDataManager.LoadSettings(); @@ -85,17 +98,20 @@ namespace HeavenStudio ChangeAudioSettings(currentDspSize, currentSampleRate); + Application.targetFrameRate = -1; + QualitySettings.vSyncCount = 0; + QualitySettings.maxQueuedFrames = 1; if (PersistentDataManager.gameSettings.isFullscreen) { - Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, FullScreenMode.FullScreenWindow); + Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, FullScreenMode.ExclusiveFullScreen); Screen.fullScreen = true; } else { + Screen.fullScreenMode = FullScreenMode.Windowed; Screen.fullScreen = false; ChangeScreenSize(); } - QualitySettings.maxQueuedFrames = 1; PlayerInput.InitInputControllers(); #if UNITY_EDITOR Starpelly.OS.ChangeWindowTitle("Heaven Studio UNITYEDITOR "); @@ -112,6 +128,9 @@ namespace HeavenStudio instance = this; fadeImage.gameObject.SetActive(false); loadingText.enabled = false; + + messagePanel.SetActive(false); + IsShowingDialog = false; } private void Update() @@ -148,6 +167,18 @@ namespace HeavenStudio }); } + public void HideDialog() + { + Debug.Log("Hiding dialog"); + messagePanel.SetActive(false); + IsShowingDialog = false; + } + + public void OpenLogFolder() + { + // TODO + } + public static void BasicCheck() { if (FindGGM() == null) @@ -195,12 +226,63 @@ namespace HeavenStudio }); } + public static void ShowErrorMessage(string header, string message) + { + IsShowingDialog = true; + if (Conductor.instance != null && Conductor.instance.isPlaying) + Conductor.instance.Pause(); + + instance.messageHeader.text = header; + instance.messageBody.text = message; + instance.errorOkButton.gameObject.SetActive(true); + // instance.errorLogButton.gameObject.SetActive(true); + instance.dialogProgress.gameObject.SetActive(false); + + instance.errorBuild.gameObject.SetActive(true); + #if UNITY_EDITOR + instance.errorBuild.text = "(EDITOR) " + System.DateTime.UtcNow.ToString("dd/MM/yyyy hh:mm:ss"); + #else + instance.errorBuild.text = Application.buildGUID.Substring(0, 8) + " " + AppInfo.Date.ToString("dd/MM/yyyy hh:mm:ss"); + #endif + + instance.messagePanel.SetActive(true); + } + + public static void ShowLoadingMessage(string header, string message, float progress = -1) + { + Debug.Log("ShowLoadingMessage"); + IsShowingDialog = true; + if (Conductor.instance != null && Conductor.instance.isPlaying) + Conductor.instance.Pause(); + + instance.messageHeader.text = header; + instance.messageBody.text = message; + instance.errorOkButton.gameObject.SetActive(false); + instance.errorBuild.gameObject.SetActive(false); + // instance.errorLogButton.gameObject.SetActive(false); + if (progress >= 0) + { + instance.dialogProgress.gameObject.SetActive(true); + instance.dialogProgress.value = progress; + } + instance.messagePanel.SetActive(true); + } + + public static void SetLoadingMessageProgress(float progress) + { + if (IsShowingDialog) + { + instance.dialogProgress.gameObject.SetActive(true); + instance.dialogProgress.value = progress; + } + } + public static void WindowFullScreen() { if (!Screen.fullScreen) { // Set the resolution to the display's current resolution - Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, FullScreenMode.FullScreenWindow); + Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, FullScreenMode.ExclusiveFullScreen); Screen.fullScreen = true; PersistentDataManager.gameSettings.isFullscreen = true; } @@ -290,6 +372,8 @@ namespace HeavenStudio { Debug.Log("Disconnecting JoyShocks..."); PlayerInput.DisconnectJoyshocks(); + Debug.Log("Clearing RIQ Cache..."); + Jukebox.RiqFileHandler.ClearCache(); } } } diff --git a/Assets/Scripts/LevelEditor/BeatGrid.cs b/Assets/Scripts/LevelEditor/BeatGrid.cs index 377cfe82..b3383a74 100644 --- a/Assets/Scripts/LevelEditor/BeatGrid.cs +++ b/Assets/Scripts/LevelEditor/BeatGrid.cs @@ -25,7 +25,6 @@ namespace HeavenStudio.Editor.Track private float lastTimelineSize; private float contentPosX => Mathf.Abs(scrollRect.content.localPosition.x / scrollRect.content.localScale.x); - private float secPerBeat => 60.0f / GameManager.instance.Beatmap.bpm; private List Lines = new List(); diff --git a/Assets/Scripts/LevelEditor/BoxSelection.cs b/Assets/Scripts/LevelEditor/BoxSelection.cs index 16a3c3e7..bbbb66bd 100644 --- a/Assets/Scripts/LevelEditor/BoxSelection.cs +++ b/Assets/Scripts/LevelEditor/BoxSelection.cs @@ -160,9 +160,9 @@ namespace HeavenStudio.Editor int selected = 0; - for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++) + for (int i = 0; i < Timeline.instance.eventObjs.Count; i++) { - TimelineEventObj e = GameManager.instance.Beatmap.entities[i].eventObj; + TimelineEventObj e = Timeline.instance.eventObjs[i]; if (selectionBox.Overlaps(GetWorldRect(e.GetComponent()))) { diff --git a/Assets/Scripts/LevelEditor/Commands/Block.cs b/Assets/Scripts/LevelEditor/Commands/Block.cs index b98aa0ed..c5b21edd 100644 --- a/Assets/Scripts/LevelEditor/Commands/Block.cs +++ b/Assets/Scripts/LevelEditor/Commands/Block.cs @@ -2,6 +2,8 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; +using Jukebox; +using Jukebox.Legacy; using HeavenStudio.Editor.Track; @@ -98,7 +100,7 @@ namespace HeavenStudio.Editor.Commands { if (pos[id].eventObj == null) { - pos[id].eventObj = GameManager.instance.Beatmap.entities.Find(c => c.eventObj.eventObjID == pos[id].eventObj.eventObjID).eventObj; + pos[id].eventObj = Timeline.instance.eventObjs.Find(c => c.eventObjID == pos[id].eventObj.eventObjID); } } } @@ -119,7 +121,7 @@ namespace HeavenStudio.Editor.Commands public void Redo() { - deletedObj = Timeline.instance.AddEventObject(deletedObj.entity.datamodel, false, new Vector3(deletedObj.entity.beat, -deletedObj.entity.track * Timeline.instance.LayerHeight()), deletedObj.entity, true, deletedObj.entity.eventObj.eventObjID); + deletedObj = Timeline.instance.AddEventObject(deletedObj.entity.datamodel, false, new Vector3((float) deletedObj.entity.beat, -deletedObj.entity["track"] * Timeline.instance.LayerHeight()), deletedObj.entity, true); } public void Undo() @@ -127,7 +129,7 @@ namespace HeavenStudio.Editor.Commands deletedObj = eventObj; Selections.instance.Deselect(eventObj); Timeline.instance.DestroyEventObject(eventObj.entity); - // DynamicBeatmap.DynamicEntity e = deletedObjs[i].entity; + // RiqEntity e = deletedObjs[i].entity; // Timeline.instance.AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * Timeline.instance.LayerHeight()), e, true, e.eventObj.eventObjID); } } @@ -166,8 +168,8 @@ namespace HeavenStudio.Editor.Commands { for (int i = 0; i < deletedObjs.Count; i++) { - DynamicBeatmap.DynamicEntity e = deletedObjs[i].entity; - eventObjs[i] = Timeline.instance.AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * Timeline.instance.LayerHeight()), e, true, e.eventObj.eventObjID); + RiqEntity e = deletedObjs[i].entity; + eventObjs[i] = Timeline.instance.AddEventObject(e.datamodel, false, new Vector3((float)e.beat, -e["track"] * Timeline.instance.LayerHeight()), e, true); } } } @@ -190,8 +192,8 @@ namespace HeavenStudio.Editor.Commands { for (int i = 0; i < copiedObjs.Count; i++) { - DynamicBeatmap.DynamicEntity e = copiedObjs[i].entity; - eventObjs[i] = Timeline.instance.AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * Timeline.instance.LayerHeight()), e, true, e.eventObj.eventObjID); + RiqEntity e = copiedObjs[i].entity; + eventObjs[i] = Timeline.instance.AddEventObject(e.datamodel, false, new Vector3((float)e.beat, -e["track"] * Timeline.instance.LayerHeight()), e, true); } } diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index 78c43113..567a26c3 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -18,6 +18,8 @@ using HeavenStudio.Editor.Track; using HeavenStudio.Util; using HeavenStudio.StudioDance; +using Jukebox; + using System.IO.Compression; using System.Text; @@ -78,8 +80,6 @@ namespace HeavenStudio.Editor public bool isShortcutsEnabled { get { return (!inAuthorativeMenu) && (!editingInputField); } } - private byte[] MusicBytes; - public static Editor instance { get; private set; } private void Start() @@ -256,11 +256,22 @@ namespace HeavenStudio.Editor { if (paths.Length > 0) { - Conductor.instance.musicSource.clip = await LoadClip(Path.Combine(paths)); - changedMusic = true; - - Timeline.FitToSong(); + try + { + if (paths.Length == 0) return; + RiqFileHandler.WriteSong(paths[0]); + StartCoroutine(LoadMusic()); + return; + } + catch (System.Exception e) + { + Debug.Log($"Error selecting music file: {e.Message}"); + Debug.LogException(e); + GlobalGameManager.ShowErrorMessage("Error", e.Message); + return; + } } + await Task.Yield(); } ); #else @@ -268,84 +279,34 @@ namespace HeavenStudio.Editor { if (paths.Length > 0) { - Conductor.instance.musicSource.clip = await LoadClip("file://" + Path.Combine(paths)); - changedMusic = true; - - Timeline.FitToSong(); - Timeline.CreateWaveform(); + try + { + if (paths.Length == 0) return; + RiqFileHandler.WriteSong(paths[0]); + StartCoroutine(LoadMusic()); + return; + } + catch (System.Exception e) + { + Debug.Log($"Error selecting music file: {e.Message}"); + Debug.LogException(e); + GlobalGameManager.ShowErrorMessage("Error", e.Message); + return; + } } + await Task.Yield(); } ); #endif } - private async Task LoadClip(string path) + IEnumerator LoadMusic() { - AudioClip clip = null; - - AudioType audioType = AudioType.OGGVORBIS; - - // this is a bad solution but i'm lazy - if (path.Substring(path.Length - 3) == "ogg") - audioType = AudioType.OGGVORBIS; - else if (path.Substring(path.Length - 3) == "mp3") - audioType = AudioType.MPEG; - else if (path.Substring(path.Length - 3) == "wav") - audioType = AudioType.WAV; - - using (UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip(path, audioType)) - { - uwr.SendWebRequest(); - - try - { - while (!uwr.isDone) await Task.Delay(5); - - if (uwr.result == UnityWebRequest.Result.ProtocolError) Debug.Log($"{uwr.error}"); - else - { - clip = DownloadHandlerAudioClip.GetContent(uwr); - } - } - catch (Exception err) - { - Debug.Log($"{err.Message}, {err.StackTrace}"); - } - } - - try - { - if (clip != null) - MusicBytes = OggVorbis.VorbisPlugin.GetOggVorbis(clip, 1); - else - { - MusicBytes = null; - Debug.LogWarning("Failed to load music file! The stream is currently empty."); - } - } - catch (System.ArgumentNullException) - { - clip = null; - MusicBytes = null; - Debug.LogWarning("Failed to load music file! The stream is currently empty."); - } - catch (System.ArgumentOutOfRangeException) - { - clip = null; - MusicBytes = null; - Debug.LogWarning("Failed to load music file! The stream is malformed."); - } - catch (System.ArgumentException) - { - clip = null; - MusicBytes = null; - Debug.LogWarning("Failed to load music file! Only 1 or 2 channels are supported!."); - } - - return clip; + yield return GameManager.instance.LoadMusic(); + Timeline.FitToSong(); + // Timeline.CreateWaveform(); } - public void SaveRemix(bool saveAs = true) { if (saveAs == true) @@ -383,24 +344,17 @@ namespace HeavenStudio.Editor private void SaveRemixFile(string path) { - using (FileStream zipFile = File.Open(path, FileMode.Create)) + try { - using (var archive = new ZipArchive(zipFile, ZipArchiveMode.Update)) - { - var levelFile = archive.CreateEntry("remix.json", System.IO.Compression.CompressionLevel.NoCompression); - using (var zipStream = levelFile.Open()) - zipStream.Write(Encoding.UTF8.GetBytes(GetJson()), 0, Encoding.UTF8.GetBytes(GetJson()).Length); - - if (MusicBytes != null) - { - var musicFile = archive.CreateEntry("song.ogg", System.IO.Compression.CompressionLevel.NoCompression); - using (var zipStream = musicFile.Open()) - zipStream.Write(MusicBytes, 0, MusicBytes.Length); - } - } - - currentRemixPath = path; - UpdateEditorStatus(false); + RiqFileHandler.WriteRiq(GameManager.instance.Beatmap); + RiqFileHandler.PackRiq(path, true); + Debug.Log("Packed RIQ successfully!"); + return; + } + catch (System.Exception e) + { + Debug.Log($"Error packing RIQ: {e.Message}"); + return; } } @@ -410,17 +364,18 @@ namespace HeavenStudio.Editor Timeline.instance?.Stop(0); else GameManager.instance.Stop(0); - MusicBytes = null; - LoadRemix(""); + LoadRemix(true); } - public void LoadRemix(string json = "", string type = "riq") + public void LoadRemix(bool create = false) { - GameManager.instance.LoadRemix(json, type); + if (create) + GameManager.instance.NewRemix(); + else + { + GameManager.instance.LoadRemix(true); + } Timeline.instance.LoadRemix(); - // Timeline.instance.SpecialInfo.UpdateStartingBPMText(); - // Timeline.instance.VolumeInfo.UpdateStartingVolumeText(); - // Timeline.instance.SpecialInfo.UpdateOffsetText(); Timeline.FitToSong(); currentRemixPath = string.Empty; @@ -440,49 +395,30 @@ namespace HeavenStudio.Editor var path = Path.Combine(paths); if (path == string.Empty) return; - loadedMusic = false; - string extension = path.GetExtension(); - using var zipFile = File.Open(path, FileMode.Open); - using var archive = new ZipArchive(zipFile, ZipArchiveMode.Read); - - foreach (var entry in archive.Entries) - switch (entry.Name) - { - case "remix.json": - { - using var stream = entry.Open(); - using var reader = new StreamReader(stream); - LoadRemix(reader.ReadToEnd(), extension); - - break; - } - case "song.ogg": - { - using var stream = entry.Open(); - using var memoryStream = new MemoryStream(); - stream.CopyTo(memoryStream); - MusicBytes = memoryStream.ToArray(); - Conductor.instance.musicSource.clip = OggVorbis.VorbisPlugin.ToAudioClip(MusicBytes, "music"); - loadedMusic = true; - Timeline.FitToSong(); - - break; - } - } - - if (!loadedMusic) + GlobalGameManager.ShowLoadingMessage("Loading", $"Loading remix from {path}"); + try { - Conductor.instance.musicSource.clip = null; - MusicBytes = null; + string tmpDir = RiqFileHandler.ExtractRiq(path); + Debug.Log("Imported RIQ successfully!"); + LoadRemix(); } + catch (System.Exception e) + { + Debug.Log($"Error importing RIQ: {e.Message}"); + Debug.LogException(e); + GlobalGameManager.ShowErrorMessage("Error Loading RIQ", e.Message + "\n\n" + e.StackTrace); + return; + } + + StartCoroutine(LoadMusic()); currentRemixPath = path; remixName = Path.GetFileName(path); UpdateEditorStatus(false); CommandManager.instance.Clear(); - Timeline.FitToSong(); - Timeline.CreateWaveform(); + + GlobalGameManager.instance.HideDialog(); }); } @@ -521,13 +457,6 @@ namespace HeavenStudio.Editor GlobalGameManager.UpdateDiscordStatus($"{remixName}", true, updateTime); } - public string GetJson() - { - string json = string.Empty; - json = JsonConvert.SerializeObject(GameManager.instance.Beatmap); - return json; - } - public void SetGameEventTitle(string txt) { GameEventSelectorTitle.text = txt; diff --git a/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs b/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs index 47d942b2..347663df 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using UnityEngine; using HeavenStudio.Editor.Track; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Editor { @@ -20,7 +22,7 @@ namespace HeavenStudio.Editor [SerializeField] private GameObject ColorP; [SerializeField] private GameObject StringP; - public DynamicBeatmap.DynamicEntity entity; + public RiqEntity entity; public bool active; @@ -61,7 +63,7 @@ namespace HeavenStudio.Editor Editor.instance.SetGameEventTitle($"Select game event for {gridGameSelector.SelectedMinigame.Replace("\n", "")}"); } - public void StartParams(DynamicBeatmap.DynamicEntity entity) + public void StartParams(RiqEntity entity) { active = true; AddParams(entity); @@ -76,7 +78,7 @@ namespace HeavenStudio.Editor _ => EditorTheme.theme.properties.Layer1Col }; - private void AddParams(DynamicBeatmap.DynamicEntity entity) + private void AddParams(RiqEntity entity) { var minigame = EventCaller.instance.GetMinigame(entity.datamodel.Split(0)); int actionIndex = minigame.actions.IndexOf(minigame.actions.Find(c => c.actionName == entity.datamodel.Split(1))); @@ -87,7 +89,7 @@ namespace HeavenStudio.Editor eventSelector.SetActive(false); this.entity = entity; - string col = TrackToThemeColour(entity.track); + string col = TrackToThemeColour(entity["track"]); Editor.instance.SetGameEventTitle($"Properties for {action.displayName} on Beat {entity.beat}"); DestroyParams(); diff --git a/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs b/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs index ba71d222..86e8eaee 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs @@ -251,10 +251,10 @@ namespace HeavenStudio.Editor index = 0; } - eventObj = Timeline.instance.AddEventObject(mg.name + "/" + mg.actions[index].actionName, true, new Vector3(0, 0), null, true, Timeline.RandomID()); + eventObj = Timeline.instance.AddEventObject(mg.name + "/" + mg.actions[index].actionName, true, new Vector3(0, 0), null, true); } else - eventObj = Timeline.instance.AddEventObject($"gameManager/switchGame/{mg.name}", true, new Vector3(0, 0), null, true, Timeline.RandomID()); + eventObj = Timeline.instance.AddEventObject($"gameManager/switchGame/{mg.name}", true, new Vector3(0, 0), null, true); } else { @@ -268,7 +268,7 @@ namespace HeavenStudio.Editor index = currentEventIndex; } - eventObj = Timeline.instance.AddEventObject(mg.name + "/" + mg.actions[index].actionName, true, new Vector3(0, 0), null, true, Timeline.RandomID()); + eventObj = Timeline.instance.AddEventObject(mg.name + "/" + mg.actions[index].actionName, true, new Vector3(0, 0), null, true); } eventObj.isCreating = true; diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs index 5f48ab9c..0c1431ee 100644 --- a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs @@ -3,6 +3,8 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using HeavenStudio.Editor.Track; +using Jukebox; +using Jukebox.Legacy; using TMPro; @@ -32,7 +34,7 @@ namespace HeavenStudio.Editor [SerializeField] public GameObject HeaderP; [SerializeField] public GameObject SubHeaderP; - [NonSerialized] public DynamicBeatmap chart; + [NonSerialized] public RiqBeatmap chart; List tabContents; private void Start() { } @@ -73,9 +75,9 @@ namespace HeavenStudio.Editor foreach (PropertyTag property in tags) { - if (chart.properties.ContainsKey(property.tag)) + if (chart.data.properties.ContainsKey(property.tag)) { - container.AddParam(this, property.tag, chart.properties[property.tag], property.label, property.isReadOnly); + container.AddParam(this, property.tag, chart.data.properties[property.tag], property.label, property.isReadOnly); } else { diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SectionDialog.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SectionDialog.cs index 913398e7..45e9d925 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SectionDialog.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SectionDialog.cs @@ -30,8 +30,8 @@ public class SectionDialog : Dialog public void SetSectionObj(SectionTimelineObj sectionObj) { this.sectionObj = sectionObj; - sectionName.text = sectionObj.chartSection.sectionName; - challengeEnable.isOn = sectionObj.chartSection.startPerfect; + sectionName.text = sectionObj.chartSection["sectionName"]; + challengeEnable.isOn = sectionObj.chartSection["startPerfect"]; } public void DeleteSection() @@ -41,20 +41,20 @@ public class SectionDialog : Dialog Editor.instance.inAuthorativeMenu = false; } if (sectionObj == null) return; - GameManager.instance.Beatmap.beatmapSections.Remove(sectionObj.chartSection); + GameManager.instance.Beatmap.SectionMarkers.Remove(sectionObj.chartSection); sectionObj.DeleteObj(); } public void ChangeSectionName(string name) { if (sectionObj == null) return; - sectionObj.chartSection.sectionName = name; + sectionObj.chartSection["sectionName"] = name; sectionObj.UpdateLabel(); } public void SetSectionChallenge() { if (sectionObj == null) return; - sectionObj.chartSection.startPerfect = challengeEnable.isOn; + sectionObj.chartSection["startPerfect"] = challengeEnable.isOn; } } diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs index 810491f9..4a795ded 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs @@ -6,6 +6,8 @@ using System; using TMPro; using Starpelly; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Editor.Track { @@ -45,14 +47,23 @@ namespace HeavenStudio.Editor.Track public void Setup() { ClearSpecialTimeline(); + GameManager.instance.SortEventsList(); + + bool first = true; + foreach (var tempoChange in GameManager.instance.Beatmap.TempoChanges) + { + AddTempoChange(false, tempoChange, first); + first = false; + } - foreach (var tempoChange in GameManager.instance.Beatmap.tempoChanges) - AddTempoChange(false, tempoChange); + first = true; + foreach (var volumeChange in GameManager.instance.Beatmap.VolumeChanges) + { + AddVolumeChange(false, volumeChange, first); + first = false; + } - foreach (var volumeChange in GameManager.instance.Beatmap.volumeChanges) - AddVolumeChange(false, volumeChange); - - foreach (var sectionChange in GameManager.instance.Beatmap.beatmapSections) + foreach (var sectionChange in GameManager.instance.Beatmap.SectionMarkers) AddChartSection(false, sectionChange); Timeline.instance.timelineState.SetState(Timeline.CurrentTimelineState.State.Selection); @@ -114,7 +125,7 @@ namespace HeavenStudio.Editor.Track specialTimelineObjs.Clear(); } - public void AddTempoChange(bool create, DynamicBeatmap.TempoChange tempoChange_ = null) + public void AddTempoChange(bool create, RiqEntity tempoChange_ = null, bool first = false) { GameObject tempoChange = Instantiate(RefTempoChange.gameObject, this.transform); @@ -131,29 +142,23 @@ namespace HeavenStudio.Editor.Track tempoChange.transform.position = new Vector3(Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition).x + 0.08f, tempoChange.transform.position.y); tempoChange.transform.localPosition = new Vector3(Starpelly.Mathp.Round2Nearest(tempoChange.transform.localPosition.x, Timeline.SnapInterval()), tempoChange.transform.localPosition.y); - DynamicBeatmap.TempoChange tempoC = new DynamicBeatmap.TempoChange(); - tempoC.beat = tempoChange.transform.localPosition.x; + float lastTempo = Conductor.instance.GetBpmAtBeat(tempoChange.transform.localPosition.x); if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { - tempoC.tempo = GameManager.instance.Beatmap.bpm * 2f; + lastTempo = lastTempo * 2f; } else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { - tempoC.tempo = GameManager.instance.Beatmap.bpm / 2f; + lastTempo = lastTempo / 2f; } - else - { - tempoC.tempo = GameManager.instance.Beatmap.bpm; - } - + RiqEntity tempoC = GameManager.instance.Beatmap.AddNewTempoChange(tempoChange.transform.localPosition.x, lastTempo); tempoTimelineObj.tempoChange = tempoC; - GameManager.instance.Beatmap.tempoChanges.Add(tempoC); } else { - tempoChange.transform.localPosition = new Vector3(tempoChange_.beat, tempoChange.transform.localPosition.y); - tempoTimelineObj.tempoChange = tempoChange_; + tempoChange.transform.localPosition = new Vector3((float) tempoTimelineObj.tempoChange.beat, tempoChange.transform.localPosition.y); + tempoTimelineObj.first = first; } tempoTimelineObj.SetVisibility(Timeline.instance.timelineState.currentState); @@ -162,7 +167,7 @@ namespace HeavenStudio.Editor.Track Timeline.instance.FitToSong(); } - public void AddVolumeChange(bool create, DynamicBeatmap.VolumeChange volumeChange_ = null) + public void AddVolumeChange(bool create, RiqEntity volumeChange_ = null, bool first = false) { GameObject volumeChange = Instantiate(RefVolumeChange.gameObject, this.transform); @@ -179,25 +184,22 @@ namespace HeavenStudio.Editor.Track volumeChange.transform.position = new Vector3(Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition).x + 0.08f, volumeChange.transform.position.y); volumeChange.transform.localPosition = new Vector3(Starpelly.Mathp.Round2Nearest(volumeChange.transform.localPosition.x, Timeline.SnapInterval()), volumeChange.transform.localPosition.y); - DynamicBeatmap.VolumeChange volumeC = new DynamicBeatmap.VolumeChange(); - volumeC.beat = volumeChange.transform.localPosition.x; - volumeC.volume = GameManager.instance.Beatmap.musicVolume; - + RiqEntity volumeC = GameManager.instance.Beatmap.AddNewVolumeChange(volumeChange.transform.localPosition.x, 100f); volumeTimelineObj.volumeChange = volumeC; - GameManager.instance.Beatmap.volumeChanges.Add(volumeC); + GameManager.instance.Beatmap.VolumeChanges.Add(volumeC); } else { - volumeChange.transform.localPosition = new Vector3(volumeChange_.beat, volumeChange.transform.localPosition.y); - volumeTimelineObj.volumeChange = volumeChange_; + volumeChange.transform.localPosition = new Vector3((float) volumeTimelineObj.volumeChange.beat, volumeChange.transform.localPosition.y); + volumeTimelineObj.first = first; } volumeTimelineObj.SetVisibility(Timeline.instance.timelineState.currentState); specialTimelineObjs.Add(volumeTimelineObj); } - public void AddChartSection(bool create, DynamicBeatmap.ChartSection chartSection_ = null) + public void AddChartSection(bool create, RiqEntity chartSection_ = null) { GameObject chartSection = Instantiate(RefSectionChange.gameObject, this.transform); @@ -215,20 +217,15 @@ namespace HeavenStudio.Editor.Track chartSection.transform.position = new Vector3(Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition).x + 0.08f, chartSection.transform.position.y); chartSection.transform.localPosition = new Vector3(Starpelly.Mathp.Round2Nearest(chartSection.transform.localPosition.x, Timeline.SnapInterval()), chartSection.transform.localPosition.y); - DynamicBeatmap.ChartSection sectionC = new DynamicBeatmap.ChartSection(); - sectionC.beat = chartSection.transform.localPosition.x; - sectionC.sectionName = "New Section"; - sectionC.startPerfect = false; - sectionC.isCheckpoint = false; + RiqEntity sectionC = GameManager.instance.Beatmap.AddNewSectionMarker(chartSection.transform.localPosition.x, "New Section"); sectionTimelineObj.chartSection = sectionC; - GameManager.instance.Beatmap.beatmapSections.Add(sectionC); + GameManager.instance.Beatmap.SectionMarkers.Add(sectionC); } else { - chartSection.transform.localPosition = new Vector3(chartSection_.beat, chartSection.transform.localPosition.y); - sectionTimelineObj.chartSection = chartSection_; + chartSection.transform.localPosition = new Vector3((float) sectionTimelineObj.chartSection.beat, chartSection.transform.localPosition.y); } sectionTimelineObj.SetVisibility(Timeline.instance.timelineState.currentState); diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SectionTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SectionTimelineObj.cs index bde055fa..10f3e683 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SectionTimelineObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SectionTimelineObj.cs @@ -5,6 +5,7 @@ using UnityEngine; using TMPro; using DG.Tweening; +using Jukebox; namespace HeavenStudio.Editor.Track { @@ -15,7 +16,7 @@ namespace HeavenStudio.Editor.Track [SerializeField] private GameObject chartLine; [SerializeField] private SectionDialog sectionDialog; - public DynamicBeatmap.ChartSection chartSection; + public RiqEntity chartSection; new private void Update() { @@ -30,7 +31,7 @@ namespace HeavenStudio.Editor.Track public void UpdateLabel() { - sectionLabel.text = chartSection.sectionName; + sectionLabel.text = chartSection["sectionName"]; } public override void Init() @@ -55,7 +56,7 @@ namespace HeavenStudio.Editor.Track public override bool OnMove(float beat) { - foreach (var sectionChange in GameManager.instance.Beatmap.beatmapSections) + foreach (RiqEntity sectionChange in GameManager.instance.Beatmap.SectionMarkers) { if (this.chartSection == sectionChange) continue; diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SpecialTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SpecialTimelineObj.cs index 743d3f16..06c83cf0 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SpecialTimelineObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SpecialTimelineObj.cs @@ -19,6 +19,7 @@ namespace HeavenStudio.Editor.Track public bool moving = false; public bool hovering; + public bool first = false; private void Start() { @@ -78,6 +79,7 @@ namespace HeavenStudio.Editor.Track public void StartMove() { + if (first) return; Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition); startPosX = mousePos.x - transform.position.x; moving = true; @@ -86,6 +88,7 @@ namespace HeavenStudio.Editor.Track public void DeleteObj() { + if (first) return; transform.parent.GetComponent().specialTimelineObjs.Remove(this); Destroy(this.gameObject); } diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs index 3fe34e7a..97478cd7 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs @@ -5,6 +5,8 @@ using UnityEngine; using TMPro; using DG.Tweening; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Editor.Track { @@ -14,7 +16,7 @@ namespace HeavenStudio.Editor.Track [SerializeField] private TMP_Text tempoTXT; [SerializeField] private GameObject tempoLine; - public DynamicBeatmap.TempoChange tempoChange; + public RiqEntity tempoChange; new private void Update() { @@ -31,11 +33,14 @@ namespace HeavenStudio.Editor.Track if (Input.GetKey(KeyCode.LeftControl)) newTempo /= 100f; - tempoChange.tempo += newTempo; + tempoChange["tempo"] += newTempo; //make sure tempo is positive - if (tempoChange.tempo < 1) - tempoChange.tempo = 1; + if (tempoChange["tempo"] < 1) + tempoChange["tempo"] = 1; + + if (first && newTempo != 0) + Timeline.instance.UpdateStartingBPMText(); } } @@ -44,7 +49,7 @@ namespace HeavenStudio.Editor.Track private void UpdateTempo() { - tempoTXT.text = $"{tempoChange.tempo} BPM"; + tempoTXT.text = $"{tempoChange["tempo"]} BPM"; Timeline.instance.FitToSong(); } @@ -61,16 +66,17 @@ namespace HeavenStudio.Editor.Track public override void OnRightClick() { + if (first) return; if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.TempoChange) { - GameManager.instance.Beatmap.tempoChanges.Remove(tempoChange); + GameManager.instance.Beatmap.TempoChanges.Remove(tempoChange); DeleteObj(); } } public override bool OnMove(float beat) { - foreach (var tempoChange in GameManager.instance.Beatmap.tempoChanges) + foreach (var tempoChange in GameManager.instance.Beatmap.TempoChanges) { if (this.tempoChange == tempoChange) continue; diff --git a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/VolumeTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/VolumeTimelineObj.cs index 1e68bcb3..dc7d02af 100644 --- a/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/VolumeTimelineObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/VolumeTimelineObj.cs @@ -5,6 +5,8 @@ using UnityEngine; using TMPro; using DG.Tweening; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Editor.Track { @@ -14,7 +16,7 @@ namespace HeavenStudio.Editor.Track [SerializeField] private TMP_Text volumeTXT; [SerializeField] private GameObject volumeLine; - public DynamicBeatmap.VolumeChange volumeChange; + public RiqEntity volumeChange; new private void Update() { @@ -31,19 +33,21 @@ namespace HeavenStudio.Editor.Track if (Input.GetKey(KeyCode.LeftControl)) newVolume /= 100f; - volumeChange.volume += newVolume; + volumeChange["volume"] += newVolume; //make sure volume is positive - volumeChange.volume = Mathf.Clamp(volumeChange.volume, 0, 100); + volumeChange["volume"] = Mathf.Clamp(volumeChange["volume"], 0, 100); + + if (first && newVolume != 0) + Timeline.instance.UpdateStartingVolText(); } } - UpdateVolume(); } private void UpdateVolume() { - volumeTXT.text = $"{volumeChange.volume}%"; + volumeTXT.text = $"{volumeChange["volume"]}%"; } public override void Init() @@ -59,16 +63,17 @@ namespace HeavenStudio.Editor.Track public override void OnRightClick() { + if (first) return; if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.MusicVolume) { - GameManager.instance.Beatmap.volumeChanges.Remove(volumeChange); + GameManager.instance.Beatmap.VolumeChanges.Remove(volumeChange); DeleteObj(); } } public override bool OnMove(float beat) { - foreach (var volumeChange in GameManager.instance.Beatmap.volumeChanges) + foreach (var volumeChange in GameManager.instance.Beatmap.VolumeChanges) { if (this.volumeChange == volumeChange) continue; diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index 11009b5d..8b5a9a0c 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -7,6 +7,8 @@ using UnityEngine.EventSystems; using TMPro; using Starpelly; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Editor.Track { @@ -184,11 +186,11 @@ namespace HeavenStudio.Editor.Track } eventObjs.Clear(); - for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++) + for (int i = 0; i < GameManager.instance.Beatmap.Entities.Count; i++) { - var e = GameManager.instance.Beatmap.entities[i]; + var e = GameManager.instance.Beatmap.Entities[i]; - AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * LayerHeight()), e, false, RandomID()); + AddEventObject(e.datamodel, false, new Vector3((float)e.beat, -e["track"] * LayerHeight()), e, false); } SpecialInfo.Setup(); @@ -319,7 +321,7 @@ namespace HeavenStudio.Editor.Track { Debug.Log("what"); // DrawWaveform(); - StartCoroutine(DrawWaveformRealtime()); + // StartCoroutine(DrawWaveformRealtime()); } public void AutoBtnUpdate() @@ -366,11 +368,11 @@ namespace HeavenStudio.Editor.Track private void Update() { - waveform.rectTransform.anchoredPosition = new Vector2( - -(GameManager.instance.Beatmap.firstBeatOffset / (60.0f / GameManager.instance.Beatmap.bpm)), - waveform.rectTransform.anchoredPosition.y); + // waveform.rectTransform.anchoredPosition = new Vector2( + // -(GameManager.instance.Beatmap.data.offset / (60.0f / GameManager.instance.Beatmap.bpm)), + // waveform.rectTransform.anchoredPosition.y); - WaveformBTN.transform.GetChild(0).GetComponent().color = (Conductor.instance.musicSource.clip != null && waveform.gameObject.activeInHierarchy) ? Color.white : Color.gray; + // WaveformBTN.transform.GetChild(0).GetComponent().color = (Conductor.instance.musicSource.clip != null && waveform.gameObject.activeInHierarchy) ? Color.white : Color.gray; if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused) { @@ -638,7 +640,8 @@ namespace HeavenStudio.Editor.Track { if (Conductor.instance.musicSource.clip == null) return; - waveform.gameObject.SetActive(!waveform.gameObject.activeInHierarchy); + // waveform.gameObject.SetActive(!waveform.gameObject.activeInHierarchy); + waveform.gameObject.SetActive(false); } public IEnumerator DrawWaveformRealtime() @@ -731,7 +734,7 @@ namespace HeavenStudio.Editor.Track return tex2D; } - public TimelineEventObj AddEventObject(string eventName, bool dragNDrop = false, Vector3 pos = new Vector3(), DynamicBeatmap.DynamicEntity entity = null, bool addEvent = false, string eventId = "") + public TimelineEventObj AddEventObject(string eventName, bool dragNDrop = false, Vector3 pos = new Vector3(), RiqEntity entity = null, bool addEvent = false) { var game = EventCaller.instance.GetMinigame(eventName.Split(0)); var action = EventCaller.instance.GetGameAction(game, eventName.Split(1)); @@ -742,9 +745,9 @@ namespace HeavenStudio.Editor.Track TimelineEventObj eventObj = g.GetComponent(); if (eventName.Split(1) == "switchGame") - eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(2)); - else - eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(0)); + eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(2)); + else + eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(0)); Minigames.GameAction gameAction = EventCaller.instance.GetGameAction(EventCaller.instance.GetMinigame(eventName.Split(0)), eventName.Split(1)); @@ -770,8 +773,6 @@ namespace HeavenStudio.Editor.Track } } - g.SetActive(true); - if (dragNDrop) { var mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition); @@ -782,22 +783,16 @@ namespace HeavenStudio.Editor.Track } else { - entity.eventObj = g.GetComponent(); - entity.track = entity.eventObj.GetTrack(); + entity["track"] = eventObj.GetTrack(); } - if (addEvent) { - DynamicBeatmap.DynamicEntity tempEntity = entity; + RiqEntity tempEntity = entity; if (entity == null) { - DynamicBeatmap.DynamicEntity en = new DynamicBeatmap.DynamicEntity(); - en.datamodel = eventName; - en.eventObj = eventObj; - - GameManager.instance.Beatmap.entities.Add(en); + RiqEntity en = GameManager.instance.Beatmap.AddNewEntity(eventName, g.transform.localPosition.x, gameAction.defaultLength); GameManager.instance.SortEventsList(); tempEntity = en; @@ -832,14 +827,21 @@ namespace HeavenStudio.Editor.Track } else { - GameManager.instance.Beatmap.entities.Add(entity); + GameManager.instance.Beatmap.Entities.Add(tempEntity); GameManager.instance.SortEventsList(); } + + eventObj.entity = tempEntity; + } + else + { + eventObj.entity = entity; } eventObjs.Add(eventObj); + eventObj.eventObjID = eventObj.entity.uid; - eventObj.eventObjID = eventId; + g.SetActive(true); return eventObj; } @@ -847,8 +849,8 @@ namespace HeavenStudio.Editor.Track private List duplicatedEventObjs = new List(); public TimelineEventObj CopyEventObject(TimelineEventObj e) { - DynamicBeatmap.DynamicEntity clone = e.entity.DeepCopy(); - TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3(clone.beat, -clone.track * Timeline.instance.LayerHeight()), clone, true, RandomID()); + RiqEntity clone = e.entity.DeepCopy(); + TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3((float)clone.beat, -clone["track"] * Timeline.instance.LayerHeight()), clone, true); duplicatedEventObjs.Add(dup); return dup; @@ -860,16 +862,23 @@ namespace HeavenStudio.Editor.Track duplicatedEventObjs = new List(); } - public void DestroyEventObject(DynamicBeatmap.DynamicEntity entity) + public void DestroyEventObject(RiqEntity entity) { if (EventParameterManager.instance.entity == entity) EventParameterManager.instance.Disable(); - eventObjs.Remove(entity.eventObj); - GameManager.instance.Beatmap.entities.Remove(entity); - Timeline.instance.eventObjs.Remove(entity.eventObj); - - Destroy(entity.eventObj.gameObject); + // eventObjs.Remove(entity.eventObj); + foreach (TimelineEventObj e in eventObjs) + { + if (e.entity == entity) + { + Destroy(e.gameObject); + eventObjs.Remove(e); + break; + } + } + GameManager.instance.Beatmap.Entities.Remove(entity); + GameManager.instance.SortEventsList(); } @@ -915,7 +924,7 @@ namespace HeavenStudio.Editor.Track public void UpdateOffsetText() { - FirstBeatOffset.text = (GameManager.instance.Beatmap.firstBeatOffset * 1000f).ToString("G"); + FirstBeatOffset.text = (GameManager.instance.Beatmap.data.offset * 1000f).ToString("G"); } public void UpdateOffsetFromText() @@ -930,14 +939,15 @@ namespace HeavenStudio.Editor.Track // Limit decimal places to 4. newOffset = (float)System.Math.Round(newOffset, 4); - GameManager.instance.Beatmap.firstBeatOffset = newOffset; + GameManager.instance.Beatmap.data.offset = newOffset; UpdateOffsetText(); + FitToSong(); } public void UpdateStartingBPMText() { - StartingTempoSpecialAll.text = GameManager.instance.Beatmap.bpm.ToString("G"); + StartingTempoSpecialAll.text = GameManager.instance.Beatmap.TempoChanges[0]["tempo"].ToString("G"); StartingTempoSpecialTempo.text = StartingTempoSpecialAll.text; } @@ -960,7 +970,9 @@ namespace HeavenStudio.Editor.Track // Limit decimal places to 4. newBPM = System.Math.Round(newBPM, 4); - GameManager.instance.Beatmap.bpm = (float) newBPM; + RiqEntity tempoChange = GameManager.instance.Beatmap.TempoChanges[0]; + tempoChange["tempo"] = (float) newBPM; + GameManager.instance.Beatmap.TempoChanges[0] = tempoChange; // In case the newBPM ended up differing from the inputted string. UpdateStartingBPMText(); @@ -970,7 +982,7 @@ namespace HeavenStudio.Editor.Track public void UpdateStartingVolText() { - StartingVolumeSpecialVolume.text = (GameManager.instance.Beatmap.musicVolume).ToString("G"); + StartingVolumeSpecialVolume.text = (GameManager.instance.Beatmap.VolumeChanges[0]["volume"]).ToString("G"); } public void UpdateStartingVolFromText() @@ -982,7 +994,9 @@ namespace HeavenStudio.Editor.Track var newVol = Convert.ToInt32(StartingVolumeSpecialVolume.text); newVol = Mathf.Clamp(newVol, 0, 100); - GameManager.instance.Beatmap.musicVolume = newVol; + RiqEntity volChange = GameManager.instance.Beatmap.VolumeChanges[0]; + volChange["volume"] = newVol; + GameManager.instance.Beatmap.VolumeChanges[0] = volChange; UpdateStartingVolText(); } diff --git a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs index fc9d8e52..6cec36d3 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs @@ -5,6 +5,8 @@ using UnityEngine.UI; using Starpelly; using DG.Tweening; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Editor.Track { @@ -29,7 +31,7 @@ namespace HeavenStudio.Editor.Track // private GameObject moveTemp; [Header("Properties")] - public DynamicBeatmap.DynamicEntity entity; + public RiqEntity entity; public float length; public bool eligibleToMove = false; private bool lastVisible; @@ -43,7 +45,7 @@ namespace HeavenStudio.Editor.Track private bool resizingRight; private bool inResizeRegion; public bool isCreating; - public string eventObjID; + public int eventObjID; [Header("Colors")] public Color NormalCol; @@ -74,7 +76,11 @@ namespace HeavenStudio.Editor.Track private void Update() { selected = Selections.instance.eventsSelected.Contains(this); - entity = GameManager.instance.Beatmap.entities.Find(a => a.eventObj == this); + if (eventObjID != entity.uid) + { + eventObjID = GameManager.instance.Beatmap.Entities.Find(a => a == entity).uid; + Debug.Log($"assigning uid {eventObjID}"); + } mouseHovering = RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, Editor.instance.EditorCamera) && Timeline.instance.timelineState.selected; @@ -100,7 +106,7 @@ namespace HeavenStudio.Editor.Track #endregion - SetColor(entity.track); + SetColor(entity["track"]); if (selected) { @@ -143,7 +149,7 @@ namespace HeavenStudio.Editor.Track } rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, Timeline.instance.LayerHeight()); - this.transform.localPosition = new Vector3(this.transform.localPosition.x, -entity.track * Timeline.instance.LayerHeight()); + this.transform.localPosition = new Vector3(this.transform.localPosition.x, -entity["track"] * Timeline.instance.LayerHeight()); return; } @@ -250,7 +256,7 @@ namespace HeavenStudio.Editor.Track } rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, Timeline.instance.LayerHeight()); - this.transform.localPosition = new Vector3(this.transform.localPosition.x, -entity.track * Timeline.instance.LayerHeight()); + this.transform.localPosition = new Vector3(this.transform.localPosition.x, -entity["track"] * Timeline.instance.LayerHeight()); } #region ClickEvents @@ -406,7 +412,7 @@ namespace HeavenStudio.Editor.Track private void OnMove() { - if (GameManager.instance.Beatmap.entities.FindAll(c => c.beat == this.transform.localPosition.x && c.track == GetTrack() && c != this.entity).Count > 0) + if (GameManager.instance.Beatmap.Entities.FindAll(c => c.beat == this.transform.localPosition.x && c["track"] == GetTrack() && c != this.entity).Count > 0) { eligibleToMove = false; } @@ -423,7 +429,7 @@ namespace HeavenStudio.Editor.Track entity.length = rectTransform.sizeDelta.x; entity.beat = this.transform.localPosition.x; GameManager.instance.SortEventsList(); - entity.track = GetTrack(); + entity["track"] = GetTrack(); } #endregion @@ -477,7 +483,7 @@ namespace HeavenStudio.Editor.Track { // better safety net than canada's healthcare system // this is still hilarious - // GameManager.instance.Beatmap.entities.Remove(GameManager.instance.Beatmap.entities.Find(c => c.eventObj = this)); + // GameManager.instance.Beatmap.Entities.Remove(GameManager.instance.Beatmap.Entities.Find(c => c.eventObj = this)); } #endregion diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index ae1208ff..1281038e 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -7,6 +7,8 @@ using DG.Tweening; using HeavenStudio.Util; using HeavenStudio.Editor.Track; using HeavenStudio.Games; +using Jukebox; +using Jukebox.Legacy; using System; using System.Linq; @@ -18,6 +20,204 @@ namespace HeavenStudio public class Minigames { + + public static void InitPreprocessor() + { + RiqBeatmap.OnUpdateBeatmap += PreProcessBeatmap; + } + + public static Dictionary propertiesModel = new() + { + // mapper set properties? (future: use this to flash the button) + {"propertiesmodified", false}, + + ////// CATEGORY 1: SONG INFO + // general chart info + {"remixtitle", "New Remix"}, // chart name + {"remixauthor", "Your Name"}, // charter's name + {"remixdesc", "Remix Description"}, // chart description + {"remixlevel", 1}, // chart difficulty (maybe offer a suggestion but still have the mapper determine it) + {"remixtempo", 120f}, // avg. chart tempo + {"remixtags", ""}, // chart tags + {"icontype", 0}, // chart icon (presets, custom - future) + {"iconurl", ""}, // custom icon location (future) + {"challengetype", 0}, // perfect challenge type + + // chart song info + {"idolgenre", "Song Genre"}, // song genre + {"idolsong", "Song Name"}, // song name + {"idolcredit", "Artist"}, // song artist + + ////// CATEGORY 2: PROLOGUE AND EPILOGUE + // chart prologue + {"prologuetype", 0}, // prologue card animation (future) + {"prologuecaption", "Remix"}, // prologue card sub-title (future) + + // chart results screen messages + {"resultcaption", "Rhythm League Notes"}, // result screen header + {"resultcommon_hi", "Good rhythm."}, // generic "Superb" message (one-liner, or second line for single-type) + {"resultcommon_ok", "Eh. Passable."}, // generic "OK" message (one-liner, or second line for single-type) + {"resultcommon_ng", "Try harder next time."}, // generic "Try Again" message (one-liner, or second line for single-type) + + // the following are shown / hidden in-editor depending on the tags of the games used + {"resultnormal_hi", "You show strong fundamentals."}, // "Superb" message for normal games (two-liner) + {"resultnormal_ng", "Work on your fundamentals."}, // "Try Again" message for normal games (two-liner) + + {"resultkeep_hi", "You kept the beat well."}, // "Superb" message for keep-the-beat games (two-liner) + {"resultkeep_ng", "You had trouble keeping the beat."}, // "Try Again" message for keep-the-beat games (two-liner) + + {"resultaim_hi", "You had great aim."}, // "Superb" message for aim games (two-liner) + {"resultaim_ng", "Your aim was a little shaky."}, // "Try Again" message for aim games (two-liner) + + {"resultrepeat_hi", "You followed the example well."}, // "Superb" message for call-and-response games (two-liner) + {"resultrepeat_ng", "Next time, follow the example better."}, // "Try Again" message for call-and-response games (two-liner) + }; + + /// + /// processes an riq beatmap after it is loaded + /// + public static RiqBeatmapData? PreProcessBeatmap(string version, RiqBeatmapData data) + { + Debug.Log("Preprocessing beatmap..."); + Minigames.Minigame game; + Minigames.GameAction action; + System.Type type, pType; + foreach (var e in data.entities) + { + var gameName = e.datamodel.Split(0); + var actionName = e.datamodel.Split(1); + game = EventCaller.instance.GetMinigame(gameName); + if (game == null) + { + Debug.LogWarning($"Unknown game {gameName} found in remix.json! Adding game..."); + game = new Minigames.Minigame(gameName, gameName.DisplayName() + " \n[inferred from remix.json]", "", false, false, new List(), inferred: true); + EventCaller.instance.minigames.Add(game); + if (Editor.Editor.instance != null) + Editor.Editor.instance.AddIcon(game); + } + action = EventCaller.instance.GetGameAction(game, actionName); + if (action == null) + { + Debug.LogWarning($"Unknown action {gameName}/{actionName} found in remix.json! Adding action..."); + var parameters = new List(); + foreach (var item in e.dynamicData) + { + var value = item.Value; + if (value.GetType() == typeof(long)) + value = new EntityTypes.Integer(int.MinValue, int.MaxValue, (int)value); + else if (value.GetType() == typeof(double)) + value = new EntityTypes.Float(float.NegativeInfinity, float.PositiveInfinity, (float)value); + parameters.Add(new Minigames.Param(item.Key, value, item.Key, "[inferred from remix.json]")); + } + action = new Minigames.GameAction(actionName, actionName.DisplayName(), e.length, true, parameters); + game.actions.Add(action); + } + + //check each param of the action + if (action.parameters != null) + { + foreach (var param in action.parameters) + { + type = param.parameter.GetType(); + //add property if it doesn't exist + if (!e.dynamicData.ContainsKey(param.propertyName)) + { + Debug.LogWarning($"Property {param.propertyName} does not exist in the entity's dynamic data! Adding..."); + if (type == typeof(EntityTypes.Integer)) + e.dynamicData.Add(param.propertyName, ((EntityTypes.Integer)param.parameter).val); + else if (type == typeof(EntityTypes.Float)) + e.dynamicData.Add(param.propertyName, ((EntityTypes.Float)param.parameter).val); + else if (type.IsEnum && param.propertyName != "ease") + e.dynamicData.Add(param.propertyName, (int)param.parameter); + else + e.dynamicData.Add(param.propertyName, Convert.ChangeType(param.parameter, type)); + continue; + } + pType = e[param.propertyName].GetType(); + if (pType != type) + { + try + { + if (type == typeof(EntityTypes.Integer)) + e.dynamicData[param.propertyName] = (int)e[param.propertyName]; + else if (type == typeof(EntityTypes.Float)) + e.dynamicData[param.propertyName] = (float)e[param.propertyName]; + else if (type == typeof(Util.EasingFunction.Ease) && (pType == typeof(string) || pType == typeof(int) || pType == typeof(long))) + { + if (pType == typeof(int) || pType == typeof(long) || pType == typeof(Jukebox.EasingFunction.Ease)) + { + e.dynamicData[param.propertyName] = (Util.EasingFunction.Ease)e[param.propertyName]; + } + else + e.dynamicData[param.propertyName] = Enum.Parse(typeof(Util.EasingFunction.Ease), (string)e[param.propertyName]); + } + else if (type.IsEnum) + e.dynamicData[param.propertyName] = (int)e[param.propertyName]; + else if (pType == typeof(Newtonsoft.Json.Linq.JObject)) + e.dynamicData[param.propertyName] = e[param.propertyName].ToObject(type); + else + e.dynamicData[param.propertyName] = Convert.ChangeType(e[param.propertyName], type); + } + catch + { + Debug.LogWarning($"Could not convert {param.propertyName} to {type}! Using default value..."); + // GlobalGameManager.ShowErrorMessage("Warning", $"Could not convert {e.datamodel}/{param.propertyName} to {type}! This will be loaded using the default value, so chart may be unstable."); + // use default value + if (type == typeof(EntityTypes.Integer)) + e.dynamicData[param.propertyName] = ((EntityTypes.Integer)param.parameter).val; + else if (type == typeof(EntityTypes.Float)) + e.dynamicData[param.propertyName] = ((EntityTypes.Float)param.parameter).val; + else if (type.IsEnum && param.propertyName != "ease") + e.dynamicData[param.propertyName] = (int)param.parameter; + else + e.dynamicData[param.propertyName] = Convert.ChangeType(param.parameter, type); + } + } + } + } + } + + foreach (var tempo in data.tempoChanges) + { + tempo["tempo"] = (float)tempo["tempo"]; + tempo["swing"] = (float)tempo["swing"]; + if (tempo.dynamicData.ContainsKey("timeSignature")) + tempo["timeSignature"] = (Vector2)tempo["timeSignature"]; + else + tempo.dynamicData.Add("timeSignature", new Vector2(4, 4)); + } + + foreach (var vol in data.volumeChanges) + { + vol["volume"] = (float)vol["volume"]; + if (vol["fade"].GetType() == typeof(string)) + vol["fade"] = Enum.Parse(typeof(Util.EasingFunction.Ease), (string)vol["fade"]); + else + vol["fade"] = (Util.EasingFunction.Ease)vol["fade"]; + } + + foreach (var section in data.beatmapSections) + { + section["sectionName"] = (string)section["sectionName"]; + section["isCheckpoint"] = (bool)section["isCheckpoint"]; + section["startPerfect"] = (bool)section["startPerfect"]; + section["breakSection"] = (bool)section["breakSection"]; + section["extendsPrevious"] = (bool)section["extendsPrevious"]; + section["sectionWeight"] = (float)section["sectionWeight"]; + } + + //go thru each property of the model beatmap and add any missing keyvalue pair + foreach (var prop in propertiesModel) + { + if (!data.properties.ContainsKey(prop.Key)) + { + data.properties.Add(prop.Key, prop.Value); + } + } + + return data; + } + public class Minigame { @@ -233,7 +433,7 @@ namespace HeavenStudio } public delegate void EventCallback(); - public delegate void ParamChangeCallback(string paramName, object paramValue, DynamicBeatmap.DynamicEntity entity); + public delegate void ParamChangeCallback(string paramName, object paramValue, RiqEntity entity); // overengineered af but it's a modified version of // https://stackoverflow.com/a/19877141 @@ -307,7 +507,7 @@ namespace HeavenStudio new Param("colorB", Color.white, "End Color"), new Param("valA", new EntityTypes.Float(0, 1, 1), "Start Opacity"), new Param("valB", new EntityTypes.Float(0, 1, 0), "End Opacity"), - new Param("ease", EasingFunction.Ease.Linear, "Ease") + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease") }, hidden: true ), @@ -316,7 +516,7 @@ namespace HeavenStudio new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left"), new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down"), new Param("valC", new EntityTypes.Float(-0, 250, 10), "In / Out"), - new Param("ease", EasingFunction.Ease.Linear, "Ease Type") + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type") }, hidden: true ), new GameAction("rotate camera", "", 1f, true, new List() @@ -324,7 +524,7 @@ namespace HeavenStudio new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch"), new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw"), new Param("valC", new EntityTypes.Integer(-360, 360, 0), "Roll"), - new Param("ease", EasingFunction.Ease.Linear, "Ease Type") + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type") }, hidden: true ), }), @@ -396,7 +596,7 @@ namespace HeavenStudio new Param("colorB", Color.white, "End Color"), new Param("valA", new EntityTypes.Float(0, 1, 1), "Start Opacity"), new Param("valB", new EntityTypes.Float(0, 1, 0), "End Opacity"), - new Param("ease", EasingFunction.Ease.Linear, "Ease") + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease") } ), new GameAction("filter", "Filter", 1f, true, @@ -413,7 +613,7 @@ namespace HeavenStudio new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left", "Next position on the X axis"), new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down", "Next position on the Y axis"), new Param("valC", new EntityTypes.Float(-0, 250, 10), "In / Out", "Next position on the Z axis"), - new Param("ease", EasingFunction.Ease.Linear, "Ease Type"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), new Param("axis", GameCamera.CameraAxis.All, "Axis", "The axis to move the camera on" ) } ), @@ -422,7 +622,7 @@ namespace HeavenStudio new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch", "Next rotation on the X axis"), new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw", "Next rotation on the Y axis"), new Param("valC", new EntityTypes.Integer(-360, 360, 0), "Roll", "Next rotation on the Z axis"), - new Param("ease", EasingFunction.Ease.Linear, "Ease Type"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), new Param("axis", GameCamera.CameraAxis.All, "Axis", "The axis to move the camera on" ) } ), @@ -430,21 +630,21 @@ namespace HeavenStudio { new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left", "Next position on the X axis"), new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down", "Next position on the Y axis"), - new Param("ease", EasingFunction.Ease.Linear, "Ease Type"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to pan the viewport in" ) } ), new GameAction("rotate view", "Rotate Viewport", 1f, true, new List() { new Param("valA", new EntityTypes.Float(-360, 360, 0), "Rotation", "Next viewport rotation"), - new Param("ease", EasingFunction.Ease.Linear, "Ease Type"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), } ), new GameAction("scale view", "Scale Viewport", 1f, true, new List() { new Param("valA", new EntityTypes.Float(0, 50, 1), "Width", "Next viewport width"), new Param("valB", new EntityTypes.Float(0, 50, 1), "Height", "Next viewport height"), - new Param("ease", EasingFunction.Ease.Linear, "Ease Type"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the viewport in" ) } ), diff --git a/Assets/Scripts/StaticCamera.cs b/Assets/Scripts/StaticCamera.cs index 787647a1..a1de536d 100644 --- a/Assets/Scripts/StaticCamera.cs +++ b/Assets/Scripts/StaticCamera.cs @@ -6,6 +6,8 @@ using UnityEngine.UI; using HeavenStudio.Util; using HeavenStudio.Common; using HeavenStudio.Editor; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio { @@ -31,9 +33,9 @@ namespace HeavenStudio const float AspectRatioWidth = 1; const float AspectRatioHeight = 1; - private List panEvents = new List(); - private List scaleEvents = new List(); - private List rotationEvents = new List(); + private List panEvents = new(); + private List scaleEvents = new(); + private List rotationEvents = new(); static Vector3 defaultPan = new Vector3(0, 0, 0); static Vector3 defaultScale = new Vector3(1, 1, 1); @@ -68,7 +70,7 @@ namespace HeavenStudio ToggleLetterboxGlow(PersistentDataManager.gameSettings.letterboxFxEnable); } - public void OnBeatChanged(float beat) + public void OnBeatChanged(double beat) { Reset(); @@ -104,7 +106,7 @@ namespace HeavenStudio float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); if (prog >= 0f) { - EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); switch (e["axis"]) { case (int) ViewAxis.X: @@ -145,7 +147,7 @@ namespace HeavenStudio float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); if (prog >= 0f) { - EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); rotation = func(rotationLast, -e["valA"], Mathf.Min(prog, 1f)); } if (prog > 1f) @@ -162,7 +164,7 @@ namespace HeavenStudio float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); if (prog >= 0f) { - EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); switch (e["axis"]) { case (int) ViewAxis.X: diff --git a/Assets/Scripts/StudioDance/Dancer.cs b/Assets/Scripts/StudioDance/Dancer.cs index 60caa696..5b83e00e 100644 --- a/Assets/Scripts/StudioDance/Dancer.cs +++ b/Assets/Scripts/StudioDance/Dancer.cs @@ -6,8 +6,8 @@ namespace HeavenStudio.StudioDance public class Dancer : MonoBehaviour { private Animator animator; - private float lastReportedBeat = 0f; - private float currentBeat = 0f; + private double lastReportedBeat = 0f; + private double currentBeat = 0f; private bool isDance = false; diff --git a/Assets/Scripts/Transform/SuperCurveObject.cs b/Assets/Scripts/Transform/SuperCurveObject.cs index 7497a1e5..5dade153 100644 --- a/Assets/Scripts/Transform/SuperCurveObject.cs +++ b/Assets/Scripts/Transform/SuperCurveObject.cs @@ -49,7 +49,7 @@ namespace HeavenStudio return default(PathPos); } - public static PathPos GetPathPosByTime(Path path, float currentTime, out float posTime, out PathPos nextPos, out PathPos prevPos, out bool pastCurve) + public static PathPos GetPathPosByTime(Path path, double currentTime, out double posTime, out PathPos nextPos, out PathPos prevPos, out bool pastCurve) { pastCurve = false; PathPos currentPos = path.positions[0]; @@ -81,7 +81,7 @@ namespace HeavenStudio return default(PathPos); } - public static PathPos GetPathPosByTime(Path path, float currentTime) + public static PathPos GetPathPosByTime(Path path, double currentTime) { return GetPathPosByTime(path, currentTime, out _, out _, out _, out _); } @@ -117,7 +117,7 @@ namespace HeavenStudio return 0f; } - protected virtual Vector3 GetPathPositionFromBeat(Path path, float currentTime, out float heightOffset, float startTime = 0f) + protected virtual Vector3 GetPathPositionFromBeat(Path path, double currentTime, out double heightOffset, double startTime = 0f) { heightOffset = 0f; Vector3 anchorPos = Vector3.zero; @@ -127,7 +127,7 @@ namespace HeavenStudio return transform.position; PathPos nextPos = path.positions[0]; - float currentPosTime = 0f; + double currentPosTime = 0; PathPos currentPos = GetPathPosByTime(path, currentTime - startTime, out currentPosTime, out nextPos, out _, out _); currentPathPos = currentPos; if (currentPos.pos == null || nextPos.pos == null) @@ -142,16 +142,16 @@ namespace HeavenStudio if (nextPos.target != null) endPos = nextPos.target.position; - float time = (currentTime - startTime - currentPosTime) / currentPos.duration; - Vector3 pos = Vector3.LerpUnclamped(startPos, endPos, time); - float yMul = time * 2f - 1f; - float yWeight = -(yMul * yMul) + 1f; + double time = (currentTime - startTime - currentPosTime) / currentPos.duration; + Vector3 pos = Vector3.LerpUnclamped(startPos, endPos, (float) time); + double yMul = time * 2f - 1f; + double yWeight = -(yMul * yMul) + 1f; heightOffset = yWeight * currentPos.height; - pos.y += heightOffset; + pos.y += (float) heightOffset; return pos + offset + anchorPos; } - protected virtual Vector3 GetPathPositionFromBeat(Path path, float currentTime, float startTime = 0f) + protected virtual Vector3 GetPathPositionFromBeat(Path path, double currentTime, double startTime = 0f) { return GetPathPositionFromBeat(path, currentTime, out _, startTime); } diff --git a/Assets/Scripts/UI/Overlays/ChartSectionDisplay.cs b/Assets/Scripts/UI/Overlays/ChartSectionDisplay.cs index fb43e73d..674f549c 100644 --- a/Assets/Scripts/UI/Overlays/ChartSectionDisplay.cs +++ b/Assets/Scripts/UI/Overlays/ChartSectionDisplay.cs @@ -6,6 +6,8 @@ using UnityEngine.UI; using TMPro; using HeavenStudio.Editor; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Common { @@ -25,26 +27,26 @@ namespace HeavenStudio.Common // Update is called once per frame void Update() { - SectionProgress.value = GameManager.instance.sectionProgress; + SectionProgress.value = (float) GameManager.instance.sectionProgress; } - public void OnBeatChanged(float beat) + public void OnBeatChanged(double beat) { gameObject.SetActive(GameManager.instance.currentSection != null); - SectionProgress.value = GameManager.instance.sectionProgress; + SectionProgress.value = (float) GameManager.instance.sectionProgress; } - public void OnSectionChange(DynamicBeatmap.ChartSection section) + public void OnSectionChange(RiqEntity section) { if (section != null) { gameObject.SetActive(true); - SectionText.text = section.sectionName; - SectionProgress.value = GameManager.instance.sectionProgress; + SectionText.text = section["sectionName"]; + SectionProgress.value = (float) GameManager.instance.sectionProgress; if (PersistentDataManager.gameSettings.perfectChallengeType == PersistentDataManager.PerfectChallengeType.Off) return; if (!OverlaysManager.OverlaysEnabled) return; - if (section.startPerfect && GoForAPerfect.instance != null && GoForAPerfect.instance.perfect && !GoForAPerfect.instance.gameObject.activeSelf) + if (section["startPerfect"] && GoForAPerfect.instance != null && GoForAPerfect.instance.perfect && !GoForAPerfect.instance.gameObject.activeSelf) { GoForAPerfect.instance.Enable(section.beat); } diff --git a/Assets/Scripts/UI/Overlays/GoForAPerfect.cs b/Assets/Scripts/UI/Overlays/GoForAPerfect.cs index 6fc7fadf..8dd1bc21 100644 --- a/Assets/Scripts/UI/Overlays/GoForAPerfect.cs +++ b/Assets/Scripts/UI/Overlays/GoForAPerfect.cs @@ -19,8 +19,8 @@ namespace HeavenStudio.Common public bool perfect; Conductor cond; - float lastReportedBeat = 0f; - float currentBeat = 0f; + double lastReportedBeat = 0f; + double currentBeat = 0f; long currentBlink = 0; @@ -87,7 +87,7 @@ namespace HeavenStudio.Common texAnim.Play("GoForAPerfect_Miss"); pAnim.Play("PerfectIcon_Miss", -1, 0); - Jukebox.PlayOneShot("perfectMiss"); + SoundByte.PlayOneShot("perfectMiss"); if (GameProfiler.instance != null) GameProfiler.instance.perfect = false; diff --git a/Assets/Scripts/UI/Overlays/SectionMedalsManager.cs b/Assets/Scripts/UI/Overlays/SectionMedalsManager.cs index 3d4845b4..8b12c380 100644 --- a/Assets/Scripts/UI/Overlays/SectionMedalsManager.cs +++ b/Assets/Scripts/UI/Overlays/SectionMedalsManager.cs @@ -4,6 +4,8 @@ using UnityEngine; using HeavenStudio.Util; using HeavenStudio.Games; +using Jukebox; +using Jukebox.Legacy; namespace HeavenStudio.Common { @@ -59,7 +61,7 @@ namespace HeavenStudio.Common } } - public void OnSectionChange(DynamicBeatmap.ChartSection section) + public void OnSectionChange(RiqEntity section) { if (section == null) return; if (!PersistentDataManager.gameSettings.isMedalOn) return; diff --git a/Assets/Scripts/UI/Overlays/SkillStarManager.cs b/Assets/Scripts/UI/Overlays/SkillStarManager.cs index 2ecc3d86..e765dd5f 100644 --- a/Assets/Scripts/UI/Overlays/SkillStarManager.cs +++ b/Assets/Scripts/UI/Overlays/SkillStarManager.cs @@ -20,11 +20,11 @@ namespace HeavenStudio.Common [SerializeField] private Animator starAnim; [SerializeField] private ParticleSystem starParticle; - public float StarTargetTime { get { return starStart + starLength; } } + public double StarTargetTime { get { return starStart + starLength; } } public bool IsEligible { get; private set; } public bool IsCollected { get { return state == StarState.Collected; } } - float starStart = float.MaxValue; + double starStart = double.MaxValue; float starLength = float.MaxValue; StarState state = StarState.None; Conductor cond; @@ -74,11 +74,11 @@ namespace HeavenStudio.Common state = StarState.None; starAnim.Play("NoPose", -1, 0f); starAnim.speed = 1f; - starStart = float.MaxValue; + starStart = double.MaxValue; starLength = float.MaxValue; } - public void DoStarIn(float beat, float length) + public void DoStarIn(double beat, float length) { if (!OverlaysManager.OverlaysEnabled) return; IsEligible = true; @@ -101,7 +101,7 @@ namespace HeavenStudio.Common state = StarState.Collected; starAnim.Play("StarJust", -1, 0f); starParticle.Play(); - Jukebox.PlayOneShot("skillStar"); + SoundByte.PlayOneShot("skillStar"); TimingAccuracyDisplay.instance.StopStarFlash(); return true; diff --git a/Assets/Scripts/UI/PauseMenu.cs b/Assets/Scripts/UI/PauseMenu.cs index 0c70ab64..bdf87db2 100644 --- a/Assets/Scripts/UI/PauseMenu.cs +++ b/Assets/Scripts/UI/PauseMenu.cs @@ -42,12 +42,13 @@ namespace HeavenStudio.Common void Pause() { + if (!Conductor.instance.isPlaying) return; Conductor.instance.Pause(); pauseBeat = Conductor.instance.songPositionInBeatsAsDouble; chartTitleText.text = GameManager.instance.Beatmap["remixtitle"]; chartArtistText.text = GameManager.instance.Beatmap["remixauthor"]; animator.Play("PauseShow"); - Jukebox.PlayOneShot("ui/PauseIn"); + SoundByte.PlayOneShot("ui/PauseIn"); isPaused = true; canPick = false; @@ -56,6 +57,7 @@ namespace HeavenStudio.Common void UnPause(bool instant = false) { + if ((!instant) && (!Conductor.instance.isPaused)) return; Conductor.instance.Play(pauseBeat); if (instant) { @@ -64,7 +66,7 @@ namespace HeavenStudio.Common else { animator.Play("PauseHide"); - Jukebox.PlayOneShot("ui/PauseOut"); + SoundByte.PlayOneShot("ui/PauseOut"); } isPaused = false; @@ -141,7 +143,7 @@ namespace HeavenStudio.Common } optionHolder.transform.GetChild((int) option).transform.localScale = new Vector3(1.2f, 1.2f, 1.2f); if (sound) - Jukebox.PlayOneShot("ui/UIOption"); + SoundByte.PlayOneShot("ui/UIOption"); } void UseOption(Options option) @@ -156,7 +158,7 @@ namespace HeavenStudio.Common break; case Options.Settings: OnSettings(); - Jukebox.PlayOneShot("ui/UISelect"); + SoundByte.PlayOneShot("ui/UISelect"); break; case Options.Quit: OnQuit(); @@ -174,13 +176,13 @@ namespace HeavenStudio.Common UnPause(true); GlobalGameManager.ForceFade(0, 1f, 0.5f); GameManager.instance.Stop(0, true, 1.5f); - Jukebox.PlayOneShot("ui/UIEnter"); + SoundByte.PlayOneShot("ui/UIEnter"); } void OnQuit() { isQuitting = true; - Jukebox.PlayOneShot("ui/PauseQuit"); + SoundByte.PlayOneShot("ui/PauseQuit"); GlobalGameManager.LoadScene("Editor", 0, 0.1f); } diff --git a/Assets/Scripts/UI/SettingsDialog/Tabs/CreditsLegalSettings.cs b/Assets/Scripts/UI/SettingsDialog/Tabs/CreditsLegalSettings.cs index 7525fb9e..14a0e59f 100644 --- a/Assets/Scripts/UI/SettingsDialog/Tabs/CreditsLegalSettings.cs +++ b/Assets/Scripts/UI/SettingsDialog/Tabs/CreditsLegalSettings.cs @@ -38,7 +38,7 @@ namespace HeavenStudio.Editor if (SecretActive) return; SecretActive = true; - Jukebox.PlayOneShot("applause"); + SoundByte.PlayOneShot("applause"); Debug.Log("Activating Studio Dance..."); if (Editor.instance == null) diff --git a/Assets/Scripts/Util/AnimationHelpers.cs b/Assets/Scripts/Util/AnimationHelpers.cs index 1bfd40fa..366fcb31 100644 --- a/Assets/Scripts/Util/AnimationHelpers.cs +++ b/Assets/Scripts/Util/AnimationHelpers.cs @@ -30,7 +30,7 @@ namespace HeavenStudio.Util /// duration of animation (progress 1.0) /// multiplier for animation progress (smaller values make animation slower) /// animator layer to play animation on - public static void DoScaledAnimation(this Animator anim, string animName, float startTime, float length = 1f, float timeScale = 1f, int animLayer = -1) + public static void DoScaledAnimation(this Animator anim, string animName, double startTime, float length = 1f, float timeScale = 1f, int animLayer = -1) { float pos = Conductor.instance.GetPositionFromBeat(startTime, length) * timeScale; anim.Play(animName, animLayer, pos); diff --git a/Assets/Scripts/Util/GameEvent.cs b/Assets/Scripts/Util/GameEvent.cs index 52220e32..6e2e1a34 100644 --- a/Assets/Scripts/Util/GameEvent.cs +++ b/Assets/Scripts/Util/GameEvent.cs @@ -3,8 +3,8 @@ namespace HeavenStudio.Util public class GameEvent { public float length; - public float startBeat; - public float lastReportedBeat; + public double startBeat; + public double lastReportedBeat; public bool enabled; } } \ No newline at end of file diff --git a/Assets/Scripts/Util/MultiSound.cs b/Assets/Scripts/Util/MultiSound.cs index 2f583a4f..f22a30aa 100644 --- a/Assets/Scripts/Util/MultiSound.cs +++ b/Assets/Scripts/Util/MultiSound.cs @@ -7,7 +7,7 @@ namespace HeavenStudio.Util { public class MultiSound : MonoBehaviour { - private float startBeat; + private double startBeat; private bool game; private bool forcePlay; public List sounds = new List(); @@ -16,13 +16,13 @@ namespace HeavenStudio.Util public class Sound { public string name { get; set; } - public float beat { get; set; } + public double beat { get; set; } public float pitch { get; set; } public float volume { get; set; } public bool looping { get; set; } - public float offset { get; set; } + public double offset { get; set; } - public Sound(string name, float beat, float pitch = 1f, float volume = 1f, bool looping = false, float offset = 0f) + public Sound(string name, double beat, float pitch = 1f, float volume = 1f, bool looping = false, double offset = 0f) { this.name = name; this.beat = beat; @@ -48,9 +48,9 @@ namespace HeavenStudio.Util { Util.Sound s; if (game) - s = Jukebox.PlayOneShotGame(sounds[i].name, sounds[i].beat, sounds[i].pitch, sounds[i].volume, sounds[i].looping, forcePlay, sounds[i].offset); + s = SoundByte.PlayOneShotGame(sounds[i].name, sounds[i].beat, sounds[i].pitch, sounds[i].volume, sounds[i].looping, forcePlay, sounds[i].offset); else - s = Jukebox.PlayOneShot(sounds[i].name, sounds[i].beat, sounds[i].pitch, sounds[i].volume, sounds[i].looping, null, sounds[i].offset); + s = SoundByte.PlayOneShot(sounds[i].name, sounds[i].beat, sounds[i].pitch, sounds[i].volume, sounds[i].looping, null, sounds[i].offset); ms.playingSounds.Add(s); } diff --git a/Assets/Scripts/Util/Sound.cs b/Assets/Scripts/Util/Sound.cs index dcd74ee4..3cd74789 100644 --- a/Assets/Scripts/Util/Sound.cs +++ b/Assets/Scripts/Util/Sound.cs @@ -1,5 +1,5 @@ +using System; using System.Collections; -using System.Collections.Generic; using UnityEngine; using Starpelly; @@ -17,8 +17,8 @@ namespace HeavenStudio.Util public double scheduledTime; public bool looping; - public float loopEndBeat = -1; - public float fadeTime; + public double loopEndBeat = -1; + public double fadeTime; int loopIndex = 0; private AudioSource audioSource; @@ -27,8 +27,8 @@ namespace HeavenStudio.Util private double startTime; - public float beat; - public float offset; + public double beat; + public double offset; public float scheduledPitch = 1f; bool playInstant = false; @@ -48,7 +48,7 @@ namespace HeavenStudio.Util audioSource.Play(); playInstant = true; played = true; - startTime = cnd.songPositionAsDouble; + startTime = AudioSettings.dspTime; StartCoroutine(NotRelyOnBeatSound()); } else @@ -126,7 +126,7 @@ namespace HeavenStudio.Util } } - public void SetLoopParams(float endBeat, float fadeTime) + public void SetLoopParams(double endBeat, double fadeTime) { loopEndBeat = endBeat; this.fadeTime = fadeTime; @@ -158,6 +158,7 @@ namespace HeavenStudio.Util #region Bend // All of these should only be used with rockers. + // minenice: consider doing these in the audio thread so they can work per-sample? public void BendUp(float bendTime, float bendedPitch) { this.bendedPitch = bendedPitch; @@ -201,20 +202,20 @@ namespace HeavenStudio.Util #endregion - public void KillLoop(float fadeTime) + public void KillLoop(double fadeTime) { StartCoroutine(FadeLoop(fadeTime)); } float loopFadeTimer = 0f; - IEnumerator FadeLoop(float fadeTime) + IEnumerator FadeLoop(double fadeTime) { float startingVol = audioSource.volume; while (loopFadeTimer < fadeTime) { loopFadeTimer += Time.deltaTime; - audioSource.volume = Mathf.Max((1f - (loopFadeTimer / fadeTime)) * startingVol, 0f); + audioSource.volume = (float) Math.Max((1f - (loopFadeTimer / fadeTime)) * startingVol, 0.0); yield return null; } diff --git a/Assets/Scripts/Util/Jukebox.cs b/Assets/Scripts/Util/SoundByte.cs similarity index 96% rename from Assets/Scripts/Util/Jukebox.cs rename to Assets/Scripts/Util/SoundByte.cs index 72200064..e789be66 100644 --- a/Assets/Scripts/Util/Jukebox.cs +++ b/Assets/Scripts/Util/SoundByte.cs @@ -5,7 +5,7 @@ using UnityEngine; namespace HeavenStudio.Util { - public class Jukebox + public class SoundByte { static GameObject oneShotAudioSourceObject; static AudioSource oneShotAudioSource; @@ -135,7 +135,7 @@ namespace HeavenStudio.Util /// Unpitched, non-scheduled, non-looping sounds are played using a global One-Shot audio source that doesn't create a Sound object. /// Looped sounds return their created Sound object so they can be canceled after creation. /// - public static Sound PlayOneShot(string name, float beat = -1, float pitch = 1f, float volume = 1f, bool looping = false, string game = null, float offset = 0f) + public static Sound PlayOneShot(string name, double beat = -1, float pitch = 1f, float volume = 1f, bool looping = false, string game = null, double offset = 0f) { AudioClip clip = null; if (game != null) @@ -247,7 +247,7 @@ namespace HeavenStudio.Util /// Unpitched, non-scheduled, non-looping sounds are played using a global One-Shot audio source that doesn't create a Sound object. /// Looped sounds return their created Sound object so they can be canceled after creation. /// - public static Sound PlayOneShotGame(string name, float beat = -1, float pitch = 1f, float volume = 1f, bool looping = false, bool forcePlay = false, float offset = 0f) + public static Sound PlayOneShotGame(string name, double beat = -1, float pitch = 1f, float volume = 1f, bool looping = false, bool forcePlay = false, double offset = 0f) { string gameName = name.Split('/')[0]; var inf = GameManager.instance.GetGameInfo(gameName); diff --git a/Assets/Scripts/Util/Jukebox.cs.meta b/Assets/Scripts/Util/SoundByte.cs.meta similarity index 100% rename from Assets/Scripts/Util/Jukebox.cs.meta rename to Assets/Scripts/Util/SoundByte.cs.meta diff --git a/Assets/Scripts/Util/StringUtils.cs b/Assets/Scripts/Util/StringUtils.cs new file mode 100644 index 00000000..769fe52d --- /dev/null +++ b/Assets/Scripts/Util/StringUtils.cs @@ -0,0 +1,32 @@ +using System.Globalization; +using System.Text.RegularExpressions; + +namespace HeavenStudio.Util +{ + public static class StringUtils + { + public static string DisplayName(this string name) + { + // "gameName" -> "Game Name" + // "action name" -> "Action Name" + if (!name.Contains(" ")) + name = SplitCamelCase(name); + TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; + return textInfo.ToTitleCase(name); + } + + // https://stackoverflow.com/a/5796793 + public static string SplitCamelCase(this string str) + { + return Regex.Replace( + Regex.Replace( + str, + @"(\P{Ll})(\P{Ll}\p{Ll})", + "$1 $2" + ), + @"(\p{Ll})(\P{Ll})", + "$1 $2" + ); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/BeatmapFormats/Beatmap.cs.meta b/Assets/Scripts/Util/StringUtils.cs.meta similarity index 83% rename from Assets/Scripts/BeatmapFormats/Beatmap.cs.meta rename to Assets/Scripts/Util/StringUtils.cs.meta index ba21c2d4..028dfa1f 100644 --- a/Assets/Scripts/BeatmapFormats/Beatmap.cs.meta +++ b/Assets/Scripts/Util/StringUtils.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9ec74fe21af663f4d9645852eb4cfb88 +guid: b54ef038cb59bf74d86a4d1872d4fcdd MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Packages/manifest.json b/Packages/manifest.json index 70efba4e..3fd746bd 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,6 +1,6 @@ { "dependencies": { - "com.ecasillas.missingrefsfinder": "https://github.com/edcasillas/unity-missing-references-finder.git", + "com.rheavenstudio.jukebox": "https://github.com/RHeavenStudio/Jukebox.git?path=/Assets/Scripts/Jukebox", "com.unity.2d.sprite": "1.0.0", "com.unity.assetbundlebrowser": "https://github.com/Unity-Technologies/AssetBundles-Browser.git", "com.unity.collab-proxy": "2.0.1", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 4216022c..de7ccdd0 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,11 +1,13 @@ { "dependencies": { - "com.ecasillas.missingrefsfinder": { - "version": "https://github.com/edcasillas/unity-missing-references-finder.git", + "com.rheavenstudio.jukebox": { + "version": "https://github.com/RHeavenStudio/Jukebox.git?path=/Assets/Scripts/Jukebox", "depth": 0, "source": "git", - "dependencies": {}, - "hash": "183e49b96580cfcd348ec0437d6fa8f7c4e9b280" + "dependencies": { + "com.unity.nuget.newtonsoft-json": "3.2.1" + }, + "hash": "619442ba26163fb6a00dd50ba52e2fdeaea33e37" }, "com.unity.2d.sprite": { "version": "1.0.0", @@ -60,8 +62,8 @@ "url": "https://packages.unity.com" }, "com.unity.nuget.newtonsoft-json": { - "version": "3.0.2", - "depth": 0, + "version": "3.2.1", + "depth": 1, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com"