From 77a67d9e22772b024b3c64c64c79fce8f3b37b87 Mon Sep 17 00:00:00 2001 From: yuncoffee Date: Fri, 31 Mar 2023 06:36:04 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20app=20image=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ContentView.swift | 10 +++++++++- .../ButtonSelectCharcterView.swift | 2 +- View/SceneView/SequenceView/SequenceEndingView.swift | 8 +++++++- View/SceneView/SequenceView/SequenceOneView.swift | 12 +++++++++--- .../SceneView/SequenceView/SequenceOpeningView.swift | 12 ++++++------ View/SceneView/SequenceView/SequenceTwoView.swift | 4 ++-- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/ContentView.swift b/ContentView.swift index 6c59e43..df7b888 100644 --- a/ContentView.swift +++ b/ContentView.swift @@ -2,7 +2,6 @@ import SwiftUI import AVFoundation struct ContentView: View { - @EnvironmentObject var globalStore: GlobalStore @@ -44,3 +43,12 @@ struct ContentView: View { } } +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + let globalStore = GlobalStore() + ContentView().environmentObject(globalStore) + .previewDevice(PreviewDevice(rawValue: "iPhone 14")) + .previewDisplayName("iPhone 14") + + } +} diff --git a/View/InteractionView/SelectCharcterView/ButtonSelectCharcterView.swift b/View/InteractionView/SelectCharcterView/ButtonSelectCharcterView.swift index 2043619..30ad268 100644 --- a/View/InteractionView/SelectCharcterView/ButtonSelectCharcterView.swift +++ b/View/InteractionView/SelectCharcterView/ButtonSelectCharcterView.swift @@ -24,7 +24,7 @@ struct ButtonSelectCharcterView: View { Button { completion() } label: { - CustomText(value: "\(index + 1). \(charcter.personalColor)", color: charcter == .coffee ? .red : CustomColor.scriptColor) + CustomText(value: "\(index + 1). \(charcter.personalColor)", color: CustomColor.scriptColor) .frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity) } .frame(minWidth: 0, maxWidth: .infinity ,maxHeight: .infinity) diff --git a/View/SceneView/SequenceView/SequenceEndingView.swift b/View/SceneView/SequenceView/SequenceEndingView.swift index 10fd5f6..55b9980 100644 --- a/View/SceneView/SequenceView/SequenceEndingView.swift +++ b/View/SceneView/SequenceView/SequenceEndingView.swift @@ -19,7 +19,7 @@ struct SequenceEndingView: View { @State private var treasure = false @State private var MC2 = false - + let backgroundMusicFiles = ["BGM_PopPop"] let soundEffectFiles = ["SFX_SeqEnd_coin_cluster8", "SFX_SeqEnd_sounds_fanfare1"] // add the names of your sound effect files here let musicFileExtension = "wav" // add the extension of your music files here //let soundEffectCountIntervals = [2, 4] // play sound effects when the count is equal to these values @@ -137,6 +137,12 @@ struct SequenceEndingView: View { .onReceive(globalStore.$scriptCount, perform: { currentCount in handleSequenceView(scriptCount: currentCount) switch currentCount { + case 0 : + let musicFileName = backgroundMusicFiles[0] // count starts at 1, but array index starts at 0 + let musicFileUrl = Bundle.main.url(forResource: musicFileName, withExtension: musicFileExtension)! + backgroundMusicPlayer = AVPlayer(url: musicFileUrl) + backgroundMusicPlayer?.volume = volume + backgroundMusicPlayer?.play() case 4: let musicFileName = soundEffectFiles[0] // count starts at 1, but array index starts at 0 let musicFileUrl = Bundle.main.url(forResource: musicFileName, withExtension: musicFileExtension)! diff --git a/View/SceneView/SequenceView/SequenceOneView.swift b/View/SceneView/SequenceView/SequenceOneView.swift index 5be1ca0..a51040c 100644 --- a/View/SceneView/SequenceView/SequenceOneView.swift +++ b/View/SceneView/SequenceView/SequenceOneView.swift @@ -36,8 +36,8 @@ struct SequenceOneView: View { - let backgroundMusicFiles = ["BGM_Adventure_Rest", "Walk"] - let soundEffectFiles = ["SFX_SeqOne_sound_neutral6", "SFX_SeqOne_lowhealth_alarmloop7", "SFX_SeqOne_sound_neutral11", "SFX_SeqOne_alarm_loop6", "SFX_SeqOne_coin_double7"] // add the names of your sound effect files here + let backgroundMusicFiles = ["BGM_Adventure_Rest"] + let soundEffectFiles = ["SFX_SeqOne_sound_neutral6", "SFX_SeqOne_lowhealth_alarmloop7", "SFX_SeqOne_sound_neutral11", "SFX_SeqOne_alarm_loop6", "SFX_SeqOne_coin_double7", "Walk"] // add the names of your sound effect files here let musicFileExtension = "wav" // add the extension of your music files here let musicFileExtension1 = "m4a" //let soundEffectCountIntervals = [2, 4] // play sound effects when the count is equal to these values @@ -110,11 +110,17 @@ struct SequenceOneView: View { handleSequenceView(scriptCount: currentCount) switch currentCount { case 0: - let musicFileName = backgroundMusicFiles[1] // count starts at 1, but array index starts at 0 + let musicFileName = backgroundMusicFiles[0] // count starts at 1, but array index starts at 0 let musicFileUrl = Bundle.main.url(forResource: musicFileName, withExtension: musicFileExtension)! backgroundMusicPlayer = AVPlayer(url: musicFileUrl) backgroundMusicPlayer?.volume = volume backgroundMusicPlayer?.play() + +// let effectFileName = soundEffectFiles[0] // count starts at 1, but array index starts at 0 +// let effectFileUrl = Bundle.main.url(forResource: effectFileName, withExtension: musicFileExtension1)! +// soundEffectPlayer = AVPlayer(url: effectFileUrl) +// soundEffectPlayer?.volume = volume1 +// soundEffectPlayer?.play() case 1: let musicFileName = soundEffectFiles[0] // count starts at 1, but array index starts at 0 let musicFileUrl = Bundle.main.url(forResource: musicFileName, withExtension: musicFileExtension)! diff --git a/View/SceneView/SequenceView/SequenceOpeningView.swift b/View/SceneView/SequenceView/SequenceOpeningView.swift index 9a6419d..551eb91 100644 --- a/View/SceneView/SequenceView/SequenceOpeningView.swift +++ b/View/SceneView/SequenceView/SequenceOpeningView.swift @@ -117,12 +117,12 @@ struct SequenceOpeningView: View { soundEffectPlayer = AVPlayer(url: effectFileUrl) soundEffectPlayer?.volume = volume1 soundEffectPlayer?.play() - case 4 : - let effectFileName = soundEffectFiles[1] // count starts at 1, but array index starts at 0 - let effectFileUrl = Bundle.main.url(forResource: effectFileName, withExtension: musicFileExtension1)! - soundEffectPlayer = AVPlayer(url: effectFileUrl) - soundEffectPlayer?.volume = volume1 - soundEffectPlayer?.play() +// case 4 : +// let effectFileName = soundEffectFiles[1] // count starts at 1, but array index starts at 0 +// let effectFileUrl = Bundle.main.url(forResource: effectFileName, withExtension: musicFileExtension1)! +// soundEffectPlayer = AVPlayer(url: effectFileUrl) +// soundEffectPlayer?.volume = volume1 +// soundEffectPlayer?.play() case 6 : let effectFileName = soundEffectFiles[2] // count starts at 1, but array index starts at 0 let effectFileUrl = Bundle.main.url(forResource: effectFileName, withExtension: musicFileExtension1)! diff --git a/View/SceneView/SequenceView/SequenceTwoView.swift b/View/SceneView/SequenceView/SequenceTwoView.swift index 1a18936..1c9ea81 100644 --- a/View/SceneView/SequenceView/SequenceTwoView.swift +++ b/View/SceneView/SequenceView/SequenceTwoView.swift @@ -44,8 +44,8 @@ struct SequenceTwoView: View { - let backgroundMusicFiles = ["Walk"] - let soundEffectFiles = ["SFX_SeqTwo_sound_nagger2", "SFX_SeqTwo_sounds_button6", "SFX_SeqTwo_interaction20", "SFX_SeqTwo_menu_move4", "SFX_SeqOne_sound_neutral11"] // add the names of your sound effect files here + let backgroundMusicFiles = ["BGM_Adventure_Rest"] + let soundEffectFiles = ["Walk", "SFX_SeqTwo_sound_nagger2", "SFX_SeqTwo_sounds_button6", "SFX_SeqTwo_interaction20", "SFX_SeqTwo_menu_move4", "SFX_SeqOne_sound_neutral11"] // add the names of your sound effect files here let musicFileExtension = "wav" // add the extension of your music files here let musicFileExtension1 = "wav" //let soundEffectCountIntervals = [2, 4] // play sound effects when the count is equal to these values