diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/DnDGridView.swift b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/DnDGridView.swift index f1c938163..ca21614a4 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/DnDGridView.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/DnDGridView.swift @@ -39,19 +39,22 @@ public struct DnDGridView: View { .opacity(0.4) .frame(maxHeight: 500) .padding(.vertical, 20) + } - Spacer() - - self.standardDnDGridView - .colorMultiply(self.viewModel.isActionTriggered ? .white : .gray.opacity(0.4)) - .animation(.easeOut(duration: 0.3), value: self.viewModel.isActionTriggered) - .allowsHitTesting(self.viewModel.isActionTriggered) - - Spacer() + Spacer() - } else { - self.standardDnDGridView + GeometryReader { proxy in + SpriteView(scene: self.makeScene(size: proxy.size), options: [.allowsTransparency]) + .frame(width: proxy.size.width, height: proxy.size.height) + .onAppear { + self.scene = self.getScene(for: self.viewModel.choices.count, size: proxy.size) + } } + .colorMultiply(self.viewModel.isActionTriggered ? .white : .gray.opacity(0.4)) + .animation(.easeOut(duration: 0.3), value: self.viewModel.isActionTriggered) + .allowsHitTesting(self.viewModel.isActionTriggered) + + Spacer() } } @@ -60,16 +63,6 @@ public struct DnDGridView: View { @StateObject private var viewModel: DnDGridViewModel @State private var scene: SKScene = .init() - private var standardDnDGridView: some View { - GeometryReader { proxy in - SpriteView(scene: self.makeScene(size: proxy.size), options: [.allowsTransparency]) - .frame(width: proxy.size.width, height: proxy.size.height) - .onAppear { - self.scene = self.getScene(for: self.viewModel.choices.count, size: proxy.size) - } - } - } - private func makeScene(size: CGSize) -> SKScene { guard let finalScene = scene as? DnDGridBaseScene else { return SKScene() diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/DnDGridViewModel.swift b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/DnDGridViewModel.swift index a3f21e700..79d8c8fbf 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/DnDGridViewModel.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Views/DnD/Grid/DnDGridViewModel.swift @@ -14,6 +14,7 @@ public class DnDGridViewModel: ObservableObject { public init(coordinator: DnDGridGameplayCoordinatorProtocol) { self.choices = coordinator.uiModel.value.choices self.action = coordinator.uiModel.value.action + self.isActionTriggered = (self.action == nil) ? true : false self.coordinator = coordinator self.coordinator.uiModel .receive(on: DispatchQueue.main)