diff --git a/Modules/ContentKit/Resources/Content/activities/remotes/icons/remote_standard_arrows.activity.icon.png b/Modules/ContentKit/Resources/Content/activities/remotes/icons/remote_standard_arrows.activity.icon.png new file mode 100644 index 0000000000..1b328efb14 --- /dev/null +++ b/Modules/ContentKit/Resources/Content/activities/remotes/icons/remote_standard_arrows.activity.icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef89a772377bd0289dd350f319e394132e7d7aa367a34bd942bc809be37f6f56 +size 11048 diff --git a/Modules/ContentKit/Resources/Content/activities/remotes/remote_standard_arrows-5554CD696BB6492594082C5F8F895A85.activity.yml b/Modules/ContentKit/Resources/Content/activities/remotes/remote_standard_arrows-5554CD696BB6492594082C5F8F895A85.activity.yml new file mode 100644 index 0000000000..ae3e1f740f --- /dev/null +++ b/Modules/ContentKit/Resources/Content/activities/remotes/remote_standard_arrows-5554CD696BB6492594082C5F8F895A85.activity.yml @@ -0,0 +1,93 @@ +# Leka - iOS Monorepo +# Copyright APF France handicap +# SPDX-License-Identifier: Apache-2.0 + +version: 1.0.0 + +uuid: 5554CD696BB6492594082C5F8F895A85 +name: remote_standard_arrows + +created_at: "2024-03-04T18:07:12.519606" +last_edited_at: "2024-04-10T16:32:10.108131" +status: published + +authors: + - leka + +skills: + - sensory_interaction + - gross_motor_skills + +tags: + - robot_movements + - robot_colors + +hmi: + - tablet_robot + +types: + - one_on_one + - group + +locales: + - en_US + - fr_FR + +l10n: + - locale: fr_FR + details: + icon: remote_standard_arrows + + title: Commande Standard + subtitle: Flèches + + short_description: Contrôle Leka avec la télécommande, fais le se déplacer, + changer de couleur ou lance le renforçateur de ton choix + + description: | + La Commande Standard offre plusieurs fonctionnalités pour contrôler le robot : + - La Commande Fléchée pour téléguider le robot + - Les 5 renforçateurs de Leka + - Une commande colorée pour colorer le robot dans différentes couleurs + + instructions: | + - Pour faire se déplacer Leka, utiliser la Commande Fléchée en bas à gauche de l'écran. Appuyer sur les flèches pour choisir la direction du robot. + - Pour lancer un ou plusieurs renforçateurs, appuyer sur leurs différents icones à gauche de l'écran de l'iPad. + - Pour allumer le robot dans différentes couleurs, utiliser la commande colorée en bas à droite de l'écran. + + - locale: en_US + details: + icon: remote_standard_arrows + + title: Remote Standard + subtitle: Arrows + + short_description: | + Control Leka with the remote control, make him move, change color or throw the reinforcer of your choice + + description: | + The Remote Standard offers several features to control the robot: + - The Remote Arrow to remotely guide the robot + - Leka’s 5 reinforcers + - The colorful command to color the robot in different colors + + instructions: | + - To move Leka, use the Remote Arrow at the bottom left of the screen. Press the arrows to choose the direction of the robot. + - To launch one or more reinforcers, press their different icons on the left of the iPad screen. + - To turn the robot on in different colors, use the colored command at the bottom right of the screen. + +exercises_payload: + options: + shuffle_exercises: false + shuffle_groups: false + + exercise_groups: + - group: + - instructions: + - locale: fr_FR + value: Contrôle Leka avec la télécommande, fais le se déplacer, changer + de couleur ou lance le renforçateur de ton choix + - locale: en_US + value: Control Leka with the remote control, make him move, change color + or throw the reinforcer of your choice + interface: remoteStandardArrow diff --git a/Modules/ContentKit/Resources/Content/activities/remotes/remote_standard-E85F0498A29047E893631397592CC444.activity.yml b/Modules/ContentKit/Resources/Content/activities/remotes/remote_standard_joystick-E85F0498A29047E893631397592CC444.activity.yml similarity index 94% rename from Modules/ContentKit/Resources/Content/activities/remotes/remote_standard-E85F0498A29047E893631397592CC444.activity.yml rename to Modules/ContentKit/Resources/Content/activities/remotes/remote_standard_joystick-E85F0498A29047E893631397592CC444.activity.yml index 2aa30fe2fe..8d5395c27a 100644 --- a/Modules/ContentKit/Resources/Content/activities/remotes/remote_standard-E85F0498A29047E893631397592CC444.activity.yml +++ b/Modules/ContentKit/Resources/Content/activities/remotes/remote_standard_joystick-E85F0498A29047E893631397592CC444.activity.yml @@ -5,10 +5,10 @@ version: 1.0.0 uuid: E85F0498A29047E893631397592CC444 -name: remote_standard +name: remote_standard_joystick created_at: "2024-03-04T18:07:12.519606" -last_edited_at: "2024-03-05T09:42:38.078478" +last_edited_at: "2024-04-10T16:32:10.108131" status: published authors: @@ -39,7 +39,7 @@ l10n: icon: remote_standard title: Commande Standard - subtitle: null + subtitle: Joystick short_description: Contrôle Leka avec la télécommande, fais le se déplacer, changer de couleur ou lance le renforçateur de ton choix @@ -60,7 +60,7 @@ l10n: icon: remote_standard title: Remote Standard - subtitle: null + subtitle: Joystick short_description: | Control Leka with the remote control, make him move, change color or throw the reinforcer of your choice @@ -90,4 +90,4 @@ exercises_payload: - locale: en_US value: Control Leka with the remote control, make him move, change color or throw the reinforcer of your choice - interface: remoteStandard + interface: remoteStandardJoystick diff --git a/Modules/ContentKit/Resources/Content/categories/remotes.category.yml b/Modules/ContentKit/Resources/Content/categories/remotes.category.yml index 9e59dd1553..770e418133 100644 --- a/Modules/ContentKit/Resources/Content/categories/remotes.category.yml +++ b/Modules/ContentKit/Resources/Content/categories/remotes.category.yml @@ -16,4 +16,5 @@ l10n: content: - remote_colored_arrows-D91BDA161F8E455CA8A71881F1D2E923 - - remote_standard-E85F0498A29047E893631397592CC444 + - remote_standard_joystick-E85F0498A29047E893631397592CC444 + - remote_standard_arrows-5554CD696BB6492594082C5F8F895A85 diff --git a/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift b/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift index 6742bf314a..b48f9f1dd8 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift @@ -13,7 +13,8 @@ public extension Exercise { case dragAndDropIntoZones case dragAndDropToAssociate case danceFreeze - case remoteStandard + case remoteStandardJoystick + case remoteStandardArrow case remoteArrow case hideAndSeek case musicalInstruments diff --git a/Modules/ContentKit/Sources/Exercise/Exercise.swift b/Modules/ContentKit/Sources/Exercise/Exercise.swift index 17f7b5f7f6..60d42d2b36 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise.swift @@ -52,7 +52,8 @@ public struct Exercise: Decodable { case (.melody, .none): self.payload = try container.decode(MidiRecordingPlayer.Payload.self, forKey: .payload) - case (.remoteStandard, .none), + case (.remoteStandardJoystick, .none), + (.remoteStandardArrow, .none), (.remoteArrow, .none), (.hideAndSeek, .none), (.pairing, .none): diff --git a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView+ArrowButton.swift b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView+ArrowButton.swift index ed83de341c..674c37e5e1 100644 --- a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView+ArrowButton.swift +++ b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView+ArrowButton.swift @@ -47,18 +47,19 @@ extension RemoteArrowView { @State private var isPressed = false let arrow: Arrow + let size: CGFloat let onChanged: () -> Void let onReleased: () -> Void var body: some View { Circle() .fill(.white) - .frame(width: 200, height: 200) + .frame(width: self.size, height: self.size) .overlay { Image(systemName: self.arrow.name) .resizable() .foregroundColor(self.arrow.color.screen) - .frame(width: 80, height: 100) + .frame(width: self.size / 2.5, height: self.size / 2) } .shadow(color: .black.opacity(0.1), radius: 10, x: 0, y: 0) .scaleEffect(self.isPressed ? 0.95 : 1.0) @@ -78,7 +79,7 @@ extension RemoteArrowView { } #Preview { - RemoteArrowView.ArrowButton(arrow: .counterclockwise) { + RemoteArrowView.ArrowButton(arrow: .counterclockwise, size: 200) { print("Button pressed") } onReleased: { print("Button released") diff --git a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView+CircleLayout.swift b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView+CircleLayout.swift index defe9b261a..4fbe480ed3 100644 --- a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView+CircleLayout.swift +++ b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView+CircleLayout.swift @@ -6,6 +6,8 @@ import SwiftUI extension RemoteArrowView { struct CircleLayout: Layout { + let xPosition: CGFloat + func sizeThatFits(proposal: ProposedViewSize, subviews _: Subviews, cache _: inout ()) -> CGSize { proposal.replacingUnspecifiedDimensions() } @@ -16,7 +18,7 @@ extension RemoteArrowView { let posY = bounds.midY for (index, subview) in subviews.enumerated() { - var point = CGPoint(x: 180, y: 0) + var point = CGPoint(x: self.xPosition, y: 0) .applying(CGAffineTransform(rotationAngle: CGFloat(angle) * CGFloat(index - 1))) point.x += posX diff --git a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView.swift b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView.swift index 0d69ef1c8a..3b179bddbd 100644 --- a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView.swift +++ b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteArrow/RemoteArrowView.swift @@ -7,31 +7,33 @@ import SwiftUI struct RemoteArrowView: View { let robot = Robot.shared + let size: CGFloat + let xPosition: CGFloat var body: some View { - CircleLayout { - ArrowButton(arrow: .up) { + CircleLayout(xPosition: self.xPosition) { + ArrowButton(arrow: .up, size: self.size) { self.robot.move(.forward(speed: 1)) self.robot.shine(.all(in: ArrowButton.Arrow.up.color)) } onReleased: { self.robot.stopMotion() self.robot.stopLights() } - ArrowButton(arrow: .clockwise) { + ArrowButton(arrow: .clockwise, size: self.size) { self.robot.move(.spin(.clockwise, speed: 1)) self.robot.shine(.all(in: ArrowButton.Arrow.clockwise.color)) } onReleased: { self.robot.stopMotion() self.robot.stopLights() } - ArrowButton(arrow: .down) { + ArrowButton(arrow: .down, size: self.size) { self.robot.move(.backward(speed: 1)) self.robot.shine(.all(in: ArrowButton.Arrow.down.color)) } onReleased: { self.robot.stopMotion() self.robot.stopLights() } - ArrowButton(arrow: .counterclockwise) { + ArrowButton(arrow: .counterclockwise, size: self.size) { self.robot.move(.spin(.counterclockwise, speed: 1)) self.robot.shine(.all(in: ArrowButton.Arrow.counterclockwise.color)) } onReleased: { @@ -43,5 +45,5 @@ struct RemoteArrowView: View { } #Preview { - RemoteArrowView() + RemoteArrowView(size: 200, xPosition: 180) } diff --git a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+ArrowCommand.swift b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+ArrowCommand.swift new file mode 100644 index 0000000000..4d86da5fad --- /dev/null +++ b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+ArrowCommand.swift @@ -0,0 +1,39 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import DesignKit +import RobotKit +import SwiftUI + +extension RemoteStandard { + struct ArrowCommand: View { + // MARK: Internal + + var body: some View { + HStack(spacing: 150) { + VStack(spacing: 200) { + Spacer() + + RemoteArrowView(size: 130, xPosition: 130) + } + + RadialLayout(firstButtonPosX: -120, firstButtonPosY: -200, angle: 90.0) { + LedZoneSelectorView(displayMode: self.displayMode) + + ForEach(DisplayMode.allCases, id: \.self) { mode in + LedZoneSelectorView.ModeButton(mode: mode, displayMode: self.$displayMode) + } + } + } + } + + // MARK: Private + + @State private var displayMode = DisplayMode.fullBelt + } +} + +#Preview { + RemoteStandard.ArrowCommand() +} diff --git a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+MainView.swift b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+JoystickCommand.swift similarity index 97% rename from Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+MainView.swift rename to Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+JoystickCommand.swift index ed849ce01c..2b5e913408 100644 --- a/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+MainView.swift +++ b/Modules/GameEngineKit/Sources/Exercises/Specialized/RemoteStandard/RemoteStandard+JoystickCommand.swift @@ -45,7 +45,7 @@ enum RemoteStandard { } } - struct MainView: View { + struct JoystickCommand: View { // MARK: Internal var body: some View { @@ -75,5 +75,5 @@ enum RemoteStandard { } #Preview { - RemoteStandard.MainView() + RemoteStandard.JoystickCommand() } diff --git a/Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift b/Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift index b5953b9d5b..29baf75580 100644 --- a/Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift +++ b/Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift @@ -290,11 +290,14 @@ public struct ActivityView: View { data: self.viewModel.currentExerciseSharedData ) - case .remoteStandard: - RemoteStandard.MainView() + case .remoteStandardJoystick: + RemoteStandard.JoystickCommand() + + case .remoteStandardArrow: + RemoteStandard.ArrowCommand() case .remoteArrow: - RemoteArrowView() + RemoteArrowView(size: 200, xPosition: 180) case .hideAndSeek: HideAndSeekView( diff --git a/Specs/jtd/activity.jtd.json b/Specs/jtd/activity.jtd.json index e4b4ee35ba..039729f1f6 100644 --- a/Specs/jtd/activity.jtd.json +++ b/Specs/jtd/activity.jtd.json @@ -236,7 +236,14 @@ } } }, - "remoteStandard": { + "remoteStandardJoystick": { + "properties": { + "instructions": { + "ref": "$exercise/instructions" + } + } + }, + "remoteStandardArrow": { "properties": { "instructions": { "ref": "$exercise/instructions" @@ -308,7 +315,8 @@ "dragAndDropIntoZones", "dragAndDropToAssociate", "danceFreeze", - "remoteStandard", + "remoteStandardJoystick", + "remoteStandardArrow", "remoteArrow", "hideAndSeek", "musicalInstruments",