From 883ccaf257212ba7c8da1c36d0e9d5bb4b389558 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Tue, 3 Dec 2024 16:03:29 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(New=20GEK):=20Fix=20choice=20si?= =?UTF-8?q?ze=20variable=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...DnDGridCoordinator+AssociateCategories.swift | 2 +- ...thZonesCoordinator+AssociateCategories.swift | 2 +- ...DOneToOneCoordinator+FindTheRightOrder.swift | 2 +- .../Views/DnD/SKComponents/DnDAnswerNode.swift | 17 +++++++++-------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/Coordinators/DnDGridCoordinator+AssociateCategories.swift b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/Coordinators/DnDGridCoordinator+AssociateCategories.swift index c899e9a64..fdbbe9cd3 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/Coordinators/DnDGridCoordinator+AssociateCategories.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/Coordinators/DnDGridCoordinator+AssociateCategories.swift @@ -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)) } } diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/GridWithZones/Coordinators/DnDGridWithZonesCoordinator+AssociateCategories.swift b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/GridWithZones/Coordinators/DnDGridWithZonesCoordinator+AssociateCategories.swift index 70de2fa2e..c516ce13b 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/GridWithZones/Coordinators/DnDGridWithZonesCoordinator+AssociateCategories.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/GridWithZones/Coordinators/DnDGridWithZonesCoordinator+AssociateCategories.swift @@ -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)) } } diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/OneToOne/Coordinators/DnDOneToOneCoordinator+FindTheRightOrder.swift b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/OneToOne/Coordinators/DnDOneToOneCoordinator+FindTheRightOrder.swift index a8fe0a1d2..812cd0624 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/OneToOne/Coordinators/DnDOneToOneCoordinator+FindTheRightOrder.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/OneToOne/Coordinators/DnDOneToOneCoordinator+FindTheRightOrder.swift @@ -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 diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/SKComponents/DnDAnswerNode.swift b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/SKComponents/DnDAnswerNode.swift index 2a4068fe7..b43bb85e9 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/SKComponents/DnDAnswerNode.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/SKComponents/DnDAnswerNode.swift @@ -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 @@ -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) } } }