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

faet: 퀴즈뷰, 시퀸스_1 병합 #45

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
1 change: 1 addition & 0 deletions Data/Global/globalStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ enum EnumDetailImage: CaseIterable {
case Redkey // 열쇠 중 1개(커피)를 선택한다.
case Water
case Door
case Treasure
}

// 이미지를 교체하기 위한 EnumDirection
Expand Down
10 changes: 5 additions & 5 deletions Data/Quiz/QuizData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import Foundation

let QUESTION_TWO: NSDictionary = [
"question" : "Guiding Question은 솔루션을 도출하기 위해 답해야하는 챌린지와 관련된 질문이다",
"answer" : "a. O\nb. X\nc. 둘다정답\nd. 둘다 오답",
"question1" : "쫄쫄... CBL의 3가지 단계로 옳지 않은 것은... 쫄쫄...?",
"answer1" : "a. Engage\nb. Investigate\nc. Plan\nd. Act"
let QUESTION_INFO: NSDictionary = [
"question" : "쫄쫄... CBL의 3가지 단계로 옳지 않은 것은... 쫄쫄...?",
"answer" : "a. Engage b. Investigate\nc. Plan d. Act",
"question1" : "Guiding Question은 솔루션을 도출하기 위해 답해야하는 챌린지와 관련된 질문이다",
"answer1" : "a. O b. X"
//"question" : ""
]

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.
5 changes: 4 additions & 1 deletion Utils/Scene/handleSequenceOne.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ func handleSequenceOne(globalStore: GlobalStore){
globalStore.turnOffIsFaceViewActive()
globalStore.turnOnIsQuizSequence()
globalStore.turnOffIsTapAble()

case 7:
globalStore.turnOffIsFaceViewActive()
case 8:
globalStore.turnOnIsFaceViewActive()
//case 7: handleSequenceQuizOne() //실행될 것
default:
print("sequence one is Ready")
Expand Down
11 changes: 8 additions & 3 deletions Utils/Scene/handleSequenceThree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,23 @@ func handleSequenceThree(globalStore: GlobalStore){
*/
case 0:
globalStore.resetUI()
globalStore.toggleIsFaceViewActive() // true
globalStore.turnOnIsFaceViewActive()
case 6:
globalStore.turnOffIsFaceViewActive()
globalStore.toggleIsFaceViewActive() // false
case 7:
print("배가 만들어지는 이벤트 진행")
case 8:
globalStore.toggleIsFaceViewActive() // true
globalStore.turnOnIsFaceViewActive()
// case 14:
//// globalStore.toggleIsFaceViewActive() // false
// case 16:
//// globalStore.toggleIsFaceViewActive() // true
// ...
case 24:
globalStore.updateCurrentDetailImage(detailImage: .Treasure)
globalStore.turnOnIsPopupActive()
case 25:
globalStore.turnOffIsPopupActive()
default:
print("sequence one is Ready")
}
Expand Down
13 changes: 7 additions & 6 deletions View/QuizModalView/AnswerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ struct AnswerView: View {
// QuizData에 있는 question값을 가져와서 String으로 형 변환해준다

// @Binding var isStart: Bool
let answer: String = QUESTION_TWO["answer"] as? String ?? ""
let answer1: String = QUESTION_TWO["answer1"] as? String ?? ""
let answer: String = QUESTION_INFO["answer"] as? String ?? ""
let answer1: String = QUESTION_INFO["answer1"] as? String ?? ""

var body: some View {
if globalStore.currentScene == EnumScene.sequence1 {
CustomText(value: "\(answer)", fontSize: 18, color: Color.black)
.border(.red)
CustomText(value: "\(answer)", fontSize: 28, color: Color.black)

}
else {
CustomText(value: "\(answer1)", fontSize: 18, color: Color.black)
.border(.red)
CustomText(value: "\(answer1)", fontSize: 28, color: Color.black)
.offset(y: -16)

}
}
}
12 changes: 5 additions & 7 deletions View/QuizModalView/QuestionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@ struct QuestionView: View {

// @Binding var isStart: Bool

let q = QUESTION_TWO["question"] as? String ?? ""
let q1 = QUESTION_TWO["question1"] as? String ?? ""
let q = QUESTION_INFO["question"] as? String ?? ""
let q1 = QUESTION_INFO["question1"] as? String ?? ""

// QuizData에 있는 question값을 가져와서 String으로 형 변환해준다

var body: some View {
if globalStore.currentScene == EnumScene.sequence1 {
CustomText(value: "\(q)", fontSize: 23, color: Color.black)
.border(.red)
CustomText(value: "\(q)", fontSize: 32, color: Color.black)
}
else {
CustomText(value: "\(q1)", fontSize: 23, color: Color.black)
.border(.red)
CustomText(value: "\(q1)", fontSize: 32, color: Color.black)

}
// Text(QUESTION_TWO["question"] as? String ?? "") .border(.red)
}
}
40 changes: 9 additions & 31 deletions View/QuizModalView/QuizButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ struct QuizButtonView: View {
var body: some View {
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible())]) {
Button{
quizFalse.toggle()
isShowingModal = false
handleSequenceQuizOne(globalStore: globalStore)
} label: {
CustomText(value: "A", fontSize: 18, color: Color.black)
CustomText(value: "O", fontSize: 32, color: Color.black)
.frame(width: 180, height: 70)
.foregroundColor(.white)
.background(.gray)
.foregroundColor(Color.clear)
.background(Color.clear)
}.alert(isPresented: $quizFalse) {
Alert(title: Text("틀렸습니다!"),
message: Text(""),
Expand All @@ -38,42 +39,19 @@ struct QuizButtonView: View {
//completion()
quizFalse.toggle()
} label: {
CustomText(value: "B", fontSize: 18, color: Color.black)
.frame(width: 180, height: 70)
.foregroundColor(.white)
.background(.gray)
}.alert(isPresented: $quizFalse) {
Alert(title: Text("틀렸습니다!"),
message: Text(""),
dismissButton: .default(Text("다시 풀어보기")))
}
.cornerRadius(15)
Button {
isShowingModal = false
handleSequenceQuizOne(globalStore: globalStore)

} label: {
CustomText(value: "C", fontSize: 18, color: Color.black)
.frame(width: 180, height: 70)
.foregroundColor(.white)
.background(.gray)
}
.cornerRadius(15)
Button {
quizFalse.toggle()
} label: {
CustomText(value: "D", fontSize: 18, color: Color.black)
CustomText(value: "X", fontSize: 32, color: Color.black)
.frame(width: 180, height: 70)
.foregroundColor(.white)
.background(.gray)
.background(Color.clear)
}.alert(isPresented: $quizFalse) {
Alert(title: Text("틀렸습니다!"),
message: Text(""),
dismissButton: .default(Text("다시 풀어보기")))
}
.cornerRadius(15)

}
.offset(y: -32)
.padding(.horizontal, 24)
}
}

Expand Down
40 changes: 17 additions & 23 deletions View/QuizModalView/QuizButtonView1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,59 +21,53 @@ struct QuizButtonView1: View {
var body: some View {
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible())]) {
Button{
isShowingModal = false
handleSequenceQuizOne(globalStore: globalStore)
quizFalse.toggle()
} label: {
CustomText(value: "A", fontSize: 18, color: Color.black)
CustomText(value: "A", fontSize: 32, color: Color.black)
.frame(width: 180, height: 70)
.foregroundColor(.white)
.background(.gray)
.background(Color.clear)
}.alert(isPresented: $quizFalse) {
Alert(title: Text("틀렸습니다!"),
message: Text(""),
dismissButton: .default(Text("다시 풀어보기")))
}
.cornerRadius(15)
Button {
//print("hello")
//completion()
quizFalse.toggle()
} label: {
CustomText(value: "B", fontSize: 18, color: Color.black)
CustomText(value: "B", fontSize: 32, color: Color.black)
.frame(width: 180, height: 70)
.foregroundColor(.white)
.background(.gray)
}.alert(isPresented: $quizFalse) {
Alert(title: Text("틀렸습니다!"),
message: Text(""),
dismissButton: .default(Text("다시 풀어보기")))
.background(Color.clear)
}
.cornerRadius(15)
Button {
quizFalse.toggle()

isShowingModal = false
handleSequenceQuizOne(globalStore: globalStore)
} label: {
CustomText(value: "C", fontSize: 18, color: Color.black)
CustomText(value: "C", fontSize: 32, color: Color.black)
.frame(width: 180, height: 70)
.foregroundColor(.white)
.background(.gray)
}.alert(isPresented: $quizFalse) {
Alert(title: Text("틀렸습니다!"),
message: Text(""),
dismissButton: .default(Text("다시 풀어보기")))
.background(Color.clear)
}
.cornerRadius(15)
Button {
quizFalse.toggle()
} label: {
CustomText(value: "D", fontSize: 18, color: Color.black)
CustomText(value: "D", fontSize: 32, color: Color.black)
.frame(width: 180, height: 70)
.foregroundColor(.white)
.background(.gray)
.background(Color.clear)
}.alert(isPresented: $quizFalse) {
Alert(title: Text("틀렸습니다!"),
message: Text(""),
dismissButton: .default(Text("다시 풀어보기")))
}
.cornerRadius(15)

}
.offset(y: -24)
.padding(.horizontal, 24)
}
}

