Skip to content

Commit

Permalink
🐛 (New GEK): Fix choice size variable bug
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Dec 3, 2024
1 parent e7c65eb commit 883ccaf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DnDGridCoordinatorAssociateCategories: DnDGridGameplayCoordinatorPr
self.gameplay = gameplay

self.uiChoices.value.choices = gameplay.choices.map { choice in
DnDAnswerNode(id: choice.id, value: choice.value, type: choice.type, size: self.uiChoices.value.choiceSize)
DnDAnswerNode(id: choice.id, value: choice.value, type: choice.type, size: self.uiChoices.value.choiceSize(for: gameplay.choices.count))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class DnDGridWithZonesCoordinatorAssociateCategories: DnDGridWithZonesGam
}

self.uiChoices.value.choices = gameplay.choices[2...].map { choice in
DnDAnswerNode(id: choice.id, value: choice.value, type: choice.type, size: self.uiChoices.value.choiceSize)
DnDAnswerNode(id: choice.id, value: choice.value, type: choice.type, size: self.uiChoices.value.choiceSize(for: gameplay.choices.count))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DnDOneToOneCoordinatorFindTheRightOrder: DnDOneToOneGameplayCoordin
self.gameplay = gameplay

self.uiChoices.value.choices = gameplay.orderedChoices.map { choice in
DnDAnswerNode(id: choice.id, value: choice.value, type: choice.type, size: self.uiChoices.value.choiceSize)
DnDAnswerNode(id: choice.id, value: choice.value, type: choice.type, size: self.uiChoices.value.choiceSize(for: gameplay.orderedChoices.count))
}

self.uiDropZones = self.uiChoices.value.choices.map { node in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public struct DnDUIChoices {

var choices: [DnDAnswerNode]

var choiceSize: CGSize {
DnDGridSize(self.choices.count).choiceSize
func choiceSize(for choiceNumber: Int) -> CGSize {
DnDGridSize(choiceNumber).choiceSize
}

// MARK: Private
Expand Down Expand Up @@ -142,14 +142,15 @@ public struct DnDUIChoices {
switch self {
case .one,
.two:
CGSize(width: 220, height: 220)
case .three,
.four:
CGSize(width: 200, height: 200)
case .three:
CGSize(width: 180, height: 180)
case .four,
.five,
.six,
case .five:
CGSize(width: 160, height: 160)
case .six,
.none:
CGSize(width: 140, height: 140)
CGSize(width: 150, height: 150)
}
}
}
Expand Down

0 comments on commit 883ccaf

Please sign in to comment.