新增响应候选领域模型和结构化私有动作消息,支持响应窗口和候选动作下发。主要变更包括: - 新增 ResponseActionOption、ResponseActionSeatCandidate 和 ResponseActionWindow 模型 - 扩展 PrivateActionMessage 支持响应候选上下文 - 实现 ResponseActionWindowBuilder 构建弃牌响应候选 - 拆分 GameMessagePublisher 支持回合动作和响应动作消息 - 更新前端原型页展示结构化候选动作 - 新增响应优先级规则文档 RESPONSE_RESOLUTION_RULES.md
67 lines
1.7 KiB
Java
67 lines
1.7 KiB
Java
package com.xuezhanmaster.game.domain;
|
|
|
|
import com.xuezhanmaster.game.event.GameEvent;
|
|
|
|
import java.util.ArrayList;
|
|
import java.time.Instant;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
|
|
public class GameSession {
|
|
|
|
private final String gameId;
|
|
private final String roomId;
|
|
private final Instant createdAt;
|
|
private final GameTable table;
|
|
private final List<GameEvent> events;
|
|
private ResponseActionWindow pendingResponseActionWindow;
|
|
private final Map<Integer, ActionType> responseActionSelections;
|
|
|
|
public GameSession(String roomId, GameTable table) {
|
|
this.gameId = UUID.randomUUID().toString();
|
|
this.roomId = roomId;
|
|
this.createdAt = Instant.now();
|
|
this.table = table;
|
|
this.events = new ArrayList<>();
|
|
this.responseActionSelections = new LinkedHashMap<>();
|
|
}
|
|
|
|
public String getGameId() {
|
|
return gameId;
|
|
}
|
|
|
|
public String getRoomId() {
|
|
return roomId;
|
|
}
|
|
|
|
public Instant getCreatedAt() {
|
|
return createdAt;
|
|
}
|
|
|
|
public GameTable getTable() {
|
|
return table;
|
|
}
|
|
|
|
public List<GameEvent> getEvents() {
|
|
return events;
|
|
}
|
|
|
|
public ResponseActionWindow getPendingResponseActionWindow() {
|
|
return pendingResponseActionWindow;
|
|
}
|
|
|
|
public void setPendingResponseActionWindow(ResponseActionWindow pendingResponseActionWindow) {
|
|
this.pendingResponseActionWindow = pendingResponseActionWindow;
|
|
}
|
|
|
|
public Map<Integer, ActionType> getResponseActionSelections() {
|
|
return responseActionSelections;
|
|
}
|
|
|
|
public void clearResponseActionSelections() {
|
|
responseActionSelections.clear();
|
|
}
|
|
}
|