-
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.
✨ (UIExplorer): Add Xylophone musical instrument activity
- add MIDI files to Utils - remove old Xylophone and MIDI system - add Instrument and Xylophone views - start to deprecate old system Melody with changes
- Loading branch information
Showing
20 changed files
with
312 additions
and
165 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...ekaActivityUIExplorer/Resources/GEKNewSystem/activities/activity-xylophone-heptatonic.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,15 @@ | ||
# Leka - iOS Monorepo | ||
# Copyright 2023 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
id: cd5d93afbd8f4071b25479cd6372a7a9 | ||
name: Xylophone Heptatonic | ||
description: L'objectif est de jouer de la musique à l'aide du xylophone | ||
image: activity_color_recognition_1 | ||
sequence: | ||
- exercises: | ||
- instructions: Joue du xylophone avec Leka | ||
interface: musicalInstruments | ||
payload: | ||
instrument: xylophone | ||
scale: majorHeptatonic |
15 changes: 15 additions & 0 deletions
15
...ekaActivityUIExplorer/Resources/GEKNewSystem/activities/activity-xylophone-pentatonic.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,15 @@ | ||
# Leka - iOS Monorepo | ||
# Copyright 2023 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
id: 264d720bf8904043b97d5d7b3d0e7124 | ||
name: Xylophone Pentatonic | ||
description: L'objectif est de jouer de la musique à l'aide du xylophone | ||
image: activity_color_recognition_1 | ||
sequence: | ||
- exercises: | ||
- instructions: Joue du xylophone avec Leka | ||
interface: musicalInstruments | ||
payload: | ||
instrument: xylophone | ||
scale: majorPentatonic |
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
23 changes: 23 additions & 0 deletions
23
Modules/ContentKit/Sources/Exercise/Exercice+MusicalInstrument.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,23 @@ | ||
// Leka - iOS Monorepo | ||
// Copyright 2023 APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
public enum MusicalInstrument { | ||
|
||
public struct Payload: Codable { | ||
public let instrument: String | ||
public let scale: String | ||
|
||
enum CodingKeys: String, CodingKey { | ||
Check failure on line 11 in Modules/ContentKit/Sources/Exercise/Exercice+MusicalInstrument.swift GitHub Actions / lint
|
||
case instrument, scale | ||
} | ||
|
||
public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
|
||
self.instrument = try container.decode(String.self, forKey: .instrument) | ||
self.scale = try container.decode(String.self, forKey: .scale) | ||
} | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ extension Exercise { | |
case remoteStandard | ||
case remoteArrow | ||
case hideAndSeek | ||
case musicalInstruments | ||
} | ||
|
||
} |
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
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
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
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
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
56 changes: 0 additions & 56 deletions
56
Modules/GameEngineKit/Sources/Staging/Xylophone/XylophoneView.swift
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
...xercises/Specialized/Instrument/MusicalInstrumentView+XylophoneView+TileButtonStyle.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,82 @@ | ||
// Leka - iOS Monorepo | ||
// Copyright 2023 APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import AudioKit | ||
import DesignKit | ||
import RobotKit | ||
import SwiftUI | ||
|
||
extension MusicalInstrumentView.XylophoneView { | ||
|
||
struct TileButtonStyle: ButtonStyle { | ||
let xyloAttachColor = Color(red: 0.87, green: 0.65, blue: 0.54) | ||
let defaultMaxTileHeight: Int = 500 | ||
let defaultTileHeightGap: Int = 250 | ||
let defaultTileWidth: CGFloat = 130 | ||
let defaultTilesScaleFeedback: CGFloat = 0.98 | ||
let defaultTilesRotationFeedback: CGFloat = -1 | ||
|
||
let index: Int | ||
let tileNumber: Int | ||
|
||
func makeBody(configuration: Self.Configuration) -> some View { | ||
configuration.label | ||
.overlay { | ||
VStack { | ||
Spacer() | ||
Circle() | ||
.fill(xyloAttachColor) | ||
.shadow( | ||
color: .black.opacity(0.4), | ||
radius: 3, x: 0, y: 3 | ||
) | ||
Spacer() | ||
Circle() | ||
.fill(xyloAttachColor) | ||
.shadow( | ||
color: .black.opacity(0.4), | ||
radius: 3, x: 0, y: 3 | ||
) | ||
Spacer() | ||
} | ||
.frame(width: 44) | ||
} | ||
.overlay { | ||
RoundedRectangle(cornerRadius: 7, style: .circular) | ||
.stroke(.black.opacity(configuration.isPressed ? 0.3 : 0), lineWidth: 20) | ||
} | ||
.clipShape(RoundedRectangle(cornerRadius: 7, style: .circular)) | ||
.frame(width: defaultTileWidth, height: setSizeFromIndex()) | ||
.scaleEffect( | ||
configuration.isPressed ? defaultTilesScaleFeedback : 1, | ||
anchor: .center | ||
) | ||
.rotationEffect( | ||
Angle(degrees: configuration.isPressed ? defaultTilesRotationFeedback : 0), | ||
anchor: .center | ||
) | ||
.shadow( | ||
color: .black.opacity(0.4), | ||
radius: 3, x: 0, y: 3 | ||
) | ||
} | ||
|
||
private func setSizeFromIndex() -> CGFloat { | ||
let sizeDiff = defaultTileHeightGap / tileNumber | ||
let tileHeight = defaultMaxTileHeight - index * sizeDiff | ||
|
||
return CGFloat(tileHeight) | ||
} | ||
} | ||
|
||
} | ||
|
||
#Preview { | ||
Button { | ||
// Nothing to do | ||
} label: { | ||
Color(.red) | ||
} | ||
.buttonStyle(MusicalInstrumentView.XylophoneView.TileButtonStyle(index: 0, tileNumber: 1)) | ||
} |
Oops, something went wrong.