@thegraid/hexlib 1.2.0 → 1.2.10
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/choosers.d.ts +11 -2
- package/dist/choosers.d.ts.map +1 -1
- package/dist/choosers.js +13 -3
- package/dist/choosers.js.map +1 -1
- package/dist/game-play.d.ts +22 -17
- package/dist/game-play.d.ts.map +1 -1
- package/dist/game-play.js +36 -38
- package/dist/game-play.js.map +1 -1
- package/dist/game-setup.d.ts +1 -0
- package/dist/game-setup.d.ts.map +1 -1
- package/dist/game-setup.js +6 -4
- package/dist/game-setup.js.map +1 -1
- package/dist/game-state.d.ts +18 -6
- package/dist/game-state.d.ts.map +1 -1
- package/dist/game-state.js +38 -36
- package/dist/game-state.js.map +1 -1
- package/dist/hex-intfs.d.ts +0 -6
- package/dist/hex-intfs.d.ts.map +1 -1
- package/dist/hex-intfs.js +1 -0
- package/dist/hex-intfs.js.map +1 -1
- package/dist/hex.d.ts +12 -5
- package/dist/hex.d.ts.map +1 -1
- package/dist/hex.js +16 -5
- 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 +5 -7
- package/dist/meeple.d.ts.map +1 -1
- package/dist/meeple.js +8 -13
- package/dist/meeple.js.map +1 -1
- package/dist/player-panel.d.ts +5 -9
- package/dist/player-panel.d.ts.map +1 -1
- package/dist/player-panel.js +56 -42
- package/dist/player-panel.js.map +1 -1
- package/dist/player.d.ts +2 -1
- package/dist/player.d.ts.map +1 -1
- package/dist/player.js +6 -2
- package/dist/player.js.map +1 -1
- package/dist/scenario-parser.d.ts.map +1 -1
- package/dist/scenario-parser.js +4 -6
- package/dist/scenario-parser.js.map +1 -1
- package/dist/shapes.d.ts +42 -194
- package/dist/shapes.d.ts.map +1 -1
- package/dist/shapes.js +54 -363
- 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 +42 -18
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +89 -67
- package/dist/table.js.map +1 -1
- package/dist/text-log.js +2 -2
- package/dist/text-log.js.map +1 -1
- package/dist/tile.d.ts +17 -20
- package/dist/tile.d.ts.map +1 -1
- package/dist/tile.js +31 -31
- package/dist/tile.js.map +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/table.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/// <reference types="easeljs" />
|
|
2
|
-
/// <reference types="createjs-lib" />
|
|
3
2
|
/// <reference types="@thegraid/easeljs-lib/dist/createjs-functions" />
|
|
4
|
-
import { Constructor,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { Constructor, XY, XYWH } from "@thegraid/common-lib";
|
|
4
|
+
import { Dispatcher, Dragger, DragInfo, DropdownStyle, NamedContainer, NamedObject, ParamGUI, RectShape, ScaleableContainer } from "@thegraid/easeljs-lib";
|
|
5
|
+
import { Container, DisplayObject, Shape, Stage, Text } from "@thegraid/easeljs-module";
|
|
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";
|
|
10
|
-
import { XYWH } from "./hex-intfs";
|
|
11
10
|
import { Player } from "./player";
|
|
12
11
|
import { PlayerPanel } from "./player-panel";
|
|
13
|
-
import { HexShape,
|
|
12
|
+
import { HexShape, UtilButton } from "./shapes";
|
|
14
13
|
import { Tile } from "./tile";
|
|
15
14
|
import { TileSource } from "./tile-source";
|
|
16
15
|
export interface Dragable {
|
|
@@ -38,21 +37,20 @@ declare class TextLog extends NamedContainer {
|
|
|
38
37
|
lines: Text[];
|
|
39
38
|
lastLine: string;
|
|
40
39
|
nReps: number;
|
|
41
|
-
height(
|
|
40
|
+
height(nLines?: number): number;
|
|
42
41
|
clear(): void;
|
|
43
42
|
private newText;
|
|
44
43
|
private spaceLines;
|
|
44
|
+
/** convert line to single-line; inc count if same line; insert & scroll up */
|
|
45
45
|
log(line: string, from?: string, toConsole?: boolean): string;
|
|
46
46
|
}
|
|
47
47
|
/** layout display components, setup callbacks to GamePlay.
|
|
48
48
|
*
|
|
49
49
|
* uses a HexMap\<IHex2\>
|
|
50
50
|
*/
|
|
51
|
-
export declare class Table {
|
|
51
|
+
export declare class Table extends Dispatcher {
|
|
52
52
|
static table: Table;
|
|
53
53
|
static stageTable(obj: DisplayObject): Table;
|
|
54
|
-
disp: EventDispatcher;
|
|
55
|
-
namedOn(Aname: string, type: string, listener: (eventObj: any) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): void;
|
|
56
54
|
gamePlay: GamePlay;
|
|
57
55
|
stage: Stage;
|
|
58
56
|
bgRect: Shape;
|
|
@@ -77,12 +75,14 @@ export declare class Table {
|
|
|
77
75
|
hexC: Constructor<IHex2>;
|
|
78
76
|
readonly overlayCont: NamedContainer;
|
|
79
77
|
constructor(stage: Stage);
|
|
80
|
-
/** shows the last
|
|
78
|
+
/** shows the last TP.numPlayers start of turn lines */
|
|
81
79
|
turnLog: TextLog;
|
|
82
80
|
/** show [13] other interesting log strings */
|
|
83
81
|
textLog: TextLog;
|
|
84
|
-
|
|
85
|
-
logText(line: string, from?: string): void;
|
|
82
|
+
/** write '// ${turn}: ${line}' comment line to TextLog (& console) & logWriter */
|
|
83
|
+
logText(line: string, from?: string, toConsole?: boolean): void;
|
|
84
|
+
logCurPlayer(plyr: Player): void;
|
|
85
|
+
logTurnPlayer(line: string): void;
|
|
86
86
|
setupUndoButtons(xOffs: number, bSize: number, skipRad: number, bgr: XYWH, row?: number, col?: number): void;
|
|
87
87
|
showWinText(msg?: string, color?: string): void;
|
|
88
88
|
enableHexInspector(qY?: number, cont?: Container): HexShape;
|
|
@@ -462,10 +462,26 @@ export declare class Table {
|
|
|
462
462
|
* six panel locations [row, col, dir][].
|
|
463
463
|
*
|
|
464
464
|
* col==0 is on left edge of hexMap; The *center* hex is col == (nHexes-1)
|
|
465
|
+
* @example
|
|
466
|
+
* P0 --- P3
|
|
467
|
+
* P1 --C-- P4
|
|
468
|
+
* P2 --- P5
|
|
469
|
+
*/
|
|
470
|
+
getPanelLocs(): number[][];
|
|
471
|
+
/**
|
|
472
|
+
* Which PanelLocs to use for a given number of Players
|
|
473
|
+
* @param np number of Players
|
|
474
|
+
* @returns array of indices into PanelLocs (one for each Player)
|
|
475
|
+
*/
|
|
476
|
+
panelLocsForNp(np: number): number[];
|
|
477
|
+
/** Panel location for the nth of nPlayers.
|
|
478
|
+
*
|
|
479
|
+
* @param pIndex Player index (0 .. nPlayers-1)
|
|
480
|
+
* @param nPlayers [allPlayers.length] total number of Players
|
|
481
|
+
* @param panelLocs [getPanelLocs] potential panel locations
|
|
482
|
+
* @return panelLocs[panelLocsForNp(nPlayers)][pIndex]
|
|
465
483
|
*/
|
|
466
|
-
|
|
467
|
-
/** select from setPanelLoc, based on pIndex from total np */
|
|
468
|
-
panelLoc(pIndex: number, np?: number, locs?: number[][]): number[];
|
|
484
|
+
panelLoc(pIndex: number, nPlayers?: number, panelLocs?: number[][]): number[];
|
|
469
485
|
readonly allPlayerPanels: PlayerPanel[];
|
|
470
486
|
/** make player panels, placed at panelLoc... */
|
|
471
487
|
makePerPlayer(): void;
|
|
@@ -641,7 +657,15 @@ export declare class Table {
|
|
|
641
657
|
showNetworkGroup(group_name?: string): void;
|
|
642
658
|
doneButton: UtilButton;
|
|
643
659
|
doneClicked: (evt?: any) => void;
|
|
644
|
-
|
|
660
|
+
/**
|
|
661
|
+
* May be contained or placed with ActionSelection buttons.
|
|
662
|
+
* @param cont [scaleCont] a Container to hold the DoneButton
|
|
663
|
+
* @param cx [0] offset in Container (to 'center', 'left', 'right' per align)
|
|
664
|
+
* @param cy [0] offset in Container (to top of text box)
|
|
665
|
+
* @param align ['center'] left or right
|
|
666
|
+
* @returns actionCont
|
|
667
|
+
*/
|
|
668
|
+
addDoneButton(cont?: Container, cx?: number, cy?: number, align?: string): Container;
|
|
645
669
|
/** show player player score on table */
|
|
646
670
|
setPlayerScore(plyr: Player, score: number, rank?: number): void;
|
|
647
671
|
/** update table when a new Game is started.
|
|
@@ -1305,8 +1329,8 @@ export declare class Table {
|
|
|
1305
1329
|
*/
|
|
1306
1330
|
dragTarget(dragObj?: DisplayObject, xy?: XY): void;
|
|
1307
1331
|
startDragging(dragObj: DisplayObject, xy?: XY): void;
|
|
1308
|
-
logCurPlayer(plyr: Player): void;
|
|
1309
1332
|
showRedoUndoCount(): void;
|
|
1333
|
+
/** log --> comment line to [console], TextLog, logWriter; showRedoUndoCount() */
|
|
1310
1334
|
showNextPlayer(log?: boolean): void;
|
|
1311
1335
|
_tablePlanner: TablePlanner;
|
|
1312
1336
|
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":"
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../src/table.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAS,WAAW,EAAe,EAAE,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAwC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAa,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAa,SAAS,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACvN,OAAO,EAAE,SAAS,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAElG,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;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EAAE,SAAM,EAAE,EAAE;;;KAAiB;IAU1C,IAAI,CAAC,CAAC,SAAM;IAQZ,GAAG,CAAC,EAAE,EAAE,EAAE;IAKV;;;;;;OAMG;IACH,aAAa;CAWd;AACD,KAAK,IAAI,GAAG,EAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
package/dist/table.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AT, C, F, S, stime } from "@thegraid/common-lib";
|
|
2
|
+
import { afterUpdate, CenterText, CircleShape, Dispatcher, Dragger, KeyBinder, NamedContainer, ParamGUI, RectShape, ScaleableContainer } from "@thegraid/easeljs-lib";
|
|
3
|
+
import { Container, Graphics, Shape, Text } from "@thegraid/easeljs-module";
|
|
3
4
|
import { EBC, PidChoice } from "./choosers";
|
|
4
|
-
import {
|
|
5
|
+
import { TileEvent } from "./game-play";
|
|
5
6
|
import { RecycleHex } from "./hex";
|
|
6
|
-
import { Player } from "./player";
|
|
7
7
|
import { PlayerPanel } from "./player-panel";
|
|
8
|
-
import {
|
|
8
|
+
import { HexShape, UtilButton } from "./shapes";
|
|
9
9
|
import { playerColor0, playerColor1, TP } from "./table-params";
|
|
10
10
|
import { Tile } from "./tile";
|
|
11
11
|
/** to own file... */
|
|
@@ -15,7 +15,7 @@ class TablePlanner {
|
|
|
15
15
|
class TextLog extends NamedContainer {
|
|
16
16
|
size;
|
|
17
17
|
lead;
|
|
18
|
-
constructor(Aname, nlines = 6, size =
|
|
18
|
+
constructor(Aname, nlines = 6, size = TP.hexRad / 2, lead = 3) {
|
|
19
19
|
super(Aname);
|
|
20
20
|
this.size = size;
|
|
21
21
|
this.lead = lead;
|
|
@@ -27,8 +27,8 @@ class TextLog extends NamedContainer {
|
|
|
27
27
|
lines;
|
|
28
28
|
lastLine = '';
|
|
29
29
|
nReps = 0;
|
|
30
|
-
height(
|
|
31
|
-
return (this.size + this.lead) *
|
|
30
|
+
height(nLines = this.lines.length) {
|
|
31
|
+
return (this.size + this.lead) * nLines;
|
|
32
32
|
}
|
|
33
33
|
clear() {
|
|
34
34
|
this.lines.forEach(tline => tline.text = '');
|
|
@@ -43,8 +43,9 @@ class TextLog extends NamedContainer {
|
|
|
43
43
|
spaceLines(cy = 0, lead = this.lead) {
|
|
44
44
|
this.lines.forEach(tline => (tline.y = cy, cy += tline.getMeasuredLineHeight() + lead));
|
|
45
45
|
}
|
|
46
|
+
/** convert line to single-line; inc count if same line; insert & scroll up */
|
|
46
47
|
log(line, from = '', toConsole = true) {
|
|
47
|
-
line = line.replace(
|
|
48
|
+
line = line.replace(/\n/g, '-');
|
|
48
49
|
toConsole && console.log(stime(`${from}:`), line);
|
|
49
50
|
if (line === this.lastLine) {
|
|
50
51
|
this.lines[this.lines.length - 1].text = `[${++this.nReps}] ${line}`;
|
|
@@ -64,16 +65,11 @@ class TextLog extends NamedContainer {
|
|
|
64
65
|
*
|
|
65
66
|
* uses a HexMap\<IHex2\>
|
|
66
67
|
*/
|
|
67
|
-
export class Table {
|
|
68
|
+
export class Table extends Dispatcher {
|
|
68
69
|
static table;
|
|
69
70
|
static stageTable(obj) {
|
|
70
71
|
return obj.stage.table;
|
|
71
72
|
}
|
|
72
|
-
disp = this;
|
|
73
|
-
namedOn(Aname, type, listener, scope, once, data, useCapture = false) {
|
|
74
|
-
const list2 = this.disp.on(type, listener, scope, once, data, useCapture);
|
|
75
|
-
list2.Aname = Aname;
|
|
76
|
-
}
|
|
77
73
|
gamePlay;
|
|
78
74
|
stage;
|
|
79
75
|
bgRect;
|
|
@@ -98,8 +94,7 @@ export class Table {
|
|
|
98
94
|
hexC;
|
|
99
95
|
overlayCont = new NamedContainer('overlay');
|
|
100
96
|
constructor(stage) {
|
|
101
|
-
|
|
102
|
-
EventDispatcher.initialize(this);
|
|
97
|
+
super();
|
|
103
98
|
// backpointer so Containers can find their Table (& curMark)
|
|
104
99
|
Table.table = stage.table = this;
|
|
105
100
|
this.stage = stage;
|
|
@@ -111,20 +106,28 @@ export class Table {
|
|
|
111
106
|
this.bindKeys();
|
|
112
107
|
}
|
|
113
108
|
}
|
|
114
|
-
/** shows the last
|
|
115
|
-
turnLog = new TextLog('turnLog',
|
|
109
|
+
/** shows the last TP.numPlayers start of turn lines */
|
|
110
|
+
turnLog = new TextLog('turnLog', TP.numPlayers);
|
|
116
111
|
/** show [13] other interesting log strings */
|
|
117
112
|
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
|
|
113
|
+
/** write '// ${turn}: ${line}' comment line to TextLog (& console) & logWriter */
|
|
114
|
+
logText(line, from = '', toConsole = true) {
|
|
115
|
+
const text = this.textLog.log(`${this.gamePlay.turnNumber}: ${line}`, from || '***', toConsole); // scrolling lines below
|
|
123
116
|
this.gamePlay.logWriter.writeLine(`// ${text}`);
|
|
124
117
|
// JSON string, instead of JSON5 comment:
|
|
125
118
|
// const text = this.textLog.log(`${this.gamePlay.turnNumber}: ${line}`, from); // scrolling lines below
|
|
126
119
|
// this.gamePlay.logWriter.writeLine(`"${line}",`);
|
|
127
120
|
}
|
|
121
|
+
logCurPlayer(plyr) {
|
|
122
|
+
const tn = this.gamePlay.turnNumber;
|
|
123
|
+
const robo = plyr.useRobo ? AT.ansiText(['red', 'bold'], "robo") : "----";
|
|
124
|
+
const info = { turn: tn, gamePlay: this.gamePlay, curPlayer: plyr, plyr: plyr.Aname };
|
|
125
|
+
console.log(stime(this, `.logCurPlayer --${robo}--`), info);
|
|
126
|
+
this.logTurnPlayer(`//${tn}: ${plyr.Aname}`);
|
|
127
|
+
}
|
|
128
|
+
logTurnPlayer(line) {
|
|
129
|
+
this.turnLog.log(line, 'table.logTurn', false); // in top two lines
|
|
130
|
+
}
|
|
128
131
|
setupUndoButtons(xOffs, bSize, skipRad, bgr, row = 8, col = -7) {
|
|
129
132
|
const undoC = this.undoCont; // holds the undo buttons.
|
|
130
133
|
this.setToRowCol(undoC, row, col);
|
|
@@ -224,7 +227,7 @@ export class Table {
|
|
|
224
227
|
console.log(stime('GamePlay', `.reCacheTiles: TP.cacheTiles=`), TP.cacheTiles, this.scaleCont.scaleX);
|
|
225
228
|
Tile.allTiles.forEach(tile => {
|
|
226
229
|
const rad = tile.radius;
|
|
227
|
-
tile.
|
|
230
|
+
tile.setBoundsNull();
|
|
228
231
|
if (tile.cacheID) {
|
|
229
232
|
tile.uncache();
|
|
230
233
|
const { x, y, width, height } = tile.getBounds() ?? { x: -rad, y: -rad, width: 2 * rad, height: 2 * rad };
|
|
@@ -338,7 +341,7 @@ export class Table {
|
|
|
338
341
|
const parent = this.scaleCont;
|
|
339
342
|
this.setToRowCol(this.turnLog, rowy, colx);
|
|
340
343
|
this.setToRowCol(this.textLog, rowy, colx);
|
|
341
|
-
this.textLog.y += this.turnLog.height(
|
|
344
|
+
this.textLog.y += this.turnLog.height(TP.numPlayers + 1); // allow room for 1 line per player
|
|
342
345
|
parent.addChild(this.turnLog, this.textLog);
|
|
343
346
|
parent.stage.update();
|
|
344
347
|
}
|
|
@@ -386,20 +389,19 @@ export class Table {
|
|
|
386
389
|
*/
|
|
387
390
|
makeGUIs(scale = TP.hexRad / 60, cx = -200, cy = 250, dy = 20) {
|
|
388
391
|
const scaleCont = this.scaleCont;
|
|
389
|
-
let
|
|
390
|
-
const
|
|
392
|
+
let wmax = 0, ymax = 0;
|
|
393
|
+
const guiWYmax = (gui) => {
|
|
391
394
|
ymax += (gui.ymax + dy);
|
|
392
|
-
|
|
395
|
+
wmax = Math.max(wmax, gui.children[0].getBounds().width);
|
|
396
|
+
return gui;
|
|
393
397
|
};
|
|
394
398
|
const guis = [this.makeNetworkGUI, this.makeParamGUI, this.makeParamGUI2].map(mgf => {
|
|
395
|
-
|
|
396
|
-
align(gui);
|
|
397
|
-
return gui;
|
|
399
|
+
return guiWYmax(this.gpanel(mgf, cx, cy + ymax, scale));
|
|
398
400
|
});
|
|
401
|
+
guis.forEach(gui => gui.x -= wmax);
|
|
399
402
|
scaleCont.addChild(...guis.reverse()); // lower y values ABOVE to dropdown is not obscured
|
|
400
|
-
guis.forEach(gui => gui.x -= lmax);
|
|
401
403
|
// TODO: dropdown to use given 'top' container!
|
|
402
|
-
|
|
404
|
+
scaleCont.stage.update();
|
|
403
405
|
}
|
|
404
406
|
get panelHeight() { return (2 * TP.nHexes - 1) / 3 - .2; }
|
|
405
407
|
get panelOffset() { return TP.nHexes + 2; }
|
|
@@ -407,8 +409,12 @@ export class Table {
|
|
|
407
409
|
* six panel locations [row, col, dir][].
|
|
408
410
|
*
|
|
409
411
|
* col==0 is on left edge of hexMap; The *center* hex is col == (nHexes-1)
|
|
412
|
+
* @example
|
|
413
|
+
* P0 --- P3
|
|
414
|
+
* P1 --C-- P4
|
|
415
|
+
* P2 --- P5
|
|
410
416
|
*/
|
|
411
|
-
|
|
417
|
+
getPanelLocs() {
|
|
412
418
|
const r0 = this.hexMap.centerHex.row, dr = this.panelHeight + .2;
|
|
413
419
|
const cc = this.hexMap.centerHex.col, coff = this.panelOffset;
|
|
414
420
|
const c0 = cc - coff, c1 = cc + coff;
|
|
@@ -418,18 +424,32 @@ export class Table {
|
|
|
418
424
|
];
|
|
419
425
|
return locs;
|
|
420
426
|
}
|
|
421
|
-
/**
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
427
|
+
/**
|
|
428
|
+
* Which PanelLocs to use for a given number of Players
|
|
429
|
+
* @param np number of Players
|
|
430
|
+
* @returns array of indices into PanelLocs (one for each Player)
|
|
431
|
+
*/
|
|
432
|
+
panelLocsForNp(np) {
|
|
433
|
+
return [[], [0], [0, 3], [0, 3, 1], [0, 3, 4, 1], [0, 3, 4, 2, 1], [0, 3, 4, 5, 2, 1]][np];
|
|
434
|
+
}
|
|
435
|
+
/** Panel location for the nth of nPlayers.
|
|
436
|
+
*
|
|
437
|
+
* @param pIndex Player index (0 .. nPlayers-1)
|
|
438
|
+
* @param nPlayers [allPlayers.length] total number of Players
|
|
439
|
+
* @param panelLocs [getPanelLocs] potential panel locations
|
|
440
|
+
* @return panelLocs[panelLocsForNp(nPlayers)][pIndex]
|
|
441
|
+
*/
|
|
442
|
+
panelLoc(pIndex, nPlayers = Math.min(TP.numPlayers, 6), panelLocs = this.getPanelLocs()) {
|
|
443
|
+
const seqn = this.panelLocsForNp(nPlayers);
|
|
444
|
+
const ndx = seqn[Math.min(pIndex, nPlayers - 1)];
|
|
445
|
+
return panelLocs[ndx];
|
|
426
446
|
}
|
|
427
447
|
allPlayerPanels = [];
|
|
428
448
|
/** make player panels, placed at panelLoc... */
|
|
429
449
|
makePerPlayer() {
|
|
430
450
|
this.allPlayerPanels.length = 0; // TODO: maybe deconstruct
|
|
431
451
|
const high = this.panelHeight, wide = 4.5;
|
|
432
|
-
const np = Math.min(
|
|
452
|
+
const np = Math.min(TP.numPlayers, 6), locs = this.getPanelLocs();
|
|
433
453
|
this.gamePlay.forEachPlayer((player, pIndex) => {
|
|
434
454
|
const [row, col, dir] = this.panelLoc(pIndex, np, locs);
|
|
435
455
|
this.allPlayerPanels[pIndex] = player.panel = new PlayerPanel(this, player, high, wide, row - high / 2, col - wide / 2, dir);
|
|
@@ -458,7 +478,7 @@ export class Table {
|
|
|
458
478
|
hex.legalMark.setOnHex(hex);
|
|
459
479
|
hex.cont.visible = false;
|
|
460
480
|
}
|
|
461
|
-
makeCircleButton(color = C.WHITE, rad =
|
|
481
|
+
makeCircleButton(color = C.WHITE, rad = TP.hexRad / 3, c, fs = rad * 3 / 2) {
|
|
462
482
|
const button = new Container();
|
|
463
483
|
button.name = 'circle';
|
|
464
484
|
const shape = new CircleShape(color, rad, '');
|
|
@@ -472,7 +492,7 @@ export class Table {
|
|
|
472
492
|
button.mouseEnabled = false;
|
|
473
493
|
return button;
|
|
474
494
|
}
|
|
475
|
-
makeSquareButton(color = C.WHITE, xywh, c, fs =
|
|
495
|
+
makeSquareButton(color = C.WHITE, xywh, c, fs = TP.hexRad / 2) {
|
|
476
496
|
const button = new Container();
|
|
477
497
|
button.name = 'square';
|
|
478
498
|
const shape = new RectShape(xywh, color, '');
|
|
@@ -579,24 +599,33 @@ export class Table {
|
|
|
579
599
|
this.doneButton.visible = false;
|
|
580
600
|
this.gamePlay.phaseDone(); // <--- main doneButton does not supply 'panel'
|
|
581
601
|
};
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
602
|
+
/**
|
|
603
|
+
* May be contained or placed with ActionSelection buttons.
|
|
604
|
+
* @param cont [scaleCont] a Container to hold the DoneButton
|
|
605
|
+
* @param cx [0] offset in Container (to 'center', 'left', 'right' per align)
|
|
606
|
+
* @param cy [0] offset in Container (to top of text box)
|
|
607
|
+
* @param align ['center'] left or right
|
|
608
|
+
* @returns actionCont
|
|
609
|
+
*/
|
|
610
|
+
addDoneButton(cont = this.scaleCont, cx = 0, cy = 0, align = 'center') {
|
|
611
|
+
const doneButton = this.doneButton = new UtilButton('Done', { bgColor: 'lightgreen' });
|
|
612
|
+
doneButton.disp.textAlign = align; // Note: baseline is still 'middle'
|
|
613
|
+
const { x, y, width: w, height: h } = doneButton.getBounds();
|
|
585
614
|
doneButton.name = 'doneButton';
|
|
586
|
-
doneButton.x = -
|
|
587
|
-
doneButton.y =
|
|
588
|
-
doneButton.label.textAlign = 'right';
|
|
615
|
+
doneButton.x = cx - 0; // XY is the top-right corner, align extends to left
|
|
616
|
+
doneButton.y = cy - y; // XY is the top-right corner, align extends to left
|
|
589
617
|
doneButton.on(S.click, this.doneClicked, this);
|
|
590
|
-
|
|
591
|
-
// prefix advice: set text color
|
|
618
|
+
cont.addChild(doneButton);
|
|
619
|
+
// prefix advice: set text color to contrast with RectShape color
|
|
620
|
+
// TODO: add as option to UtilButton
|
|
592
621
|
const o_cgf = doneButton.rectShape.cgf;
|
|
593
622
|
const cgf = (color) => {
|
|
594
|
-
const tcolor = (C.dist(color, C.WHITE) < C.dist(color, C.
|
|
595
|
-
doneButton.
|
|
596
|
-
return o_cgf(color);
|
|
623
|
+
const tcolor = (C.dist(color, C.WHITE) < C.dist(color, C.BLACK)) ? C.black : C.white;
|
|
624
|
+
doneButton.disp.color = tcolor;
|
|
625
|
+
return o_cgf.call(doneButton.rectShape, color);
|
|
597
626
|
};
|
|
598
627
|
doneButton.rectShape.cgf = cgf; // invokes shape.paint(cgf) !!
|
|
599
|
-
return
|
|
628
|
+
return cont;
|
|
600
629
|
}
|
|
601
630
|
/** show player player score on table */
|
|
602
631
|
setPlayerScore(plyr, score, rank) {
|
|
@@ -782,17 +811,11 @@ export class Table {
|
|
|
782
811
|
startDragging(dragObj, xy = { x: 0, y: 0 }) {
|
|
783
812
|
this.dragger.dragTarget(dragObj, xy);
|
|
784
813
|
}
|
|
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
814
|
showRedoUndoCount() {
|
|
793
815
|
this.undoText.text = `${this.gamePlay.undoRecs.length}`;
|
|
794
816
|
this.redoText.text = `${this.gamePlay.redoMoves.length}`;
|
|
795
817
|
}
|
|
818
|
+
/** log --> comment line to [console], TextLog, logWriter; showRedoUndoCount() */
|
|
796
819
|
showNextPlayer(log = true) {
|
|
797
820
|
let curPlayer = this.gamePlay.curPlayer; // after gamePlay.setNextPlayer()
|
|
798
821
|
if (log)
|
|
@@ -822,7 +845,7 @@ export class Table {
|
|
|
822
845
|
moveTileToHex(tile, ihex) {
|
|
823
846
|
const hex = this.hexMap.getHex(ihex);
|
|
824
847
|
this.hexMap.showMark(hex);
|
|
825
|
-
this.
|
|
848
|
+
this.dispatchEvent(new TileEvent(S.add, tile, hex)); // -> GamePlay.playerMoveEvent(hex, sc)
|
|
826
849
|
}
|
|
827
850
|
/** default scaling-up value */
|
|
828
851
|
upscale = 1.5;
|
|
@@ -852,8 +875,7 @@ export class Table {
|
|
|
852
875
|
KeyBinder.keyBinder.setKey('S-Space', () => this.dragTarget());
|
|
853
876
|
KeyBinder.keyBinder.setKey('t', () => this.toggleText());
|
|
854
877
|
// of dubious utility...
|
|
855
|
-
|
|
856
|
-
KeyBinder.keyBinder.setKey("p", { func: () => getOop(), thisArg: this });
|
|
878
|
+
KeyBinder.keyBinder.setKey("p", () => this.stage.getObjectsUnderPoint(500, 100, 1));
|
|
857
879
|
}
|
|
858
880
|
/** put a Rectangle Shape at (0,0) with XYWH bounds as given */
|
|
859
881
|
setBackground(parent, bounds, bgColor = TP.bgColor) {
|
|
@@ -892,9 +914,9 @@ export class Table {
|
|
|
892
914
|
views = [this.viewA, this.viewZ];
|
|
893
915
|
}
|
|
894
916
|
views.forEach(view => {
|
|
895
|
-
KeyBinder.keyBinder.setKey(view.isk,
|
|
917
|
+
KeyBinder.keyBinder.setKey(view.isk, () => invokeView(view));
|
|
896
918
|
if (view.ssk)
|
|
897
|
-
KeyBinder.keyBinder.setKey(view.ssk,
|
|
919
|
+
KeyBinder.keyBinder.setKey(view.ssk, () => saveView(view));
|
|
898
920
|
});
|
|
899
921
|
if (views?.[0])
|
|
900
922
|
KeyBinder.keyBinder.dispatchChar(views[0].isk);
|