- Echtgeld bankroll = conservative N-buy-in reserve per table (configurable,
default 20), replacing the aggressive 1/5 rule; threaded through table
selection (auswahl) and the sit gate (sitzen) end to end.
- Table shape selectable (Multiway/Heads-Up/Both); heads-up detected from the
seat count AND the room name ('NL HU'); an opened wrong-shape table is closed.
- Bomb Pot playable in both modes (PLO5, engine capable); only K-Poker stays
off (bet menu unmeasured). Drop the 'gambling' framing for an honest
capability gate (nicht_bespielbar / NICHT_BESPIELBAR).
- Stakes band (min/max BB) added to the money model; 'Echtgeld' mode rename;
native Preferences window; budget tile shows the reserve, not a percent.
- Fix runner import path so the client auto-config thread finds lobby_adapter.
134 lines
6.1 KiB
Swift
134 lines
6.1 KiB
Swift
import Foundation
|
||
import CockpitKern
|
||
import SwiftUI
|
||
|
||
/// Zuschauer: was der Laeufer sieht und täte. Der Lauf liest nur das Log und kann nicht klicken.
|
||
struct ZuschauerAnsicht: View {
|
||
@Environment(Cockpit.self) private var cockpit
|
||
|
||
var body: some View {
|
||
let z = cockpit.ansicht.zuschauer
|
||
ScrollView {
|
||
VStack(alignment: .leading, spacing: 10) {
|
||
if let leer = z?.leer {
|
||
Text(leer).font(.caption).foregroundStyle(.secondary)
|
||
}
|
||
let tische = z?.tische ?? []
|
||
ForEach(tische) { p in
|
||
// die Gegnerliste nur bei einem Tisch: bei mehreren schöbe sie die anderen aus dem Bild
|
||
if let t = p.tisch { ZuschauerTischKarte(t: t, mitGegnern: tische.count == 1) }
|
||
if let a = p.zug { ZuschauerZugKarte(a: a) }
|
||
}
|
||
if let z, !z.abgleich.isEmpty {
|
||
Abschnitt(titel: "Abgleich", hinweis: "du gegen den Kern, nur Chips") { EmptyView() }
|
||
ForEach(z.abgleich) { AbgleichZeile(a: $0) }
|
||
}
|
||
}
|
||
.padding(12)
|
||
}
|
||
}
|
||
}
|
||
|
||
private struct ZuschauerTischKarte: View {
|
||
var t: ZuschauerTisch
|
||
var mitGegnern: Bool
|
||
|
||
var body: some View {
|
||
VStack(alignment: .leading, spacing: 7) {
|
||
HStack(spacing: 6) {
|
||
Text(t.raum ?? "Tisch").font(.subheadline.weight(.semibold)).lineLimit(1)
|
||
Abzeichen(text: t.modus == "uebung" ? "Übung" : t.modus == "cash" ? "Echtgeld" : "Modus unbekannt",
|
||
farbe: t.modus == "uebung" ? .blue : .red)
|
||
Spacer(minLength: 0)
|
||
}
|
||
MiniTisch(plaetze: max(t.tisch.spieler.map(\.sitz).max() ?? 6, 6), board: t.board, topf: t.topf, zug: nil, tisch: t.tisch)
|
||
if let n = t.amZug?.name {
|
||
Text("Am Zug: \(n)" + (t.amZug?.fristS.map { " · Frist \(Int($0)) s" } ?? ""))
|
||
.font(.caption).foregroundStyle(.secondary)
|
||
}
|
||
if let h = t.hinweis { Text(h).font(.caption).foregroundStyle(.secondary) }
|
||
if mitGegnern, t.tisch.spieler.contains(where: { !$0.ich }) { GegnerListe(tisch: t.tisch) }
|
||
}
|
||
.padding(10)
|
||
.background(.white.opacity(0.05), in: RoundedRectangle(cornerRadius: 16, style: .continuous))
|
||
}
|
||
}
|
||
|
||
private struct ZuschauerZugKarte: View {
|
||
var a: ZuschauerZug
|
||
|
||
var body: some View {
|
||
VStack(alignment: .leading, spacing: 7) {
|
||
HStack(spacing: 6) {
|
||
HStack(spacing: 4) { ForEach(Array(a.karten.enumerated()), id: \.offset) { KarteAnsicht(code: $0.element, gross: true) } }
|
||
Spacer(minLength: 0)
|
||
if let s = a.strasse { Text(s).font(.caption2).foregroundStyle(.tertiary) }
|
||
}
|
||
if let e = a.empfehlung {
|
||
HStack(alignment: .firstTextBaseline, spacing: 6) {
|
||
Text(Aktionstext.mitBetrag(e.aktion, e.betragBB)).font(.callout.weight(.semibold))
|
||
if let q = a.equity { Text("Equity \(Format.prozent(q))").font(.caption).foregroundStyle(.secondary) }
|
||
Spacer(minLength: 0)
|
||
}
|
||
if let t = e.klartext ?? e.grund, !t.isEmpty {
|
||
Text(t).font(.caption).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)
|
||
}
|
||
}
|
||
if let h = a.hinweis { Text(h).font(.caption).foregroundStyle(.secondary) }
|
||
Text(kenngroessen).font(.caption2.monospacedDigit()).foregroundStyle(.tertiary)
|
||
if !a.linien.isEmpty {
|
||
Divider()
|
||
Text("EV je Linie").font(.caption2.weight(.semibold)).foregroundStyle(.secondary)
|
||
ForEach(a.linien) { l in
|
||
HStack {
|
||
Text(Aktionstext.mitBetrag(l.aktion, l.betragBB)).font(.caption)
|
||
Spacer(minLength: 0)
|
||
Text(l.evBB.map { String(format: "%+.2f bb", $0) } ?? "–").font(.caption.monospacedDigit())
|
||
}
|
||
}
|
||
}
|
||
if !a.reads.isEmpty {
|
||
Divider()
|
||
Text("Reads").font(.caption2.weight(.semibold)).foregroundStyle(.secondary)
|
||
ForEach(a.reads) { r in
|
||
Text("Sitz \(r.sitz): \(r.einschaetzung.stilText) · \(r.einschaetzung.satz)")
|
||
.font(.caption).fixedSize(horizontal: false, vertical: true)
|
||
}
|
||
}
|
||
}
|
||
.padding(10)
|
||
.background(.white.opacity(0.05), in: RoundedRectangle(cornerRadius: 16, style: .continuous))
|
||
}
|
||
|
||
private var kenngroessen: String {
|
||
var teile: [String] = []
|
||
if let t = a.topfBB { teile.append(String(format: "Topf %.1f bb", t)) }
|
||
if let z = a.zuZahlenBB { teile.append(String(format: "zu zahlen %.1f bb", z)) }
|
||
if let s = a.stackBB { teile.append(String(format: "Stack %.1f bb", s)) }
|
||
if let t = a.taktS { teile.append("Takt \(Int(t)) s") }
|
||
return teile.joined(separator: " · ")
|
||
}
|
||
}
|
||
|
||
private struct AbgleichZeile: View {
|
||
var a: ZuschauerAbgleich
|
||
|
||
var body: some View {
|
||
VStack(alignment: .leading, spacing: 3) {
|
||
HStack {
|
||
Text(a.hand ?? "Hand").font(.caption.weight(.semibold)).lineLimit(1)
|
||
Spacer(minLength: 0)
|
||
Text(a.abweichungen == 0 ? "wie der Kern" : a.kostenBB.map { String(format: "kostet %.2f bb", $0) } ?? "")
|
||
.font(.caption.monospacedDigit()).foregroundStyle(a.abweichungen == 0 ? .green : .orange)
|
||
}
|
||
ForEach(a.zuege) { z in
|
||
Text("\(z.strasse ?? ""): du \(z.bediener ?? "?"), Kern \(z.kern ?? "?")" + (z.warum.map { " - \($0)" } ?? ""))
|
||
.font(.caption2).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)
|
||
}
|
||
if a.unbewertet > 0 { Text("\(a.unbewertet) Züge unbewertet").font(.caption2).foregroundStyle(.tertiary) }
|
||
}
|
||
.padding(8)
|
||
.background(.white.opacity(0.05), in: RoundedRectangle(cornerRadius: 10))
|
||
}
|
||
}
|