@thegraid/hexlib 1.1.12 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/game-play.d.ts +33 -13
- package/dist/game-play.d.ts.map +1 -1
- package/dist/game-play.js +53 -36
- package/dist/game-play.js.map +1 -1
- package/dist/game-setup.d.ts +20 -5
- package/dist/game-setup.d.ts.map +1 -1
- package/dist/game-setup.js +20 -12
- package/dist/game-setup.js.map +1 -1
- package/dist/game-state.d.ts +20 -7
- package/dist/game-state.d.ts.map +1 -1
- package/dist/game-state.js +40 -36
- package/dist/game-state.js.map +1 -1
- package/dist/hex.d.ts +17 -9
- package/dist/hex.d.ts.map +1 -1
- package/dist/hex.js +19 -9
- package/dist/hex.js.map +1 -1
- package/dist/image-loader.d.ts.map +1 -1
- package/dist/image-loader.js.map +1 -1
- package/dist/meeple.d.ts +6 -8
- package/dist/meeple.d.ts.map +1 -1
- package/dist/meeple.js +8 -14
- package/dist/meeple.js.map +1 -1
- package/dist/player-panel.d.ts +3 -7
- package/dist/player-panel.d.ts.map +1 -1
- package/dist/player-panel.js +50 -38
- package/dist/player-panel.js.map +1 -1
- package/dist/player.d.ts +5 -2
- package/dist/player.d.ts.map +1 -1
- package/dist/player.js +10 -6
- package/dist/player.js.map +1 -1
- package/dist/scenario-parser.d.ts +8 -4
- package/dist/scenario-parser.d.ts.map +1 -1
- package/dist/scenario-parser.js +10 -4
- package/dist/scenario-parser.js.map +1 -1
- package/dist/shapes.d.ts +96 -33
- package/dist/shapes.d.ts.map +1 -1
- package/dist/shapes.js +151 -92
- package/dist/shapes.js.map +1 -1
- package/dist/table-params.d.ts +3 -3
- package/dist/table-params.d.ts.map +1 -1
- package/dist/table-params.js +2 -2
- package/dist/table-params.js.map +1 -1
- package/dist/table.d.ts +38 -11
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +79 -51
- package/dist/table.js.map +1 -1
- package/dist/text-log.js +1 -1
- package/dist/text-log.js.map +1 -1
- package/dist/tile.d.ts +22 -25
- package/dist/tile.d.ts.map +1 -1
- package/dist/tile.js +38 -37
- package/dist/tile.js.map +1 -1
- package/package.json +3 -2
package/dist/table-params.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const playerColorsLib: readonly ["b", "w"];
|
|
2
|
-
export declare const playerColors: ("
|
|
2
|
+
export declare const playerColors: ("w" | "b")[];
|
|
3
3
|
/** Default type for PlayerColor. Maybe don't import, define your own locally.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
@@ -8,8 +8,8 @@ export declare const playerColors: ("b" | "w")[];
|
|
|
8
8
|
* type PlayerColor = PCLib | 'c' // Player Colors + Criminal!
|
|
9
9
|
*/
|
|
10
10
|
export type PlayerColor = typeof playerColorsLib[number];
|
|
11
|
-
export declare const playerColor0: "
|
|
12
|
-
export declare const playerColor1: "
|
|
11
|
+
export declare const playerColor0: "w" | "b";
|
|
12
|
+
export declare const playerColor1: "w" | "b";
|
|
13
13
|
export declare function otherColor(color: PlayerColor): PlayerColor;
|
|
14
14
|
export type PlayerColorRecord<T> = Record<PlayerColor, T>;
|
|
15
15
|
/** @return \{ pc0: arg0 as T, pc1: arg1 as T, ...}: PlayerColorRecord\<T> */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-params.d.ts","sourceRoot":"","sources":["../src/table-params.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,eAAe,qBAAsB,CAAA;AAC3C,eAAO,MAAM,YAAY,eAA2B,CAAC;AACrD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAGzD,eAAO,MAAM,YAAY,WAAkB,CAAA;AAC3C,eAAO,MAAM,YAAY,WAAkB,CAAA;AAE3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAAgE;AAE3H,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,MAAM,CAAC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E,MAAM,CAAO;IAC3B,MAAM,CAAC,UAAU,EAAE,MAAM,CAAiB;IAC1C,MAAM,CAAC,YAAY,EAAE,MAAM,CAAiB;IAE5C,MAAM,CAAC,OAAO,EAAE,MAAM,CAAM;IAC5B,MAAM,CAAC,YAAY,EAAE,MAAM,CAAM;IAEjC,MAAM,CAAC,iBAAiB,EAAE,OAAO,CAAQ;IAEzC,MAAM,CAAC,MAAM,SAAM;IACnB,MAAM,CAAC,SAAS,SAAmB;IACnC,MAAM,CAAC,QAAQ,SAAmB;IAGlC,MAAM,CAAC,OAAO,SAAK;IACnB,MAAM,CAAC,UAAU,SAAK;CACvB"}
|
package/dist/table-params.js
CHANGED
|
@@ -89,8 +89,8 @@ export class TP {
|
|
|
89
89
|
static roboDrawTile = 1.0; // Bias toward draw Tile
|
|
90
90
|
static trapNotDropTarget = true; // warn & alert when D&D to non-DropTarget
|
|
91
91
|
static hexRad = 60;
|
|
92
|
-
static meepleRad =
|
|
93
|
-
static meepleY0 =
|
|
92
|
+
static meepleRad = TP.hexRad * .75;
|
|
93
|
+
static meepleY0 = TP.hexRad * .25;
|
|
94
94
|
// for AI control:
|
|
95
95
|
static maxPlys = 3;
|
|
96
96
|
static maxBreadth = 3;
|
package/dist/table-params.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-params.js","sourceRoot":"","sources":["../src/table-params.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,CAAU,CAAA,CAAC,iBAAiB;AAC7D,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC;AASrD,mCAAmC;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;AAC3C,+CAA+C;AAC/C,MAAM,UAAU,UAAU,CAAC,KAAkB,IAAiB,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,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC;IACnC,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC;IAElC,kBAAkB;IAClB,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC"}
|
package/dist/table.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="easeljs" />
|
|
2
2
|
/// <reference types="createjs-lib" />
|
|
3
3
|
/// <reference types="@thegraid/easeljs-lib/dist/createjs-functions" />
|
|
4
|
-
import { Constructor, Dragger, DragInfo, DropdownStyle, ParamGUI, ScaleableContainer, XY } from "@thegraid/easeljs-lib";
|
|
4
|
+
import { Constructor, Dragger, DragInfo, DropdownStyle, NamedContainer, NamedObject, ParamGUI, ScaleableContainer, XY } from "@thegraid/easeljs-lib";
|
|
5
5
|
import { Container, DisplayObject, EventDispatcher, Shape, Stage, Text } from "@thegraid/easeljs-module";
|
|
6
|
-
import {
|
|
6
|
+
import { type GamePlay } from "./game-play";
|
|
7
7
|
import { Scenario } from "./game-setup";
|
|
8
8
|
import type { GameState } from "./game-state";
|
|
9
9
|
import { Hex, HexM, IdHex, IHex2, RecycleHex } from "./hex";
|
|
@@ -38,10 +38,11 @@ declare class TextLog extends NamedContainer {
|
|
|
38
38
|
lines: Text[];
|
|
39
39
|
lastLine: string;
|
|
40
40
|
nReps: number;
|
|
41
|
-
height(
|
|
41
|
+
height(nLines?: number): number;
|
|
42
42
|
clear(): void;
|
|
43
43
|
private newText;
|
|
44
44
|
private spaceLines;
|
|
45
|
+
/** convert line to single-line; inc count if same line; insert & scroll up */
|
|
45
46
|
log(line: string, from?: string, toConsole?: boolean): string;
|
|
46
47
|
}
|
|
47
48
|
/** layout display components, setup callbacks to GamePlay.
|
|
@@ -77,12 +78,14 @@ export declare class Table {
|
|
|
77
78
|
hexC: Constructor<IHex2>;
|
|
78
79
|
readonly overlayCont: NamedContainer;
|
|
79
80
|
constructor(stage: Stage);
|
|
80
|
-
/** shows the last
|
|
81
|
+
/** shows the last TP.numPlayers start of turn lines */
|
|
81
82
|
turnLog: TextLog;
|
|
82
83
|
/** show [13] other interesting log strings */
|
|
83
84
|
textLog: TextLog;
|
|
84
|
-
|
|
85
|
-
logText(line: string, from?: string): void;
|
|
85
|
+
/** write '// ${turn}: ${line}' comment line to TextLog (& console) & logWriter */
|
|
86
|
+
logText(line: string, from?: string, toConsole?: boolean): void;
|
|
87
|
+
logCurPlayer(plyr: Player): void;
|
|
88
|
+
logTurnPlayer(line: string): void;
|
|
86
89
|
setupUndoButtons(xOffs: number, bSize: number, skipRad: number, bgr: XYWH, row?: number, col?: number): void;
|
|
87
90
|
showWinText(msg?: string, color?: string): void;
|
|
88
91
|
enableHexInspector(qY?: number, cont?: Container): HexShape;
|
|
@@ -462,10 +465,26 @@ export declare class Table {
|
|
|
462
465
|
* six panel locations [row, col, dir][].
|
|
463
466
|
*
|
|
464
467
|
* col==0 is on left edge of hexMap; The *center* hex is col == (nHexes-1)
|
|
468
|
+
* @example
|
|
469
|
+
* P0 --- P3
|
|
470
|
+
* P1 --C-- P4
|
|
471
|
+
* P2 --- P5
|
|
472
|
+
*/
|
|
473
|
+
getPanelLocs(): number[][];
|
|
474
|
+
/**
|
|
475
|
+
* Which PanelLocs to use for a given number of Players
|
|
476
|
+
* @param np number of Players
|
|
477
|
+
* @returns array of indices into PanelLocs (one for each Player)
|
|
478
|
+
*/
|
|
479
|
+
panelLocsForNp(np: number): number[];
|
|
480
|
+
/** Panel location for the nth of nPlayers.
|
|
481
|
+
*
|
|
482
|
+
* @param pIndex Player index (0 .. nPlayers-1)
|
|
483
|
+
* @param nPlayers [allPlayers.length] total number of Players
|
|
484
|
+
* @param panelLocs [getPanelLocs] potential panel locations
|
|
485
|
+
* @return panelLocs[panelLocsForNp(nPlayers)][pIndex]
|
|
465
486
|
*/
|
|
466
|
-
|
|
467
|
-
/** select from setPanelLoc, based on pIndex from total np */
|
|
468
|
-
panelLoc(pIndex: number, np?: number, locs?: number[][]): number[];
|
|
487
|
+
panelLoc(pIndex: number, nPlayers?: number, panelLocs?: number[][]): number[];
|
|
469
488
|
readonly allPlayerPanels: PlayerPanel[];
|
|
470
489
|
/** make player panels, placed at panelLoc... */
|
|
471
490
|
makePerPlayer(): void;
|
|
@@ -641,7 +660,15 @@ export declare class Table {
|
|
|
641
660
|
showNetworkGroup(group_name?: string): void;
|
|
642
661
|
doneButton: UtilButton;
|
|
643
662
|
doneClicked: (evt?: any) => void;
|
|
644
|
-
|
|
663
|
+
/**
|
|
664
|
+
* May be contained or placed with ActionSelection buttons.
|
|
665
|
+
* @param cont [scaleCont] a Container to hold the DoneButton
|
|
666
|
+
* @param cx [0] offset in Container (to 'center', 'left', 'right' per align)
|
|
667
|
+
* @param cy [0] offset in Container (to top of text box)
|
|
668
|
+
* @param align ['center'] left or right
|
|
669
|
+
* @returns actionCont
|
|
670
|
+
*/
|
|
671
|
+
addDoneButton(cont?: Container, cx?: number, cy?: number, align?: string): Container;
|
|
645
672
|
/** show player player score on table */
|
|
646
673
|
setPlayerScore(plyr: Player, score: number, rank?: number): void;
|
|
647
674
|
/** update table when a new Game is started.
|
|
@@ -1305,8 +1332,8 @@ export declare class Table {
|
|
|
1305
1332
|
*/
|
|
1306
1333
|
dragTarget(dragObj?: DisplayObject, xy?: XY): void;
|
|
1307
1334
|
startDragging(dragObj: DisplayObject, xy?: XY): void;
|
|
1308
|
-
logCurPlayer(plyr: Player): void;
|
|
1309
1335
|
showRedoUndoCount(): void;
|
|
1336
|
+
/** log --> comment line to [console], TextLog, logWriter; showRedoUndoCount() */
|
|
1310
1337
|
showNextPlayer(log?: boolean): void;
|
|
1311
1338
|
_tablePlanner: TablePlanner;
|
|
1312
1339
|
get tablePlanner(): TablePlanner;
|
package/dist/table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../src/table.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAkC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAgB,QAAQ,EAAgB,kBAAkB,EAAS,EAAE,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../src/table.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAkC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAgB,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAgB,kBAAkB,EAAS,EAAE,EAAE,MAAM,uBAAuB,CAAC;AACxN,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAwB,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAE/H,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAU,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAe,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAExE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,WAAW,QAAQ;IACvB,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAA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AAE,CAAA"}
|
package/dist/table.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { afterUpdate, AT, C, CenterText, Dragger, F, KeyBinder, ParamGUI, S, ScaleableContainer, stime } from "@thegraid/easeljs-lib";
|
|
1
|
+
import { afterUpdate, AT, C, CenterText, Dragger, F, KeyBinder, NamedContainer, ParamGUI, S, ScaleableContainer, stime } from "@thegraid/easeljs-lib";
|
|
2
2
|
import { Container, EventDispatcher, Graphics, Shape, Text } from "@thegraid/easeljs-module";
|
|
3
3
|
import { EBC, PidChoice } from "./choosers";
|
|
4
|
-
import {
|
|
4
|
+
import { TileEvent } from "./game-play";
|
|
5
5
|
import { RecycleHex } from "./hex";
|
|
6
|
-
import { Player } from "./player";
|
|
7
6
|
import { PlayerPanel } from "./player-panel";
|
|
8
7
|
import { CircleShape, HexShape, RectShape, UtilButton } from "./shapes";
|
|
9
8
|
import { playerColor0, playerColor1, TP } from "./table-params";
|
|
@@ -15,7 +14,7 @@ class TablePlanner {
|
|
|
15
14
|
class TextLog extends NamedContainer {
|
|
16
15
|
size;
|
|
17
16
|
lead;
|
|
18
|
-
constructor(Aname, nlines = 6, size =
|
|
17
|
+
constructor(Aname, nlines = 6, size = TP.hexRad / 2, lead = 3) {
|
|
19
18
|
super(Aname);
|
|
20
19
|
this.size = size;
|
|
21
20
|
this.lead = lead;
|
|
@@ -27,8 +26,8 @@ class TextLog extends NamedContainer {
|
|
|
27
26
|
lines;
|
|
28
27
|
lastLine = '';
|
|
29
28
|
nReps = 0;
|
|
30
|
-
height(
|
|
31
|
-
return (this.size + this.lead) *
|
|
29
|
+
height(nLines = this.lines.length) {
|
|
30
|
+
return (this.size + this.lead) * nLines;
|
|
32
31
|
}
|
|
33
32
|
clear() {
|
|
34
33
|
this.lines.forEach(tline => tline.text = '');
|
|
@@ -43,8 +42,9 @@ class TextLog extends NamedContainer {
|
|
|
43
42
|
spaceLines(cy = 0, lead = this.lead) {
|
|
44
43
|
this.lines.forEach(tline => (tline.y = cy, cy += tline.getMeasuredLineHeight() + lead));
|
|
45
44
|
}
|
|
45
|
+
/** convert line to single-line; inc count if same line; insert & scroll up */
|
|
46
46
|
log(line, from = '', toConsole = true) {
|
|
47
|
-
line = line.replace(
|
|
47
|
+
line = line.replace(/\n/g, '-');
|
|
48
48
|
toConsole && console.log(stime(`${from}:`), line);
|
|
49
49
|
if (line === this.lastLine) {
|
|
50
50
|
this.lines[this.lines.length - 1].text = `[${++this.nReps}] ${line}`;
|
|
@@ -111,20 +111,28 @@ export class Table {
|
|
|
111
111
|
this.bindKeys();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
/** shows the last
|
|
115
|
-
turnLog = new TextLog('turnLog',
|
|
114
|
+
/** shows the last TP.numPlayers start of turn lines */
|
|
115
|
+
turnLog = new TextLog('turnLog', TP.numPlayers);
|
|
116
116
|
/** show [13] other interesting log strings */
|
|
117
117
|
textLog = new TextLog('textLog', TP.textLogLines);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
logText(line, from = '') {
|
|
122
|
-
const text = this.textLog.log(`${this.gamePlay.turnNumber}: ${line}`, from || '***'); // scrolling lines below
|
|
118
|
+
/** write '// ${turn}: ${line}' comment line to TextLog (& console) & logWriter */
|
|
119
|
+
logText(line, from = '', toConsole = true) {
|
|
120
|
+
const text = this.textLog.log(`${this.gamePlay.turnNumber}: ${line}`, from || '***', toConsole); // scrolling lines below
|
|
123
121
|
this.gamePlay.logWriter.writeLine(`// ${text}`);
|
|
124
122
|
// JSON string, instead of JSON5 comment:
|
|
125
123
|
// const text = this.textLog.log(`${this.gamePlay.turnNumber}: ${line}`, from); // scrolling lines below
|
|
126
124
|
// this.gamePlay.logWriter.writeLine(`"${line}",`);
|
|
127
125
|
}
|
|
126
|
+
logCurPlayer(plyr) {
|
|
127
|
+
const tn = this.gamePlay.turnNumber;
|
|
128
|
+
const robo = plyr.useRobo ? AT.ansiText(['red', 'bold'], "robo") : "----";
|
|
129
|
+
const info = { turn: tn, gamePlay: this.gamePlay, curPlayer: plyr, plyr: plyr.Aname };
|
|
130
|
+
console.log(stime(this, `.logCurPlayer --${robo}--`), info);
|
|
131
|
+
this.logTurnPlayer(`//${tn}: ${plyr.Aname}`);
|
|
132
|
+
}
|
|
133
|
+
logTurnPlayer(line) {
|
|
134
|
+
this.turnLog.log(line, 'table.logTurn', false); // in top two lines
|
|
135
|
+
}
|
|
128
136
|
setupUndoButtons(xOffs, bSize, skipRad, bgr, row = 8, col = -7) {
|
|
129
137
|
const undoC = this.undoCont; // holds the undo buttons.
|
|
130
138
|
this.setToRowCol(undoC, row, col);
|
|
@@ -338,7 +346,7 @@ export class Table {
|
|
|
338
346
|
const parent = this.scaleCont;
|
|
339
347
|
this.setToRowCol(this.turnLog, rowy, colx);
|
|
340
348
|
this.setToRowCol(this.textLog, rowy, colx);
|
|
341
|
-
this.textLog.y += this.turnLog.height(
|
|
349
|
+
this.textLog.y += this.turnLog.height(TP.numPlayers + 1); // allow room for 1 line per player
|
|
342
350
|
parent.addChild(this.turnLog, this.textLog);
|
|
343
351
|
parent.stage.update();
|
|
344
352
|
}
|
|
@@ -386,20 +394,19 @@ export class Table {
|
|
|
386
394
|
*/
|
|
387
395
|
makeGUIs(scale = TP.hexRad / 60, cx = -200, cy = 250, dy = 20) {
|
|
388
396
|
const scaleCont = this.scaleCont;
|
|
389
|
-
let
|
|
390
|
-
const
|
|
397
|
+
let wmax = 0, ymax = 0;
|
|
398
|
+
const guiWYmax = (gui) => {
|
|
391
399
|
ymax += (gui.ymax + dy);
|
|
392
|
-
|
|
400
|
+
wmax = Math.max(wmax, gui.children[0].getBounds().width);
|
|
401
|
+
return gui;
|
|
393
402
|
};
|
|
394
403
|
const guis = [this.makeNetworkGUI, this.makeParamGUI, this.makeParamGUI2].map(mgf => {
|
|
395
|
-
|
|
396
|
-
align(gui);
|
|
397
|
-
return gui;
|
|
404
|
+
return guiWYmax(this.gpanel(mgf, cx, cy + ymax, scale));
|
|
398
405
|
});
|
|
406
|
+
guis.forEach(gui => gui.x -= wmax);
|
|
399
407
|
scaleCont.addChild(...guis.reverse()); // lower y values ABOVE to dropdown is not obscured
|
|
400
|
-
guis.forEach(gui => gui.x -= lmax);
|
|
401
408
|
// TODO: dropdown to use given 'top' container!
|
|
402
|
-
|
|
409
|
+
scaleCont.stage.update();
|
|
403
410
|
}
|
|
404
411
|
get panelHeight() { return (2 * TP.nHexes - 1) / 3 - .2; }
|
|
405
412
|
get panelOffset() { return TP.nHexes + 2; }
|
|
@@ -407,8 +414,12 @@ export class Table {
|
|
|
407
414
|
* six panel locations [row, col, dir][].
|
|
408
415
|
*
|
|
409
416
|
* col==0 is on left edge of hexMap; The *center* hex is col == (nHexes-1)
|
|
417
|
+
* @example
|
|
418
|
+
* P0 --- P3
|
|
419
|
+
* P1 --C-- P4
|
|
420
|
+
* P2 --- P5
|
|
410
421
|
*/
|
|
411
|
-
|
|
422
|
+
getPanelLocs() {
|
|
412
423
|
const r0 = this.hexMap.centerHex.row, dr = this.panelHeight + .2;
|
|
413
424
|
const cc = this.hexMap.centerHex.col, coff = this.panelOffset;
|
|
414
425
|
const c0 = cc - coff, c1 = cc + coff;
|
|
@@ -418,18 +429,32 @@ export class Table {
|
|
|
418
429
|
];
|
|
419
430
|
return locs;
|
|
420
431
|
}
|
|
421
|
-
/**
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
432
|
+
/**
|
|
433
|
+
* Which PanelLocs to use for a given number of Players
|
|
434
|
+
* @param np number of Players
|
|
435
|
+
* @returns array of indices into PanelLocs (one for each Player)
|
|
436
|
+
*/
|
|
437
|
+
panelLocsForNp(np) {
|
|
438
|
+
return [[], [0], [0, 3], [0, 3, 1], [0, 3, 4, 1], [0, 3, 4, 2, 1], [0, 3, 4, 5, 2, 1]][np];
|
|
439
|
+
}
|
|
440
|
+
/** Panel location for the nth of nPlayers.
|
|
441
|
+
*
|
|
442
|
+
* @param pIndex Player index (0 .. nPlayers-1)
|
|
443
|
+
* @param nPlayers [allPlayers.length] total number of Players
|
|
444
|
+
* @param panelLocs [getPanelLocs] potential panel locations
|
|
445
|
+
* @return panelLocs[panelLocsForNp(nPlayers)][pIndex]
|
|
446
|
+
*/
|
|
447
|
+
panelLoc(pIndex, nPlayers = Math.min(TP.numPlayers, 6), panelLocs = this.getPanelLocs()) {
|
|
448
|
+
const seqn = this.panelLocsForNp(nPlayers);
|
|
449
|
+
const ndx = seqn[Math.min(pIndex, nPlayers - 1)];
|
|
450
|
+
return panelLocs[ndx];
|
|
426
451
|
}
|
|
427
452
|
allPlayerPanels = [];
|
|
428
453
|
/** make player panels, placed at panelLoc... */
|
|
429
454
|
makePerPlayer() {
|
|
430
455
|
this.allPlayerPanels.length = 0; // TODO: maybe deconstruct
|
|
431
456
|
const high = this.panelHeight, wide = 4.5;
|
|
432
|
-
const np = Math.min(
|
|
457
|
+
const np = Math.min(TP.numPlayers, 6), locs = this.getPanelLocs();
|
|
433
458
|
this.gamePlay.forEachPlayer((player, pIndex) => {
|
|
434
459
|
const [row, col, dir] = this.panelLoc(pIndex, np, locs);
|
|
435
460
|
this.allPlayerPanels[pIndex] = player.panel = new PlayerPanel(this, player, high, wide, row - high / 2, col - wide / 2, dir);
|
|
@@ -458,7 +483,7 @@ export class Table {
|
|
|
458
483
|
hex.legalMark.setOnHex(hex);
|
|
459
484
|
hex.cont.visible = false;
|
|
460
485
|
}
|
|
461
|
-
makeCircleButton(color = C.WHITE, rad =
|
|
486
|
+
makeCircleButton(color = C.WHITE, rad = TP.hexRad / 3, c, fs = rad * 3 / 2) {
|
|
462
487
|
const button = new Container();
|
|
463
488
|
button.name = 'circle';
|
|
464
489
|
const shape = new CircleShape(color, rad, '');
|
|
@@ -472,7 +497,7 @@ export class Table {
|
|
|
472
497
|
button.mouseEnabled = false;
|
|
473
498
|
return button;
|
|
474
499
|
}
|
|
475
|
-
makeSquareButton(color = C.WHITE, xywh, c, fs =
|
|
500
|
+
makeSquareButton(color = C.WHITE, xywh, c, fs = TP.hexRad / 2) {
|
|
476
501
|
const button = new Container();
|
|
477
502
|
button.name = 'square';
|
|
478
503
|
const shape = new RectShape(xywh, color, '');
|
|
@@ -579,24 +604,33 @@ export class Table {
|
|
|
579
604
|
this.doneButton.visible = false;
|
|
580
605
|
this.gamePlay.phaseDone(); // <--- main doneButton does not supply 'panel'
|
|
581
606
|
};
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
607
|
+
/**
|
|
608
|
+
* May be contained or placed with ActionSelection buttons.
|
|
609
|
+
* @param cont [scaleCont] a Container to hold the DoneButton
|
|
610
|
+
* @param cx [0] offset in Container (to 'center', 'left', 'right' per align)
|
|
611
|
+
* @param cy [0] offset in Container (to top of text box)
|
|
612
|
+
* @param align ['center'] left or right
|
|
613
|
+
* @returns actionCont
|
|
614
|
+
*/
|
|
615
|
+
addDoneButton(cont = this.scaleCont, cx = 0, cy = 0, align = 'center') {
|
|
616
|
+
const doneButton = this.doneButton = new UtilButton('Done', 'lightgreen');
|
|
617
|
+
doneButton.disp.textAlign = align; // Note: baseline is still 'middle'
|
|
618
|
+
const { x, y, width: w, height: h } = doneButton.getBounds();
|
|
585
619
|
doneButton.name = 'doneButton';
|
|
586
|
-
doneButton.x = -
|
|
587
|
-
doneButton.y =
|
|
588
|
-
doneButton.label.textAlign = 'right';
|
|
620
|
+
doneButton.x = cx - 0; // XY is the top-right corner, align extends to left
|
|
621
|
+
doneButton.y = cy - y; // XY is the top-right corner, align extends to left
|
|
589
622
|
doneButton.on(S.click, this.doneClicked, this);
|
|
590
|
-
|
|
591
|
-
// prefix advice: set text color
|
|
623
|
+
cont.addChild(doneButton);
|
|
624
|
+
// prefix advice: set text color to contrast with RectShape color
|
|
625
|
+
// TODO: add as option to UtilButton
|
|
592
626
|
const o_cgf = doneButton.rectShape.cgf;
|
|
593
627
|
const cgf = (color) => {
|
|
594
|
-
const tcolor = (C.dist(color, C.WHITE) < C.dist(color, C.
|
|
595
|
-
doneButton.
|
|
596
|
-
return o_cgf(color);
|
|
628
|
+
const tcolor = (C.dist(color, C.WHITE) < C.dist(color, C.BLACK)) ? C.black : C.white;
|
|
629
|
+
doneButton.disp.color = tcolor;
|
|
630
|
+
return o_cgf.call(doneButton.rectShape, color);
|
|
597
631
|
};
|
|
598
632
|
doneButton.rectShape.cgf = cgf; // invokes shape.paint(cgf) !!
|
|
599
|
-
return
|
|
633
|
+
return cont;
|
|
600
634
|
}
|
|
601
635
|
/** show player player score on table */
|
|
602
636
|
setPlayerScore(plyr, score, rank) {
|
|
@@ -782,17 +816,11 @@ export class Table {
|
|
|
782
816
|
startDragging(dragObj, xy = { x: 0, y: 0 }) {
|
|
783
817
|
this.dragger.dragTarget(dragObj, xy);
|
|
784
818
|
}
|
|
785
|
-
logCurPlayer(plyr) {
|
|
786
|
-
const tn = this.gamePlay.turnNumber;
|
|
787
|
-
const robo = plyr.useRobo ? AT.ansiText(['red', 'bold'], "robo") : "----";
|
|
788
|
-
const info = { turn: tn, plyr: plyr.Aname, gamePlay: this.gamePlay, curPlayer: plyr };
|
|
789
|
-
console.log(stime(this, `.logCurPlayer --${robo}--`), info);
|
|
790
|
-
this.logTurn(`//${tn}: ${plyr.Aname}`);
|
|
791
|
-
}
|
|
792
819
|
showRedoUndoCount() {
|
|
793
820
|
this.undoText.text = `${this.gamePlay.undoRecs.length}`;
|
|
794
821
|
this.redoText.text = `${this.gamePlay.redoMoves.length}`;
|
|
795
822
|
}
|
|
823
|
+
/** log --> comment line to [console], TextLog, logWriter; showRedoUndoCount() */
|
|
796
824
|
showNextPlayer(log = true) {
|
|
797
825
|
let curPlayer = this.gamePlay.curPlayer; // after gamePlay.setNextPlayer()
|
|
798
826
|
if (log)
|