From 0fd434cc45e91784455cbdaed571e0cf879bb8c4 Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 28 May 2024 16:55:48 +0200 Subject: [PATCH] :loud_sound: Add: Music on GameView --- DouShouQi_App/DouShouQi_App/Views/GameView.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DouShouQi_App/DouShouQi_App/Views/GameView.swift b/DouShouQi_App/DouShouQi_App/Views/GameView.swift index 080a72e..94ccb79 100644 --- a/DouShouQi_App/DouShouQi_App/Views/GameView.swift +++ b/DouShouQi_App/DouShouQi_App/Views/GameView.swift @@ -15,6 +15,12 @@ struct MainMenuView: View { TopGameBoard().frame(maxHeight: 200) SpriteView(scene: gameScene).frame(width: 950, height: 600) } + .onAppear { + MusicPlayer.shared.playBackgroundMusic(music: "TitleScreenMusic") + } + .onDisappear { + MusicPlayer.shared.stopBackgroundMusic() + } } }