Mercurial > public > geoquiz
diff GeoQuiz/GuessTheCapitalView.swift @ 3:4dbe0cd9dadc
first game prototype
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Thu, 22 Sep 2022 10:42:39 +0200 |
parents | 413e2d21333e |
children | de54f05adb78 |
line wrap: on
line diff
--- a/GeoQuiz/GuessTheCapitalView.swift Tue Sep 20 11:54:06 2022 +0200 +++ b/GeoQuiz/GuessTheCapitalView.swift Thu Sep 22 10:42:39 2022 +0200 @@ -11,13 +11,13 @@ @Binding var gameName: GameName? @StateObject var game = GuessTheCapital() - var flagSymbol: String { - if let countryAsked = game.countries[game.countryNameAsked] { - return countryAsked.flagSymbol - } else { - fatalError("Couldn't find \(game.countryNameAsked) in countries") - } - } +// var flagSymbol: String { +// if let countryAsked = game.countries[game.countryNameAsked] { +// return countryAsked.flagSymbol +// } else { +// fatalError("Couldn't find \(game.countryNameAsked) in countries") +// } +// } var body: some View { ZStack { @@ -26,44 +26,44 @@ GeometryReader { geo in VStack(spacing: 20) { - GameToolbar( - userScore: $game.userScore, - userLives: $game.userLives, - gameName: $gameName, - showingBuyLivesView: $game.showingBuyLivesView - ) +// GameToolbar( +// userScore: $game.userScore, +// userLives: $game.userLives, +// gameName: $gameName, +// showingBuyLivesView: $game.showingBuyLivesView +// ) Spacer() - FlagImage(flagSymbol: flagSymbol, cornerRadius: 20) - .shadow(radius: 10) - .frame(height: geo.size.height * 0.15) +// FlagImage(flagSymbol: flagSymbol, cornerRadius: 20) +// .shadow(radius: 10) +// .frame(height: geo.size.height * 0.15) Spacer() HStack { - VStack(alignment: .leading, spacing: 10) { - Text("Question \(game.questionCounter) of \(game.countries.count)") - .font(.title3) - - Text("What is the capital of \(game.countryNameAsked)?") - .font(.title) - .fontWeight(.semibold) - } - .foregroundColor(.white) +// VStack(alignment: .leading, spacing: 10) { +// Text("Question \(game.questionCounter) of \(game.countries.count)") +// .font(.title3) +// +// Text("What is the capital of \(game.countryNameAsked)?") +// .font(.title) +// .fontWeight(.semibold) +// } +// .foregroundColor(.white) Spacer() } VStack { - ForEach(Array(game.userChoices.values), id: \.self) { country in - Button { - game.answered(userChoice: country.capitalName) - } label: { - AnswerButton(optionName: country.capitalName, color: .secondary) - .frame(height: geo.size.height * 0.08) - } - } +// ForEach(Array(game.userChoices.values), id: \.self) { country in +// Button { +// game.answered(userChoice: country.capitalName) +// } label: { +// AnswerButton(optionName: country.capitalName, color: .secondary) +// .frame(height: geo.size.height * 0.08) +// } +// } } } .padding() @@ -71,29 +71,29 @@ } .navigationBarHidden(true) - .sheet(isPresented: $game.showingBuyLivesView) { - BuyLivesModal() - } - - .alert(game.alertTitle, isPresented: $game.showingNoLivesAlert) { - Button("Buy lives") { game.showingBuyLivesView = true } - Button("Exit", role: .destructive) { gameName = nil } - Button("Cancel", role: .cancel) { } - } message: { - Text(game.alertMessage) - } - - .alert(game.alertTitle, isPresented: $game.showingWrongAnswerAlert) { - Button("Continue", role: .cancel) { game.askQuestion() } - } message: { - Text(game.alertMessage) - } - - .alert(game.alertTitle, isPresented: $game.showingEndGameAlert) { - Button("Exit", role: .cancel) { gameName = nil } - } message: { - Text(game.alertMessage) - } +// .sheet(isPresented: $game.showingBuyLivesView) { +// BuyLivesModal() +// } +// +// .alert(game.alertTitle, isPresented: $game.showingNoLivesAlert) { +// Button("Buy lives") { game.showingBuyLivesView = true } +// Button("Exit", role: .destructive) { gameName = nil } +// Button("Cancel", role: .cancel) { } +// } message: { +// Text(game.alertMessage) +// } +// +// .alert(game.alertTitle, isPresented: $game.showingWrongAnswerAlert) { +// Button("Continue", role: .cancel) { game.askQuestion() } +// } message: { +// Text(game.alertMessage) +// } +// +// .alert(game.alertTitle, isPresented: $game.showingEndGameAlert) { +// Button("Exit", role: .cancel) { gameName = nil } +// } message: { +// Text(game.alertMessage) +// } } }