Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix march order line #1826

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions agot-bg-game-server/src/client/GameLogListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default class GameLogListComponent extends Component<GameLogListComponent
</Col>}
<Col>
<div className="game-log-content">
{this.renderGameLogData(l.data, this.currentRound, i)}
{this.renderGameLogData(l.data, this.currentRound, i, l.time)}
</div>
</Col>
</Row>
Expand All @@ -172,7 +172,7 @@ export default class GameLogListComponent extends Component<GameLogListComponent
));
}

renderGameLogData(data: GameLogData, currentRound: number, currentLogIndex: number): ReactNode {
renderGameLogData(data: GameLogData, currentRound: number, currentLogIndex: number, logTime: Date): ReactNode {
switch (data.type) {
case "player-action": {
const house = this.game.houses.get(data.house);
Expand Down Expand Up @@ -243,12 +243,21 @@ export default class GameLogListComponent extends Component<GameLogListComponent
const army = data.units.map(utid => unitTypes.get(utid));
const orderImgUrl = data.orderType ? orderImages.get(data.orderType) : null;

const showDottedLine = this.logManager.logs[currentLogIndex - 1]?.data.type != "march-resolved";
const previousLog = this.logManager.logs[currentLogIndex - 1];
let showDottedLine = true;

if (previousLog.data.type == "action-phase-resolve-march-began") {
showDottedLine = false;
} else if (previousLog.data.type == "march-resolved") {
if (previousLog.data.house == data.attacker && (logTime.getTime() - previousLog.time.getTime()) <= 100) {
showDottedLine = false;
}
}

return (
<Row className="align-items-center">
{showDottedLine && <Col xs="12">
<hr style={{ borderTop: "dotted 3px" }} />
<hr style={{ borderTop: "dotted 1px", color: "grey" }} />
</Col>}
{orderImgUrl && <Col xs="auto">
<img src={orderImgUrl} width="42px"/>
Expand Down