Commit 5007a40ca8
Unsigned
Layout: unified · split
DayByDay/Home/TodayBanner.swift +3
| @@ -15,8 +15,11 @@ struct TodayBanner: View { | ||
| 15 | 15 | |
| 16 | 16 | var body: some View { |
| 17 | 17 | HStack(spacing: 20) { |
| 18 | // On white: the orange is too close to the owl's purple. | |
| 18 | 19 | MascotView(mood: .idle) |
| 20 | .padding(8) | |
| 19 | 21 | .frame(width: 96, height: 96) |
| 22 | .background(Circle().fill(.white)) | |
| 20 | 23 | VStack(alignment: .leading, spacing: 6) { |
| 21 | 24 | Text("Today is \(DayOfWeek.current.name)!") |
| 22 | 25 | .font(.system(size: 30, weight: .heavy, design: .rounded)) |
DayByDay/Mascot/GameMascot.swift added +30
| @@ -0,0 +1,30 @@ | ||
| 1 | // | |
| 2 | // GameMascot.swift | |
| 3 | // DayByDay | |
| 4 | // | |
| 5 | ||
| 6 | import SwiftUI | |
| 7 | ||
| 8 | /// A game's mascot, small enough to sit beside "Hear it again". Puts the | |
| 9 | /// mood back to idle once it has held. | |
| 10 | struct GameMascot: View { | |
| 11 | @Binding var state: MascotState | |
| 12 | ||
| 13 | /// Bumped when the mascot goes away, so a pending settle does nothing. | |
| 14 | @State private var generation = 0 | |
| 15 | ||
| 16 | var body: some View { | |
| 17 | MascotView(mood: state.mood) | |
| 18 | .frame(width: 64, height: 64) | |
| 19 | .onAppear(perform: scheduleSettle) | |
| 20 | .onChange(of: state.ticket, scheduleSettle) | |
| 21 | .onDisappear { generation += 1 } | |
| 22 | } | |
| 23 | ||
| 24 | private func scheduleSettle() { | |
| 25 | let ticket = state.ticket, gen = generation | |
| 26 | DispatchQueue.main.asyncAfter(deadline: .now() + state.hold) { | |
| 27 | if gen == generation { state.settle(ticket) } | |
| 28 | } | |
| 29 | } | |
| 30 | } | |
DayByDay/Mascot/MascotMotion.swift added +63
| @@ -0,0 +1,63 @@ | ||
| 1 | // | |
| 2 | // MascotMotion.swift | |
| 3 | // DayByDay | |
| 4 | // | |
| 5 | ||
| 6 | import Foundation | |
| 7 | ||
| 8 | /// Where the mascot's parts are at one moment. | |
| 9 | nonisolated struct MascotPose: Equatable { | |
| 10 | /// Up and down drift, as a fraction of the size; up is negative. | |
| 11 | var bob: Double | |
| 12 | /// Cheer hop, as a fraction of the size; up is negative. | |
| 13 | var hop: Double | |
| 14 | /// 1 open, 0.1 shut. | |
| 15 | var eyeOpen: Double | |
| 16 | /// Degrees the raised wing is lifted. | |
| 17 | var wing: Double | |
| 18 | /// Degrees the whole owl leans. | |
| 19 | var tilt: Double | |
| 20 | /// 0 closed, 1 wide open. | |
| 21 | var beakOpen: Double | |
| 22 | } | |
| 23 | ||
| 24 | /// Subtle motion for each mood: a slow bob, a blink, a hop when cheering, a | |
| 25 | /// wave, and a talking beak when asking. | |
| 26 | nonisolated enum MascotMotion { | |
| 27 | static let blinkCycle = 3.8 | |
| 28 | static let blinkLength = 0.14 | |
| 29 | ||
| 30 | /// The pose `t` seconds after the mood began. | |
| 31 | static func pose(_ mood: MascotMood, at t: TimeInterval) -> MascotPose { | |
| 32 | let t = max(0, t) | |
| 33 | var pose = still(mood) | |
| 34 | pose.bob = -0.012 * (1 - cos(2 * .pi * t / 2.6)) / 2 | |
| 35 | if mood != .cheering, t.truncatingRemainder(dividingBy: blinkCycle) >= blinkCycle - blinkLength { | |
| 36 | pose.eyeOpen = 0.1 | |
| 37 | } | |
| 38 | switch mood { | |
| 39 | case .cheering: | |
| 40 | if t.truncatingRemainder(dividingBy: 4) < 1.6 { pose.hop = -0.06 * abs(sin(.pi * t / 0.4)) } | |
| 41 | case .waving: | |
| 42 | if t.truncatingRemainder(dividingBy: 5) < 2.1 { pose.wing = 135 + 15 * sin(2 * .pi * t / 0.7) } | |
| 43 | case .asking: | |
| 44 | pose.beakOpen = 0.5 + 0.5 * abs(sin(.pi * t / 0.22)) | |
| 45 | case .idle, .puzzled: | |
| 46 | break | |
| 47 | } | |
| 48 | return pose | |
| 49 | } | |
| 50 | ||
| 51 | /// The mood's pose with no motion, for Reduce Motion. | |
| 52 | static func still(_ mood: MascotMood) -> MascotPose { | |
| 53 | var pose = MascotPose(bob: 0, hop: 0, eyeOpen: 1, wing: 0, tilt: 0, beakOpen: 0) | |
| 54 | switch mood { | |
| 55 | case .idle: break | |
| 56 | case .asking: pose.tilt = 4; pose.beakOpen = 1 | |
| 57 | case .cheering: pose.wing = 130 | |
| 58 | case .puzzled: pose.tilt = -10 | |
| 59 | case .waving: pose.wing = 135 | |
| 60 | } | |
| 61 | return pose | |
| 62 | } | |
| 63 | } | |
DayByDay/Mascot/MascotState.swift added +54
| @@ -0,0 +1,54 @@ | ||
| 1 | // | |
| 2 | // MascotState.swift | |
| 3 | // DayByDay | |
| 4 | // | |
| 5 | ||
| 6 | import Foundation | |
| 7 | ||
| 8 | nonisolated enum MascotMood: CaseIterable { | |
| 9 | case idle, asking, cheering, puzzled, waving | |
| 10 | } | |
| 11 | ||
| 12 | /// Something in a game the mascot reacts to. | |
| 13 | nonisolated enum MascotEvent: Equatable { | |
| 14 | /// A prompt being said, after an optional sound cue. | |
| 15 | case prompt(String, after: TimeInterval = 0) | |
| 16 | case correct | |
| 17 | case wrong | |
| 18 | case greet | |
| 19 | } | |
| 20 | ||
| 21 | /// The mascot's mood in a game. Each event sets a mood that holds for a | |
| 22 | /// while, then `settle` puts it back to idle unless a newer event came in. | |
| 23 | nonisolated struct MascotState: Equatable { | |
| 24 | private(set) var mood: MascotMood = .idle | |
| 25 | /// Bumped by every event, so a settle for an older one does nothing. | |
| 26 | private(set) var ticket = 0 | |
| 27 | private(set) var hold: TimeInterval = 0 | |
| 28 | ||
| 29 | mutating func handle(_ event: MascotEvent) { | |
| 30 | switch event { | |
| 31 | case .prompt: mood = .asking | |
| 32 | case .correct: mood = .cheering | |
| 33 | case .wrong: mood = .puzzled | |
| 34 | case .greet: mood = .waving | |
| 35 | } | |
| 36 | ticket += 1 | |
| 37 | hold = Self.hold(for: event) | |
| 38 | } | |
| 39 | ||
| 40 | mutating func settle(_ ticket: Int) { | |
| 41 | if ticket == self.ticket { mood = .idle } | |
| 42 | } | |
| 43 | ||
| 44 | /// How long the event's mood lasts. A prompt lasts through its sound cue | |
| 45 | /// and roughly as long as it takes to say. | |
| 46 | static func hold(for event: MascotEvent) -> TimeInterval { | |
| 47 | switch event { | |
| 48 | case .prompt(let text, let delay): delay + 0.5 + 0.45 * Double(text.split(separator: " ").count) | |
| 49 | case .correct: 1.8 | |
| 50 | case .wrong: 1.6 | |
| 51 | case .greet: 2.4 | |
| 52 | } | |
| 53 | } | |
| 54 | } | |
DayByDay/Mascot/MascotView.swift +172 −30
| @@ -5,54 +5,196 @@ | ||
| 5 | 5 | |
| 6 | 6 | import SwiftUI |
| 7 | 7 | |
| 8 | /// Placeholder mascot: a round green face. Replaced in part 6. | |
| 8 | enum MascotStyle { | |
| 9 | /// Shows on white and on black. | |
| 10 | static let body = Color(red: 0.55, green: 0.36, blue: 0.85) | |
| 11 | static let belly = Color(red: 0.93, green: 0.89, blue: 1.0) | |
| 12 | static let ink = Color(red: 0.12, green: 0.08, blue: 0.25) | |
| 13 | static let beak = Color(red: 1.0, green: 0.88, blue: 0.45) | |
| 14 | static let eyeWhite = Color.white | |
| 15 | } | |
| 16 | ||
| 17 | /// The owl. Moves gently unless Reduce Motion is on, then holds the mood's | |
| 18 | /// still pose. | |
| 9 | 19 | struct MascotView: View { |
| 10 | enum Mood { case idle, cheering } | |
| 20 | let mood: MascotMood | |
| 11 | 21 | |
| 12 | let mood: Mood | |
| 13 | ||
| 14 | init(mood: Mood) { | |
| 15 | self.mood = mood | |
| 16 | } | |
| 22 | @Environment(\.accessibilityReduceMotion) private var reduceMotion | |
| 23 | @State private var moodStart = Date.now | |
| 17 | 24 | |
| 18 | 25 | var body: some View { |
| 19 | GeometryReader { geo in | |
| 20 | let s = min(geo.size.width, geo.size.height) | |
| 21 | ZStack { | |
| 22 | Circle().fill(Color(red: 0.35, green: 0.76, blue: 0.56).gradient) | |
| 23 | HStack(spacing: s * 0.2) { | |
| 24 | eye(s) | |
| 25 | eye(s) | |
| 26 | Group { | |
| 27 | if reduceMotion { | |
| 28 | OwlCanvas(mood: mood, pose: MascotMotion.still(mood)) | |
| 29 | } else { | |
| 30 | TimelineView(.animation(minimumInterval: 1 / 30)) { timeline in | |
| 31 | OwlCanvas(mood: mood, pose: MascotMotion.pose(mood, at: timeline.date.timeIntervalSince(moodStart))) | |
| 26 | 32 | } |
| 27 | .offset(y: -s * 0.1) | |
| 28 | smile(s) | |
| 29 | .stroke(.black.opacity(0.8), style: StrokeStyle(lineWidth: s * 0.05, lineCap: .round)) | |
| 30 | .frame(width: s * (mood == .cheering ? 0.5 : 0.36), height: s * 0.2) | |
| 31 | .offset(y: s * 0.17) | |
| 32 | 33 | } |
| 33 | .frame(width: s, height: s) | |
| 34 | .frame(maxWidth: .infinity, maxHeight: .infinity) | |
| 35 | 34 | } |
| 36 | 35 | .aspectRatio(1, contentMode: .fit) |
| 36 | .onChange(of: mood) { moodStart = .now } | |
| 37 | 37 | .accessibilityHidden(true) |
| 38 | 38 | } |
| 39 | } | |
| 39 | 40 | |
| 40 | private func eye(_ s: CGFloat) -> some View { | |
| 41 | Capsule().fill(.black.opacity(0.85)).frame(width: s * 0.09, height: s * 0.14) | |
| 41 | /// The owl in one pose. | |
| 42 | struct OwlCanvas: View { | |
| 43 | let mood: MascotMood | |
| 44 | let pose: MascotPose | |
| 45 | ||
| 46 | var body: some View { | |
| 47 | Canvas { context, size in | |
| 48 | // 110 wide, so the raised wings stay inside the frame. | |
| 49 | let scale = min(size.width, size.height) / 110 | |
| 50 | context.translateBy(x: (size.width - 100 * scale) / 2, y: (size.height - 100 * scale) / 2) | |
| 51 | context.scaleBy(x: scale, y: scale) | |
| 52 | OwlDrawing(mood: mood, pose: pose).draw(in: &context) | |
| 53 | } | |
| 42 | 54 | } |
| 55 | } | |
| 56 | ||
| 57 | /// The owl in a 100×100 space. | |
| 58 | private struct OwlDrawing { | |
| 59 | let mood: MascotMood | |
| 60 | let pose: MascotPose | |
| 61 | ||
| 62 | private let body = GraphicsContext.Shading.color(MascotStyle.body) | |
| 63 | private let ink = GraphicsContext.Shading.color(MascotStyle.ink) | |
| 64 | private let beak = GraphicsContext.Shading.color(MascotStyle.beak) | |
| 65 | private let white = GraphicsContext.Shading.color(MascotStyle.eyeWhite) | |
| 66 | ||
| 67 | func draw(in context: inout GraphicsContext) { | |
| 68 | context.translateBy(x: 0, y: (pose.bob + pose.hop) * 100) | |
| 69 | // Lean from the feet. | |
| 70 | context.translateBy(x: 50, y: 89) | |
| 71 | context.rotate(by: .degrees(pose.tilt)) | |
| 72 | context.translateBy(x: -50, y: -89) | |
| 73 | ||
| 74 | wing(&context, left: true, lift: mood == .cheering ? pose.wing : 0) | |
| 75 | wing(&context, left: false, lift: pose.wing) | |
| 76 | ||
| 77 | context.fill(Path(ellipseIn: CGRect(x: 20, y: 23, width: 60, height: 66)), with: body) | |
| 78 | context.fill(tuft(left: true), with: body) | |
| 79 | context.fill(tuft(left: false), with: body) | |
| 80 | ||
| 81 | context.fill(Path(ellipseIn: CGRect(x: 31, y: 64, width: 38, height: 24)), with: .color(MascotStyle.belly)) | |
| 82 | for (x, y) in [(43.0, 70.0), (57.0, 70.0), (50.0, 77.0)] { | |
| 83 | var chevron = Path() | |
| 84 | chevron.move(to: CGPoint(x: x - 3, y: y)) | |
| 85 | chevron.addLine(to: CGPoint(x: x, y: y + 2.5)) | |
| 86 | chevron.addLine(to: CGPoint(x: x + 3, y: y)) | |
| 87 | context.stroke(chevron, with: ink, style: StrokeStyle(lineWidth: 1.6, lineCap: .round, lineJoin: .round)) | |
| 88 | } | |
| 89 | for x in [38.0, 62.0] { | |
| 90 | for dx in [-4.0, 0, 4] { | |
| 91 | context.fill(Path(ellipseIn: CGRect(x: x + dx - 2.2, y: 85, width: 4.4, height: 6)), with: beak) | |
| 92 | } | |
| 93 | } | |
| 43 | 94 | |
| 44 | private func smile(_ s: CGFloat) -> Path { | |
| 45 | Path { p in | |
| 46 | p.move(to: CGPoint(x: 0, y: 0)) | |
| 47 | p.addQuadCurve(to: CGPoint(x: 1, y: 0), control: CGPoint(x: 0.5, y: 1.4)) | |
| 95 | eye(&context, x: 37) | |
| 96 | eye(&context, x: 63) | |
| 97 | brows(&context) | |
| 98 | beakShape(&context) | |
| 99 | ||
| 100 | if mood == .puzzled { | |
| 101 | let mark = context.resolve(Text("?").font(.system(size: 24, weight: .heavy, design: .rounded)) | |
| 102 | .foregroundStyle(MascotStyle.body)) | |
| 103 | context.draw(mark, at: CGPoint(x: 89, y: 22)) | |
| 104 | } | |
| 105 | } | |
| 106 | ||
| 107 | private func tuft(left: Bool) -> Path { | |
| 108 | let f: (Double) -> Double = { left ? $0 : 100 - $0 } | |
| 109 | var p = Path() | |
| 110 | p.move(to: CGPoint(x: f(25), y: 42)) | |
| 111 | p.addQuadCurve(to: CGPoint(x: f(27), y: 13), control: CGPoint(x: f(20), y: 22)) | |
| 112 | p.addQuadCurve(to: CGPoint(x: f(44), y: 27), control: CGPoint(x: f(36), y: 18)) | |
| 113 | p.closeSubpath() | |
| 114 | return p | |
| 115 | } | |
| 116 | ||
| 117 | /// Hangs from the shoulder; `lift` raises it outward. | |
| 118 | private func wing(_ context: inout GraphicsContext, left: Bool, lift: Double) { | |
| 119 | var c = context | |
| 120 | c.translateBy(x: left ? 24 : 76, y: 52) | |
| 121 | c.rotate(by: .degrees(left ? 12 + lift : -12 - lift)) | |
| 122 | let shape = Path(ellipseIn: CGRect(x: -7, y: -2, width: 14, height: 32)) | |
| 123 | c.fill(shape, with: body) | |
| 124 | c.stroke(shape, with: ink, lineWidth: 1.6) | |
| 125 | } | |
| 126 | ||
| 127 | private func eye(_ context: inout GraphicsContext, x: Double) { | |
| 128 | let center = CGPoint(x: x, y: 45) | |
| 129 | if mood == .cheering { | |
| 130 | context.fill(Path(ellipseIn: CGRect(x: x - 12, y: 33, width: 24, height: 24)), with: white) | |
| 131 | var arc = Path() | |
| 132 | arc.move(to: CGPoint(x: x - 7, y: 48)) | |
| 133 | arc.addQuadCurve(to: CGPoint(x: x + 7, y: 48), control: CGPoint(x: x, y: 36)) | |
| 134 | context.stroke(arc, with: ink, style: StrokeStyle(lineWidth: 3.6, lineCap: .round)) | |
| 135 | return | |
| 136 | } | |
| 137 | if pose.eyeOpen < 0.5 { | |
| 138 | var lid = Path() | |
| 139 | lid.move(to: CGPoint(x: x - 9, y: 46)) | |
| 140 | lid.addQuadCurve(to: CGPoint(x: x + 9, y: 46), control: CGPoint(x: x, y: 50)) | |
| 141 | context.stroke(lid, with: white, style: StrokeStyle(lineWidth: 3.6, lineCap: .round)) | |
| 142 | return | |
| 143 | } | |
| 144 | var c = context | |
| 145 | c.translateBy(x: center.x, y: center.y) | |
| 146 | c.scaleBy(x: 1, y: pose.eyeOpen) | |
| 147 | c.fill(Path(ellipseIn: CGRect(x: -12, y: -12, width: 24, height: 24)), with: white) | |
| 148 | // Pupils look a little toward the middle. | |
| 149 | let dx: Double = x < 50 ? 1.5 : -1.5 | |
| 150 | c.fill(Path(ellipseIn: CGRect(x: dx - 6.5, y: -5.5, width: 13, height: 13)), with: ink) | |
| 151 | c.fill(Path(ellipseIn: CGRect(x: dx - 3.5, y: -3.5, width: 4, height: 4)), with: white) | |
| 152 | } | |
| 153 | ||
| 154 | private func brows(_ context: inout GraphicsContext) { | |
| 155 | let lines: [(CGPoint, CGPoint, CGPoint)] | |
| 156 | switch mood { | |
| 157 | case .asking: | |
| 158 | lines = [(CGPoint(x: 28, y: 30), CGPoint(x: 37, y: 25), CGPoint(x: 45, y: 29)), | |
| 159 | (CGPoint(x: 55, y: 29), CGPoint(x: 63, y: 25), CGPoint(x: 72, y: 30))] | |
| 160 | case .puzzled: | |
| 161 | lines = [(CGPoint(x: 28, y: 28), CGPoint(x: 36, y: 21), CGPoint(x: 45, y: 26)), | |
| 162 | (CGPoint(x: 55, y: 30), CGPoint(x: 63, y: 27), CGPoint(x: 71, y: 29))] | |
| 163 | default: | |
| 164 | return | |
| 165 | } | |
| 166 | for (a, control, b) in lines { | |
| 167 | var p = Path() | |
| 168 | p.move(to: a) | |
| 169 | p.addQuadCurve(to: b, control: control) | |
| 170 | context.stroke(p, with: ink, style: StrokeStyle(lineWidth: 3.6, lineCap: .round)) | |
| 171 | } | |
| 172 | } | |
| 173 | ||
| 174 | private func beakShape(_ context: inout GraphicsContext) { | |
| 175 | let gap = 4 * pose.beakOpen | |
| 176 | if gap > 0.2 { | |
| 177 | context.fill(Path(ellipseIn: CGRect(x: 45.5, y: 54, width: 9, height: 4 + gap)), with: ink) | |
| 178 | } | |
| 179 | var upper = Path() | |
| 180 | upper.move(to: CGPoint(x: 44, y: 52)) | |
| 181 | upper.addLine(to: CGPoint(x: 56, y: 52)) | |
| 182 | upper.addLine(to: CGPoint(x: 50, y: 60)) | |
| 183 | upper.closeSubpath() | |
| 184 | context.fill(upper, with: beak) | |
| 185 | if gap > 0.2 { | |
| 186 | var lower = Path() | |
| 187 | lower.move(to: CGPoint(x: 46.5, y: 57 + gap)) | |
| 188 | lower.addLine(to: CGPoint(x: 53.5, y: 57 + gap)) | |
| 189 | lower.addLine(to: CGPoint(x: 50, y: 61 + gap)) | |
| 190 | lower.closeSubpath() | |
| 191 | context.fill(lower, with: beak) | |
| 48 | 192 | } |
| 49 | .applying(CGAffineTransform(scaleX: s * (mood == .cheering ? 0.5 : 0.36), y: s * 0.2)) | |
| 50 | 193 | } |
| 51 | 194 | } |
| 52 | 195 | |
| 53 | 196 | #Preview { |
| 54 | 197 | HStack { |
| 55 | MascotView(mood: .idle).frame(width: 120) | |
| 56 | MascotView(mood: .cheering).frame(width: 120) | |
| 198 | ForEach(MascotMood.allCases, id: \.self) { MascotView(mood: $0).frame(width: 120) } | |
| 57 | 199 | } |
| 58 | 200 | } |
DayByDay/Profiles/ProfilePickerView.swift +4 −1
| @@ -14,6 +14,9 @@ struct ProfilePickerView: View { | ||
| 14 | 14 | |
| 15 | 15 | var body: some View { |
| 16 | 16 | ScrollView { |
| 17 | MascotView(mood: .waving) | |
| 18 | .frame(width: 120, height: 120) | |
| 19 | .padding(.top, 16) | |
| 17 | 20 | LazyVGrid(columns: columns, spacing: 28) { |
| 18 | 21 | ForEach(session.profiles) { profile in |
| 19 | 22 | Button { |
| @@ -61,7 +64,7 @@ struct ProfileSetupView: View { | ||
| 61 | 64 | } |
| 62 | 65 | } else { |
| 63 | 66 | VStack(spacing: 24) { |
| 64 | MascotView(mood: .idle) | |
| 67 | MascotView(mood: .waving) | |
| 65 | 68 | .frame(width: 160, height: 160) |
| 66 | 69 | Text("Welcome to Day By Day") |
| 67 | 70 | .font(.system(size: 32, weight: .bold, design: .rounded)) |
DayByDay/Quiz/CountingView.swift +21 −10
| @@ -10,6 +10,7 @@ struct CountingView: View { | ||
| 10 | 10 | @State private var round: CountingRound |
| 11 | 11 | @State private var showTotal = false |
| 12 | 12 | @State private var celebrating = false |
| 13 | @State private var mascot = MascotState() | |
| 13 | 14 | @State private var speechToken = 0 |
| 14 | 15 | /// Bumped when the screen goes away, so pending work says nothing. |
| 15 | 16 | @State private var generation = 0 |
| @@ -28,13 +29,13 @@ struct CountingView: View { | ||
| 28 | 29 | FinishedView { |
| 29 | 30 | var rng = SystemRandomNumberGenerator() |
| 30 | 31 | round = CountingRound(using: &rng) |
| 31 | say(prompt, after: 0.3) | |
| 32 | ask(after: 0.3) | |
| 32 | 33 | } |
| 33 | 34 | } else { |
| 34 | 35 | board |
| 35 | 36 | } |
| 36 | 37 | } |
| 37 | .onAppear { say(prompt, after: 0) } | |
| 38 | .onAppear { ask(after: 0) } | |
| 38 | 39 | .onDisappear { |
| 39 | 40 | generation += 1 |
| 40 | 41 | speechToken += 1 |
| @@ -47,14 +48,17 @@ struct CountingView: View { | ||
| 47 | 48 | private var board: some View { |
| 48 | 49 | ScrollView { |
| 49 | 50 | VStack(spacing: 28) { |
| 50 | Button { say(prompt, after: 0) } label: { | |
| 51 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 52 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 53 | .padding(.horizontal, 28) | |
| 54 | .padding(.vertical, 16) | |
| 55 | .background(Capsule().fill(Color(.systemGray6))) | |
| 51 | HStack(spacing: 12) { | |
| 52 | GameMascot(state: $mascot) | |
| 53 | Button { ask(after: 0) } label: { | |
| 54 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 55 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 56 | .padding(.horizontal, 28) | |
| 57 | .padding(.vertical, 16) | |
| 58 | .background(Capsule().fill(Color(.systemGray6))) | |
| 59 | } | |
| 60 | .buttonStyle(.plain) | |
| 56 | 61 | } |
| 57 | .buttonStyle(.plain) | |
| 58 | 62 | |
| 59 | 63 | Text(showTotal ? "\(round.target)" : " ") |
| 60 | 64 | .font(.system(size: 96, weight: .heavy, design: .rounded)) |
| @@ -106,6 +110,7 @@ struct CountingView: View { | ||
| 106 | 110 | } |
| 107 | 111 | let summary = round.summary() |
| 108 | 112 | SoundEngine.shared.play(.success) |
| 113 | mascot.handle(.correct) | |
| 109 | 114 | showTotal = true |
| 110 | 115 | celebrating = true |
| 111 | 116 | say(summary, after: RoundStyle.speechDelay) |
| @@ -117,10 +122,16 @@ struct CountingView: View { | ||
| 117 | 122 | showTotal = false |
| 118 | 123 | var rng = SystemRandomNumberGenerator() |
| 119 | 124 | round.nextSet(using: &rng) |
| 120 | if !round.isComplete { say(prompt, after: 0) } | |
| 125 | if !round.isComplete { ask(after: 0) } | |
| 121 | 126 | } |
| 122 | 127 | } |
| 123 | 128 | |
| 129 | /// Says the prompt, with the mascot asking. | |
| 130 | private func ask(after delay: TimeInterval) { | |
| 131 | mascot.handle(.prompt(prompt, after: delay)) | |
| 132 | say(prompt, after: delay) | |
| 133 | } | |
| 134 | ||
| 124 | 135 | private func say(_ text: String, after delay: TimeInterval) { |
| 125 | 136 | speechToken += 1 |
| 126 | 137 | let token = speechToken, gen = generation |
DayByDay/Quiz/MovesView.swift +13 −7
| @@ -13,6 +13,7 @@ struct MovesView: View { | ||
| 13 | 13 | @State private var round: MovesRound |
| 14 | 14 | @State private var praise = PraisePhrases() |
| 15 | 15 | @State private var celebrating = false |
| 16 | @State private var mascot = MascotState() | |
| 16 | 17 | /// Bumped by each new move and when the screen goes away. |
| 17 | 18 | @State private var generation = 0 |
| 18 | 19 | |
| @@ -25,14 +26,17 @@ struct MovesView: View { | ||
| 25 | 26 | ZStack { |
| 26 | 27 | if let part = round.current { |
| 27 | 28 | VStack(spacing: 32) { |
| 28 | Button { start() } label: { | |
| 29 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 30 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 31 | .padding(.horizontal, 28) | |
| 32 | .padding(.vertical, 16) | |
| 33 | .background(Capsule().fill(Color(.systemGray6))) | |
| 29 | HStack(spacing: 12) { | |
| 30 | GameMascot(state: $mascot) | |
| 31 | Button { start() } label: { | |
| 32 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 33 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 34 | .padding(.horizontal, 28) | |
| 35 | .padding(.vertical, 16) | |
| 36 | .background(Capsule().fill(Color(.systemGray6))) | |
| 37 | } | |
| 38 | .buttonStyle(.plain) | |
| 34 | 39 | } |
| 35 | .buttonStyle(.plain) | |
| 36 | 40 | Image(systemName: part.symbol) |
| 37 | 41 | .font(.system(size: 140)) |
| 38 | 42 | .foregroundStyle(.white) |
| @@ -66,10 +70,12 @@ struct MovesView: View { | ||
| 66 | 70 | generation += 1 |
| 67 | 71 | let gen = generation |
| 68 | 72 | celebrating = false |
| 73 | mascot.handle(.prompt(part.command)) | |
| 69 | 74 | SpeechSynthesizer.shared.speak(part.command) { |
| 70 | 75 | DispatchQueue.main.asyncAfter(deadline: .now() + Self.wait) { |
| 71 | 76 | guard gen == generation else { return } |
| 72 | 77 | SoundEngine.shared.play(.success) |
| 78 | mascot.handle(.correct) | |
| 73 | 79 | celebrating = true |
| 74 | 80 | var rng = SystemRandomNumberGenerator() |
| 75 | 81 | DispatchQueue.main.asyncAfter(deadline: .now() + RoundStyle.speechDelay) { |
DayByDay/Quiz/RoundView.swift +19 −8
| @@ -22,6 +22,7 @@ struct RoundView<Choice: View>: View { | ||
| 22 | 22 | @State private var praise = PraisePhrases() |
| 23 | 23 | @State private var celebrating = false |
| 24 | 24 | @State private var dimmed: QuizItem? |
| 25 | @State private var mascot = MascotState() | |
| 25 | 26 | /// Bumped whenever something new is said, so a delayed prompt that has |
| 26 | 27 | /// been overtaken stays quiet. |
| 27 | 28 | @State private var speechToken = 0 |
| @@ -54,14 +55,19 @@ struct RoundView<Choice: View>: View { | ||
| 54 | 55 | private var question: some View { |
| 55 | 56 | ScrollView { |
| 56 | 57 | VStack(spacing: 28) { |
| 57 | Button(action: speakPrompt) { | |
| 58 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 59 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 60 | .padding(.horizontal, 28) | |
| 61 | .padding(.vertical, 16) | |
| 62 | .background(Capsule().fill(Color(.systemGray6))) | |
| 58 | HStack(spacing: 12) { | |
| 59 | GameMascot(state: $mascot) | |
| 60 | Button(action: speakPrompt) { | |
| 61 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 62 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 63 | .lineLimit(1) | |
| 64 | .minimumScaleFactor(0.7) | |
| 65 | .padding(.horizontal, 28) | |
| 66 | .padding(.vertical, 16) | |
| 67 | .background(Capsule().fill(Color(.systemGray6))) | |
| 68 | } | |
| 69 | .buttonStyle(.plain) | |
| 63 | 70 | } |
| 64 | .buttonStyle(.plain) | |
| 65 | 71 | |
| 66 | 72 | ProgressDots(filled: round.correctCount, total: Round.length) |
| 67 | 73 | |
| @@ -102,6 +108,7 @@ struct RoundView<Choice: View>: View { | ||
| 102 | 108 | switch outcome { |
| 103 | 109 | case .correct: |
| 104 | 110 | SoundEngine.shared.play(.success) |
| 111 | mascot.handle(.correct) | |
| 105 | 112 | var rng = SystemRandomNumberGenerator() |
| 106 | 113 | say(praise.next(using: &rng), after: RoundStyle.speechDelay) |
| 107 | 114 | celebrating = true |
| @@ -111,6 +118,7 @@ struct RoundView<Choice: View>: View { | ||
| 111 | 118 | } |
| 112 | 119 | case .incorrect: |
| 113 | 120 | SoundEngine.shared.play(.gentleMiss) |
| 121 | mascot.handle(.wrong) | |
| 114 | 122 | say(round.current.correction(for: item), after: RoundStyle.speechDelay) |
| 115 | 123 | withAnimation(.easeOut(duration: 0.2)) { dimmed = item } |
| 116 | 124 | DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) { |
| @@ -129,8 +137,11 @@ struct RoundView<Choice: View>: View { | ||
| 129 | 137 | speechToken += 1 |
| 130 | 138 | SpeechSynthesizer.shared.stop() |
| 131 | 139 | SoundEngine.shared.play(sound) |
| 132 | say(round.current.prompt, after: SoundEngine.shared.remaining(sound) + 0.2) | |
| 140 | let delay = SoundEngine.shared.remaining(sound) + 0.2 | |
| 141 | mascot.handle(.prompt(round.current.prompt, after: delay)) | |
| 142 | say(round.current.prompt, after: delay) | |
| 133 | 143 | } else { |
| 144 | mascot.handle(.prompt(round.current.prompt)) | |
| 134 | 145 | say(round.current.prompt, after: 0) |
| 135 | 146 | } |
| 136 | 147 | } |
DayByDay/Quiz/SequencePuzzleView.swift +33 −9
| @@ -15,6 +15,7 @@ struct SequencePuzzleView: View { | ||
| 15 | 15 | @State private var puzzle: SequencePuzzle |
| 16 | 16 | @State private var praise = PraisePhrases() |
| 17 | 17 | @State private var dimmed: QuizItem? |
| 18 | @State private var mascot = MascotState() | |
| 18 | 19 | @State private var celebrating = false |
| 19 | 20 | @State private var finished = false |
| 20 | 21 | @State private var speechToken = 0 |
| @@ -37,13 +38,13 @@ struct SequencePuzzleView: View { | ||
| 37 | 38 | FinishedView { |
| 38 | 39 | puzzle = make() |
| 39 | 40 | finished = false |
| 40 | say(puzzle.current?.prompt ?? "", after: 0.3) | |
| 41 | ask(after: 0.3) | |
| 41 | 42 | } |
| 42 | 43 | } else { |
| 43 | 44 | board |
| 44 | 45 | } |
| 45 | 46 | } |
| 46 | .onAppear { say(puzzle.current?.prompt ?? "", after: 0) } | |
| 47 | .onAppear { ask(after: 0) } | |
| 47 | 48 | .onDisappear { |
| 48 | 49 | generation += 1 |
| 49 | 50 | speechToken += 1 |
| @@ -54,14 +55,17 @@ struct SequencePuzzleView: View { | ||
| 54 | 55 | private var board: some View { |
| 55 | 56 | ScrollView { |
| 56 | 57 | VStack(spacing: 28) { |
| 57 | Button { say(puzzle.current?.prompt ?? "", after: 0) } label: { | |
| 58 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 59 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 60 | .padding(.horizontal, 28) | |
| 61 | .padding(.vertical, 16) | |
| 62 | .background(Capsule().fill(Color(.systemGray6))) | |
| 58 | HStack(spacing: 12) { | |
| 59 | GameMascot(state: $mascot) | |
| 60 | Button { ask(after: 0) } label: { | |
| 61 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 62 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 63 | .padding(.horizontal, 28) | |
| 64 | .padding(.vertical, 16) | |
| 65 | .background(Capsule().fill(Color(.systemGray6))) | |
| 66 | } | |
| 67 | .buttonStyle(.plain) | |
| 63 | 68 | } |
| 64 | .buttonStyle(.plain) | |
| 65 | 69 | |
| 66 | 70 | slots |
| 67 | 71 | .dropDestination(for: String.self) { ids, _ in |
| @@ -163,6 +167,7 @@ struct SequencePuzzleView: View { | ||
| 163 | 167 | case .correct where puzzle.isSolved: |
| 164 | 168 | let sound: SoundEffect = game == .weekTrain ? .whistle : .success |
| 165 | 169 | SoundEngine.shared.play(sound) |
| 170 | mascot.handle(.correct) | |
| 166 | 171 | celebrating = true |
| 167 | 172 | speechToken += 1 |
| 168 | 173 | solves += 1 |
| @@ -181,11 +186,14 @@ struct SequencePuzzleView: View { | ||
| 181 | 186 | DispatchQueue.main.asyncAfter(deadline: .now() + 15, execute: finish) |
| 182 | 187 | case .correct: |
| 183 | 188 | SoundEngine.shared.play(.success) |
| 189 | mascot.handle(.correct) | |
| 184 | 190 | var rng = SystemRandomNumberGenerator() |
| 185 | 191 | // One utterance: a second speak() would cut the praise off. |
| 186 | 192 | say("\(praise.next(using: &rng)) \(puzzle.current?.prompt ?? "")", after: RoundStyle.speechDelay) |
| 193 | askAfterCheer() | |
| 187 | 194 | case .incorrect: |
| 188 | 195 | SoundEngine.shared.play(.gentleMiss) |
| 196 | mascot.handle(.wrong) | |
| 189 | 197 | say(puzzle.correction(), after: RoundStyle.speechDelay) |
| 190 | 198 | withAnimation(.easeOut(duration: 0.2)) { dimmed = item } |
| 191 | 199 | DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) { |
| @@ -197,6 +205,22 @@ struct SequencePuzzleView: View { | ||
| 197 | 205 | } |
| 198 | 206 | } |
| 199 | 207 | |
| 208 | /// Praise and the next prompt are one line; the owl asks once the cheer is over. | |
| 209 | private func askAfterCheer() { | |
| 210 | let ticket = mascot.ticket, gen = generation | |
| 211 | DispatchQueue.main.asyncAfter(deadline: .now() + mascot.hold) { | |
| 212 | guard gen == generation, ticket == mascot.ticket, let prompt = puzzle.current?.prompt else { return } | |
| 213 | mascot.handle(.prompt(prompt)) | |
| 214 | } | |
| 215 | } | |
| 216 | ||
| 217 | /// Says the current step's prompt, with the mascot asking. | |
| 218 | private func ask(after delay: TimeInterval) { | |
| 219 | let prompt = puzzle.current?.prompt ?? "" | |
| 220 | mascot.handle(.prompt(prompt, after: delay)) | |
| 221 | say(prompt, after: delay) | |
| 222 | } | |
| 223 | ||
| 200 | 224 | /// Speaks after `delay` unless something newer was said first. |
| 201 | 225 | private func say(_ text: String, after delay: TimeInterval) { |
| 202 | 226 | guard !text.isEmpty else { return } |
DayByDay/Quiz/SortView.swift +31 −9
| @@ -17,6 +17,7 @@ struct SortView: View { | ||
| 17 | 17 | @State private var praise = PraisePhrases() |
| 18 | 18 | @State private var celebrating = false |
| 19 | 19 | @State private var shaking = false |
| 20 | @State private var mascot = MascotState() | |
| 20 | 21 | @State private var speechToken = 0 |
| 21 | 22 | /// Bumped when the screen goes away, so pending work does nothing. |
| 22 | 23 | @State private var generation = 0 |
| @@ -36,13 +37,13 @@ struct SortView: View { | ||
| 36 | 37 | var rng = SystemRandomNumberGenerator() |
| 37 | 38 | round = SortRound(using: &rng) |
| 38 | 39 | finished = false |
| 39 | say(round.prompt, after: 0.3) | |
| 40 | ask(after: 0.3) | |
| 40 | 41 | } |
| 41 | 42 | } else { |
| 42 | 43 | board |
| 43 | 44 | } |
| 44 | 45 | } |
| 45 | .onAppear { say(round.prompt, after: 0) } | |
| 46 | .onAppear { ask(after: 0) } | |
| 46 | 47 | .onDisappear { |
| 47 | 48 | generation += 1 |
| 48 | 49 | speechToken += 1 |
| @@ -53,14 +54,17 @@ struct SortView: View { | ||
| 53 | 54 | private var board: some View { |
| 54 | 55 | ScrollView { |
| 55 | 56 | VStack(spacing: 28) { |
| 56 | Button { say(round.prompt, after: 0) } label: { | |
| 57 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 58 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 59 | .padding(.horizontal, 28) | |
| 60 | .padding(.vertical, 16) | |
| 61 | .background(Capsule().fill(Color(.systemGray6))) | |
| 57 | HStack(spacing: 12) { | |
| 58 | GameMascot(state: $mascot) | |
| 59 | Button { ask(after: 0) } label: { | |
| 60 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 61 | .font(.system(size: 24, weight: .bold, design: .rounded)) | |
| 62 | .padding(.horizontal, 28) | |
| 63 | .padding(.vertical, 16) | |
| 64 | .background(Capsule().fill(Color(.systemGray6))) | |
| 65 | } | |
| 66 | .buttonStyle(.plain) | |
| 62 | 67 | } |
| 63 | .buttonStyle(.plain) | |
| 64 | 68 | |
| 65 | 69 | if let food = round.current { |
| 66 | 70 | let item = Category.food.item(food) |
| @@ -117,6 +121,7 @@ struct SortView: View { | ||
| 117 | 121 | switch outcome { |
| 118 | 122 | case .correct: |
| 119 | 123 | SoundEngine.shared.play(.success) |
| 124 | mascot.handle(.correct) | |
| 120 | 125 | celebrating = true |
| 121 | 126 | var rng = SystemRandomNumberGenerator() |
| 122 | 127 | let text = "\(praise.next(using: &rng)) \(SortRound.fact(for: food)) \(round.prompt ?? "")" |
| @@ -125,6 +130,7 @@ struct SortView: View { | ||
| 125 | 130 | } |
| 126 | 131 | guard round.isDone else { |
| 127 | 132 | say(text, after: RoundStyle.speechDelay) |
| 133 | askAfterCheer() | |
| 128 | 134 | break |
| 129 | 135 | } |
| 130 | 136 | // Finish once the last food's line has been said. |
| @@ -136,6 +142,7 @@ struct SortView: View { | ||
| 136 | 142 | DispatchQueue.main.asyncAfter(deadline: .now() + 8, execute: finish) |
| 137 | 143 | case .incorrect: |
| 138 | 144 | SoundEngine.shared.play(.gentleMiss) |
| 145 | mascot.handle(.wrong) | |
| 139 | 146 | withAnimation(.default.repeatCount(3)) { shaking = true } |
| 140 | 147 | // Taps stay ignored until the correction has been said. |
| 141 | 148 | let resume = { |
| @@ -150,6 +157,21 @@ struct SortView: View { | ||
| 150 | 157 | } |
| 151 | 158 | } |
| 152 | 159 | |
| 160 | /// Praise and the next prompt are one line; the owl asks once the cheer is over. | |
| 161 | private func askAfterCheer() { | |
| 162 | let ticket = mascot.ticket, gen = generation | |
| 163 | DispatchQueue.main.asyncAfter(deadline: .now() + mascot.hold) { | |
| 164 | guard gen == generation, ticket == mascot.ticket, let prompt = round.prompt else { return } | |
| 165 | mascot.handle(.prompt(prompt)) | |
| 166 | } | |
| 167 | } | |
| 168 | ||
| 169 | /// Says the prompt, with the mascot asking. | |
| 170 | private func ask(after delay: TimeInterval) { | |
| 171 | mascot.handle(.prompt(round.prompt ?? "", after: delay)) | |
| 172 | say(round.prompt, after: delay) | |
| 173 | } | |
| 174 | ||
| 153 | 175 | private func say(_ text: String?, after delay: TimeInterval, then completion: (() -> Void)? = nil) { |
| 154 | 176 | guard let text, !text.isEmpty else { return } |
| 155 | 177 | speechToken += 1 |
DayByDay/Quiz/TraceView.swift +9 −2
| @@ -16,6 +16,7 @@ struct TraceView: View { | ||
| 16 | 16 | @State private var index = 0 |
| 17 | 17 | @State private var strokes: [[CGPoint]] = [] |
| 18 | 18 | @State private var celebrating = false |
| 19 | @State private var mascot = MascotState() | |
| 19 | 20 | @State private var busy = false |
| 20 | 21 | @State private var speechToken = 0 |
| 21 | 22 | /// Bumped when the screen goes away, so pending work does nothing. |
| @@ -61,6 +62,8 @@ struct TraceView: View { | ||
| 61 | 62 | |
| 62 | 63 | private func board(_ item: QuizItem) -> some View { |
| 63 | 64 | VStack(spacing: 20) { |
| 65 | // Own row: beside both pills it would squeeze their labels on a phone. | |
| 66 | GameMascot(state: $mascot) | |
| 64 | 67 | HStack(spacing: 16) { |
| 65 | 68 | pill("Hear it again", "speaker.wave.2.fill", action: prompt) |
| 66 | 69 | pill("Start over", "eraser.fill") { strokes = [] } |
| @@ -120,6 +123,7 @@ struct TraceView: View { | ||
| 120 | 123 | busy = true |
| 121 | 124 | celebrating = true |
| 122 | 125 | SoundEngine.shared.play(.success) |
| 126 | mascot.handle(.correct) | |
| 123 | 127 | passes += 1 |
| 124 | 128 | let gen = generation, pass = passes |
| 125 | 129 | let advance = { |
| @@ -135,6 +139,7 @@ struct TraceView: View { | ||
| 135 | 139 | } else if score.accuracy < 0.5 && score.coverage > 0.4 { |
| 136 | 140 | record(item, correct: false) |
| 137 | 141 | SoundEngine.shared.play(.gentleMiss) |
| 142 | mascot.handle(.wrong) | |
| 138 | 143 | strokes = [] |
| 139 | 144 | say("Stay on \(label(item)). Let's try again.", after: RoundStyle.speechDelay) |
| 140 | 145 | } |
| @@ -148,8 +153,10 @@ struct TraceView: View { | ||
| 148 | 153 | |
| 149 | 154 | private func prompt() { |
| 150 | 155 | guard let item else { return } |
| 151 | say(category == .alphabet ? "Trace the letter \(item.name) with your finger." | |
| 152 | : "Trace the \(item.name.lowercased()) with your finger.", after: 0) | |
| 156 | let text = category == .alphabet ? "Trace the letter \(item.name) with your finger." | |
| 157 | : "Trace the \(item.name.lowercased()) with your finger." | |
| 158 | mascot.handle(.prompt(text)) | |
| 159 | say(text, after: 0) | |
| 153 | 160 | } |
| 154 | 161 | |
| 155 | 162 | private func say(_ text: String, after delay: TimeInterval, then completion: (() -> Void)? = nil) { |
DayByDay/Today/TodayRoutineView.swift +23 −9
| @@ -17,6 +17,7 @@ struct TodayRoutineView: View { | ||
| 17 | 17 | @State private var phase = Phase.line(0) |
| 18 | 18 | @State private var lines: [RoutineScript.Line] = [] |
| 19 | 19 | @State private var celebrating = false |
| 20 | @State private var mascot = MascotState() | |
| 20 | 21 | @State private var speechToken = 0 |
| 21 | 22 | /// Bumped when the screen goes away, so pending work does nothing. |
| 22 | 23 | @State private var generation = 0 |
| @@ -35,6 +36,7 @@ struct TodayRoutineView: View { | ||
| 35 | 36 | case .done: |
| 36 | 37 | ScrollView { |
| 37 | 38 | VStack(spacing: 20) { |
| 39 | GameMascot(state: $mascot) | |
| 38 | 40 | StickerCalendarView(profile: session.current) |
| 39 | 41 | .frame(maxWidth: 560) |
| 40 | 42 | .padding(.top, 8) |
| @@ -121,14 +123,17 @@ struct TodayRoutineView: View { | ||
| 121 | 123 | } |
| 122 | 124 | |
| 123 | 125 | private var hearAgain: some View { |
| 124 | Button(action: speakCurrent) { | |
| 125 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 126 | .font(.system(size: 22, weight: .bold, design: .rounded)) | |
| 127 | .padding(.horizontal, 24) | |
| 128 | .padding(.vertical, 14) | |
| 129 | .background(Capsule().fill(Color(.systemGray6))) | |
| 126 | HStack(spacing: 12) { | |
| 127 | GameMascot(state: $mascot) | |
| 128 | Button(action: speakCurrent) { | |
| 129 | Label("Hear it again", systemImage: "speaker.wave.2.fill") | |
| 130 | .font(.system(size: 22, weight: .bold, design: .rounded)) | |
| 131 | .padding(.horizontal, 24) | |
| 132 | .padding(.vertical, 14) | |
| 133 | .background(Capsule().fill(Color(.systemGray6))) | |
| 134 | } | |
| 135 | .buttonStyle(.plain) | |
| 130 | 136 | } |
| 131 | .buttonStyle(.plain) | |
| 132 | 137 | } |
| 133 | 138 | |
| 134 | 139 | private func next() { |
| @@ -139,8 +144,11 @@ struct TodayRoutineView: View { | ||
| 139 | 144 | |
| 140 | 145 | private func speakCurrent() { |
| 141 | 146 | switch phase { |
| 142 | case .line(let i) where i < lines.count: say(lines[i].text) | |
| 143 | case .weather: say("What's the weather like today?") | |
| 147 | case .line(0) where !lines.isEmpty: | |
| 148 | mascot.handle(.greet) | |
| 149 | say(lines[0].text) | |
| 150 | case .line(let i) where i < lines.count: ask(lines[i].text) | |
| 151 | case .weather: ask("What's the weather like today?") | |
| 144 | 152 | default: break |
| 145 | 153 | } |
| 146 | 154 | } |
| @@ -152,6 +160,7 @@ struct TodayRoutineView: View { | ||
| 152 | 160 | session.store.addSticker(for: profile, on: today, weather: weather) |
| 153 | 161 | } |
| 154 | 162 | SoundEngine.shared.play(.success) |
| 163 | mascot.handle(.correct) | |
| 155 | 164 | celebrating = true |
| 156 | 165 | phase = .done |
| 157 | 166 | say("It's \(weather.name.lowercased()) today! Here's your sticker!", after: RoundStyle.speechDelay) |
| @@ -161,6 +170,11 @@ struct TodayRoutineView: View { | ||
| 161 | 170 | } |
| 162 | 171 | } |
| 163 | 172 | |
| 173 | private func ask(_ text: String) { | |
| 174 | mascot.handle(.prompt(text)) | |
| 175 | say(text) | |
| 176 | } | |
| 177 | ||
| 164 | 178 | private func say(_ text: String, after delay: TimeInterval = 0) { |
| 165 | 179 | speechToken += 1 |
| 166 | 180 | let token = speechToken, gen = generation |
DayByDayTests/ContrastTests.swift +13
| @@ -97,4 +97,17 @@ struct ContrastTests { | ||
| 97 | 97 | #expect(contrast(ChoiceStyle.foodFill, .white, style) >= 3) |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | ||
| 101 | /// Body on the page in both modes; each feature on what it sits on. | |
| 102 | @Test func mascotContrast() { | |
| 103 | #expect(contrast(MascotStyle.body, .white, .light) >= 3) | |
| 104 | #expect(contrast(MascotStyle.body, .black, .dark) >= 3) | |
| 105 | for style in Self.styles { | |
| 106 | for feature in [MascotStyle.eyeWhite, MascotStyle.belly, MascotStyle.beak, MascotStyle.ink] { | |
| 107 | #expect(contrast(feature, MascotStyle.body, style) >= 3, "\(feature) \(style.rawValue)") | |
| 108 | } | |
| 109 | #expect(contrast(MascotStyle.ink, MascotStyle.eyeWhite, style) >= 3) | |
| 110 | #expect(contrast(MascotStyle.ink, MascotStyle.belly, style) >= 3) | |
| 111 | } | |
| 112 | } | |
| 100 | 113 | } |
DayByDayTests/MascotMotionTests.swift added +48
| @@ -0,0 +1,48 @@ | ||
| 1 | import Testing | |
| 2 | @testable import DayByDay | |
| 3 | ||
| 4 | struct MascotMotionTests { | |
| 5 | @Test func blinksOncePerCycle() { | |
| 6 | #expect(MascotMotion.pose(.idle, at: 1.0).eyeOpen == 1) | |
| 7 | #expect(MascotMotion.pose(.idle, at: 3.75).eyeOpen == 0.1) | |
| 8 | #expect(MascotMotion.pose(.idle, at: 3.85).eyeOpen == 1) | |
| 9 | #expect(MascotMotion.pose(.idle, at: 7.55).eyeOpen == 0.1) | |
| 10 | } | |
| 11 | ||
| 12 | @Test func cheerHopsThenRests() { | |
| 13 | #expect(MascotMotion.pose(.cheering, at: 0.2).hop < 0) | |
| 14 | #expect(MascotMotion.pose(.cheering, at: 2.0).hop == 0) | |
| 15 | #expect(MascotMotion.pose(.cheering, at: 4.2).hop < 0) | |
| 16 | #expect(MascotMotion.pose(.cheering, at: 0.2).wing == 130) | |
| 17 | } | |
| 18 | ||
| 19 | @Test func waveSwingsThenHolds() { | |
| 20 | let swings = [0.1, 0.3, 0.5].map { MascotMotion.pose(.waving, at: $0).wing } | |
| 21 | #expect(Set(swings).count == 3) | |
| 22 | #expect(MascotMotion.pose(.waving, at: 3.0).wing == 135) | |
| 23 | #expect(MascotMotion.pose(.idle, at: 0.3).wing == 0) | |
| 24 | } | |
| 25 | ||
| 26 | @Test(arguments: MascotMood.allCases) func stillPosesDoNotMove(_ mood: MascotMood) { | |
| 27 | let pose = MascotMotion.still(mood) | |
| 28 | #expect(pose.bob == 0) | |
| 29 | #expect(pose.hop == 0) | |
| 30 | #expect(pose.eyeOpen == 1) | |
| 31 | #expect(pose.beakOpen == (mood == .asking ? 1 : 0)) | |
| 32 | #expect(pose.wing == [.cheering: 130, .waving: 135][mood, default: 0]) | |
| 33 | #expect(pose.tilt == [.asking: 4, .puzzled: -10][mood, default: 0]) | |
| 34 | } | |
| 35 | ||
| 36 | @Test(arguments: MascotMood.allCases) func poseValuesInRange(_ mood: MascotMood) { | |
| 37 | for t in [-5, 0, 0.37, 1e6] { | |
| 38 | let pose = MascotMotion.pose(mood, at: t) | |
| 39 | #expect((0...1).contains(pose.eyeOpen), "\(mood) \(t)") | |
| 40 | #expect((0...1).contains(pose.beakOpen), "\(mood) \(t)") | |
| 41 | #expect((-0.06...0).contains(pose.hop), "\(mood) \(t)") | |
| 42 | #expect((-0.012...0).contains(pose.bob), "\(mood) \(t)") | |
| 43 | #expect((0...150).contains(pose.wing), "\(mood) \(t)") | |
| 44 | if mood == .waving { #expect(pose.wing >= 120, "\(t)") } | |
| 45 | } | |
| 46 | #expect(MascotMotion.pose(mood, at: -5) == MascotMotion.pose(mood, at: 0)) | |
| 47 | } | |
| 48 | } | |
DayByDayTests/MascotStateTests.swift added +50
| @@ -0,0 +1,50 @@ | ||
| 1 | import Testing | |
| 2 | @testable import DayByDay | |
| 3 | ||
| 4 | struct MascotStateTests { | |
| 5 | @Test func eventsMapToMoods() { | |
| 6 | var s = MascotState() | |
| 7 | #expect(s.mood == .idle) | |
| 8 | s.handle(.prompt("Find it!")) | |
| 9 | #expect(s.mood == .asking) | |
| 10 | s.handle(.correct) | |
| 11 | #expect(s.mood == .cheering) | |
| 12 | s.handle(.wrong) | |
| 13 | #expect(s.mood == .puzzled) | |
| 14 | s.handle(.greet) | |
| 15 | #expect(s.mood == .waving) | |
| 16 | } | |
| 17 | ||
| 18 | @Test func promptHoldCoversDelayAndWords() { | |
| 19 | #expect(abs(MascotState.hold(for: .prompt("Can you find Monday?", after: 1.0)) - 3.3) < 1e-9) | |
| 20 | #expect(MascotState.hold(for: .correct) == 1.8) | |
| 21 | #expect(MascotState.hold(for: .wrong) == 1.6) | |
| 22 | #expect(MascotState.hold(for: .greet) == 2.4) | |
| 23 | } | |
| 24 | ||
| 25 | @Test func emptyPromptSettles() { | |
| 26 | var s = MascotState() | |
| 27 | s.handle(.prompt("")) | |
| 28 | #expect(s.hold == 0.5) | |
| 29 | s.settle(s.ticket) | |
| 30 | #expect(s.mood == .idle) | |
| 31 | } | |
| 32 | ||
| 33 | @Test func settleReturnsToIdle() { | |
| 34 | var s = MascotState() | |
| 35 | s.handle(.wrong) | |
| 36 | #expect(s.hold == 1.6) | |
| 37 | s.settle(s.ticket) | |
| 38 | #expect(s.mood == .idle) | |
| 39 | } | |
| 40 | ||
| 41 | @Test func newerEventWins() { | |
| 42 | var s = MascotState() | |
| 43 | s.handle(.correct) | |
| 44 | let first = s.ticket | |
| 45 | s.handle(.prompt("Can you find Monday?")) | |
| 46 | s.settle(first) | |
| 47 | #expect(s.mood == .asking) | |
| 48 | #expect(s.ticket != first) | |
| 49 | } | |
| 50 | } | |
DayByDayTests/ReviewExport.swift +29
| @@ -53,6 +53,31 @@ struct ReviewExport { | ||
| 53 | 53 | try png(drawn).write(to: dir.appendingPathComponent("animals-large.png")) |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | /// Every mood's still pose at two sizes, then frames from its motion. | |
| 57 | @Test func mascotPoses() throws { | |
| 58 | try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true) | |
| 59 | let frames: [(MascotMood, Double)] = [(.idle, 3.75), (.asking, 0.11), (.cheering, 0.2), (.waving, 0.175), (.waving, 0.525)] | |
| 60 | for scheme in [ColorScheme.light, .dark] { | |
| 61 | let sheet = VStack(alignment: .leading, spacing: 24) { | |
| 62 | HStack(spacing: 16) { | |
| 63 | ForEach(MascotMood.allCases, id: \.self) { OwlCanvas(mood: $0, pose: MascotMotion.still($0)).frame(width: 180, height: 180) } | |
| 64 | } | |
| 65 | HStack(spacing: 16) { | |
| 66 | ForEach(MascotMood.allCases, id: \.self) { OwlCanvas(mood: $0, pose: MascotMotion.still($0)).frame(width: 64, height: 64) } | |
| 67 | } | |
| 68 | HStack(spacing: 16) { | |
| 69 | ForEach(Array(frames.enumerated()), id: \.offset) { _, f in | |
| 70 | OwlCanvas(mood: f.0, pose: MascotMotion.pose(f.0, at: f.1)).frame(width: 180, height: 180) | |
| 71 | } | |
| 72 | } | |
| 73 | } | |
| 74 | .padding(32) | |
| 75 | .background(Color(.systemBackground)) | |
| 76 | .environment(\.colorScheme, scheme) | |
| 77 | try png(sheet).write(to: dir.appendingPathComponent("mascot-\(scheme).png")) | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 56 | 81 | @Test func games() async throws { |
| 57 | 82 | try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true) |
| 58 | 83 | let container = ProfileStore.makeContainer(inMemory: true) |
| @@ -87,6 +112,10 @@ struct ReviewExport { | ||
| 87 | 112 | ("routine", AnyView(TodayRoutineView())), |
| 88 | 113 | ("calendar", AnyView(StickerCalendarView(profile: session.current, now: DateComponents(calendar: .current, year: 2026, month: 10, day: 16).date!))), |
| 89 | 114 | ("banner", AnyView(TodayBanner().padding())), |
| 115 | ("picker", AnyView(ProfilePickerView())), | |
| 116 | ("welcome", AnyView(ProfileSetupView())), | |
| 117 | ("finished", AnyView(FinishedView {})), | |
| 118 | ("find-days", AnyView(RoundView(source: DayByDay.Category.days.questionSource(for: .findIt), game: .findIt) { ChoiceTile(item: $0) })), | |
| 90 | 119 | ("animals", AnyView(AnimalsView())), |
| 91 | 120 | ("alphabet", AnyView(AlphabetView())), |
| 92 | 121 | ("counting", AnyView(CountingView())), |
docs/superpowers/plans/2026-10-16-part6-mascot.md added +101
| @@ -0,0 +1,101 @@ | ||
| 1 | # Part 6: Mascot Implementation Plan | |
| 2 | ||
| 3 | > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. | |
| 4 | ||
| 5 | **Goal:** Replace the placeholder face with one owl character drawn in code, with five moods (idle, asking, cheering, puzzled, waving), that hosts the Today banner, asks the questions in every game, cheers or looks puzzled at answers, and waves on the welcome and picker screens. | |
| 6 | ||
| 7 | **Architecture:** A pure `MascotState` maps game events to a mood and how long it holds before settling back to idle; a pure `MascotMotion` turns a mood and the time since it began into a pose (bob, hop, blink, wing angle, tilt, beak). `MascotView` draws the owl in a `Canvas` from a pose, inside a `TimelineView` unless Reduce Motion is on, when it draws the mood's still pose. `GameMascot` binds a game's `MascotState`, draws it at a small size beside "Hear it again", and schedules the settle. | |
| 8 | ||
| 9 | **Tech Stack:** SwiftUI, Swift Testing, Xcode 27. | |
| 10 | ||
| 11 | **Spec:** `docs/superpowers/specs/2026-10-16-learning-games-design.md` (part 6). Builds on the part 1–5 plans in this folder. | |
| 12 | ||
| 13 | ## Global Constraints | |
| 14 | ||
| 15 | - iOS 17.5 target; `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor`; pure logic `nonisolated`. | |
| 16 | - One character, drawn in code; no image assets. Flat fills. | |
| 17 | - Contrast ≥ 3:1 for each feature against what it sits on (eye whites, belly, beak, ink on body; pupils on eye whites) and for the body against the page in light (white) and dark (black). Tested in `ContrastTests`. | |
| 18 | - Motion is subtle: blink, slow bob, a cheer hop, a wave, a talking beak. With Reduce Motion on, still poses only (no `TimelineView`). | |
| 19 | - In games the mascot is 64 pt beside "Hear it again" so it never pushes choices down on a phone. | |
| 20 | - Wrong answers stay gentle: puzzled is a tilt and a raised brow, never a frown or red. | |
| 21 | - Lifecycle: `generation` guard (bumped only in `onDisappear`) on every new `asyncAfter`; a newer mascot event always wins over an older settle. | |
| 22 | - The celebration overlay stays confetti only; the game's own mascot cheers while it plays (no second copy over the choices). | |
| 23 | - Branch `feat/mascot`. Every commit `Ref #N` (last `Closes #N`). No AI attribution. | |
| 24 | - Test command: `xcodebuild test -project DayByDay.xcodeproj -scheme DayByDay -destination 'platform=iOS Simulator,name=iPhone 18 Pro'` (full suite ~10 min; run in background). | |
| 25 | ||
| 26 | ## Review Focus | |
| 27 | ||
| 28 | 1. Overlapping events: a correct answer's settle firing after the next prompt began must not put the mascot back to idle mid-question. Test `newerEventWins` in Task 1. | |
| 29 | 2. Long and delayed prompts: asking lasts through a sound cue and the whole prompt, and an empty prompt still settles. Tests `promptHoldCoversDelayAndWords`, `emptyPromptSettles` in Task 1. | |
| 30 | 3. Reduce Motion: the still pose has no bob, hop or tilt drift, eyes open, beak at its mood's shape, for every mood. Test `stillPosesDoNotMove` in Task 2. | |
| 31 | 4. Blink and wave timing stay in range for any time, including negative or huge values after a long session. Tests `poseValuesInRange` in Task 2. | |
| 32 | 5. Small sizes: at 64 pt on a 402 pt-wide phone the mascot row fits without truncating "Hear it again"; Trace's two pills still fit. Checked in the Task 5 renders. | |
| 33 | ||
| 34 | --- | |
| 35 | ||
| 36 | ### Task 0: Branch and issue | |
| 37 | ||
| 38 | - [ ] `git checkout -b feat/mascot main`; `gitbay issue create --title "Part 6: Mascot" --json --file -` (#6); commit this plan with `Ref #N`. | |
| 39 | ||
| 40 | ### Task 1: Mood model | |
| 41 | ||
| 42 | **Files:** Create `DayByDay/Mascot/MascotState.swift`. Test `DayByDayTests/MascotStateTests.swift`. | |
| 43 | ||
| 44 | **Interfaces:** | |
| 45 | - `nonisolated enum MascotMood: CaseIterable { case idle, asking, cheering, puzzled, waving }`. | |
| 46 | - `nonisolated enum MascotEvent: Equatable { case prompt(String, after: TimeInterval = 0), correct, wrong, greet }`. Moods: prompt → asking, correct → cheering, wrong → puzzled, greet → waving. | |
| 47 | - `nonisolated struct MascotState: Equatable { private(set) var mood: MascotMood = .idle; private(set) var ticket = 0; private(set) var hold: TimeInterval = 0; mutating func handle(_ event: MascotEvent); mutating func settle(_ ticket: Int); static func hold(for: MascotEvent) -> TimeInterval }`. `handle` sets the mood, bumps `ticket`, sets `hold`. `settle` returns to idle only when `ticket` matches. | |
| 48 | - Holds: prompt = `after + 0.5 + 0.45 × words` (words split on spaces); correct 1.8; wrong 1.6; greet 2.4. | |
| 49 | ||
| 50 | - [ ] Tests: `eventsMapToMoods`, `promptHoldCoversDelayAndWords` (`"Can you find Monday?"` after 1.0 → 3.3), `emptyPromptSettles` (hold 0.5, settle → idle), `settleReturnsToIdle`, `newerEventWins` (correct, then prompt, then settle(first ticket) → still asking). RED, implement, GREEN, commit `feat: mascot mood model`. | |
| 51 | ||
| 52 | ### Task 2: Motion | |
| 53 | ||
| 54 | **Files:** Create `DayByDay/Mascot/MascotMotion.swift`. Test `DayByDayTests/MascotMotionTests.swift`. | |
| 55 | ||
| 56 | **Interfaces:** | |
| 57 | - `nonisolated struct MascotPose: Equatable { var bob: Double; var hop: Double; var eyeOpen: Double; var wing: Double; var tilt: Double; var beakOpen: Double }`. `bob`, `hop` in fractions of the size (up is negative); `eyeOpen` 0…1; `wing` degrees the raised wing is lifted; `tilt` degrees; `beakOpen` 0…1. | |
| 58 | - `nonisolated enum MascotMotion { static func pose(_ mood: MascotMood, at t: TimeInterval) -> MascotPose; static func still(_ mood: MascotMood) -> MascotPose }`. `t` is seconds since the mood began. | |
| 59 | - Values: bob = −0.012 × (1 − cos(2πt/2.6))/2 for every mood. Blink: eyes shut (0.1) for 0.14 s at the end of each 3.8 s cycle, except cheering (eyes are happy arcs). Cheering: hop = −0.06 × |sin(πt/0.4)| while `t mod 4 < 1.6`, else 0; wings up 150. Waving: wing = 120 + 22 × sin(2πt/0.7) while `t mod 5 < 2.1`, else 120. Asking: beakOpen = 0.5 + 0.5 × |sin(πt/0.22)|; tilt 4. Puzzled: tilt −10, beakOpen 0.2. Idle: beakOpen 0, wing 0, tilt 0. | |
| 60 | - `still`: bob 0, hop 0, eyeOpen 1, beakOpen 1 for asking, cheering wings 150, waving wing 120, tilts as above. | |
| 61 | - Negative `t` is treated as 0. | |
| 62 | ||
| 63 | - [ ] Tests: `blinksOncePerCycle` (idle: eyeOpen 1 at t 1.0, 0.1 at t 3.75), `cheerHopsThenRests` (hop < 0 at 0.2, 0 at 2.0, < 0 at 4.2), `waveSwingsThenHolds`, `stillPosesDoNotMove` (all moods), `poseValuesInRange` (t in −5, 0, 0.37, 1e6 for all moods: eyeOpen and beakOpen in 0…1, hop in −0.06…0, wing in 0…150). RED, implement, GREEN, commit `feat: mascot motion`. | |
| 64 | ||
| 65 | ### Task 3: Owl drawing | |
| 66 | ||
| 67 | **Files:** Rewrite `DayByDay/Mascot/MascotView.swift`. Test `ContrastTests`. | |
| 68 | ||
| 69 | **Interfaces:** | |
| 70 | - `enum MascotStyle { static let body, belly, ink, beak, eyeWhite: Color }` — body ≈ (0.55, 0.36, 0.85) purple, belly ≈ (0.93, 0.89, 1.0), ink ≈ (0.12, 0.08, 0.25), beak ≈ (1.0, 0.88, 0.45), eye white `.white`. | |
| 71 | - `MascotView(mood: MascotMood)`: square, `accessibilityHidden`. Records when `mood` changed and passes `t` since then to `MascotMotion.pose`; with `accessibilityReduceMotion` it draws `MascotMotion.still(mood)` without a `TimelineView`. | |
| 72 | - Drawing (100×100 space, `Canvas`): egg body with two ear tufts; belly oval; two large eye whites with ink pupils and a white catch-light, lids shut by `eyeOpen`; beak triangle that opens by `beakOpen`; wings at the sides, the right one raised by `wing` (both for cheering); three-toed beak-colored feet over the body's bottom edge. Moods: cheering eyes are ink arcs on the eye whites; asking raises both brows; puzzled raises one brow, the other flat, plus a body-colored "?" beside the head; the whole owl rotates by `tilt` and moves by `bob + hop`. | |
| 73 | - Remove the old `Mood` enum; callers use `MascotMood`. | |
| 74 | ||
| 75 | - [ ] Test `mascotContrast`: body vs white (light) and black (dark); eye white, belly, beak and ink vs body; ink vs eye white; all ≥ 3 in both styles. RED, implement, GREEN. | |
| 76 | - [ ] Add `mascotPoses` to `ReviewExport`: every mood at 180 pt and 64 pt, still poses, light and dark sheets. Render, look, commit `feat: owl mascot`. | |
| 77 | ||
| 78 | ### Task 4: Banner, finish, welcome, picker | |
| 79 | ||
| 80 | **Files:** Modify `DayByDay/Home/TodayBanner.swift`, `DayByDay/Quiz/FinishedView.swift`, `DayByDay/Profiles/ProfilePickerView.swift`. | |
| 81 | ||
| 82 | - TodayBanner: idle mascot on a white disc (the orange gradient is too close to the body color), 96 pt overall. | |
| 83 | - FinishedView: `MascotView(mood: .cheering)`. | |
| 84 | - ProfileSetupView (welcome) and ProfilePickerView ("Who's playing?", mascot above the grid at 120 pt): `.waving`. | |
| 85 | ||
| 86 | - [ ] Build, render banner and picker, commit `feat: mascot on home, finish and picker`. | |
| 87 | ||
| 88 | ### Task 5: Mascot in the games | |
| 89 | ||
| 90 | **Files:** Create `DayByDay/Mascot/GameMascot.swift`. Modify `RoundView`, `SequencePuzzleView`, `TraceView`, `SortView`, `MovesView`, `CountingView`, `TodayRoutineView`. | |
| 91 | ||
| 92 | **Interfaces:** | |
| 93 | - `GameMascot(state: Binding<MascotState>)`: `MascotView(mood: state.mood)` at 64×64; on appear and on `ticket` change, `asyncAfter(hold)` then `settle(ticket)`, guarded by its own `generation` bumped in `onDisappear`. | |
| 94 | - Each game holds `@State private var mascot = MascotState()` and puts `GameMascot(state: $mascot)` in an `HStack(spacing: 12)` with its "Hear it again" button (Trace: on its own row above both pills, which would truncate beside it). Today routine also shows it above the sticker calendar so the cheer for the picked weather is seen. | |
| 95 | - Events: every spoken prompt (on appear, hear again, play again, next question/step/move/line) → `.prompt(text, after: delay)`; correct answer, solved puzzle, passed trace, finished count set, finished move, picked weather → `.correct`; wrong answer, missed trace, wrong bin → `.wrong`. Counting's per-tap numbers send nothing. The only new `asyncAfter` is the settle in `GameMascot`. | |
| 96 | ||
| 97 | - [ ] Build, run the existing suites for the touched games (`RoundTests`, `SequencePuzzleTests`, `SortRoundTests`, `TraceTests`, `MovesRoundTests`, `CountingTests`), render every game screen on a phone size in both modes, commit `feat: mascot asks and reacts in games`. | |
| 98 | ||
| 99 | ### Task 6: Reviews, MR, merge | |
| 100 | ||
| 101 | - [ ] Fresh art reviewer on the pose sheets and screen renders: recognizable, appealing, readable in both modes, contrast ≥ 3:1; two rounds max, block on clear defects, taste notes to the MR. Fresh whole-branch code reviewer with this Review Focus. One fix pass, RED→GREEN. Full suite green. Push, MR `Closes #N`, squash-merge, delete the branch locally and on the remote. | |