From 7c339c7fe056e9f16ad417e05a2446add7117be7 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Wed, 20 Sep 2023 15:58:56 +0200 Subject: [PATCH] :sparkles: (UIExplorer): Add ColorQuest 1, 2, 3 activities --- .../Activities/ColorQuest/ColorQuest1.swift | 50 ++++++++++++++++ .../Activities/ColorQuest/ColorQuest2.swift | 54 +++++++++++++++++ .../Activities/ColorQuest/ColorQuest3.swift | 59 +++++++++++++++++++ .../Sources/NewUI/Data/ActivityList.swift | 15 +++++ 4 files changed, 178 insertions(+) create mode 100644 Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest1.swift create mode 100644 Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest2.swift create mode 100644 Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest3.swift diff --git a/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest1.swift b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest1.swift new file mode 100644 index 0000000000..d8f497968a --- /dev/null +++ b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest1.swift @@ -0,0 +1,50 @@ +// Leka - iOS Monorepo +// Copyright 2023 APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import GameEngineKit +import SwiftUI + +private let choicesStep1 = [ + ChoiceViewModel(item: "blue", type: .color, rightAnswer: true) +] + +private let choicesStep2 = [ + ChoiceViewModel(item: "green", type: .color, rightAnswer: true) +] + +private let choicesStep3 = [ + ChoiceViewModel(item: "pink", type: .color, rightAnswer: true) +] + +private let choicesStep4 = [ + ChoiceViewModel(item: "yellow", type: .color, rightAnswer: true) +] + +private let choicesStep5 = [ + ChoiceViewModel(item: "red", type: .color, rightAnswer: true) + +] + +private var steps: [StandardStepModel] = [ + StandardStepModel(choices: choicesStep1, gameplay: .colorQuest, interface: .oneChoice), + StandardStepModel(choices: choicesStep2, gameplay: .colorQuest, interface: .oneChoice), + StandardStepModel(choices: choicesStep3, gameplay: .colorQuest, interface: .oneChoice), + StandardStepModel(choices: choicesStep4, gameplay: .colorQuest, interface: .oneChoice), + StandardStepModel(choices: choicesStep5, gameplay: .colorQuest, interface: .oneChoice), +] + +struct ColorQuest1: View { + @StateObject private var stepManager = StepManager(steps: steps) + + var body: some View { + stepManager.interface + } +} + +struct ColorQuest1_Previews: PreviewProvider { + static var previews: some View { + ColorQuest1() + .previewInterfaceOrientation(.landscapeLeft) + } +} diff --git a/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest2.swift b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest2.swift new file mode 100644 index 0000000000..f80509dc2e --- /dev/null +++ b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest2.swift @@ -0,0 +1,54 @@ +// Leka - iOS Monorepo +// Copyright 2023 APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import GameEngineKit +import SwiftUI + +private let choicesStep1 = [ + ChoiceViewModel(item: "red", type: .color), + ChoiceViewModel(item: "green", type: .color, rightAnswer: true), +] + +private let choicesStep2 = [ + ChoiceViewModel(item: "purple", type: .color), + ChoiceViewModel(item: "blue", type: .color, rightAnswer: true), +] + +private let choicesStep3 = [ + ChoiceViewModel(item: "yellow", type: .color, rightAnswer: true), + ChoiceViewModel(item: "red", type: .color), +] + +private let choicesStep4 = [ + ChoiceViewModel(item: "pink", type: .color), + ChoiceViewModel(item: "yellow", type: .color, rightAnswer: true), +] + +private let choicesStep5 = [ + ChoiceViewModel(item: "red", type: .color, rightAnswer: true), + ChoiceViewModel(item: "green", type: .color), +] + +private var steps: [StandardStepModel] = [ + StandardStepModel(choices: choicesStep1, gameplay: .colorQuest, interface: .twoChoices), + StandardStepModel(choices: choicesStep2, gameplay: .colorQuest, interface: .twoChoices), + StandardStepModel(choices: choicesStep3, gameplay: .colorQuest, interface: .twoChoices), + StandardStepModel(choices: choicesStep4, gameplay: .colorQuest, interface: .twoChoices), + StandardStepModel(choices: choicesStep5, gameplay: .colorQuest, interface: .twoChoices), +] + +struct ColorQuest2: View { + @StateObject private var stepManager = StepManager(steps: steps) + + var body: some View { + stepManager.interface + } +} + +struct ColorQuest2_Previews: PreviewProvider { + static var previews: some View { + ColorQuest2() + .previewInterfaceOrientation(.landscapeLeft) + } +} diff --git a/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest3.swift b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest3.swift new file mode 100644 index 0000000000..2ada832f23 --- /dev/null +++ b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/ColorQuest/ColorQuest3.swift @@ -0,0 +1,59 @@ +// Leka - iOS Monorepo +// Copyright 2023 APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import GameEngineKit +import SwiftUI + +private let choicesStep1 = [ + ChoiceViewModel(item: "red", type: .color), + ChoiceViewModel(item: "blue", type: .color, rightAnswer: true), + ChoiceViewModel(item: "yellow", type: .color), +] + +private let choicesStep2 = [ + ChoiceViewModel(item: "purple", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "blue", type: .color, rightAnswer: true), +] + +private let choicesStep3 = [ + ChoiceViewModel(item: "yellow", type: .color, rightAnswer: true), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "red", type: .color), +] + +private let choicesStep4 = [ + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "pink", type: .color), + ChoiceViewModel(item: "yellow", type: .color, rightAnswer: true), +] + +private let choicesStep5 = [ + ChoiceViewModel(item: "red", type: .color, rightAnswer: true), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "yellow", type: .color), +] + +private var steps: [StandardStepModel] = [ + StandardStepModel(choices: choicesStep1, gameplay: .colorQuest, interface: .threeChoicesInline), + StandardStepModel(choices: choicesStep2, gameplay: .colorQuest, interface: .threeChoicesInline), + StandardStepModel(choices: choicesStep3, gameplay: .colorQuest, interface: .threeChoicesInline), + StandardStepModel(choices: choicesStep4, gameplay: .colorQuest, interface: .threeChoicesInline), + StandardStepModel(choices: choicesStep5, gameplay: .colorQuest, interface: .threeChoicesInline), +] + +struct ColorQuest3: View { + @StateObject private var stepManager = StepManager(steps: steps) + + var body: some View { + stepManager.interface + } +} + +struct ColorQuest3_Previews: PreviewProvider { + static var previews: some View { + ColorQuest3() + .previewInterfaceOrientation(.landscapeLeft) + } +} diff --git a/Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift b/Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift index 3cad51dd7e..e1b2f2bf10 100644 --- a/Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift +++ b/Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift @@ -120,4 +120,19 @@ let kListOfAvailablesActivities: [ActivityModel] = [ instructions: "Start sequence and observe the user's behavior interacting with Leka", view: AnyView(PairingActivity()) ), + ActivityModel( + title: "ColorQuest1", + instructions: "Touch the right color", + view: AnyView(ColorQuest1()) + ), + ActivityModel( + title: "ColorQuest2", + instructions: "Touch the right color", + view: AnyView(ColorQuest2()) + ), + ActivityModel( + title: "ColorQuest3", + instructions: "Touch the right color", + view: AnyView(ColorQuest3()) + ), ]