-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge branch 'REVIEW+ladislas+hugo/feature/GEK-Handle-others-interf…
…ace-type'
- Loading branch information
Showing
9 changed files
with
295 additions
and
2 deletions.
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
...Examples/GameEngineKitExample/Resources/activity-touchToSelect-one_right_answer-image.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Leka - iOS Monorepo | ||
# Copyright 2023 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
id: 6be7fcc5e32942d5804ec336ef127d03 | ||
name: Touch To Select - One Right Answer - Image | ||
description: L'objectif est de trouver la bonne image ou des les rassembler par famille | ||
image: activity_image_recognition_1 | ||
sequence: | ||
- exercises: | ||
- instructions: Touche les animaux | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: image-placeholder-animals | ||
type: image | ||
isRightAnswer: true | ||
|
||
- instructions: Touche le portrait | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: image-placeholder-food | ||
type: image | ||
- value: image-placeholder-portrait | ||
type: image | ||
isRightAnswer: true | ||
|
||
- instructions: Touche le paysage | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: image-placeholder-landscape | ||
type: image | ||
isRightAnswer: true | ||
- value: image-placeholder-animals | ||
type: image | ||
- value: image-placeholder-food | ||
type: image | ||
|
||
- instructions: Touche la nourriture | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: image-placeholder-animals | ||
type: image | ||
- value: image-placeholder-portrait | ||
type: image | ||
- value: image-placeholder-food | ||
type: image | ||
isRightAnswer: true | ||
- value: image-placeholder-landscape | ||
type: image | ||
|
||
- instructions: Touche les animaux | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: image-placeholder-animals | ||
type: image | ||
- value: image-placeholder-food | ||
type: image | ||
isRightAnswer: true | ||
- value: image-placeholder-landscape | ||
type: image | ||
- value: image-placeholder-portrait | ||
type: image | ||
- value: image-placeholder-food | ||
type: image | ||
|
||
- instructions: Touche le portrait | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: image-placeholder-animals | ||
type: image | ||
- value: image-placeholder-food | ||
type: image | ||
- value: image-placeholder-landscape | ||
type: image | ||
- value: image-placeholder-food | ||
type: image | ||
- value: image-placeholder-portrait | ||
type: image | ||
isRightAnswer: true | ||
- value: image-placeholder-animals | ||
type: image |
57 changes: 57 additions & 0 deletions
57
...Examples/GameEngineKitExample/Resources/activity-touchToSelect-one_right_answer-mixed.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Leka - iOS Monorepo | ||
# Copyright 2023 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
id: 9a5431d4a5084ce4abc48109f90b8504 | ||
name: Touch To Select - One Right Answer - Mixed | ||
description: L'objectif est de trouver la bonne réponse ou des les rassembler par famille | ||
image: activity_mixed_recognition_1 | ||
sequence: | ||
- exercises: | ||
- instructions: Touche l'image | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: image-placeholder-food | ||
type: image | ||
isRightAnswer: true | ||
- value: blue | ||
type: color | ||
|
||
- instructions: Touche les images | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: blue | ||
type: color | ||
isRightAnswer: true | ||
- value: image-placeholder-animals | ||
type: image | ||
- value: green | ||
type: color | ||
- value: image-placeholder-portrait | ||
type: image | ||
isRightAnswer: true | ||
|
||
- instructions: Touche toutes les items | ||
type: selection | ||
interface: touchToSelect | ||
gameplay: selectAllRightAnswers | ||
payload: | ||
choices: | ||
- value: blue | ||
type: color | ||
isRightAnswer: true | ||
- value: image-placeholder-food | ||
type: image | ||
isRightAnswer: true | ||
- value: green | ||
type: color | ||
isRightAnswer: true | ||
- value: image-placeholder-landscape | ||
type: image | ||
isRightAnswer: true |
3 changes: 3 additions & 0 deletions
3
...it/Examples/GameEngineKitExample/Resources/images/image-placeholder-animals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...neKit/Examples/GameEngineKitExample/Resources/images/image-placeholder-food.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
.../Examples/GameEngineKitExample/Resources/images/image-placeholder-landscape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...t/Examples/GameEngineKitExample/Resources/images/image-placeholder-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
Modules/GameEngineKit/Sources/_NewSystem/Views/ChoiceImageView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// Leka - iOS Monorepo | ||
// Copyright 2023 APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//import Combine | ||
import ContentKit | ||
import RobotKit | ||
import SwiftUI | ||
|
||
struct ChoiceImageView: View { | ||
|
||
private let image: String | ||
private let size: CGFloat | ||
private let state: GameplayChoiceState | ||
private let kOverLayScaleFactor: CGFloat = 1.08 | ||
|
||
@State private var animationPercent: CGFloat = .zero | ||
@State private var overlayOpacity: CGFloat = .zero | ||
|
||
init(image: String, size: CGFloat, state: GameplayChoiceState = .idle) { | ||
self.image = image | ||
self.size = size | ||
self.state = state | ||
} | ||
|
||
@ViewBuilder | ||
var circle: some View { | ||
if let uiImage = UIImage(named: image) { | ||
Image(uiImage: uiImage) | ||
.resizable() | ||
.aspectRatio(contentMode: .fit) | ||
.frame( | ||
width: size, | ||
height: size | ||
) | ||
.clipShape(Circle()) | ||
} else { | ||
Text("❌\nImage not found:\n\(image)") | ||
.multilineTextAlignment(.center) | ||
.frame( | ||
width: size, | ||
height: size | ||
) | ||
.overlay { | ||
Circle() | ||
.stroke(Color.red, lineWidth: 5) | ||
} | ||
} | ||
} | ||
|
||
var body: some View { | ||
switch state { | ||
case .idle: | ||
circle | ||
.onAppear { | ||
withAnimation { | ||
animationPercent = 0.0 | ||
overlayOpacity = 0.0 | ||
} | ||
} | ||
|
||
case .rightAnswer: | ||
circle | ||
.overlay { | ||
RightAnswerFeedback(animationPercent: animationPercent) | ||
.frame( | ||
width: size * kOverLayScaleFactor, | ||
height: size * kOverLayScaleFactor | ||
) | ||
} | ||
.onAppear { | ||
withAnimation { | ||
animationPercent = 1.0 | ||
} | ||
} | ||
|
||
case .wrongAnswer: | ||
circle | ||
.overlay { | ||
WrongAnswerFeedback(overlayOpacity: overlayOpacity) | ||
.frame( | ||
width: size * kOverLayScaleFactor, | ||
height: size * kOverLayScaleFactor | ||
) | ||
} | ||
.onAppear { | ||
withAnimation { | ||
overlayOpacity = 0.8 | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
#Preview { | ||
VStack(spacing: 30) { | ||
HStack(spacing: 50) { | ||
ChoiceImageView(image: "image-placeholder-animals", size: 200) | ||
ChoiceImageView(image: "image-placeholder-missing", size: 200) | ||
} | ||
|
||
HStack(spacing: 50) { | ||
ChoiceImageView(image: "image-placeholder-animals", size: 200) | ||
ChoiceImageView(image: "image-placeholder-animals", size: 200, state: .rightAnswer) | ||
ChoiceImageView(image: "image-placeholder-animals", size: 200, state: .wrongAnswer) | ||
} | ||
|
||
HStack(spacing: 0) { | ||
ChoiceImageView(image: "image-placeholder-animals", size: 200) | ||
ChoiceColorView(color: "blue", size: 200) | ||
|
||
ChoiceImageView(image: "image-placeholder-animals", size: 200, state: .rightAnswer) | ||
ChoiceColorView(color: "blue", size: 200, state: .rightAnswer) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters