Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

시퀸스 코드 병합 #42

Merged
merged 3 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Data/Global/globalStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Combine
import SwiftUI

enum EnumScene: Int, CaseIterable {
// case intro
case opeaning
case sequence1
case sequence2
Expand Down Expand Up @@ -121,6 +122,9 @@ class GlobalStore: ObservableObject {
var isQuizSequence = false


@Published
var paddleCount = 0

func resetUI() {
turnOffIsPopupActive()
turnOffIsFaceViewActive()
Expand Down
6 changes: 0 additions & 6 deletions Data/ScriptBox/ScriptData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ let SEQUENCE_OPENING_SCRIPTS: [Script] = [
]

let SEQUENCE_ONE_SCRIPTS: [Script] = [
([EnumSpeaker.system],
"..."
),
([EnumSpeaker.system],
"걷는 중..."
),
Expand Down Expand Up @@ -93,9 +90,6 @@ let SEQUENCE_ONE_SCRIPTS: [Script] = [
]

let SEQUENCE_TWO_SCRIPTS: [Script] = [
([EnumSpeaker.system],
" "
),
([EnumSpeaker.system],
"걷는 중..."
),
Expand Down
Binary file modified Resources/Assets.xcassets/Quiz_var/Quiz_1.imageset/Quiz_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/Assets.xcassets/Quiz_var/Quiz_2.imageset/Quiz_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Binary file not shown.
Binary file added Resources/SFX/sfx_sounds_interaction1.wav
Binary file not shown.
8 changes: 4 additions & 4 deletions Utils/Scene/handleSequenceOne.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ func handleSequenceOne(globalStore: GlobalStore){
switch scriptCount {
case 0:
globalStore.resetUI()
case 3:
case 2:
globalStore.updateCurrentDetailImage(detailImage: .Water)
globalStore.turnOnIsPopupActive()
case 4:
case 3:
globalStore.turnOnIsFaceViewActive()
case 5:
case 4:
globalStore.turnOffIsPopupActive()
case 6:
case 5:
globalStore.turnOffIsFaceViewActive()
globalStore.turnOnIsQuizSequence()
globalStore.turnOffIsTapAble()
Expand Down
8 changes: 4 additions & 4 deletions Utils/Scene/handleSequenceThree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func handleSequenceThree(globalStore: GlobalStore){
print("배가 만들어지는 이벤트 진행")
case 8:
globalStore.toggleIsFaceViewActive() // true
case 14:
globalStore.toggleIsFaceViewActive() // false
case 16:
globalStore.toggleIsFaceViewActive() // true
// case 14:
//// globalStore.toggleIsFaceViewActive() // false
// case 16:
//// globalStore.toggleIsFaceViewActive() // true
// ...
default:
print("sequence one is Ready")
Expand Down
22 changes: 13 additions & 9 deletions Utils/Scene/handleSequenceTwo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ func handleSequenceTwo(globalStore: GlobalStore){
// write here your logic!
let scriptCount = globalStore.scriptCount
switch scriptCount {
//3에 자동문 버튼 사진 나왔다가 4에서 사라져야 함
case 3:
globalStore.resetUI()
globalStore.toggleIsFaceViewActive() // false
globalStore.updateCurrentDetailImage(detailImage: .Door)
globalStore.toggleIsPopupActive() // true
case 5 :
globalStore.toggleIsPopupActive()
// ...
//3에 자동문 버튼 사진 나왔다가 4에서 사라져야 함
case 2:
globalStore.resetUI()
globalStore.toggleIsFaceViewActive() // false
globalStore.updateCurrentDetailImage(detailImage: .Door)
globalStore.toggleIsPopupActive() // true
case 4:
globalStore.toggleIsPopupActive()
// ...
case 8:
globalStore.turnOnIsQuizSequence()
case 11:
globalStore.turnOffIsFaceViewActive()
default:
print("sequence two is Ready")
}
Expand Down
5 changes: 5 additions & 0 deletions View/InteractionView/PaddleButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import SwiftUI
1. 사용자로부터 클릭 이벤트를 받아서 배 오브젝트를 이동시킨다.
*/
struct PaddleButtonView: View {
@EnvironmentObject
var globalStore: GlobalStore

@State private var isOffsetActive = false

var body: some View {
Expand All @@ -23,6 +26,8 @@ struct PaddleButtonView: View {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.02) {
isOffsetActive = false
}
print(globalStore.paddleCount)
globalStore.paddleCount += 1
}
}
}
Expand Down
63 changes: 34 additions & 29 deletions View/QuizModalView/QuizModalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,45 @@ struct QuizModalView: View {
.background(.opacity(0))
}.sheet(isPresented: $isShowingModal) {
//Text("modal view")
VStack (alignment: .leading){
Spacer()
QuestionView().padding()
Spacer()
AnswerView().padding()
Spacer()
/*
Button(action: self.presentation.wrappedValue.dismiss()){
Text("TestButton")
}
*/
ZStack{
Image("Quiz_1")
.offset(y: globalStore.safeAreaSize.1)
VStack (alignment: .leading){
Spacer()
QuestionView().padding()
Spacer()
AnswerView().padding()
Spacer()
/*
Button(action: self.presentation.wrappedValue.dismiss()){
Text("TestButton")
}
*/



/*QuizButtonView {
presentation.wrappedValue.dismiss()

}
*/

if globalStore.currentScene == EnumScene.sequence1 {
QuizButtonView1(isShowingModal: $isShowingModal, quizFalse: $quizFalse){

/*QuizButtonView {
presentation.wrappedValue.dismiss()
}
*/

if globalStore.currentScene == EnumScene.sequence1 {
QuizButtonView1(isShowingModal: $isShowingModal, quizFalse: $quizFalse){
}
}

else {
QuizButtonView(isShowingModal: $isShowingModal, quizFalse: $quizFalse){
}
}
// QuizButtonView(isShowingModal: $isShowingModal, quizFalse: $quizFalse){
//
// }

}

else {
QuizButtonView(isShowingModal: $isShowingModal, quizFalse: $quizFalse){
}
}
// QuizButtonView(isShowingModal: $isShowingModal, quizFalse: $quizFalse){
//
// }

}
.background(CustomColor.scriptBox)
.presentationDetents([.medium, .large], selection: $settingsDetent)
}
.onAppear{
Expand Down
65 changes: 56 additions & 9 deletions View/SceneView/SceneBackgroundView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ struct SceneBackgroundView: View {
@State
private var isBlurActive = true

@State
private var isLastSequenceImage = false

@State
var currentBg: EnumBackgrundImage = .opening {
didSet {
Expand Down Expand Up @@ -97,11 +100,9 @@ struct SceneBackgroundView: View {
if scriptCount == 0 {
setTimeoutClosure(timeCount: 400) {
isBlurActive = false
bgOffsetY = 650
}
}
if scriptCount == 1 {
bgOffsetY = 200
}
if scriptCount == 10 {
globalStore.turnOffIsTapAble()
setTimeoutClosure(timeCount: 400) {
Expand All @@ -118,31 +119,68 @@ struct SceneBackgroundView: View {
}
case .sequence2:
if scriptCount == 0 {
bgOffsetY = 0
bgOffsetY = bgOffsetY + 650
globalStore.turnOffIsPopupActive()
setTimeoutClosure(timeCount: 400) {
isBlurActive = false
animationDuration = 3.0
}
}

if scriptCount == 3 {
if scriptCount == 2 {
globalStore.turnOnIsPopupActive()
}
if scriptCount == 11 {
globalStore.turnOffIsTapAble()
setTimeoutClosure(timeCount: 400) {
isBlurActive = true
}
setTimeoutClosure(timeCount: 1000) {
globalStore.turnOnIsTapAble()
}
}

case .sequence3:
currentBg = .sequence3
if scriptCount == 0 {
bgOffsetY = 0
setTimeoutClosure(timeCount: 400) {
isBlurActive = false
}
}
if scriptCount == 9 {
bgOffsetY = bgOffsetY + 350
}

if scriptCount == 19 {
globalStore.turnOffIsTapAble()
}
if scriptCount == 21 {
globalStore.turnOnIsTapAble()
bgOffsetY = bgOffsetY + 300
}
if scriptCount == 25 {
setTimeoutClosure(timeCount: 400) {
isBlurActive = true
}
setTimeoutClosure(timeCount: 1000) {
bgOffsetY = 0
}
}

case .ending:
currentBg = .ending
if scriptCount == 0 {
bgOffsetY = 0
setTimeoutClosure(timeCount: 100) {

setTimeoutClosure(timeCount: 400) {
bgOffsetY = 0
}
isLastSequenceImage = true
setTimeoutClosure(timeCount: 1000) {
isBlurActive = false
globalStore.turnOffIsTapAble()
animationDuration = 12
bgOffsetY = 2500 - 650
bgOffsetY -= 1800
}
setTimeoutClosure(timeCount: 12000) {
globalStore.turnOnIsTapAble()
Expand All @@ -166,7 +204,7 @@ struct SceneBackgroundView: View {
Image(currentSceneImage)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 390, height: 650, alignment: .bottom)
.frame(width: 390, height: 650, alignment: isLastSequenceImage ? .top : .bottom)
.offset(y: CGFloat(bgOffsetY))
.animation(.linear(duration: animationDuration), value: bgOffsetY)
.alignmentGuide(.bottom) { d in
Expand All @@ -186,5 +224,14 @@ struct SceneBackgroundView: View {
.onReceive(globalStore.$scriptCount, perform: { currentCount in
handleCurrentBackground(scriptCount: currentCount)
})
.onReceive(globalStore.$paddleCount, perform: { currentCount in
if bgOffsetY < 1550 {
bgOffsetY = bgOffsetY + currentCount * 2
}

if currentCount > 40 {
globalStore.addScriptCount()
}
})
}
}
5 changes: 1 addition & 4 deletions View/SceneView/SequenceView/SequenceOneView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@ struct SequenceOneView: View {

private func handleSequenceView(scriptCount: Int) {
switch scriptCount {
case 1...11:
case 1:
isCharacterMove = false
print(isCharacterMove)
print("scriptCount", scriptCount)

DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) {
isCharacterMove = true
}

print(isCharacterMove)
default:
print("scriptCount", scriptCount)
}
Expand Down
Loading