Merge pull request 'splash screen work ' (#8) from dev_views_SplashScreen into dev_views

Reviewed-on: #8
pull/9/head
Rayhân HASSOU 11 months ago
commit 897077d4c5

@ -38,6 +38,8 @@
EC62C4FF2C0457AD0048CD0B /* TitleScreenMusic.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EC62C4FE2C0457AD0048CD0B /* TitleScreenMusic.mp3 */; };
EC62C5012C045B590048CD0B /* SoundPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C5002C045B590048CD0B /* SoundPlayer.swift */; };
EC62C5062C045C1A0048CD0B /* TitleScreenButtonSound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EC62C5052C045C1A0048CD0B /* TitleScreenButtonSound.mp3 */; };
EC62C5092C0467240048CD0B /* SplashScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C5082C0467240048CD0B /* SplashScreenView.swift */; };
EC62C50D2C046D9E0048CD0B /* SplashScreenSound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EC62C50C2C046D9E0048CD0B /* SplashScreenSound.mp3 */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -106,6 +108,8 @@
EC62C4FE2C0457AD0048CD0B /* TitleScreenMusic.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = TitleScreenMusic.mp3; sourceTree = "<group>"; };
EC62C5002C045B590048CD0B /* SoundPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoundPlayer.swift; sourceTree = "<group>"; };
EC62C5052C045C1A0048CD0B /* TitleScreenButtonSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = TitleScreenButtonSound.mp3; sourceTree = "<group>"; };
EC62C5082C0467240048CD0B /* SplashScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashScreenView.swift; sourceTree = "<group>"; };
EC62C50C2C046D9E0048CD0B /* SplashScreenSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = SplashScreenSound.mp3; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -243,6 +247,7 @@
isa = PBXGroup;
children = (
649ABF5A2BF60D78002E8894 /* MainMenuView.swift */,
EC62C5082C0467240048CD0B /* SplashScreenView.swift */,
);
path = Menu;
sourceTree = "<group>";
@ -321,6 +326,7 @@
EC62C5032C045BD30048CD0B /* Sounds */ = {
isa = PBXGroup;
children = (
EC62C50C2C046D9E0048CD0B /* SplashScreenSound.mp3 */,
EC62C5052C045C1A0048CD0B /* TitleScreenButtonSound.mp3 */,
);
path = Sounds;
@ -443,6 +449,7 @@
6493C1C02C046BF900B5121D /* samurai.ttf in Resources */,
EC62C5062C045C1A0048CD0B /* TitleScreenButtonSound.mp3 in Resources */,
649B59AC2BF64E12002BAE38 /* Images.xcassets in Resources */,
EC62C50D2C046D9E0048CD0B /* SplashScreenSound.mp3 in Resources */,
645834632BF5F92500E18321 /* Preview Assets.xcassets in Resources */,
645834602BF5F92500E18321 /* Assets.xcassets in Resources */,
EC62C4FF2C0457AD0048CD0B /* TitleScreenMusic.mp3 in Resources */,
@ -481,6 +488,7 @@
643AB6932BFCEFD00018DA73 /* GameResumeFrame.swift in Sources */,
EC62C4EF2BFE367F0048CD0B /* SwiftUIView.swift in Sources */,
649B59B22BF65392002BAE38 /* TextStyles.swift in Sources */,
EC62C5092C0467240048CD0B /* SplashScreenView.swift in Sources */,
EC62C4F92C0371660048CD0B /* MusicPlayer.swift in Sources */,
EC62C4FD2C0391D30048CD0B /* PlayerRow.swift in Sources */,
EC62C4FB2C038BD20048CD0B /* PlayersView.swift in Sources */,

@ -8,57 +8,69 @@
import SwiftUI
struct MainMenuView: View {
@State private var showSplash = true
var body: some View {
NavigationView {
VStack {
TitlePageFrame(Text: "DOU SHOU QI", ImageWidth: 200, ImageHeight: 200)
Spacer()
VStack {
HStack{
VStack(spacing: 25) {
MainMenuButton(text: "Play", destination: ScoreBoardView(), sound: "TitleScreenButtonSound", horizontalAlignment: .leading, topRightCorner: 10, bottomRightCorner: 10)
MainMenuButton(text: "Historique", destination: HistoricView(), sound: "TitleScreenButtonSound", horizontalAlignment: .leading, topRightCorner: 10, bottomRightCorner: 10)
MainMenuButton(text: "Best Scores", destination: ScoreBoardView(), sound: "TitleScreenButtonSound", horizontalAlignment: .leading, topRightCorner: 10, bottomRightCorner: 10)
MainMenuButton(text: "Players", destination: PlayersView(), sound: "TitleScreenButtonSound", horizontalAlignment: .leading, topRightCorner: 10, bottomRightCorner: 10)
if showSplash {
SplashScreenView()
.transition(.opacity)
.animation(.easeOut(duration: 3), value: showSplash)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 8) {
withAnimation {
showSplash = false
}
}
}
Image(AppImages.SemiLion)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 200, height: 500)
}
}
Spacer()
HStack {
Text("Copyright @")
.font(.headline)
.frame(alignment: .trailing)
Text("Dou Shou Qi Team")
} else {
TitlePageFrame(Text: "DOU SHOU QI", ImageWidth: 200, ImageHeight: 200)
Spacer()
Text("2024")
.frame(alignment: .trailing)
}
.padding() // Ajout de padding pour éviter que le contenu ne touche la bordure
.background(Color.white) // Couleur de fond pour le HStack
.overlay(
Rectangle()
.stroke(Color.black, lineWidth: 1) // Couleur et épaisseur de la bordure
)
Spacer()
.onAppear {
MusicPlayer.shared.playBackgroundMusic(music: "TitleScreenMusic")
VStack {
HStack {
VStack(spacing: 25) {
MainMenuButton(text: "Play", destination: ScoreBoardView(), sound: "TitleScreenButtonSound")
MainMenuButton(text: "Historique", destination: HistoricView(), sound: "TitleScreenButtonSound")
MainMenuButton(text: "Best Scores", destination: ScoreBoardView(), sound: "TitleScreenButtonSound")
MainMenuButton(text: "Players", destination: PlayersView(), sound: "TitleScreenButtonSound")
}
Image(AppImages.SemiLion)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 200, height: 500)
}
}
.onDisappear {
MusicPlayer.shared.stopBackgroundMusic()
Spacer()
HStack {
Text("Copyright @")
.font(.headline)
.frame(alignment: .trailing)
Text("Dou Shou Qi Team")
Spacer()
Text("2024")
.frame(alignment: .trailing)
}
.padding()
.background(Color.white)
.overlay(
Rectangle()
.stroke(Color.black, lineWidth: 1)
)
Spacer()
.onAppear {
MusicPlayer.shared.playBackgroundMusic(music: "TitleScreenMusic")
}
.onDisappear {
MusicPlayer.shared.stopBackgroundMusic()
}
}
}
}
}

@ -0,0 +1,23 @@
//
// SplashScreenView.swift
// DouShouQi_App
//
// Created by étudiant on 27/05/2024.
//
import SwiftUI
struct SplashScreenView: View {
var body: some View {
TitlePageFrame(Text: "DOU SHOU QI", ImageWidth: 200, ImageHeight: 200)
.onAppear {
playSound(named: "SplashScreenSound")
}
}
}
struct SplashScreenView_Previews: PreviewProvider {
static var previews: some View {
SplashScreenView()
}
}
Loading…
Cancel
Save