|
1 | | -import { GameBase, IAPGameState, IClickResult, ICustomButton, IIndividualState, IScores, IValidationResult } from "./_base"; |
| 1 | +import { GameBase, IAPGameState, IClickResult, ICustomButton, IIndividualState, IScores, IRenderOpts, IValidationResult } from "./_base"; |
2 | 2 | import { APGamesInformation } from "../schemas/gameinfo"; |
3 | 3 | import { APRenderRep, BoardBasic, MarkerDots, RowCol } from "@abstractplay/renderer/src/schemas/schema"; |
4 | 4 | import { APMoveResult } from "../schemas/moveresults"; |
@@ -72,6 +72,7 @@ export class GoGame extends GameBase { |
72 | 72 | ], |
73 | 73 | categories: ["goal>area", "mechanic>place", "mechanic>capture", "mechanic>enclose", "board>shape>rect", "components>simple>1per"], |
74 | 74 | flags: ["scores", "custom-buttons", "custom-colours"], |
| 75 | + displays: [{uid: "show-controlled-areas"}], |
75 | 76 | }; |
76 | 77 |
|
77 | 78 | public coords2algebraic(x: number, y: number): string { |
@@ -644,7 +645,18 @@ export class GoGame extends GameBase { |
644 | 645 | return (player == 1 && !this.swapped) || (player == 2 && this.swapped) ? 1 : 2; |
645 | 646 | } |
646 | 647 |
|
647 | | - public render(): APRenderRep { |
| 648 | + public render(opts?: IRenderOpts): APRenderRep { |
| 649 | + let altDisplay: string | undefined; |
| 650 | + if (opts !== undefined) { |
| 651 | + altDisplay = opts.altDisplay; |
| 652 | + } |
| 653 | + let highlightAreas = false; |
| 654 | + if (altDisplay !== undefined) { |
| 655 | + if (altDisplay === "show-controlled-areas") { |
| 656 | + highlightAreas = true; |
| 657 | + } |
| 658 | + } |
| 659 | + |
648 | 660 | // Build piece string |
649 | 661 | let pstr = ""; |
650 | 662 | for (let row = 0; row < this.boardSize; row++) { |
@@ -696,7 +708,7 @@ export class GoGame extends GameBase { |
696 | 708 | } |
697 | 709 | } |
698 | 710 |
|
699 | | - if (this.gameover) { |
| 711 | + if (highlightAreas || this.gameover) { |
700 | 712 | const territories = this.getTerritories(); |
701 | 713 | const markers: Array<MarkerDots> = [] |
702 | 714 | for (const t of territories) { |
|
0 commit comments