Skip to content

Commit

Permalink
feat: quizAnserView 정리 #14
Browse files Browse the repository at this point in the history
  • Loading branch information
yuncoffee committed Mar 30, 2023
1 parent 4850b15 commit 0b1515d
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 105 deletions.
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.
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
11 changes: 7 additions & 4 deletions View/SceneView/SequenceView/SequenceThreeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,15 @@ struct SequenceThreeView: View {
case 23:
isGomissacColor = true
isBoatMove = false
case 24:
case 25:
isLastScene = true
isPeopleMoving3 = false
case 25:
isGomissacColor = false
isLastScene = false
setTimeoutClosure(timeCount: 2000) {
isGomissacColor = false
isLastScene = false
}



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

0 comments on commit 0b1515d

Please sign in to comment.