Skip to content

Commit

Permalink
🔀️ Merge branch 'hugo/feature/Add-radioButton-to-SeletorMode-in-GEK'
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Apr 10, 2024
2 parents d31c403 + 8b03b62 commit ec7dcbf
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 42 deletions.
36 changes: 36 additions & 0 deletions Modules/GameEngineKit/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@
}
}
},
"game_engine_kit.dance_freeze_view.motion_selection_title": {
"comment": "DanceFreezeView motion selection title",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Motion type"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Type de mouvement"
}
}
}
},
"game_engine_kit.dance_freeze_view.movement_button_label": {
"comment": "DanceFreezeView movement button label",
"extractionState": "extracted_with_value",
Expand Down Expand Up @@ -398,6 +416,24 @@
}
}
},
"game_engine_kit.melody_view.keyboard_selector_title": {
"comment": "MelodyView keyboard selection title",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Keyboard type"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Type de clavier"
}
}
}
},
"game_engine_kit.melody_view.play_button_label": {
"comment": "MelodyView play button label",
"extractionState": "extracted_with_value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,51 @@ extension DanceFreezeView {

var body: some View {
VStack {
Text(l10n.DanceFreezeView.motionSelectionTitle)
.font(.headline)
.frame(maxWidth: .infinity, alignment: .leading)

Divider()

HStack(spacing: 70) {
VStack(spacing: 0) {
MotionModeButtonStyle(
image: GameEngineKitAsset.Exercises.DanceFreeze.iconMotionModeRotation.swiftUIImage,
color: self.motion == .rotation ? .teal : .primary
)
Text(l10n.DanceFreezeView.rotationButtonLabel)
HStack {
Image(systemName: self.motion == .rotation ? "checkmark.circle.fill" : "circle")
.imageScale(.large)
.foregroundColor(
self.motion == .rotation
? self.styleManager.accentColor! : .primary
)
VStack(spacing: 0) {
MotionModeButtonStyle(
image: GameEngineKitAsset.Exercises.DanceFreeze.iconMotionModeRotation.swiftUIImage,
color: self.motion == .rotation ? self.styleManager.accentColor! : .primary
)
Text(l10n.DanceFreezeView.rotationButtonLabel)
}
}
.foregroundStyle(self.motion == .rotation ? .teal : .primary)
.foregroundStyle(self.motion == .rotation ? self.styleManager.accentColor! : .primary)
.onTapGesture {
withAnimation {
self.motion = .rotation
}
}

VStack(spacing: 0) {
MotionModeButtonStyle(
image: GameEngineKitAsset.Exercises.DanceFreeze.iconMotionModeMovement.swiftUIImage,
color: self.motion == .movement ? .teal : .primary
)
Text(l10n.DanceFreezeView.movementButtonLabel)
HStack {
Image(systemName: self.motion == .movement ? "checkmark.circle.fill" : "circle")
.imageScale(.large)
.foregroundColor(
self.motion == .movement
? self.styleManager.accentColor! : .primary
)
VStack(spacing: 0) {
MotionModeButtonStyle(
image: GameEngineKitAsset.Exercises.DanceFreeze.iconMotionModeMovement.swiftUIImage,
color: self.motion == .movement ? self.styleManager.accentColor! : .primary
)
Text(l10n.DanceFreezeView.movementButtonLabel)
}
}
.foregroundStyle(self.motion == .movement ? .teal : .primary)
.foregroundStyle(self.motion == .movement ? self.styleManager.accentColor! : .primary)
.onTapGesture {
withAnimation {
self.motion = .movement
Expand All @@ -56,6 +78,7 @@ extension DanceFreezeView {
// MARK: Private

@Binding private var motion: Motion
@ObservedObject private var styleManager: StyleManager = .shared
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extension DanceFreezeView {
.imageScale(.large)
.foregroundColor(
audioRecording == self.selectedAudioRecording
? .green : .primary
? self.styleManager.accentColor! : .primary
)
.onTapGesture {
withAnimation {
Expand All @@ -56,6 +56,10 @@ extension DanceFreezeView {
.padding(.vertical, 15)
.padding(.horizontal, 40)
}

// MARK: Private

@ObservedObject private var styleManager: StyleManager = .shared
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ extension l10n {
value: "Music selection",
comment: "DanceFreezeView music selection title")

static let motionSelectionTitle = LocalizedString("game_engine_kit.dance_freeze_view.motion_selection_title",
bundle: GameEngineKitResources.bundle,
value: "Motion type",
comment: "DanceFreezeView motion selection title")

static let rotationButtonLabel = LocalizedString("game_engine_kit.dance_freeze_view.rotation_button_label",
bundle: GameEngineKitResources.bundle,
value: "Rotation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,54 @@ extension MelodyView {
// MARK: Internal

var body: some View {
HStack(spacing: 40) {
VStack(spacing: 0) {
GameEngineKitAsset.Exercises.Melody.iconKeyboardPartial.swiftUIImage
.resizable()
.scaledToFit()
Text(l10n.MelodyView.partialKeyboardLabel)
.foregroundStyle(self.keyboard == .partial ? .black : .gray.opacity(0.4))
}
.onTapGesture {
withAnimation {
self.keyboard = .partial
VStack {
Text(l10n.MelodyView.keyboardSelectionTitle)
.font(.headline)
.frame(maxWidth: .infinity, alignment: .leading)

Divider()

HStack(spacing: 40) {
HStack {
Image(systemName: self.keyboard == .partial ? "checkmark.circle.fill" : "circle")
.imageScale(.large)
.foregroundColor(
self.keyboard == .partial
? self.styleManager.accentColor! : .primary
)
VStack(spacing: 0) {
GameEngineKitAsset.Exercises.Melody.iconKeyboardPartial.swiftUIImage
.resizable()
.scaledToFit()
Text(l10n.MelodyView.partialKeyboardLabel)
.foregroundStyle(self.keyboard == .partial ? self.styleManager.accentColor! : .primary)
}
}
.onTapGesture {
withAnimation {
self.keyboard = .partial
}
}
}

VStack(spacing: 0) {
GameEngineKitAsset.Exercises.Melody.iconKeyboardFull.swiftUIImage
.resizable()
.scaledToFit()
Text(l10n.MelodyView.fullKeyboardLabel)
.foregroundStyle(self.keyboard == .full ? .black : .gray.opacity(0.4))
}
.onTapGesture {
withAnimation {
self.keyboard = .full
HStack {
Image(systemName: self.keyboard == .full ? "checkmark.circle.fill" : "circle")
.imageScale(.large)
.foregroundColor(
self.keyboard == .full
? self.styleManager.accentColor! : .primary
)
VStack(spacing: 0) {
GameEngineKitAsset.Exercises.Melody.iconKeyboardFull.swiftUIImage
.resizable()
.scaledToFit()
Text(l10n.MelodyView.fullKeyboardLabel)
.foregroundStyle(self.keyboard == .full ? self.styleManager.accentColor! : .primary)
}
}
.onTapGesture {
withAnimation {
self.keyboard = .full
}
}
}
}
Expand All @@ -52,6 +76,7 @@ extension MelodyView {
// MARK: Private

@Binding private var keyboard: KeyboardType
@ObservedObject private var styleManager: StyleManager = .shared
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ extension MelodyView {
GameEngineKitAsset.Exercises.Melody.imageIllustration.swiftUIImage
.resizable()
.aspectRatio(contentMode: .fit)
.padding(.trailing, 50)
.padding(80)

VStack(spacing: 0) {
KeyboardModeView(keyboard: self.$keyboard)

SongSelectorView(songs: self.songs, selectedMidiRecording: self.$selectedSong)
}
}
.padding(.horizontal, 100)

Button {
self.mode = .selectionConfirmed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ extension MelodyView {
let songs: [MidiRecording]

let columns = [
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible(minimum: 160), spacing: 10, alignment: .topLeading),
GridItem(.flexible(minimum: 160), spacing: 10, alignment: .topLeading),
]

var body: some View {
Expand All @@ -41,7 +41,7 @@ extension MelodyView {
.imageScale(.large)
.foregroundColor(
midiRecording == self.selectedMidiRecording
? .green : .primary
? self.styleManager.accentColor! : .primary
)
.onTapGesture {
withAnimation {
Expand All @@ -56,6 +56,10 @@ extension MelodyView {
.padding(.vertical, 15)
.padding(.horizontal, 40)
}

// MARK: Private

@ObservedObject private var styleManager: StyleManager = .shared
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import LocalizationKit

extension l10n {
enum MelodyView {
static let keyboardSelectionTitle = LocalizedString("game_engine_kit.melody_view.keyboard_selector_title",
bundle: GameEngineKitResources.bundle,
value: "Keyboard type",
comment: "MelodyView keyboard selection title")

static let musicSelectionTitle = LocalizedString("game_engine_kit.melody_view.song_selector_title",
bundle: GameEngineKitResources.bundle,
value: "Music selection",
Expand Down

0 comments on commit ec7dcbf

Please sign in to comment.