Skip to content

Commit

Permalink
✨ (UIExplorer): Add ColorQuest 1, 2, 3 activities
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Sep 25, 2023
1 parent 2d5a1fa commit 7c339c7
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
@@ -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)
}
}
15 changes: 15 additions & 0 deletions Apps/LekaActivityUIExplorer/Sources/NewUI/Data/ActivityList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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())
),
]

0 comments on commit 7c339c7

Please sign in to comment.