Skip to content

Commit 833efe9

Browse files
committed
Enable vertex style for Gyve
1 parent d1b53ec commit 833efe9

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

locales/en/apgames.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,12 @@
25162516
"name": "Hide moves"
25172517
}
25182518
},
2519+
"pahtum": {
2520+
"vertex-style": {
2521+
"name": "Vertex style",
2522+
"description": "Display the board using vertices instead of hexes."
2523+
}
2524+
},
25192525
"pente": {
25202526
"hide-threatened": {
25212527
"description": "Don't highlight pieces that are threatened to be captured.",

src/games/gyve.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* eslint-disable @typescript-eslint/no-var-requires */
33
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
44
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
5-
import { GameBase, IAPGameState, IClickResult, ICustomButton, IIndividualState, IScores, IValidationResult } from "./_base";
5+
import { GameBase, IAPGameState, IClickResult, ICustomButton, IIndividualState, IRenderOpts, IScores, IValidationResult } from "./_base";
66
import { APGamesInformation } from "../schemas/gameinfo";
77
import { APRenderRep } from "@abstractplay/renderer/src/schemas/schema";
88
import { APMoveResult } from "../schemas/moveresults";
@@ -53,6 +53,7 @@ export class GyveGame extends GameBase {
5353
{uid: "size-12", group: "board"},
5454
],
5555
categories: ["goal>unify", "mechanic>place", "board>shape>hex", "board>connect>hex", "components>simple>1per"],
56+
displays: [{uid: "vertex-style"}],
5657
flags: ["pie", "scores", "no-moves", "custom-randomization", "custom-buttons"]
5758
};
5859

@@ -471,7 +472,17 @@ export class GyveGame extends GameBase {
471472
};
472473
}
473474

474-
public render(): APRenderRep {
475+
public render(opts?: IRenderOpts): APRenderRep {
476+
let altDisplay: string | undefined;
477+
if (opts !== undefined) {
478+
altDisplay = opts.altDisplay;
479+
}
480+
let vertexStyle = false;
481+
if (altDisplay !== undefined) {
482+
if (altDisplay === "vertex-style") {
483+
vertexStyle = true;
484+
}
485+
}
475486
const g = this.graph;
476487
// Build piece string
477488
let pstr = "";
@@ -526,7 +537,7 @@ export class GyveGame extends GameBase {
526537
// Build rep
527538
const rep: APRenderRep = {
528539
board: {
529-
style: "hex-of-hex",
540+
style: vertexStyle ? "hex-of-tri" : "hex-of-hex",
530541
minWidth: this.boardsize,
531542
maxWidth: (this.boardsize * 2) - 1,
532543
// markers: markers.length > 0 ? markers : undefined,

0 commit comments

Comments
 (0)