Expand Down
34 changes: 9 additions & 25 deletions View/QuizModalView/QuizModalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,25 @@ struct QuizModalView: View {
}.sheet(isPresented: $isShowingModal) {
//Text("modal view")
ZStack{
Image("Quiz_1")
.offset(y: globalStore.safeAreaSize.1)
Image(globalStore.currentScene == EnumScene.sequence1 ? "Quiz_1" : "Quiz_2" )
.offset(y: globalStore.safeAreaSize.1 / 2)
VStack (alignment: .leading){
Spacer()
QuestionView().padding()
QuestionView()
.padding(.horizontal, 24)
.offset(y: 16)
Spacer(minLength: 24)
AnswerView()
.padding(.horizontal, 24)
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){
}
}

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

}
}
.background(CustomColor.scriptBox)
Expand Down
4 changes: 1 addition & 3 deletions View/SceneView/SceneBackgroundView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,8 @@ struct SceneBackgroundView: View {
bgOffsetY = bgOffsetY + 300
}
if scriptCount == 25 {
setTimeoutClosure(timeCount: 400) {
setTimeoutClosure(timeCount: 2000) {
isBlurActive = true
}
setTimeoutClosure(timeCount: 1000) {
bgOffsetY = 0
}
}
Expand Down
2 changes: 1 addition & 1 deletion View/SceneView/SceneView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct SceneView: View {
// SequenceViewContainer
SceneBackgroundView()
.frame(width: deviceWidth, height: deviceHeight)
.border(.orange)
// .border(.orange)
HStack {
AnyView(setSequenceView(currentScene: globalStore.currentScene))
}
Expand Down
41 changes: 17 additions & 24 deletions View/SceneView/SequenceView/SequenceOneView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,44 +34,37 @@ struct SequenceOneView: View {

private func handleSequenceView(scriptCount: Int) {
switch scriptCount {
case 1, 4, 5, 6, 10, 11:
isCharacterMove = false
print("scriptCount", scriptCount)

DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) {
isCharacterMove = true
case 0:
setTimeoutClosure(timeCount: 3000) {
isJolJolMove = true
}
case 2: // JolJol 나옴
case 10, 11:
isCharacterMove = false
print("scriptCount", scriptCount)

DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) {
isCharacterMove = true
}
isJolJolMove = true
// JolJol 나옴
// isCharacterMove = false
// print("scriptCount", scriptCount)
//
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) {
// isCharacterMove = true
// }
case 3: // JolJol 움직임
isCharacterMove = false
// isCharacterMove = false
isJolJolMove = false
print("scriptCount", scriptCount)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) {
isCharacterMove = true
}
// print("scriptCount", scriptCount)
//
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) {
// isCharacterMove = true
// }
isJolJol = true
case 7: // JolJol 없어짐
isCharacterMove = false
isJolJol = false
isJolJolMove = false
print("scriptCount", scriptCount)

DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) {
isCharacterMove = true
}
case 8:
isMuho = true
case 9:
isMuho = false

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