-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
When the round counter is changed:
- for each squad
- set first player to false
1.Redux_SquadView.setFirstPlayer(false) - for each pilot in squad
1. set the system phase option to false (Redux_PilotCardView.setSystemPhaseState(false))
Redux_SquadView
func setFirstPlayer(_ isFirstPlayer: Bool) {
// Mutate & Persist
self.squadData.firstPlayer = isFirstPlayer
self.updateSquad(squadData: self.squadData)
// Update the local @State
self.isFirstPlayer = isFirstPlayer
}
Redux_PilotCardView
func setSystemPhaseState(state: Bool) {
measure(name: "setSystemPhaseState(state:\(state)") {
if let data = shipPilot.pilotStateData {
let name = shipPilot.pilotName
data.change(update: { psd in
print("Redux_PilotCardView.setSystemPhaseState name: \(name) state: \(state)")
psd.hasSystemPhaseAction = state
//
self.store.send(.squad(action: .updatePilotState(psd, self.shipPilot.pilotState)))
// self.store.send(.squad(action: .updatePilotState($0, self.shipPilot.pilotState)))
print("Redux_PilotCardView $0.hasSystemPhaseAction = \(String(describing: psd.hasSystemPhaseAction))")
})
}
}
}
Redux_SquadViewNew
.onChange(of: isFirstPlayer, perform: {
// Hack because swift thinks I don't want to perform
// an assignment (=) vs. a boolean check (==)
let x = $0
self.squadData.firstPlayer = x
self.updateSquad(squadData: self.squadData)
})
Metadata
Metadata
Assignees
Labels
No labels