From 771529435208c9ac6d9f66d0ac8d8ea8875f5d4c Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Thu, 21 Sep 2023 10:44:30 +0200 Subject: [PATCH] :sparkles: (UIExplorer): Add SuperSimon 1, 2, 3 activities --- .../SuperSimon/SuperSimonLevelOne.swift | 36 ++++++++ .../SuperSimon/SuperSimonLevelThree.swift | 85 +++++++++++++++++++ .../SuperSimon/SuperSimonLevelTwo.swift | 57 +++++++++++++ .../Sources/NewUI/Data/ActivityList.swift | 15 ++++ 4 files changed, 193 insertions(+) create mode 100644 Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelOne.swift create mode 100644 Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelThree.swift create mode 100644 Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelTwo.swift diff --git a/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelOne.swift b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelOne.swift new file mode 100644 index 0000000000..a7b2a34bcb --- /dev/null +++ b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelOne.swift @@ -0,0 +1,36 @@ +// 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), +] + +private let choicesStep2 = [ + ChoiceViewModel(item: "red", type: .color), + ChoiceViewModel(item: "green", type: .color), +] + +private var steps: [StandardStepModel] = [ + StandardStepModel(choices: choicesStep1, gameplay: .superSimon([1]), interface: .twoChoices), + StandardStepModel(choices: choicesStep2, gameplay: .superSimon([1, 0]), interface: .twoChoices), +] + +struct SuperSimonLevelOne: View { + private var stepManager = StepManager(steps: steps) + + var body: some View { + StepView(stepManager: stepManager) + } +} + +struct SuperSimonLevelOne_Previews: PreviewProvider { + static var previews: some View { + SuperSimonLevelOne() + .previewInterfaceOrientation(.landscapeLeft) + } +} diff --git a/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelThree.swift b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelThree.swift new file mode 100644 index 0000000000..14f6221464 --- /dev/null +++ b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelThree.swift @@ -0,0 +1,85 @@ +// Leka - iOS Monorepo +// Copyright 2023 APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import Combine +import GameEngineKit +import SwiftUI + +private let choicesStep1 = [ + ChoiceViewModel(item: "pink", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "purple", type: .color), + ChoiceViewModel(item: "yellow", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "red", type: .color), +] + +private let choicesStep2 = [ + ChoiceViewModel(item: "pink", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "purple", type: .color), + ChoiceViewModel(item: "yellow", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "red", type: .color), +] + +private let choicesStep3 = [ + ChoiceViewModel(item: "pink", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "purple", type: .color), + ChoiceViewModel(item: "yellow", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "red", type: .color), +] + +private let choicesStep4 = [ + ChoiceViewModel(item: "pink", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "purple", type: .color), + ChoiceViewModel(item: "yellow", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "red", type: .color), +] + +private let choicesStep5 = [ + ChoiceViewModel(item: "pink", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "purple", type: .color), + ChoiceViewModel(item: "yellow", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "red", type: .color), +] + +private let choicesStep6 = [ + ChoiceViewModel(item: "pink", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "purple", type: .color), + ChoiceViewModel(item: "yellow", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "red", type: .color), +] + +private var steps: [StandardStepModel] = [ + StandardStepModel(choices: choicesStep1, gameplay: .superSimon([5]), interface: .sixChoices), + StandardStepModel(choices: choicesStep2, gameplay: .superSimon([5, 2]), interface: .sixChoices), + StandardStepModel(choices: choicesStep3, gameplay: .superSimon([5, 2, 4]), interface: .sixChoices), + StandardStepModel(choices: choicesStep4, gameplay: .superSimon([5, 2, 4, 1]), interface: .sixChoices), + StandardStepModel(choices: choicesStep4, gameplay: .superSimon([5, 2, 4, 1, 3]), interface: .sixChoices), + StandardStepModel(choices: choicesStep4, gameplay: .superSimon([5, 2, 4, 1, 3, 0]), interface: .sixChoices), +] + +struct SuperSimonLevelThree: View { + private var stepManager = StepManager(steps: steps) + + var body: some View { + StepView(stepManager: stepManager) + } +} + +struct SuperSimonLevelThree_Previews: PreviewProvider { + static var previews: some View { + SuperSimonLevelThree() + .previewInterfaceOrientation(.landscapeLeft) + } +} diff --git a/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelTwo.swift b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelTwo.swift new file mode 100644 index 0000000000..154a9a5e22 --- /dev/null +++ b/Apps/LekaActivityUIExplorer/Sources/NewUI/Activities/SuperSimon/SuperSimonLevelTwo.swift @@ -0,0 +1,57 @@ +// Leka - iOS Monorepo +// Copyright 2023 APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import Combine +import GameEngineKit +import SwiftUI + +private let choicesStep1 = [ + ChoiceViewModel(item: "red", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "yellow", type: .color), +] + +private let choicesStep2 = [ + ChoiceViewModel(item: "red", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "yellow", type: .color), +] + +private let choicesStep3 = [ + ChoiceViewModel(item: "red", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "yellow", type: .color), +] + +private let choicesStep4 = [ + ChoiceViewModel(item: "red", type: .color), + ChoiceViewModel(item: "green", type: .color), + ChoiceViewModel(item: "blue", type: .color), + ChoiceViewModel(item: "yellow", type: .color), +] + +private var steps: [StandardStepModel] = [ + StandardStepModel(choices: choicesStep1, gameplay: .superSimon([0]), interface: .fourChoices), + StandardStepModel(choices: choicesStep2, gameplay: .superSimon([0, 3]), interface: .fourChoices), + StandardStepModel(choices: choicesStep3, gameplay: .superSimon([0, 3, 1]), interface: .fourChoices), + StandardStepModel(choices: choicesStep4, gameplay: .superSimon([0, 3, 1, 2]), interface: .fourChoices), +] + +struct SuperSimonLevelTwo: View { + private var stepManager = StepManager(steps: steps) + + var body: some View { + StepView(stepManager: stepManager) + } +} + +struct SuperSimonLevelTwo_Previews: PreviewProvider { + static var previews: some View { + SuperSimonLevelTwo() + .previewInterfaceOrientation(.landscapeLeft) + } +} diff --git a/Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift b/Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift index 53b2505b1b..2ad11cd601 100644 --- a/Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift +++ b/Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift @@ -135,4 +135,19 @@ let kListOfAvailablesActivities: [ActivityModel] = [ instructions: "Touch the right color", view: AnyView(ColorBingoLevelThree()) ), + ActivityModel( + title: "SuperSimon - Lvl 1", + instructions: "Touch the right color sequence", + view: AnyView(SuperSimonLevelOne()) + ), + ActivityModel( + title: "SuperSimon - Lvl 2", + instructions: "Touch the right color sequence", + view: AnyView(SuperSimonLevelTwo()) + ), + ActivityModel( + title: "SuperSimon - Lvl 3", + instructions: "Touch the right color sequence", + view: AnyView(SuperSimonLevelThree()) + ), ]