cortico-world-parlor 0.36.9 → 0.37.0
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/CHANGELOG.md +8 -0
- package/README.md +11 -0
- package/package.json +1 -1
- package/src/room/client.ts +1 -1
- package/src/room/games/gomoku-table.ts +105 -17
- package/src/web/announcement-banner.js +2 -2
- package/src/web/appearance.css +4 -0
- package/src/web/club.css +1 -1
- package/src/web/games/registry.js +2 -2
- package/src/web/night.css +3 -2
- package/src/web/parent.html +2 -2
- package/src/web/play.html +5 -5
- package/src/web/play.js +8 -8
- package/src/web/support-link.js +1 -1
- package/src/web/vue/{chunk-B1-lslHa.js → chunk-FLwAZb_7.js} +1 -1
- package/src/web/vue/main.js +1 -1
- package/src/web/vue/vue-style.css +1 -1
- package/src/world.ts +40 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 0.37.0(2026-11-06)
|
|
2
|
+
|
|
3
|
+
- 补齐开桌提示里缺的两款新玩法席位数(五子棋 2 席、快局大富翁 4 席),两代网页同步;修复原生下拉选项浅色文字叠在系统白色弹层上看不清的问题(`select option` 显式指定背景与前景色),并让窄屏下的筛选容器换行。
|
|
4
|
+
- 两代网页补齐五子棋与快局大富翁玩法枚举:快速匹配、大厅筛选、账本筛选与旧页筛选都可按新玩法过滤;旧页过滤条件改为通用匹配,配套定向用例验证 2/4 席限流下能进新玩法桌。旧页仍不带新玩法渲染器,要玩新玩法请用默认新页。
|
|
5
|
+
- 五子棋落子提示升级为威胁分级:识别活三、双活三、四三等形状,按 `block` / `danger` 给出挡点与危险提示,网页牌桌加警告条。原有三个推荐点与私视图 `hints` 结构不变。
|
|
6
|
+
- Coo 工具返回的五子棋棋盘改为带行列标尺的点阵文本,建议改用 `(行,列)` 坐标并标出末手;`parlor_game_info {op:'state'}` 与 `parlor_game_action` 回执只裁剪重复的棋盘数据,网页侧与 HTTP 快照仍是完整 225 格数组。
|
|
7
|
+
- 包版本、客户端版本与网页资源 `?v=` 统一为 0.37.0;发布内容以 npm tarball 为准。无数据库迁移,网页端刷新即用新资源;Coo 侧扩展升级并重新加载会话工具后新点阵输出生效。
|
|
8
|
+
|
|
1
9
|
## 0.36.9(2026-11-06)
|
|
2
10
|
|
|
3
11
|
- 修复 Coo 本地消息补档每分钟对到访客厅重复下载最近 200 条回放导致的高流量:新增只读 `/v1/me/history-sync`,按持久化游标只拉新增事件、正序分页、每页成功落盘后才推进;空轮询无历史正文。补档只传正文与收发/私聊去重标记,不再携带完整手牌和游戏状态;回放/补档大段 JSON 支持协商 gzip。到访区间及 event_audience 权限保持一致,旧网关保留回放兼容。增量需服务端和 Coo 同步更新;无 schema 或本地档案格式变更。
|
package/README.md
CHANGED
|
@@ -121,6 +121,17 @@ state 的 availableActions 只根据本人私视图生成;旁观者得到公
|
|
|
121
121
|
- 两款玩法都走 `parlor.game.v1`:`parlor_game_info {op:"state"}` 取本人桌面与可用动作,
|
|
122
122
|
`parlor_game_action` 提交;网页棋盘子包按需加载(五子棋约 4.5 KB、大富翁约 9.1 KB,gzip 前)。
|
|
123
123
|
|
|
124
|
+
## 0.37.0:两代网页玩法枚举与五子棋提示
|
|
125
|
+
|
|
126
|
+
这一版把四批已完成并通过独立复验的改动一起发布(对应 `5587a1a` / `baa9f59` / `7c2c020` / `ed42d4f`),没有新增数据库迁移:
|
|
127
|
+
|
|
128
|
+
- **开桌提示与下拉可读性**:两代网页的开桌提示补上「五子棋 2 席 · 大富翁 4 席」;原生下拉选项显式指定背景与文字色,避免浅色字叠在系统白色弹层上;窄屏筛选条允许换行。
|
|
129
|
+
- **两代网页玩法枚举**:快速匹配、大厅筛选、账本筛选、旧页筛选都补上 `gomoku` / `monopoly2d`,旧页过滤条件改为通用匹配。旧页仍不带新玩法渲染器,进新玩法桌会显示「已收起」;要玩新玩法请用默认新页。
|
|
130
|
+
- **五子棋落子提示**:引擎按活三/双活三/四三等威胁分级,网页牌桌显示挡点与危险警告条;推荐点数量与私视图结构不变。
|
|
131
|
+
- **Coo 工具棋盘输出**:`parlor_game_info {op:"state"}` 与 `parlor_game_action` 返回带行列标尺的点阵文本,`tablePrivate` 与 `tables[]` 不再重复带 board,建议用 `(行,列)` 坐标;网页与 HTTP 快照仍是完整 225 格数组。
|
|
132
|
+
|
|
133
|
+
**升级要求**:网页端刷新即用新资源(`?v=0.37.0`)。Coo 需升级扩展并重新加载会话工具才能看到新点阵输出;服务端与 Coo 都升级重启后,增量补档与新玩法能力才完整。无 schema 变化。
|
|
134
|
+
|
|
124
135
|
## 0.36.9:九工具收敛与增量历史补档
|
|
125
136
|
|
|
126
137
|
这一版把三批已完成并通过独立复验的改动一起发布(对应 `973c37d` / `db49784` / `6fdea04`),没有新增功能或数据库迁移:
|
package/package.json
CHANGED
package/src/room/client.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface ReplayResponse {
|
|
|
29
29
|
* 能不能玩需要新能力的游戏(狼人杀要 ≥ 0.29.0)。
|
|
30
30
|
* 它跟 npm 包版本解耦——发新版时在这里抬一格即可(有测试盯着别忘)。
|
|
31
31
|
*/
|
|
32
|
-
export const PARLOR_CLIENT_VERSION = '0.
|
|
32
|
+
export const PARLOR_CLIENT_VERSION = '0.37.0';
|
|
33
33
|
|
|
34
34
|
export class ParlorHttpError extends Error {
|
|
35
35
|
readonly status: number;
|
|
@@ -6,14 +6,32 @@ const CAPACITY = SIZE * SIZE;
|
|
|
6
6
|
type Color = 1 | 2;
|
|
7
7
|
type Point = { row: number; col: number };
|
|
8
8
|
type Move = Point & { color: Color };
|
|
9
|
-
/** win=这步连五;block=不挡就输;shape=做形/发展。前端据此区分提示样式。 */
|
|
10
9
|
type Level = 'win' | 'block' | 'shape';
|
|
11
10
|
type Hint = Point & { reason: string; level: Level };
|
|
11
|
+
type Warning = { level: 'block' | 'danger'; text: string };
|
|
12
|
+
type OpenThree = { blocks: number[]; canMakeOpenFour: boolean };
|
|
12
13
|
const directions = [[0, 1], [1, 0], [1, 1], [1, -1]] as const;
|
|
13
14
|
const other = (color: Color): Color => color === 1 ? 2 : 1;
|
|
14
15
|
const inside = (row: number, col: number) => row >= 0 && row < SIZE && col >= 0 && col < SIZE;
|
|
15
16
|
const index = (row: number, col: number) => row * SIZE + col;
|
|
16
17
|
|
|
18
|
+
export function formatGomokuBoard(board: readonly number[], last?: Point): string {
|
|
19
|
+
const rows = Array.from({ length: SIZE }, (_, row) => {
|
|
20
|
+
const cells = board.slice(index(row, 0), index(row + 1, 0)).map((cell, col) => {
|
|
21
|
+
const stone = '.XO'[cell];
|
|
22
|
+
return row === last?.row && col === last.col ? stone.toLowerCase() : stone;
|
|
23
|
+
}).join('');
|
|
24
|
+
return `${String(row).padStart(2)} ${cells}`;
|
|
25
|
+
});
|
|
26
|
+
return ['X黑 O白 .空,小写是末手。列号上下合读。', ' 11111', ' 012345678901234', ...rows].join('\n');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function formatGomokuAdvice(hints: readonly Hint[], warning?: Warning): string {
|
|
30
|
+
const suggestions = hints.map(({ row, col, reason, level }) =>
|
|
31
|
+
`(${row},${col}) ${level === 'win' ? '连五' : reason}`).join(';');
|
|
32
|
+
return [warning?.text, suggestions && `建议(行,列):${suggestions}`].filter(Boolean).join('\n');
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
function bestLine(board: readonly number[], { row: originRow, col: originCol }: Point, color: Color): Point[] {
|
|
18
36
|
const point = { row: originRow, col: originCol };
|
|
19
37
|
let best: Point[] = [point];
|
|
@@ -33,24 +51,93 @@ function bestLine(board: readonly number[], { row: originRow, col: originCol }:
|
|
|
33
51
|
return best;
|
|
34
52
|
}
|
|
35
53
|
|
|
36
|
-
|
|
37
|
-
const
|
|
54
|
+
function findOpenThrees(board: readonly number[], color: Color): OpenThree[] {
|
|
55
|
+
const threes: OpenThree[] = [];
|
|
56
|
+
const isEmpty = (row: number, col: number) => inside(row, col) && board[index(row, col)] === 0;
|
|
57
|
+
for (let i = 0; i < CAPACITY; i++) {
|
|
58
|
+
if (board[i] !== color) continue;
|
|
59
|
+
const row = Math.floor(i / SIZE), col = i % SIZE;
|
|
60
|
+
for (const [dr, dc] of directions) {
|
|
61
|
+
if (!isEmpty(row - dr, col - dc) || !isEmpty(row + 3 * dr, col + 3 * dc)
|
|
62
|
+
|| board[index(row + dr, col + dc)] !== color || board[index(row + 2 * dr, col + 2 * dc)] !== color) continue;
|
|
63
|
+
const blocks = [index(row - dr, col - dc), index(row + 3 * dr, col + 3 * dc)];
|
|
64
|
+
const canExtendBefore = isEmpty(row - 2 * dr, col - 2 * dc);
|
|
65
|
+
const canExtendAfter = isEmpty(row + 4 * dr, col + 4 * dc);
|
|
66
|
+
// 只有一侧能延伸成活四时,封住那一侧的外端也能化解这条威胁。
|
|
67
|
+
if (canExtendBefore && !canExtendAfter) blocks.push(index(row - 2 * dr, col - 2 * dc));
|
|
68
|
+
if (canExtendAfter && !canExtendBefore) blocks.push(index(row + 4 * dr, col + 4 * dc));
|
|
69
|
+
threes.push({ blocks, canMakeOpenFour: canExtendBefore || canExtendAfter });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return threes;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function makesFour(board: readonly number[], { row, col }: Point, color: Color): boolean {
|
|
76
|
+
// 包含本手的五格里,有三颗己方棋子和一个空位即可冲四,空位也可以在中间。
|
|
77
|
+
for (const [dr, dc] of directions) {
|
|
78
|
+
for (let start = -4; start <= 0; start++) {
|
|
79
|
+
const end = start + 4;
|
|
80
|
+
if (!inside(row + start * dr, col + start * dc) || !inside(row + end * dr, col + end * dc)) continue;
|
|
81
|
+
let stones = 0, empty = 0;
|
|
82
|
+
for (let offset = start; offset <= end; offset++) {
|
|
83
|
+
if (offset === 0) continue;
|
|
84
|
+
const cell = board[index(row + offset * dr, col + offset * dc)];
|
|
85
|
+
if (cell === color) stones++;
|
|
86
|
+
if (cell === 0) empty++;
|
|
87
|
+
}
|
|
88
|
+
if (stones === 3 && empty === 1) return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function analyzeGomoku(board: readonly number[], color: Color): { hints: Hint[]; warning: Warning | null } {
|
|
95
|
+
const opponent = other(color);
|
|
96
|
+
const threes = findOpenThrees(board, opponent);
|
|
97
|
+
const forcingThrees = threes.filter(three => three.canMakeOpenFour);
|
|
98
|
+
const winningReplies: number[] = [];
|
|
99
|
+
const candidates: Array<Point & { attack: number; defense: number }> = [];
|
|
38
100
|
for (let i = 0; i < CAPACITY; i++) {
|
|
39
101
|
if (board[i] !== 0) continue;
|
|
40
102
|
const point = { row: Math.floor(i / SIZE), col: i % SIZE };
|
|
41
103
|
const attack = bestLine(board, point, color).length;
|
|
42
|
-
const defense = bestLine(board, point,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
104
|
+
const defense = bestLine(board, point, opponent).length;
|
|
105
|
+
if (defense >= 5) winningReplies.push(i);
|
|
106
|
+
candidates.push({ ...point, attack, defense });
|
|
107
|
+
}
|
|
108
|
+
const fourThree = winningReplies.length === 1 && forcingThrees.some(three => !three.blocks.includes(winningReplies[0]!));
|
|
109
|
+
const doubleThree = forcingThrees.length >= 2 && !forcingThrees[0]!.blocks.some(point =>
|
|
110
|
+
forcingThrees.every(three => three.blocks.includes(point)));
|
|
111
|
+
const warning: Warning | null = fourThree ? { level: 'danger', text: '对方四三,单手封堵挡不住两路。' }
|
|
112
|
+
: doubleThree ? { level: 'danger', text: '对方双活三,单手封堵挡不住两路。' }
|
|
113
|
+
: threes.length ? { level: 'block', text: '对方有活三。不堵就被连成五,有冲四时可抢先手。' } : null;
|
|
114
|
+
const ranked = candidates.map(({ row, col, attack, defense }) => {
|
|
115
|
+
const i = index(row, col);
|
|
116
|
+
const blockedThrees = threes.filter(three => three.blocks.includes(i));
|
|
117
|
+
const blocksThree = blockedThrees.length;
|
|
118
|
+
const blocksEnd = blockedThrees.some(({ blocks: [before, after] }) => i === before || i === after);
|
|
119
|
+
const counterFour = threes.length > 0 && winningReplies.length === 0 && attack < 5
|
|
120
|
+
&& makesFour(board, { row, col }, color);
|
|
121
|
+
const distance = Math.abs(row - 7) + Math.abs(col - 7);
|
|
122
|
+
const priority = attack >= 5 ? 5 : defense >= 5 ? 4 : doubleThree && counterFour ? 3
|
|
123
|
+
: blocksEnd || blocksThree > 1 ? 2 : counterFour ? 1 : 0;
|
|
124
|
+
const score = (attack >= 5 || defense >= 5 ? 0 : 30 * attack + 18 * defense) - distance;
|
|
125
|
+
const level: Level = attack >= 5 ? 'win' : defense >= 5 || blocksThree ? 'block' : 'shape';
|
|
46
126
|
const reason = level === 'win' ? '这一步可以连五获胜'
|
|
47
|
-
:
|
|
127
|
+
: defense >= 5 ? '挡住对方下一步连五'
|
|
128
|
+
: blocksThree ? '封堵对方活三'
|
|
129
|
+
: counterFour ? '冲四抢先手'
|
|
48
130
|
: attack >= 2 ? '延伸自己的棋形'
|
|
49
131
|
: defense >= 2 ? '限制对手的棋形' : '靠近棋盘中央';
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
132
|
+
return { row, col, level, priority, blocksThree, score, reason };
|
|
133
|
+
});
|
|
134
|
+
const hints = ranked.sort((a, b) => b.priority - a.priority || b.blocksThree - a.blocksThree || b.score - a.score).slice(0, 3)
|
|
53
135
|
.map(({ row, col, reason, level }) => ({ row, col, reason, level }));
|
|
136
|
+
return { hints, warning };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function gomokuHints(board: readonly number[], color: Color): Hint[] {
|
|
140
|
+
return analyzeGomoku(board, color).hints;
|
|
54
141
|
}
|
|
55
142
|
|
|
56
143
|
function isPoint(value: unknown): value is Point {
|
|
@@ -178,7 +265,8 @@ export class GomokuTable implements TableEngine {
|
|
|
178
265
|
view(seatId: string) {
|
|
179
266
|
if (!this.has(seatId)) return null;
|
|
180
267
|
const canAct = this.status === 'playing' && this.turnSeat?.id === seatId;
|
|
181
|
-
|
|
268
|
+
const { hints, warning } = canAct ? analyzeGomoku(this.board, this.color) : { hints: [], warning: null };
|
|
269
|
+
return { ...this.public(), seat: seatId, canAct, hints, ...(warning && { warning }) };
|
|
182
270
|
}
|
|
183
271
|
|
|
184
272
|
publicText(): string {
|
|
@@ -192,11 +280,11 @@ export class GomokuTable implements TableEngine {
|
|
|
192
280
|
const view = this.view(seatId);
|
|
193
281
|
if (!view) return null;
|
|
194
282
|
if (!view.canAct) return this.publicText();
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
283
|
+
return [
|
|
284
|
+
`${this.publicText()} 你执${this.color === 1 ? '黑' : '白'},行列 0–14。`,
|
|
285
|
+
formatGomokuBoard(view.board, view.last),
|
|
286
|
+
formatGomokuAdvice(view.hints, view.warning),
|
|
287
|
+
].filter(Boolean).join('\n');
|
|
200
288
|
}
|
|
201
289
|
|
|
202
290
|
exportState() {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { el, btn, icon } from './common.js';
|
|
7
7
|
/* 内部模块统一带同一个版本号:版本不一致会让浏览器当成两份,订阅会各记各的。 */
|
|
8
|
-
import { onAnnouncements } from './announcements.js?v=0.
|
|
9
|
-
import { pickAnnouncement, rememberDismissed, excerpt } from './announcement-rules.js?v=0.
|
|
8
|
+
import { onAnnouncements } from './announcements.js?v=0.37.0';
|
|
9
|
+
import { pickAnnouncement, rememberDismissed, excerpt } from './announcement-rules.js?v=0.37.0';
|
|
10
10
|
|
|
11
11
|
const DISMISSED_KEY = 'parlor-announcements-dismissed';
|
|
12
12
|
const SEEN_KEY = 'parlor-announcements-seen';
|
package/src/web/appearance.css
CHANGED
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
transform:translateY(-70%) rotate(45deg);
|
|
19
19
|
}
|
|
20
20
|
.theme-picker option { background:var(--panel-solid); color:var(--text); }
|
|
21
|
+
/* 全局兜底:原生 <select> 的 option 只继承文字色,弹层底色却由系统 color-scheme 画,
|
|
22
|
+
深色外观下会出现浅色文字压在白色弹层上(快速匹配、狼人杀人数、可见性等都受影响)。
|
|
23
|
+
显式给每个 option 一组不透明色,跟随当前外观的面板与正文 token。 */
|
|
24
|
+
select option { background:var(--panel-solid); color:var(--text); }
|
|
21
25
|
.join .panel { position:relative; }
|
|
22
26
|
.join .theme-picker { position:absolute; right:18px; top:18px; }
|
|
23
27
|
|
package/src/web/club.css
CHANGED
|
@@ -170,7 +170,7 @@ input::placeholder,textarea::placeholder { color:#92a69a; }
|
|
|
170
170
|
.club-welcome>.club-scene { position:absolute; right:0; top:0; height:100%; width:220px; background:none; opacity:.55; }
|
|
171
171
|
.members { padding:0 0 20px; background:none; border:0; border-bottom:1px solid var(--line); border-radius:0; margin-bottom:25px; }
|
|
172
172
|
.members .panel-head h2 { font-size:12px; font-weight:500; }.members .panel-head span { font-size:10px; }
|
|
173
|
-
.club-section-head { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:11px; margin-bottom:20px; }
|
|
173
|
+
.club-section-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; font-size:11px; margin-bottom:20px; }
|
|
174
174
|
.club-section-head h2 { font-size:20px; font-weight:500; }.club-section-head>.muted { font-size:10px; }
|
|
175
175
|
.club-table-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:15px; margin-bottom:28px; }
|
|
176
176
|
.club-table-card { background:#1a2b27; border:1px solid #3a5142; border-radius:14px; padding:16px; min-width:0; }
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* - `blurb` / `foot` / `guide` 是大厅卡片的文案与玩法说明。
|
|
11
11
|
*/
|
|
12
12
|
import { mountDice } from './dice.js';
|
|
13
|
-
import { mountDdz } from './ddz.js?v=0.
|
|
13
|
+
import { mountDdz } from './ddz.js?v=0.37.0';
|
|
14
14
|
import { mountMonopoly } from './monopoly.js';
|
|
15
|
-
import { mountWerewolf } from './werewolf.js?v=0.
|
|
15
|
+
import { mountWerewolf } from './werewolf.js?v=0.37.0';
|
|
16
16
|
|
|
17
17
|
export const GAMES = {
|
|
18
18
|
dice: {
|
package/src/web/night.css
CHANGED
|
@@ -703,7 +703,8 @@ html.vue-app .search {
|
|
|
703
703
|
}
|
|
704
704
|
html.vue-app .search::placeholder { color: var(--dim); }
|
|
705
705
|
html.vue-app .search:focus { border-color: rgba(217, 248, 125, .4); }
|
|
706
|
-
|
|
706
|
+
/* 五种玩法后会比三个按钮宽,允许在窄屏折行,别把整条筛选挤出目录头。 */
|
|
707
|
+
html.vue-app .filters { display: flex; align-items: center; flex-wrap: wrap; max-width: 100%; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--line); }
|
|
707
708
|
html.vue-app .filter { height: 28px; padding: 0 13px; border-radius: 999px; font-size: 12px; color: var(--muted); }
|
|
708
709
|
html.vue-app .filter:hover { color: var(--text); }
|
|
709
710
|
html.vue-app .filter.is-on { background: rgba(217, 248, 125, .14); color: var(--lime); }
|
|
@@ -1394,7 +1395,7 @@ html.vue-app .members, html.vue-app .view-table .panel, html.vue-app .view-lobby
|
|
|
1394
1395
|
html.vue-app .panel-head { display: flex; align-items: center; gap: 12px; }
|
|
1395
1396
|
html.vue-app .panel-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
|
|
1396
1397
|
html.vue-app .panel-head .muted { margin-left: auto; font-size: 11.5px; color: var(--muted); }
|
|
1397
|
-
html.vue-app .club-section-head { display: flex; align-items: baseline; gap: 12px; margin: 26px 0 0; }
|
|
1398
|
+
html.vue-app .club-section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin: 26px 0 0; }
|
|
1398
1399
|
html.vue-app .club-section-head h2 { margin: 0; font-size: 22px; font-weight: 700; }
|
|
1399
1400
|
html.vue-app .club-section-head .muted { margin-left: auto; font-size: 11.5px; color: var(--muted); }
|
|
1400
1401
|
html.vue-app .club-table-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
|
package/src/web/parent.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="color-scheme" content="light">
|
|
8
8
|
<meta name="referrer" content="no-referrer">
|
|
9
9
|
<title>客厅 · 家长</title>
|
|
10
|
-
<link rel="stylesheet" href="/parent/assets/parent.css?v=0.
|
|
10
|
+
<link rel="stylesheet" href="/parent/assets/parent.css?v=0.37.0">
|
|
11
11
|
</head>
|
|
12
12
|
<body class="theme-cozy">
|
|
13
13
|
<a class="skip-link" href="#main">跳到主要内容</a>
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
</main>
|
|
77
77
|
|
|
78
78
|
<div id="toast" class="toast" role="status" aria-live="polite" hidden></div>
|
|
79
|
-
<script type="module" src="/parent/assets/parent.js?v=0.
|
|
79
|
+
<script type="module" src="/parent/assets/parent.js?v=0.37.0"></script>
|
|
80
80
|
</body>
|
|
81
81
|
</html>
|
package/src/web/play.html
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
<meta name="theme-color" content="#10191b">
|
|
7
7
|
<meta name="color-scheme" content="dark light">
|
|
8
8
|
<title>鲸语会馆 · 今晚,来一局</title>
|
|
9
|
-
<script src="/play/assets/theme.js?v=0.
|
|
9
|
+
<script src="/play/assets/theme.js?v=0.37.0"></script>
|
|
10
10
|
<link rel="stylesheet" href="/play/assets/play.css">
|
|
11
|
-
<link rel="stylesheet" href="/play/assets/club.css?v=0.
|
|
12
|
-
<link rel="stylesheet" href="/play/assets/appearance.css?v=0.
|
|
13
|
-
<link rel="stylesheet" href="/play/assets/night.css?v=0.
|
|
11
|
+
<link rel="stylesheet" href="/play/assets/club.css?v=0.37.0">
|
|
12
|
+
<link rel="stylesheet" href="/play/assets/appearance.css?v=0.37.0">
|
|
13
|
+
<link rel="stylesheet" href="/play/assets/night.css?v=0.37.0">
|
|
14
14
|
</head>
|
|
15
15
|
<body class="theme-club">
|
|
16
16
|
<svg class="sprite" aria-hidden="true" width="0" height="0" focusable="false">
|
|
@@ -106,6 +106,6 @@
|
|
|
106
106
|
<div id="app" class="app"><div class="booting" id="boot-note">正在打开客厅…</div></div>
|
|
107
107
|
<div id="toast" class="toast" role="status" aria-live="polite" hidden></div>
|
|
108
108
|
<noscript><p class="noscript">这个页面要开 JavaScript 才能玩。</p></noscript>
|
|
109
|
-
<script type="module" src="/play/assets/vue-loader.js?v=0.
|
|
109
|
+
<script type="module" src="/play/assets/vue-loader.js?v=0.37.0"></script>
|
|
110
110
|
</body>
|
|
111
111
|
</html>
|
package/src/web/play.js
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
el, clear, icon, initialOf, fmtClock, fmtDateTime, fmtLeft, clockSpan, btn, playerClass,
|
|
6
6
|
isNearBottom, readable, GAME_LABELS, STATUS_LABELS, KIND_LABELS,
|
|
7
7
|
} from './common.js';
|
|
8
|
-
import { ENABLED_GAMES, GAMES, gameOf, gameLabel, gameIcon, heroGame } from './games/registry.js?v=0.
|
|
8
|
+
import { ENABLED_GAMES, GAMES, gameOf, gameLabel, gameIcon, heroGame } from './games/registry.js?v=0.37.0';
|
|
9
9
|
import { createClubState, conversationKey, readRoute, routeUrl } from './club-state.js';
|
|
10
10
|
import { createRoomCarousel } from './room-carousel.js';
|
|
11
|
-
import { supportLink } from './support-link.js?v=0.
|
|
12
|
-
import { mountAnnouncementBanner } from './announcement-banner.js?v=0.
|
|
13
|
-
import { startAnnouncementWatch } from './announcements.js?v=0.
|
|
11
|
+
import { supportLink } from './support-link.js?v=0.37.0';
|
|
12
|
+
import { mountAnnouncementBanner } from './announcement-banner.js?v=0.37.0';
|
|
13
|
+
import { startAnnouncementWatch } from './announcements.js?v=0.37.0';
|
|
14
14
|
|
|
15
15
|
const club = createClubState({
|
|
16
16
|
getItem: key => sessionStorage.getItem(key),
|
|
@@ -1322,7 +1322,7 @@ function buildShell() {
|
|
|
1322
1322
|
el('p', '', '同一个客厅,不同的好时光。想玩就入座,想聊就坐一会儿。'), clubScene('ddz'));
|
|
1323
1323
|
const roomTables = el('div', 'club-table-grid');
|
|
1324
1324
|
const tableSectionHead = el('div', 'club-section-head');
|
|
1325
|
-
tableSectionHead.append(el('h2', '', '挑张桌,坐下来'), el('span', 'muted', '斗地主 3 席 · 狼人杀 6/9/12 席'));
|
|
1325
|
+
tableSectionHead.append(el('h2', '', '挑张桌,坐下来'), el('span', 'muted', '斗地主 3 席 · 狼人杀 6/9/12 席 · 五子棋 2 席 · 大富翁 4 席'));
|
|
1326
1326
|
const stay = el('div', 'club-stay');
|
|
1327
1327
|
stay.append(el('strong', '', '✳ 不玩游戏,也欢迎留下来。'), el('p', '', '打开聊天,和这个客厅里的朋友说两句。'));
|
|
1328
1328
|
viewLobby.append(roomNavigation, lobbyHead, roomWelcome, members, tableSectionHead, roomTables, gameGrid, lobbyNotice, stay, guide);
|
|
@@ -1369,7 +1369,7 @@ function buildShell() {
|
|
|
1369
1369
|
search.addEventListener('input', () => { hallQuery = search.value; renderHall(); });
|
|
1370
1370
|
const filters = el('div', 'club-filters');
|
|
1371
1371
|
filters.setAttribute('aria-label', '筛选客厅');
|
|
1372
|
-
for (const [value, label] of [['all', '全部'], ['ddz', '斗地主'], ['werewolf', '狼人杀']]) {
|
|
1372
|
+
for (const [value, label] of [['all', '全部'], ['ddz', '斗地主'], ['werewolf', '狼人杀'], ['gomoku', '五子棋'], ['monopoly2d', '快局大富翁']]) {
|
|
1373
1373
|
const button = btn(label, () => { hallFilter = value; renderHall(); }, { ghost: true, small: true });
|
|
1374
1374
|
button.dataset.filter = value; filters.append(button);
|
|
1375
1375
|
}
|
|
@@ -2378,7 +2378,7 @@ function renderHall() {
|
|
|
2378
2378
|
const query = hallQuery.trim().toLocaleLowerCase();
|
|
2379
2379
|
const rooms = scopedRooms.filter(room => {
|
|
2380
2380
|
if (query && !(room.name + ' ' + (room.topic || '')).toLocaleLowerCase().includes(query)) return false;
|
|
2381
|
-
if (hallFilter
|
|
2381
|
+
if (hallFilter !== 'all') return (room.games || []).includes(hallFilter);
|
|
2382
2382
|
return true;
|
|
2383
2383
|
});
|
|
2384
2384
|
featuredCarousel.setRooms(allRooms);
|
|
@@ -3649,7 +3649,7 @@ function renderTableInfo() {
|
|
|
3649
3649
|
ui.infoTurn.textContent = table && table.turn ? (names.get(table.turn) || '?') : '—';
|
|
3650
3650
|
ui.ruleNote.textContent = table
|
|
3651
3651
|
? (RULES[table.game] || '')
|
|
3652
|
-
: (signup ? '大富翁正在报名;人数够了由发起人开局。' : '
|
|
3652
|
+
: (signup ? '大富翁正在报名;人数够了由发起人开局。' : '选个游戏开一桌,或者等 Coo 开。');
|
|
3653
3653
|
ui.infoClock.textContent = '服务器时刻 ' + fmtClock(serverNow()).slice(0, 5) + '(UTC+8)';
|
|
3654
3654
|
}
|
|
3655
3655
|
|
package/src/web/support-link.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** 公告入口独立刷新,避免打断牌桌和聊天草稿。取数在 announcements.js,首屏横幅用的是同一份。 */
|
|
2
|
-
import { onAnnouncements } from './announcements.js?v=0.
|
|
2
|
+
import { onAnnouncements } from './announcements.js?v=0.37.0';
|
|
3
3
|
|
|
4
4
|
export function supportLink(getToken) {
|
|
5
5
|
const link = document.createElement('a');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,c as n,f as r,g as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d,u as f,v as p,y as m}from"./main.js";var h={class:`gomoku`},g={class:`gomoku-result-copy`},_={class:`gomoku-layout`},v={class:`gomoku-frame`},y=[`aria-label`,`aria-pressed`,`disabled`,`onClick`],b={key:1,class:`star`,"aria-hidden":`true`},x={class:`gomoku-side`},S={class:`gomoku-meta`},C={class:`gomoku-plies`},w={class:`gomoku-seats`},T=[`disabled`],E=[`aria-expanded`],D=c(r({__name:`GomokuGame`,props:{view:{},ctx:{}},setup(r){let c=r,D=l(()=>c.view.table),O=l(()=>c.view.priv),k=l(()=>O.value?.canAct?O.value.hints??[]:[]),A=l(()=>Math.max(5,Math.round(Math.sqrt(D.value.board?.length||225)))),j=l(()=>{let e=A.value-4,t=(A.value-1)/2;return[[3,3],[3,e],[t,t],[e,3],[e,e]]}),M=i(null),N=i(-1),P=i(!1),F=l(()=>D.value.status===`playing`&&O.value?.canAct===!0),I=l(()=>D.value.status===`ended`),L=l(()=>D.value.seats?.find(e=>e.id===c.view.me.id)),R=l(()=>L.value?.color??null),z=l(()=>D.value.board?.filter(e=>e!==0).length||0);l(()=>D.value.seats?.find(e=>e.id===D.value.turn)?.name);let B=l(()=>D.value.seats?.find(e=>e.id===D.value.winner)?.name),V=l(()=>N.value>=0?k.value[N.value]??null:null),H=l(()=>{let e=V.value;return!e||!F.value||J(M.value,e.row,e.col)?null:e}),U=l(()=>!!D.value.winner&&D.value.winner===c.view.me.id),W=l(()=>I.value&&!D.value.winner),G=l(()=>W.value?`和棋`:L.value?U.value?`你赢了`:`你输了`:`${B.value||`一方`}获胜`),K=l(()=>{if(W.value)return`棋盘已满,共 ${z.value} 手`;let e=B.value||`对手`;return U.value||!L.value?`连五 · 共 ${z.value} 手`:`${e} 连五获胜 · 共 ${z.value} 手`}),q=e=>({row:Math.floor(e/A.value),col:e%A.value}),J=(e,t,n)=>e?.row===t&&e.col===n,Y=e=>J(M.value,Math.floor(e/A.value),e%A.value),X=e=>J(D.value.last,Math.floor(e/A.value),e%A.value),Z=e=>(D.value.winningLine||[]).some(t=>J(t,Math.floor(e/A.value),e%A.value)),Q=e=>J(H.value,Math.floor(e/A.value),e%A.value),$=e=>{let t=Math.floor(e/A.value),n=e%A.value;return j.value.some(([e,r])=>e===t&&r===n)},ee=e=>{let t=D.value.board?.[e]??0,n=q(e);return`第 ${n.row+1} 行第 ${n.col+1} 列`+(t===1?` 黑棋`:t===2?` 白棋`:` 空位`)};a(()=>D.value.revision,()=>{M.value=null,N.value=-1});function te(){k.value.length&&!P.value&&(N.value=N.value>=k.value.length-1?0:N.value+1)}async function ne(){if(M.value&&F.value&&!P.value){P.value=!0;try{await c.ctx.act({type:`gomoku_action`,...M.value})&&(M.value=null)}finally{P.value=!1}}}return(i,a)=>(u(),o(`section`,h,[I.value?(u(),o(`div`,{key:0,class:e([`gomoku-result`,W.value||!L.value?`tie`:U.value?`win`:`lose`]),role:`status`},[d(`div`,g,[d(`strong`,null,m(G.value),1),d(`span`,null,m(K.value),1)]),d(`button`,{class:`btn primary`,type:`button`,onClick:a[0]||=e=>r.ctx.showLobby()},`返回客厅`)],2)):n(``,!0),d(`div`,_,[d(`div`,v,[d(`div`,{class:e([`gomoku-board`,{"is-won":!!D.value.winningLine?.length}]),style:p({"--n":A.value}),role:`grid`,"aria-label":`十五乘十五五子棋盘`},[(u(!0),o(t,null,s(D.value.board,(r,i)=>(u(),o(`button`,{key:i,type:`button`,class:e([`gomoku-point`,{selected:Y(i),last:X(i),winning:Z(i),ghost:Q(i)}]),"aria-label":ee(i),"aria-pressed":Y(i),disabled:!!r||!F.value||P.value,onClick:e=>M.value=q(i)},[r?(u(),o(`span`,{key:0,class:e([`stone`,r===1?`black`:`white`])},null,2)):(u(),o(t,{key:1},[Q(i)?(u(),o(`span`,{key:0,class:e([`stone ghost-stone`,R.value===1?`black`:`white`])},null,2)):n(``,!0),$(i)?(u(),o(`span`,b)):n(``,!0)],64))],10,y))),128))],6)]),d(`aside`,x,[d(`div`,S,[d(`span`,C,[d(`b`,null,m(z.value),1),a[1]||=f(` 手`,-1)]),d(`span`,null,m(R.value===null?`观战`:R.value===1?`你执黑`:`你执白`),1)]),d(`ul`,w,[(u(!0),o(t,null,s(D.value.seats,t=>(u(),o(`li`,{key:t.id,class:e({current:t.id===D.value.turn})},[d(`span`,{class:e([`stone`,t.color===1?`black`:`white`])},null,2),d(`span`,null,m(t.name)+m(t.id===r.view.me.id?`(你)`:``),1)],2))),128))]),F.value?(u(),o(t,{key:0},[
|
|
1
|
+
import{_ as e,a as t,c as n,f as r,g as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d,u as f,v as p,y as m}from"./main.js";var h={class:`gomoku`},g={class:`gomoku-result-copy`},_={class:`gomoku-layout`},v={class:`gomoku-frame`},y=[`aria-label`,`aria-pressed`,`disabled`,`onClick`],b={key:1,class:`star`,"aria-hidden":`true`},x={class:`gomoku-side`},S={class:`gomoku-meta`},C={class:`gomoku-plies`},w={class:`gomoku-seats`},T=[`disabled`],E=[`aria-expanded`],D=c(r({__name:`GomokuGame`,props:{view:{},ctx:{}},setup(r){let c=r,D=l(()=>c.view.table),O=l(()=>c.view.priv),k=l(()=>O.value?.canAct?O.value.hints??[]:[]),A=l(()=>Math.max(5,Math.round(Math.sqrt(D.value.board?.length||225)))),j=l(()=>{let e=A.value-4,t=(A.value-1)/2;return[[3,3],[3,e],[t,t],[e,3],[e,e]]}),M=i(null),N=i(-1),P=i(!1),F=l(()=>D.value.status===`playing`&&O.value?.canAct===!0),I=l(()=>D.value.status===`ended`),L=l(()=>D.value.seats?.find(e=>e.id===c.view.me.id)),R=l(()=>L.value?.color??null),z=l(()=>D.value.board?.filter(e=>e!==0).length||0);l(()=>D.value.seats?.find(e=>e.id===D.value.turn)?.name);let B=l(()=>D.value.seats?.find(e=>e.id===D.value.winner)?.name),V=l(()=>N.value>=0?k.value[N.value]??null:null),H=l(()=>{let e=V.value;return!e||!F.value||J(M.value,e.row,e.col)?null:e}),U=l(()=>!!D.value.winner&&D.value.winner===c.view.me.id),W=l(()=>I.value&&!D.value.winner),G=l(()=>W.value?`和棋`:L.value?U.value?`你赢了`:`你输了`:`${B.value||`一方`}获胜`),K=l(()=>{if(W.value)return`棋盘已满,共 ${z.value} 手`;let e=B.value||`对手`;return U.value||!L.value?`连五 · 共 ${z.value} 手`:`${e} 连五获胜 · 共 ${z.value} 手`}),q=e=>({row:Math.floor(e/A.value),col:e%A.value}),J=(e,t,n)=>e?.row===t&&e.col===n,Y=e=>J(M.value,Math.floor(e/A.value),e%A.value),X=e=>J(D.value.last,Math.floor(e/A.value),e%A.value),Z=e=>(D.value.winningLine||[]).some(t=>J(t,Math.floor(e/A.value),e%A.value)),Q=e=>J(H.value,Math.floor(e/A.value),e%A.value),$=e=>{let t=Math.floor(e/A.value),n=e%A.value;return j.value.some(([e,r])=>e===t&&r===n)},ee=e=>{let t=D.value.board?.[e]??0,n=q(e);return`第 ${n.row+1} 行第 ${n.col+1} 列`+(t===1?` 黑棋`:t===2?` 白棋`:` 空位`)};a(()=>D.value.revision,()=>{M.value=null,N.value=-1});function te(){k.value.length&&!P.value&&(N.value=N.value>=k.value.length-1?0:N.value+1)}async function ne(){if(M.value&&F.value&&!P.value){P.value=!0;try{await c.ctx.act({type:`gomoku_action`,...M.value})&&(M.value=null)}finally{P.value=!1}}}return(i,a)=>(u(),o(`section`,h,[I.value?(u(),o(`div`,{key:0,class:e([`gomoku-result`,W.value||!L.value?`tie`:U.value?`win`:`lose`]),role:`status`},[d(`div`,g,[d(`strong`,null,m(G.value),1),d(`span`,null,m(K.value),1)]),d(`button`,{class:`btn primary`,type:`button`,onClick:a[0]||=e=>r.ctx.showLobby()},`返回客厅`)],2)):n(``,!0),d(`div`,_,[d(`div`,v,[d(`div`,{class:e([`gomoku-board`,{"is-won":!!D.value.winningLine?.length}]),style:p({"--n":A.value}),role:`grid`,"aria-label":`十五乘十五五子棋盘`},[(u(!0),o(t,null,s(D.value.board,(r,i)=>(u(),o(`button`,{key:i,type:`button`,class:e([`gomoku-point`,{selected:Y(i),last:X(i),winning:Z(i),ghost:Q(i)}]),"aria-label":ee(i),"aria-pressed":Y(i),disabled:!!r||!F.value||P.value,onClick:e=>M.value=q(i)},[r?(u(),o(`span`,{key:0,class:e([`stone`,r===1?`black`:`white`])},null,2)):(u(),o(t,{key:1},[Q(i)?(u(),o(`span`,{key:0,class:e([`stone ghost-stone`,R.value===1?`black`:`white`])},null,2)):n(``,!0),$(i)?(u(),o(`span`,b)):n(``,!0)],64))],10,y))),128))],6)]),d(`aside`,x,[d(`div`,S,[d(`span`,C,[d(`b`,null,m(z.value),1),a[1]||=f(` 手`,-1)]),d(`span`,null,m(R.value===null?`观战`:R.value===1?`你执黑`:`你执白`),1)]),d(`ul`,w,[(u(!0),o(t,null,s(D.value.seats,t=>(u(),o(`li`,{key:t.id,class:e({current:t.id===D.value.turn})},[d(`span`,{class:e([`stone`,t.color===1?`black`:`white`])},null,2),d(`span`,null,m(t.name)+m(t.id===r.view.me.id?`(你)`:``),1)],2))),128))]),F.value?(u(),o(t,{key:0},[O.value?.warning?(u(),o(`p`,{key:0,class:e([`gomoku-tip`,O.value.warning.level]),role:`status`},m(O.value.warning.text),3)):n(``,!0),V.value?(u(),o(`p`,{key:1,class:e([`gomoku-tip`,V.value.level||`shape`]),role:`status`},` 建议 `+m(N.value+1)+`/`+m(k.value.length)+` · `+m(V.value.reason),3)):n(``,!0),d(`button`,{class:`btn primary`,type:`button`,disabled:!M.value||P.value,onClick:ne},m(P.value?`正在落子…`:M.value?`落子`:`先点一个空交点`),9,T),k.value.length?(u(),o(`button`,{key:2,class:`btn ghost`,type:`button`,"aria-expanded":N.value>=0,onClick:te},m(N.value<0?`下一步建议`:`看下一个建议(`+(N.value+1)+`/`+k.value.length+`)`),9,E)):n(``,!0)],64)):n(``,!0)])])]))}}),[[`__scopeId`,`data-v-c7a27e4f`]]);export{D as default};
|