完善了Web管理端

This commit is contained in:
2026-06-20 18:18:50 +08:00
parent aedc199777
commit c5f296fb0d
11 changed files with 735 additions and 82 deletions
+14 -2
View File
@@ -13,6 +13,8 @@ func (e *Engine) Snapshot(forPlayerID string) map[string]interface{} {
"current_turn": currentTurnID,
"your_player_id": forPlayerID,
"harmony_target": e.HarmonyTarget,
"round_num": e.RoundNum,
"turn_id": e.TurnID,
}
var players []map[string]interface{}
@@ -47,10 +49,20 @@ func (e *Engine) Snapshot(forPlayerID string) map[string]interface{} {
}
snap["hand_cards"] = hand
var myChallenge []map[string]interface{}
if me != nil {
for _, c := range me.ChallengeZone {
myChallenge = append(myChallenge, map[string]interface{}{
"uid": c.UID, "placed_by": c.PlacedByNick,
})
}
}
snap["my_challenge_zone"] = myChallenge
var harmony []map[string]interface{}
for _, c := range e.HarmonyZone {
for i, c := range e.HarmonyZone {
harmony = append(harmony, map[string]interface{}{
"uid": c.UID, "face_up": false,
"uid": c.UID, "face_up": false, "order": i + 1,
})
}
snap["harmony_zone"] = harmony