mirror of
https://github.com/jarodlee/mini-browser-games.git
synced 2026-12-01 23:19:33 +08:00
feat: turn three short games into campaigns
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 100 款迷你游戏质量审计与升级路线
|
||||
|
||||
审计与更新日期:2026-07-22
|
||||
审计与更新日期:2026-07-23
|
||||
|
||||
本报告不再按“题材数量”给高分,而是按真实可玩流程、内容体量、重复游玩、操作反馈、移动端适配和技术稳定性分级。表中的箭头表示“审计基线 → 质量重构版评级”;没有进入本轮升级名单的 D 级作品继续保留开源,但停止投入。
|
||||
|
||||
@@ -45,22 +45,25 @@
|
||||
| S | `starforge-idle.html` 星炉工坊 | 生产、远航、战斗、研究、装备、重启和离线收益完整 | 主宣传,维护与平衡 |
|
||||
| S | `tank-arena.html` 霓虹装甲 | 多模式、底盘、主炮、模块、科技和战役记录完整 | 主宣传,维护与平衡 |
|
||||
|
||||
### A 级(31 款)
|
||||
### A 级(34 款)
|
||||
|
||||
| 当前 | 游戏 | 判断 | 本轮决定 |
|
||||
| --- | --- | --- | --- |
|
||||
| C → A | `abyss-sonar.html` 深渊声呐:静默航线 | 八次潜航、三敌型、被动噪声与主动辨认、残骸扫描、六项双槽模块、三星和 V2 档案形成完整声呐战术循环 | 静默航线 V2 完成,继续平衡 |
|
||||
| B → A | `air-traffic-control.html` 塔台指挥官:三港联调 | 三机场九班次、55 架固定航班、四类机型与尾流、天气漂移、限制空域、跑道关闭、优先任务、三星和 `ATC2` 档案形成可复核空管战役 | 三港联调 V2 完成,继续平衡后期流量 |
|
||||
| C → A | `auto-chess-forge.html` 符文自走棋 | 18 名英雄、10 类双系羁绊、装备经济、侦察与 20 回合赛季形成完整策略循环 | 整体重制完成,继续平衡 |
|
||||
| B → A | `backpack-arena.html` 背包角斗场 | 24 件装备、8 条合成链、形状邻接、耐力冷却和 12 轮赛季形成多流派构筑 | 整体重制完成,继续平衡 |
|
||||
| B → A | `bytebot-lab.html` 字节机器人:指令远征 | 三章 12 关、×2/×3 循环、墙面传感、跳跃裂隙、开关门、传送环、源码/步数三星、六枚勋章和 `BYTE2` 档案形成可验证的编程远征 | 指令远征 V2 完成,继续扩关与平衡 |
|
||||
| C → A | `charm-reels.html` 幸运符文机 | 24 符号、12 护符、三契约人和八期租约形成可追求的连锁构筑 | 整体重制完成,继续平衡 |
|
||||
| B → A | `checkpoint-inspector.html` 边境值勤:审查档案 | 六日 30 宗确定性档案、逐日叠加规则、双证比对、日期尺、可解释违规原因、日星章和 `CHECK2` 档案形成完整审查循环 | 审查档案 V2 完成,继续扩剧情与平衡 |
|
||||
| B → A | `comet-weaver.html` 彗尾织者:星幕远征 | 三章十二幕差异弹幕、擦弹充能、彗核清屏、相位闪现、六件双槽星械、三星和 `COMET2` 档案形成完整弹幕远征 | 星幕远征 V2 完成,继续平衡后期弹幕密度 |
|
||||
| B → A | `courtroom-clash.html` 逆转法庭:六案终审 | 六案十八段交叉询问、72 句证词、30 件证物、追问解锁、连续异议、结案论证、错误/追问三星和 `COURT2` 档案形成完整庭审战役 | 六案终审 V2 完成,继续扩案件 |
|
||||
| B → A | `detective-desk.html` 雾城侦探 | 六案、36 条证据、证言、关联推论和三重指控形成完整叙事推理链 | 第二批整体重制完成 |
|
||||
| B → A | `dice-delver.html` 骰域远征:命运岔路 | 三地区十八节点、三名旅者、八种骰型、敌人行动预告、事件/商店/营火、十二件规则遗物、地区三星与 `DICE2` 断点档案形成完整骰子构筑远征 | 命运岔路 V2 完成,继续平衡后期敌人 |
|
||||
| B → A | `dungeon-delver.html` 烛火地牢 | 三职业、五层路线、精英、五 Boss、遗物祝福和余烬天赋形成完整动作肉鸽 | 整体重制完成,继续平衡 |
|
||||
| B → A | `ecosystem-keeper.html` 生态方舟:群落演替 | 六个生态区、12 个物种、确定性气候序列、四层趋势图、三类环境工程、三个长期项目、15 年目标、勋章和 `ECO2` 档案形成可观察的生态模拟循环 | 群落演替 V2 完成,继续平衡 |
|
||||
| C → A | `elemental-sandbox.html` 元素落沙实验室:反应档案 | 三章九项研究、11 种可绘材料、九类反应事件、条件进度、三星、反应图鉴和 `ELEM2` 档案把落沙演示升级为发现型实验系统 | 反应档案 V2 完成,继续平衡反应速率 |
|
||||
| B → A | `ember-tactics.html` 余烬战棋:九境远征 | 三章九任务、六名差异英雄、八枚双槽规则徽记、五类任务目标、墙体/掩体/熔流地形、职业技能、三星和 `EMBER2` 档案形成可构筑战棋战役 | 九境远征 V2 完成,继续平衡职业与任务 |
|
||||
| B → A | `fishing-harbor.html` 潮汐渔港 | 24 种鱼、五海域、搏鱼操作、鱼市委托与六类建设组成采集经营双循环 | 整体重制完成,继续平衡 |
|
||||
| A | `forest-dash.html` 松果快跑 | 跑酷内容、节奏、音效和触控表现较成熟 | 保留 |
|
||||
| B → A | `frontier-command.html` 前线指挥部 | 三战线、六兵种、基地建设、战术能源、五章战役与永久研究形成成熟 RTS 循环 | 第二批整体重制完成 |
|
||||
@@ -81,20 +84,17 @@
|
||||
| B → A | `tide-salvage.html` 潮汐拾荒:深蓝远征 | 五片星级航线、十六件遗物、四类海底威胁、潮汐事件、水面结算、六类四级装备与 `TIDE2` 档案形成完整风险远征 | 深蓝远征 V2 完成,继续平衡经济与航线目标 |
|
||||
| B → A | `tiny-factory.html` 微型流水线 | 双矿、八级物料链、功率堵塞、机器配方、科研与订单形成真正的物流规划 | 整体重制完成,继续平衡 |
|
||||
|
||||
### B 级(25 款)
|
||||
### B 级(22 款)
|
||||
|
||||
| 当前 | 游戏 | 判断 | 本轮决定 |
|
||||
| --- | --- | --- | --- |
|
||||
| B | `air-traffic-control.html` 塔台指挥官 | 航向、高度、跑道和流量形成完整压力循环 | 保留并修精度/UI |
|
||||
| B → A | `alchemy-workshop.html` 万象炼金室 | 三导师、五地区、20 素材、24 个双/三素材秘方、四设备、订单和六项建设形成长期发现经营循环 | 整体重制完成,继续平衡 |
|
||||
| B | `auction-fever.html` 拍卖风云 | 估值、竞价和转卖有决策空间 | 保留,补藏品事件与对手性格 |
|
||||
| B | `chalk-billiards.html` 粉笔台球 | 物理手感扎实,适合作为完整短局体育游戏 | 保留 |
|
||||
| B | `clockwork-escape.html` 钟楼密室 | 道具链和动态提示完整 | 保留,后续扩章节 |
|
||||
| B | `courier-grid.html` 极速配送网 | 路径、订单时限和准时率有规划价值 | 保留 |
|
||||
| B | `courtroom-clash.html` 逆转法庭 | 证词矛盾和证物提交形成完整章节循环 | 保留,后续补案件 |
|
||||
| B | `cozy-organizer.html` 小屋收纳师 | 分类、相邻规则和星级目标清楚 | 保留,修触控尺寸 |
|
||||
| B | `dojo-duel.html` 巷馆对决 | 轻重击、格挡和闪避使格斗选择完整 | 保留并补角色差异 |
|
||||
| B | `ember-tactics.html` 余烬战棋 | 小队战棋循环完整 | 手机适配已修复,后续补职业构筑 |
|
||||
| B | `fleet-duel.html` 深海舰队 | 海战棋加声呐与追击 AI,短局完整 | 保留,修触控尺寸 |
|
||||
| B | `gem-garden.html` 晶糖花园 | 消除与花园成长结合,完成度良好 | 保留 |
|
||||
| B | `hive-sovereign.html` 蜂巢女王 | 岗位分配、天气和繁荣目标有经营决策 | 保留 |
|
||||
@@ -260,6 +260,16 @@
|
||||
|
||||
专项测试 `promo-video/scripts/check-deduction-dice-pinball.mjs` 覆盖六案/36 证据/18 关联、十八节点/三英雄/十二遗物、三桌台/六模块,真实完成首案三次证据关联与三重指控、真实使用骰型攻击、真实蓄力发射弹球,并验证三种档案往返、弹球 Canvas 像素信号、桌面与 390×844 触屏布局。当前浏览器错误 `0`、规则错误 `0`、横向溢出 `0`。
|
||||
|
||||
## 第十四轮质量更新
|
||||
|
||||
第十四轮继续处理“操作核心已经成立,但流程仍是一场无限局或同一模板重复”的 B 级作品。三款分别把实时调度、证词攻防和小队战棋扩展为有限、可评价、可复核的战役结构:
|
||||
|
||||
1. `air-traffic-control.html`:《塔台指挥官:三港联调》V2 将无限随机刷新的单一空域改为海湾空港、山谷枢纽、极昼机场三地九个固定班次,共 55 架计划航班。客机、货机、医疗航班与支线飞机拥有不同速度、尾流和优先级;侧风、雷雨、山风与雪雾持续改变航向,低高度限制区、临时关闭跑道和离场移交共同进入事件统计。每班分别按目标落地、零事件和全部优先航班安全落地结算三星,一次自动引导只解决一个航班,不能替代持续管制;`ATC2` 档案保存九班成绩与执勤纪录。
|
||||
2. `courtroom-clash.html`:《逆转法庭:六案终审》V2 将四组单次矛盾扩展为六案十八段连续交叉询问,共 72 句证词和 30 件证物。每案需要依次击破三名证人的直接矛盾;追问不再只是随机提示,而会公开校时报告、温控曲线、无线原始录音、推流缓存、配送轨迹或合成声纹等关键证物。三段异议完成后还必须把责任人与实施方式组合成唯一结案论证,错误异议和冗余追问进入三星评价;`COURT2` 档案保存案件进度与最佳错误数。
|
||||
3. `ember-tactics.html`:《余烬战棋:九境远征》V2 将六场同构清敌任务扩展为灰原、赤峡、烬都三章九战,清剿、封印、守卫、撤离和首领五类目标要求不同站位。烬骑、弦手、星术师、守卫、医师与影刃拥有独立生命、攻击、移动、射程和职业技能;八枚双槽徽记改变伤害、移动、减伤、回合恢复、技能强度、击杀资源、初始资源和首次复燃。墙体、掩体与熔流地形、敌军目标选择、星火技能、回合上限和全员生还共同决定三星;`EMBER2` 档案保存战图、编组与徽记配置。
|
||||
|
||||
专项测试 `promo-video/scripts/check-atc-court-ember.mjs` 覆盖三机场/九班次/55 架航班、六案/十八段/72 句证词/30 件证物、九任务/六英雄/八徽记/五类目标,真实选择雷达航班并完成跑道进近,真实完成首案三段异议、隐藏证物追问与结案论证,真实执行战棋攻击和职业技能。测试同时验证三种档案往返、塔台 Canvas 像素信号、桌面与 390×844 触屏布局;人工截图检查额外发现并修复了空格与空选择同为 `null` 导致全棋盘误显示选中描边的问题。当前浏览器错误 `0`、规则错误 `0`、横向溢出 `0`。
|
||||
|
||||
## 公开资料提炼出的设计准则
|
||||
|
||||
本轮只借鉴已被验证的设计原则,不复制任何素材、角色、数值或代码。
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
## 最新更新
|
||||
|
||||
- 三款单局骨架作品完成 A 级战役化重制:《塔台指挥官:三港联调》加入三机场九班次、55 架固定航班、四类机型、天气/禁飞区/跑道状态、三星与 `ATC2` 档案;《逆转法庭:六案终审》加入六案十八段交叉询问、72 句证词、30 件证物、追问解锁、结案论证与 `COURT2` 档案;《余烬战棋:九境远征》加入三章九任务、六名职业英雄、八枚规则徽记、五类任务目标与 `EMBER2` 档案。
|
||||
- 三款已有好底层但内容偏短的 B 级作品完成 A 级重制:《星舰疑云:航迹证词》加入六起确定性案件、36 条证据、18 组有效关联、三重指控与 `SHIP2` 档案;《骰域远征:命运岔路》加入三地区十八节点、三名旅者、十二件规则遗物、分支事件与 `DICE2` 断点档案;《轨道弹球:三界巡回》加入三张独立桌台、磁场/冷却靶/传送门任务、六件双槽模块、三星与 `PIN2` 档案。
|
||||
- 三款长期结构不足的 B 级作品完成 A 级重制:《彗尾织者:星幕远征》扩展为十二幕规则弹幕、擦弹充能、彗核清屏、双槽星械、三星与 `COMET2` 档案;《口袋伙伴:星愿谱系》加入四段十二日旅程、四维性格、八种终末形态、四类设施、图鉴与 `PET2` 档案;《交易风暴:周期实验室》加入六种确定性市场情景、八家公司基本面、持续新闻冲击、回撤授权、六项研究工具与 `MARKET2` 档案。
|
||||
- 三款潜力作品完成 A 级重制:《元素落沙实验室:反应档案》加入三章九项研究、11 种可绘材料、九类真实反应事件、三星、图鉴与 `ELEM2` 档案;《潮汐拾荒:深蓝远征》加入五片星级航线、十六件遗物、四类海底威胁、潮汐事件、六类四级装备与 `TIDE2` 档案;《脉冲音乐室:霓虹巡演》扩展为六轨四级力度音序器、十二场结构化委托、四套音色、三星、作品槽与 `PULSE2` 档案。
|
||||
@@ -59,7 +60,7 @@
|
||||
| S | [晶塔前线](moba-frontier.html) | 六英雄、六种 3v3 规则、三线推塔、双远古晶兽、12 项星契三次构筑、六类补给、S/A/B/C 评价、六枚勋章、英雄熟练度、天梯连胜和六项永久研究 | `WASD/方向键` 移动,点击战场移动或锁敌;`Q/W/E/R` 施放当前英雄技能,等级 2/4/6 选择星契,`Space/P` 暂停;大厅可导出、导入存档码并切换音效 |
|
||||
| A | [符文自走棋](auto-chess-forge.html) | 18 名英雄、10 类双系羁绊、升星装备、利息连胜、商店锁定、对手侦察、赛季强化与 20 回合生存 | 购买英雄后部署到棋盘,围绕羁绊和装备调整阵型;刷新或锁定商店、侦察对手后开战,档案页支持跨设备存档码 |
|
||||
| A | [灵兽远征](monster-tamer.html) | 18 只灵兽、五岛路线、属性与状态克制、捕捉换兽、8 级进化、徽章和完整图鉴 | 点击技能进行回合战斗,压低生命后捕捉;根据敌方属性主动换兽,岛屿档案支持跨设备存档码 |
|
||||
| A | [余烬战棋](ember-tactics.html) | 六任务小队战棋、三职业、移动与射程、敌方回合 AI、战术治疗和永久强化 | 点击队员后点击绿色格移动或红色目标攻击;每名队员行动一次后结束回合,星数可释放全队治疗 |
|
||||
| A | [余烬战棋:九境远征](ember-tactics.html) | 三章九任务、清剿/封印/守卫/撤离/首领五类目标、六名差异英雄、八枚双槽规则徽记、墙体/掩体/熔流地形、职业技能、三星与 `EMBER2` 档案 | 非战斗时编组三名英雄与至多两枚徽记;战斗中点击英雄后移动或攻击,消耗星火释放裂阵、贯星、星爆、壁垒、复燃或闪袭,再结束回合处理敌方 AI |
|
||||
| A | [四季小农场](pocket-farm.html) | 四季 16 种作物、再生与轮作、三种出身、居民关系、节庆、三份动态订单、六类建筑和年度图鉴 | 选择种子或工具后点击土地;通过每日体力规划种植、灌溉和收获,在溪谷镇送礼、交付订单并建设农场;档案支持跨设备存档码 |
|
||||
| A | [口袋地铁](metro-weaver.html) | 五座城市、六类线路与目的地、程序化新站、换乘寻路、桥隧地形、车辆分配、枢纽容量和每周升级 | 选择线路后点击车站规划网络,按线路增配列车并控制拥堵;跨河与长距线段消耗桥隧组件,城市档案支持跨设备存档码 |
|
||||
| A | [掌心城市](skyline-planner.html) | 10×10 城市规划、七类设施、道路连通、电力就业、污染幸福和十五年目标 | 选择建筑后点击地块建造;住宅、商业和工业必须邻接道路,推进年份结算税收与维护并检查发展指标 |
|
||||
@@ -90,7 +91,7 @@
|
||||
| A | [彗尾织者:星幕远征](comet-weaver.html) | 三章十二幕规则弹幕、圆环/扇面/车道/螺旋/折返/弯曲/交叉/猎手/迷宫敌幕、擦弹充能、彗核清屏、相位闪现、六件双槽星械、三星与 `COMET2` 档案 | `WASD/方向键`、拖动画布或方向按钮移动,`Space`/相位按钮闪现,`Q`/彗核按钮满能清屏并重创核心;贴近弹幕外缘积攒彗能 |
|
||||
| A | [巷馆对决](dojo-duel.html) | 2D 街机格斗、轻重攻击、格挡和闪避 | `A/D` 移动,`W` 跳跃,`J` 轻击,`K` 重击,`L` 格挡,`Shift` 闪避,`P` 暂停,`R` 重开 |
|
||||
| A | [烛火地牢](dungeon-delver.html) | 三职业、五层分支路线、祭坛商店、精英、五名守门者、12 件遗物、12 类祝福与余烬天赋 | `WASD/方向键` 移动,鼠标瞄准,点击/`Space` 攻击,`Shift` 冲刺,`Q` 战技;完整触屏操作,远征档案支持跨设备存档码 |
|
||||
| A | [塔台指挥官](air-traffic-control.html) | 实时空域管制、航向与高度调整、双跑道分配、降落许可、航班间隔和逐级流量 | 点击航班选中,用页面按钮转向、升降并指定跑道;低空对准跑道方向后许可降落,避免离场与危险接近 |
|
||||
| A | [塔台指挥官:三港联调](air-traffic-control.html) | 海湾/山谷/极昼三机场九班次、55 架固定计划航班、四类机型与尾流、天气漂移、限制空域、跑道关闭、优先任务、三星与 `ATC2` 档案 | 点击雷达航班后调整航向和高度、分配开放跑道并许可进近;建立高度与尾流间隔,避开低空限制区,在固定班次内完成目标落地 |
|
||||
| A | [午夜监控室](midnight-monitor.html) | 六个故事夜、五类可学习行为的异常体、九路监控、双门、通风口、音乐盒、诱饵、电力信号与六类设备升级 | 通过摄像头和声音征兆判断威胁路线,针对目标使用闸门、灯光、通风封锁或音乐盒并控制耗电;夜班档案支持跨设备存档码 |
|
||||
| A | [深渊声呐:静默航线](abyss-sonar.html) | 八次潜航、猎潜艇/护卫/水雷差异行为、被动噪声与主动辨认、残骸扫描、六项双槽潜艇模块、三星和跨设备档案 | 主动声呐辨认接触后点击锁定,调整航向并发射鱼雷;静默航行降低噪声,诱饵打断敌方解算,航线页管理模块与存档码 |
|
||||
| B+ | [爆格特攻](bomb-grid.html) | 炸弹人式关卡、木箱、巡逻敌人、范围/数量/速度道具和本地纪录 | `WASD/方向键` 或屏幕方向键移动,`Space` 或“炸弹”按钮放炸弹 |
|
||||
@@ -132,7 +133,7 @@
|
||||
| A | [深海舰队](fleet-duel.html) | 10×10 海战棋、五舰随机部署、智能追击 AI、命中击沉、声呐扫描与战役胜场 | 点击敌方坐标开火,命中后继续推断舰身方向;击沉舰船补充声呐,扫描可标记一片 3×3 可疑海域 |
|
||||
| A | [雾城侦探](detective-desk.html) | 六起连续案件、18 个场景、36 条证据、嫌疑人盘问、两证据关联、三段关键推论、完整指控与侦探技能 | 搜查每个现场并盘问证人,在证据板连接正确线索;完成推论后同时选择凶手、动机和手法,案件档案支持跨设备存档码 |
|
||||
| A | [河牌之夜](river-holdem.html) | 德州扑克锦标赛、三名 AI、动态盲注、翻牌转牌河牌、七选五牌型、加注弃牌和淘汰 | 每条下注街选择跟注、加注或弃牌;结合两张手牌与五张公共牌判断胜率,赢光三名对手筹码 |
|
||||
| A | [逆转法庭](courtroom-clash.html) | 四案连续审理、逐句证词、追问、证物提交、可信度惩罚、矛盾解释和终审评分 | 左右切换证词,选择证物后在矛盾句点击“异议”;错误提交损失可信度,追问可获得方向提示 |
|
||||
| A | [逆转法庭:六案终审](courtroom-clash.html) | 六案十八段交叉询问、72 句证词、30 件证物、逐句追问公开隐藏证物、连续异议、责任人/实施方式结案论证、三星与 `COURT2` 档案 | 切换证词并在关键句追问细节,选择已公开证物后对直接矛盾提出异议;连续击破三段证词,再组合责任人与实施方式完成结案 |
|
||||
| A | [字节机器人:指令远征](bytebot-lab.html) | 三章 12 关编程解谜、前进/转向、×2/×3 循环、墙面传感、跳跃裂隙、开关门、传送环、源码/步数三星、六枚勋章与 `BYTE2` 档案 | 编排有限指令后运行程序;让机器人收齐芯片并抵达终点,逐步学习循环、条件式墙感与机关交互 |
|
||||
| A | [小屋收纳师](cozy-organizer.html) | 六房间分类收纳、区域规则、物品换位、相邻限制、撤回、效率星级和永久星星 | 选择待收纳物品再点击架子格放置,也可点击已放物品换位;按分类和相邻规则整理后检查 |
|
||||
| A | [十字词咖啡馆](crossword-cafe.html) | 五张主题十字词盘、横纵提示、交叉字母、逐格检查、三次提示和自动进阶 | 根据中文提示在对应白格输入英文单词,点击检查高亮正误;提示可自动填写一个错误或空白字母 |
|
||||
|
||||
@@ -1,335 +1,102 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<meta charset="utf-8" /><meta
|
||||
name="viewport"
|
||||
content="width=device-width,initial-scale=1"
|
||||
/><title>塔台指挥官</title
|
||||
><style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
background: #08131d;
|
||||
color: #eaf5ff;
|
||||
font-family: system-ui, "Microsoft YaHei";
|
||||
}
|
||||
.app {
|
||||
min-height: 100vh;
|
||||
padding: 14px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
.shell {
|
||||
width: min(1000px, 100%);
|
||||
background: #10283a;
|
||||
border: 1px solid #41677e;
|
||||
border-radius: 20px;
|
||||
padding: 16px;
|
||||
}
|
||||
.top,
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.stage {
|
||||
position: relative;
|
||||
margin: 12px 0;
|
||||
}
|
||||
canvas {
|
||||
width: 100%;
|
||||
aspect-ratio: 16/9;
|
||||
background: #091b28;
|
||||
border: 1px solid #446579;
|
||||
border-radius: 13px;
|
||||
display: block;
|
||||
touch-action: none;
|
||||
}
|
||||
.panel {
|
||||
background: #0a1c29;
|
||||
border: 1px solid #38596c;
|
||||
border-radius: 11px;
|
||||
padding: 10px;
|
||||
}
|
||||
.controls button {
|
||||
min-width: 70px;
|
||||
}
|
||||
.selected {
|
||||
color: #ffe07a;
|
||||
}
|
||||
button {
|
||||
padding: 9px 11px;
|
||||
border: 1px solid #527589;
|
||||
border-radius: 9px;
|
||||
background: #244b62;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
.land {
|
||||
background: #9a6230;
|
||||
}
|
||||
.danger {
|
||||
color: #ff7474;
|
||||
}
|
||||
.help {
|
||||
font-size: 13px;
|
||||
color: #a8c6d6;
|
||||
}
|
||||
@media (max-width: 650px) {
|
||||
.app {
|
||||
place-items: start center;
|
||||
}
|
||||
.controls button {
|
||||
min-width: 58px;
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>塔台指挥官:三港联调</title>
|
||||
<style>
|
||||
:root{--bg:#07131c;--panel:#102636;--panel2:#0a1b27;--line:#41687b;--ink:#edf8ff;--muted:#a8c5d3;--cyan:#72d8de;--gold:#f0c766;--red:#ed7777;--green:#72d59d}
|
||||
*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at 8% 0,#17445a 0,transparent 30%),radial-gradient(circle at 94% 4%,#453d59 0,transparent 27%),linear-gradient(145deg,#061019,#0b1c28 62%,#171827);color:var(--ink);font-family:system-ui,"Microsoft YaHei",sans-serif}.app{width:min(1450px,calc(100% - 22px));margin:11px auto}.top,.panel{border:1px solid var(--line);border-radius:14px;background:rgba(16,38,54,.97);box-shadow:0 18px 46px rgba(0,0,0,.32)}.top{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:15px 18px}.eyebrow{margin:0 0 4px;color:var(--cyan);font-size:12px;font-weight:950;letter-spacing:.14em}.top h1{margin:0;font-size:clamp(26px,4vw,42px);line-height:1}.sub{margin:7px 0 0;color:var(--muted);font-size:13px}.actions,.row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}button,textarea{font:inherit}.btn{min-height:42px;padding:0 13px;border:1px solid #588196;border-radius:8px;background:#28546b;color:white;font-weight:900;cursor:pointer}.btn.gold{border-color:#9d7a34;background:#7b5b22}.btn.red{border-color:#9b4a4a;background:#7a363b}.btn:disabled{opacity:.4;cursor:not-allowed}.layout{display:grid;grid-template-columns:minmax(0,1fr) 385px;gap:12px;margin-top:12px;align-items:start}.radar{position:relative;overflow:hidden;min-height:650px}.radar canvas{display:block;width:100%;height:650px;touch-action:none;background:#071925}.hud{position:absolute;left:10px;right:10px;top:10px;display:grid;grid-template-columns:repeat(6,1fr);gap:6px;pointer-events:none}.stat{padding:7px;border:1px solid rgba(255,255,255,.28);border-radius:8px;background:rgba(5,22,31,.82);text-shadow:0 1px #000}.stat b{display:block;font-size:19px}.stat small{font-size:10px;color:#cce0e6}.notice{position:absolute;left:10px;right:10px;bottom:10px;min-height:39px;padding:9px;border:1px solid rgba(255,255,255,.25);border-radius:8px;background:rgba(5,22,31,.86);color:#dcecf0;font-size:12px}.side{padding:12px;display:grid;gap:10px;max-height:calc(100vh - 105px);overflow:auto}.block{padding:11px;border:1px solid #3d6275;border-radius:10px;background:var(--panel2)}.block h2,.block h3{margin:0 0 8px}.block h2{font-size:20px}.block h3{font-size:14px;color:var(--cyan)}.shifts{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}.shift{min-height:55px;padding:5px;border:1px solid #456d81;border-radius:8px;background:#173447;color:white;cursor:pointer}.shift.active{outline:3px solid var(--cyan)}.shift:disabled{opacity:.36}.shift b,.shift small{display:block}.shift small{font-size:9px;color:var(--muted);margin-top:3px}.stars{color:var(--gold)}.brief{display:grid;gap:6px}.brief div{display:flex;justify-content:space-between;gap:8px;padding:6px;border-bottom:1px solid #ffffff17;font-size:11px}.brief span{color:var(--muted)}.selected{min-height:64px;padding:8px;border:1px solid #477084;border-radius:8px;background:#123044}.selected b,.selected small{display:block}.selected small{margin-top:4px;color:var(--muted);line-height:1.4}.controls{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:7px}.controls .wide{grid-column:span 3}.control{min-height:45px;padding:4px;border:1px solid #52788a;border-radius:8px;background:#244b61;color:white;font-weight:850;cursor:pointer}.control.land{background:#7d5527;border-color:#9e783c}.control.warn{background:#73383e;border-color:#9b5357}.goals{display:grid;gap:5px}.goal{padding:7px;border:1px solid #47687a;border-radius:7px;color:var(--muted);font-size:11px}.goal.pass{border-color:#4e8b69;background:#143529;color:#dff7ea}.career{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.career div{padding:7px;border:1px solid #416578;border-radius:8px;background:#123044;text-align:center}.career b{display:block;font-size:19px}.career small{font-size:9px;color:var(--muted)}.archive{position:fixed;inset:0;z-index:9;display:grid;place-items:center;padding:18px;background:rgba(2,10,15,.86)}.archive.hidden{display:none}.dialog{width:min(620px,100%);padding:18px;border:1px solid #50788d;border-radius:14px;background:#102839}.dialog h2{margin:0 0 8px}.dialog textarea{width:100%;min-height:125px;padding:10px;border:1px solid #527487;border-radius:8px;background:#071923;color:white;resize:vertical}.feedback{min-height:20px;margin-top:7px;color:var(--gold);font-size:12px;font-weight:850}.tip{color:var(--muted);font-size:12px;line-height:1.5}
|
||||
@media(max-width:900px){.layout{grid-template-columns:1fr}.side{max-height:none}.radar,.radar canvas{min-height:520px;height:520px}.top{align-items:flex-start}.hud{grid-template-columns:repeat(3,1fr)}}
|
||||
@media(max-width:520px){.app{width:min(100% - 12px,1450px);margin:6px auto}.top{padding:12px;display:grid}.top h1{font-size:26px}.radar,.radar canvas{min-height:440px;height:440px}.hud{left:6px;right:6px;top:6px;gap:3px}.stat{padding:4px}.stat b{font-size:15px}.stat small{font-size:8px}.notice{left:6px;right:6px;bottom:6px}.side{padding:8px}.controls{grid-template-columns:repeat(2,1fr)}.controls .wide{grid-column:span 2}.btn{min-height:40px}}
|
||||
</style>
|
||||
<main class="app">
|
||||
<section class="shell">
|
||||
<div class="top">
|
||||
<div>
|
||||
<h1 style="margin: 0">塔台指挥官</h1>
|
||||
<div class="help">
|
||||
点击航班选中;调整航向、高度并分配跑道。低空对准跑道方向后许可降落。
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
班次 <b id="score"></b> 安全 <b id="lives"></b>/3 等级
|
||||
<b id="level"></b> 流量 <b id="traffic"></b>
|
||||
</div>
|
||||
</head>
|
||||
<body>
|
||||
<main class="app">
|
||||
<header class="top">
|
||||
<div><p class="eyebrow">DETERMINISTIC AIRSPACE CAMPAIGN</p><h1>塔台指挥官:三港联调</h1><p class="sub">九个固定班次 · 机型尾流 · 天气漂移 · 限制空域 · 跨设备执照档案</p></div>
|
||||
<div class="actions"><button class="btn" id="pauseBtn">暂停</button><button class="btn" id="speedBtn">速度 ×1</button><button class="btn gold" id="archiveBtn">执照档案</button></div>
|
||||
</header>
|
||||
<section class="layout">
|
||||
<div class="panel radar">
|
||||
<canvas id="radarCanvas" width="960" height="650"></canvas>
|
||||
<div class="hud">
|
||||
<div class="stat"><b id="landedStat">0</b><small>安全落地</small></div><div class="stat"><b id="incidentStat">0</b><small>事件</small></div><div class="stat"><b id="trafficStat">0</b><small>空中航班</small></div><div class="stat"><b id="clockStat">00:00</b><small>班次时间</small></div><div class="stat"><b id="weatherStat">晴</b><small>天气</small></div><div class="stat"><b id="priorityStat">0/0</b><small>优先航班</small></div>
|
||||
</div>
|
||||
<div class="stage"><canvas id="c" width="960" height="540"></canvas></div>
|
||||
<div class="panel">
|
||||
<div class="row">
|
||||
<div id="selectedInfo" class="selected">请选择航班</div>
|
||||
<div class="controls row">
|
||||
<button data-turn="-20">↶ 左转</button
|
||||
><button data-turn="20">右转 ↷</button
|
||||
><button data-alt="1">爬升</button
|
||||
><button data-alt="-1">下降</button
|
||||
><button data-rw="A">跑道 A</button
|
||||
><button data-rw="B">跑道 B</button
|
||||
><button class="land" id="land">许可降落</button
|
||||
><button id="pause">暂停</button
|
||||
><button id="restart">新班次</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="msg" class="help"></div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<script>
|
||||
const cv = document.getElementById("c"),
|
||||
g = cv.getContext("2d"),
|
||||
R = {
|
||||
A: { x: 480, y: 215, heading: 0 },
|
||||
B: { x: 480, y: 330, heading: 180 },
|
||||
};
|
||||
let q,
|
||||
last = 0,
|
||||
selected = null;
|
||||
const $ = (x) => document.getElementById(x);
|
||||
function fresh() {
|
||||
return {
|
||||
planes: [],
|
||||
score: 0,
|
||||
lives: 3,
|
||||
level: 1,
|
||||
spawn: 0,
|
||||
clock: 0,
|
||||
paused: false,
|
||||
over: false,
|
||||
};
|
||||
}
|
||||
function plane() {
|
||||
let side = Math.floor(Math.random() * 4),
|
||||
x = side === 1 ? 940 : side === 3 ? 20 : Math.random() * 900 + 30,
|
||||
y = side === 0 ? 20 : side === 2 ? 520 : Math.random() * 480 + 30,
|
||||
h = side === 0 ? 90 : side === 1 ? 180 : side === 2 ? 270 : 0;
|
||||
return {
|
||||
id: Math.random().toString(36).slice(2, 5).toUpperCase(),
|
||||
x,
|
||||
y,
|
||||
h,
|
||||
alt: 3,
|
||||
runway: null,
|
||||
cleared: false,
|
||||
speed: 38 + q.level * 2,
|
||||
};
|
||||
}
|
||||
function angleDiff(a, b) {
|
||||
return ((a - b + 540) % 360) - 180;
|
||||
}
|
||||
function update(dt) {
|
||||
if (q.paused || q.over) return;
|
||||
q.clock += dt;
|
||||
q.spawn -= dt;
|
||||
if (q.spawn <= 0 && q.planes.length < 4 + q.level) {
|
||||
q.planes.push(plane());
|
||||
q.spawn = Math.max(2.8, 7 - q.level * 0.55);
|
||||
}
|
||||
for (const p of q.planes) {
|
||||
let a = (p.h * Math.PI) / 180;
|
||||
p.x += Math.cos(a) * p.speed * dt;
|
||||
p.y += Math.sin(a) * p.speed * dt;
|
||||
if (p.cleared && p.runway) {
|
||||
let r = R[p.runway],
|
||||
d = Math.hypot(p.x - r.x, p.y - r.y),
|
||||
need = p.runway === "A" ? 0 : 180;
|
||||
if (d < 58 && Math.abs(angleDiff(p.h, need)) < 24 && p.alt === 1) {
|
||||
q.score++;
|
||||
q.planes = q.planes.filter((x) => x !== p);
|
||||
if (selected === p) selected = null;
|
||||
note(`${p.id} 安全降落 ${p.runway} 跑道。`);
|
||||
if (q.score % 5 === 0) q.level++;
|
||||
}
|
||||
}
|
||||
if (p.x < -30 || p.x > 990 || p.y < -30 || p.y > 570) {
|
||||
q.planes = q.planes.filter((x) => x !== p);
|
||||
q.lives--;
|
||||
note(`${p.id} 离开管制空域,安全度下降。`);
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < q.planes.length; i++)
|
||||
for (let j = i + 1; j < q.planes.length; j++) {
|
||||
let a = q.planes[i],
|
||||
b = q.planes[j];
|
||||
if (
|
||||
Math.hypot(a.x - b.x, a.y - b.y) < 25 &&
|
||||
Math.abs(a.alt - b.alt) < 1
|
||||
) {
|
||||
q.planes = q.planes.filter((x) => x !== a && x !== b);
|
||||
q.lives--;
|
||||
note("航班间隔失守,发生危险接近!");
|
||||
}
|
||||
}
|
||||
if (q.lives <= 0) {
|
||||
q.over = true;
|
||||
note("空域关闭,请重新开始。");
|
||||
}
|
||||
drawUI();
|
||||
}
|
||||
function render() {
|
||||
g.clearRect(0, 0, 960, 540);
|
||||
g.strokeStyle = "#23485e";
|
||||
g.lineWidth = 1;
|
||||
for (let x = 60; x < 960; x += 80) {
|
||||
g.beginPath();
|
||||
g.moveTo(x, 0);
|
||||
g.lineTo(x, 540);
|
||||
g.stroke();
|
||||
}
|
||||
for (let y = 60; y < 540; y += 80) {
|
||||
g.beginPath();
|
||||
g.moveTo(0, y);
|
||||
g.lineTo(960, y);
|
||||
g.stroke();
|
||||
}
|
||||
for (const [k, r] of Object.entries(R)) {
|
||||
g.save();
|
||||
g.translate(r.x, r.y);
|
||||
g.rotate((r.heading * Math.PI) / 180);
|
||||
g.fillStyle = "#8b9295";
|
||||
g.fillRect(-100, -13, 200, 26);
|
||||
g.fillStyle = "white";
|
||||
g.font = "18px sans-serif";
|
||||
g.textAlign = "center";
|
||||
g.fillText(k, 0, 7);
|
||||
g.restore();
|
||||
}
|
||||
for (const p of q.planes) {
|
||||
g.save();
|
||||
g.translate(p.x, p.y);
|
||||
g.rotate((p.h * Math.PI) / 180);
|
||||
g.fillStyle =
|
||||
p === selected ? "#ffe36b" : p.cleared ? "#70e0a0" : "#fff";
|
||||
g.font = "27px sans-serif";
|
||||
g.textAlign = "center";
|
||||
g.fillText("✈", 0, 8);
|
||||
g.restore();
|
||||
g.fillStyle = "#d8eafa";
|
||||
g.font = "12px sans-serif";
|
||||
g.fillText(`${p.id} FL${p.alt} ${p.runway || "-"}`, p.x + 15, p.y - 13);
|
||||
}
|
||||
if (q.over) {
|
||||
g.fillStyle = "#07121dcc";
|
||||
g.fillRect(0, 0, 960, 540);
|
||||
g.fillStyle = "white";
|
||||
g.font = "bold 38px sans-serif";
|
||||
g.textAlign = "center";
|
||||
g.fillText("空域关闭", 480, 270);
|
||||
}
|
||||
}
|
||||
function drawUI() {
|
||||
score.textContent = q.score;
|
||||
lives.textContent = q.lives;
|
||||
level.textContent = q.level;
|
||||
traffic.textContent = q.planes.length;
|
||||
selectedInfo.textContent = selected
|
||||
? `${selected.id} · 航向 ${Math.round(selected.h)}° · 高度 FL${selected.alt} · ${selected.runway ? "跑道 " + selected.runway : "未分配"}`
|
||||
: "请选择航班";
|
||||
}
|
||||
function note(s) {
|
||||
msg.textContent = s;
|
||||
}
|
||||
function loop(t) {
|
||||
let dt = Math.min(0.04, (t - last) / 1000 || 0);
|
||||
last = t;
|
||||
update(dt);
|
||||
render();
|
||||
requestAnimationFrame(loop);
|
||||
}
|
||||
cv.onclick = (e) => {
|
||||
let r = cv.getBoundingClientRect(),
|
||||
x = ((e.clientX - r.left) * 960) / r.width,
|
||||
y = ((e.clientY - r.top) * 540) / r.height;
|
||||
selected =
|
||||
q.planes.sort(
|
||||
(a, b) => Math.hypot(a.x - x, a.y - y) - Math.hypot(b.x - x, b.y - y),
|
||||
)[0] || null;
|
||||
drawUI();
|
||||
};
|
||||
document.querySelectorAll("[data-turn]").forEach(
|
||||
(e) =>
|
||||
(e.onclick = () => {
|
||||
if (selected) selected.h = (selected.h + +e.dataset.turn + 360) % 360;
|
||||
}),
|
||||
);
|
||||
document.querySelectorAll("[data-alt]").forEach(
|
||||
(e) =>
|
||||
(e.onclick = () => {
|
||||
if (selected)
|
||||
selected.alt = Math.max(
|
||||
1,
|
||||
Math.min(5, selected.alt + +e.dataset.alt),
|
||||
);
|
||||
}),
|
||||
);
|
||||
document.querySelectorAll("[data-rw]").forEach(
|
||||
(e) =>
|
||||
(e.onclick = () => {
|
||||
if (selected) selected.runway = e.dataset.rw;
|
||||
}),
|
||||
);
|
||||
land.onclick = () => {
|
||||
if (!selected || !selected.runway) return note("先选择航班并分配跑道。");
|
||||
selected.cleared = true;
|
||||
note(`${selected.id} 已获得降落许可。`);
|
||||
};
|
||||
pause.onclick = () => {
|
||||
q.paused = !q.paused;
|
||||
pause.textContent = q.paused ? "继续" : "暂停";
|
||||
};
|
||||
restart.onclick = () => {
|
||||
q = fresh();
|
||||
selected = null;
|
||||
drawUI();
|
||||
};
|
||||
q = fresh();
|
||||
loop(0);
|
||||
</script>
|
||||
<div class="notice" id="notice">选择一个已解锁班次开始调度。</div>
|
||||
</div>
|
||||
<aside class="panel side">
|
||||
<section class="block"><h3>三港轮值</h3><div class="shifts" id="shiftList"></div></section>
|
||||
<section class="block"><h2 id="shiftTitle">海湾空港 · 晨潮</h2><div class="brief" id="brief"></div><div class="goals" id="goals"></div><div class="row" style="margin-top:8px"><button class="btn gold" id="startBtn">开始班次</button><button class="btn red" id="endBtn">结算班次</button></div></section>
|
||||
<section class="block"><h3>雷达指令</h3><div class="selected" id="selectedInfo"><b>未选择航班</b><small>点击雷达上的航班标记。</small></div><div class="controls"><button class="control" data-turn="-15">左转 15°</button><button class="control" data-turn="15">右转 15°</button><button class="control" data-alt="1">爬升</button><button class="control" data-alt="-1">下降</button><button class="control" data-rw="A">分配 A</button><button class="control" data-rw="B">分配 B</button><button class="control land wide" id="clearBtn">许可进近</button><button class="control warn wide" id="vectorBtn">一次引导:自动对准跑道</button></div></section>
|
||||
<section class="block"><h3>执照生涯</h3><div class="career"><div><b id="totalStars">0</b><small>总星章</small></div><div><b id="clears">0</b><small>完成班次</small></div><div><b id="perfects">0</b><small>无事件班次</small></div></div><p class="tip">每班至少完成目标落地获得一星;无事件、全部优先航班安全落地各增加一星。</p></section>
|
||||
</aside>
|
||||
</section>
|
||||
</main>
|
||||
<div class="archive hidden" id="archiveModal"><div class="dialog"><h2>跨设备塔台执照</h2><p class="tip">档案包含九班星级、最佳事件数、解锁进度和累计执勤纪录。</p><textarea id="archiveText" spellcheck="false"></textarea><div class="row" style="justify-content:flex-end;margin-top:8px"><button class="btn" id="closeArchiveBtn">关闭</button><button class="btn" id="importBtn">导入</button><button class="btn gold" id="exportBtn">生成并复制</button></div><div class="feedback" id="archiveFeedback"></div></div></div>
|
||||
<script>
|
||||
(() => {
|
||||
const TYPES={jet:{name:"客机",mark:"J",speed:44,wake:2,color:"#f5f8ff"},cargo:{name:"货机",mark:"C",speed:36,wake:3,color:"#f1c76a"},med:{name:"医疗",mark:"M",speed:48,wake:1,color:"#72e3a8",priority:true},prop:{name:"支线",mark:"P",speed:31,wake:1,color:"#79d9ea"}};
|
||||
const AIRPORTS=[
|
||||
{id:"bay",name:"海湾空港",runways:{A:{x:430,y:250,h:0},B:{x:655,y:390,h:270}},zones:[],theme:["#071b28","#28556b"]},
|
||||
{id:"valley",name:"山谷枢纽",runways:{A:{x:430,y:280,h:25},B:{x:650,y:365,h:155}},zones:[{x:220,y:320,r:72,label:"山脊",maxAlt:2},{x:780,y:235,r:64,label:"观测区",maxAlt:3}],theme:["#101b21","#506454"]},
|
||||
{id:"polar",name:"极昼机场",runways:{A:{x:430,y:260,h:0},B:{x:570,y:405,h:180}},zones:[{x:745,y:355,r:58,label:"科考站",maxAlt:4}],theme:["#10212b","#6f8790"]}
|
||||
];
|
||||
const patterns=[
|
||||
[[0,"jet",3],[5,"prop",0],[10,"med",1],[16,"cargo",2],[23,"jet",3]],
|
||||
[[0,"cargo",1],[4,"jet",3],[8,"prop",0],[13,"med",2],[18,"jet",1],[24,"cargo",3]],
|
||||
[[0,"jet",0],[3,"jet",2],[7,"cargo",1],[11,"med",3],[16,"prop",0],[20,"jet",2],[26,"cargo",1]],
|
||||
[[0,"prop",0],[5,"jet",3],[9,"cargo",1],[14,"med",2],[19,"prop",0]],
|
||||
[[0,"cargo",3],[4,"prop",0],[8,"jet",2],[12,"med",1],[17,"jet",3],[23,"cargo",0]],
|
||||
[[0,"jet",1],[3,"cargo",3],[7,"med",0],[10,"prop",2],[14,"jet",1],[19,"cargo",3],[25,"med",0]],
|
||||
[[0,"prop",2],[5,"cargo",0],[10,"med",3],[15,"jet",1],[21,"prop",2]],
|
||||
[[0,"jet",3],[4,"cargo",1],[8,"med",0],[13,"jet",2],[18,"cargo",3],[24,"prop",1]],
|
||||
[[0,"cargo",0],[3,"jet",2],[6,"med",1],[10,"prop",3],[14,"jet",0],[18,"cargo",2],[22,"med",1],[27,"jet",3]]
|
||||
];
|
||||
const shiftNames=["晨潮","侧风","雷雨交接","雾谷","窄域会车","山风急援","白夜","冰跑道","极光总调"];
|
||||
const weather=["晴","侧风","雷雨","薄雾","阵风","山风","飘雪","冻雾","极光雪"];
|
||||
const SHIFTS=patterns.map((flights,i)=>({id:i,airport:Math.floor(i/3),name:shiftNames[i],weather:weather[i],wind:[0,4,-5,1,5,-4,2,-2,4][i],target:[4,5,6,4,5,6,4,5,7][i],duration:[48,54,60,50,56,62,50,58,68][i],closed:i===2?"B":i===7?"A":null,flights:flights.map((f,n)=>({at:f[0],type:f[1],side:f[2],code:`${["BH","VG","PL"][Math.floor(i/3)]}${i+1}${n+1}`}))}));
|
||||
const KEY="mini_atc_campaign_v2";const $=id=>document.getElementById(id);const els={canvas:$("radarCanvas"),shiftList:$("shiftList"),shiftTitle:$("shiftTitle"),brief:$("brief"),goals:$("goals"),selectedInfo:$("selectedInfo"),notice:$("notice"),start:$("startBtn"),end:$("endBtn"),pause:$("pauseBtn"),speed:$("speedBtn"),clear:$("clearBtn"),vector:$("vectorBtn"),landed:$("landedStat"),incident:$("incidentStat"),traffic:$("trafficStat"),clock:$("clockStat"),weather:$("weatherStat"),priority:$("priorityStat"),totalStars:$("totalStars"),clears:$("clears"),perfects:$("perfects"),archive:$("archiveModal"),archiveText:$("archiveText"),archiveFeedback:$("archiveFeedback")};const g=els.canvas.getContext("2d");
|
||||
function defaults(){return {v:2,unlocked:0,stars:Array(9).fill(0),bestIncidents:Array(9).fill(null),clears:0,perfects:0};}
|
||||
function load(){try{const v=JSON.parse(localStorage.getItem(KEY)||"null");if(v&&v.v===2)return {...defaults(),...v,stars:Array.from({length:9},(_,i)=>clamp(+v.stars?.[i]||0,0,3)),bestIncidents:Array.from({length:9},(_,i)=>Number.isInteger(v.bestIncidents?.[i])?Math.max(0,v.bestIncidents[i]):null)};}catch(_){}return defaults();}
|
||||
let profile=load(),selectedShift=Math.min(profile.unlocked,8),state=makeState(),selected=null,last=0,speed=1;
|
||||
function clamp(v,a,b){return Math.max(a,Math.min(b,v));}function totalStars(){return profile.stars.reduce((a,b)=>a+b,0);}function save(){localStorage.setItem(KEY,JSON.stringify(profile));}
|
||||
function makeState(){return {mode:"brief",clock:0,next:0,planes:[],landed:0,incidents:0,priorityLanded:0,priorityTotal:SHIFTS[selectedShift].flights.filter(f=>TYPES[f.type].priority).length,vectorUsed:false,near:new Set(),zoneHits:new Set()};}
|
||||
function current(){return SHIFTS[selectedShift];}function airport(){return AIRPORTS[current().airport];}
|
||||
function entry(side){return [{x:25,y:115,h:5},{x:925,y:145,h:180},{x:890,y:610,h:225},{x:35,y:575,h:320}][side];}
|
||||
function spawnPlane(spec){const e=entry(spec.side);const t=TYPES[spec.type];const p={...e,id:spec.code,type:spec.type,alt:spec.type==="cargo"?4:3,runway:null,cleared:false,speed:t.speed,active:true};state.planes.push(p);return p;}
|
||||
function start(){state=makeState();selected=null;state.mode="playing";els.notice.textContent="班次开始:选择航班,建立高度间隔并分配开放跑道。";renderAll();}
|
||||
function issue(text){state.incidents++;els.notice.textContent=text;}
|
||||
function angleDiff(a,b){return ((a-b+540)%360)-180;}function dist(a,b){return Math.hypot(a.x-b.x,a.y-b.y);}
|
||||
function step(rawDt){if(state.mode!=="playing")return;const dt=rawDt*speed;const s=current(),ap=airport();state.clock+=dt;while(state.next<s.flights.length&&s.flights[state.next].at<=state.clock)spawnPlane(s.flights[state.next++]);
|
||||
for(const p of [...state.planes]){p.h=(p.h+s.wind*dt*.12+360)%360;const a=p.h*Math.PI/180;p.x+=Math.cos(a)*p.speed*dt;p.y+=Math.sin(a)*p.speed*dt;
|
||||
for(const z of ap.zones){const key=p.id+z.label;if(Math.hypot(p.x-z.x,p.y-z.y)<z.r&&p.alt<=z.maxAlt&&!state.zoneHits.has(key)){state.zoneHits.add(key);issue(`${p.id} 低高度进入${z.label}限制空域。`);}}
|
||||
if(p.cleared&&p.runway){const r=ap.runways[p.runway];if(dist(p,r)<54&&Math.abs(angleDiff(p.h,r.h))<22&&p.alt===1){state.landed++;if(TYPES[p.type].priority)state.priorityLanded++;state.planes=state.planes.filter(x=>x!==p);if(selected===p)selected=null;els.notice.textContent=`${p.id} 在 ${p.runway} 跑道安全落地。`;continue;}}
|
||||
if(p.x<-45||p.x>1005||p.y<-45||p.y>695){state.planes=state.planes.filter(x=>x!==p);if(selected===p)selected=null;issue(`${p.id} 未完成移交便离开空域。`);}}
|
||||
for(let i=0;i<state.planes.length;i++)for(let j=i+1;j<state.planes.length;j++){const a=state.planes[i],b=state.planes[j],key=[a.id,b.id].sort().join(":");const need=30+(TYPES[a.type].wake+TYPES[b.type].wake)*4;if(dist(a,b)<need&&Math.abs(a.alt-b.alt)<1&&!state.near.has(key)){state.near.add(key);issue(`${a.id} 与 ${b.id} 间隔不足。`);}if(dist(a,b)>need*1.8)state.near.delete(key);}
|
||||
if(state.next===s.flights.length&&!state.planes.length&&state.clock>=s.flights.at(-1).at+4)finishShift();renderAll();}
|
||||
function grade(){if(state.landed<current().target)return 0;return 1+(state.incidents===0?1:0)+(state.priorityLanded===state.priorityTotal?1:0);}
|
||||
function finishShift(force=false){if(state.mode!=="playing")return grade();if(!force&&state.next<current().flights.length)return 0;state.mode="result";const stars=grade();if(stars){profile.stars[selectedShift]=Math.max(profile.stars[selectedShift],stars);profile.bestIncidents[selectedShift]=profile.bestIncidents[selectedShift]===null?state.incidents:Math.min(profile.bestIncidents[selectedShift],state.incidents);profile.unlocked=Math.max(profile.unlocked,Math.min(8,selectedShift+1));profile.clears++;if(state.incidents===0)profile.perfects++;save();els.notice.textContent=`班次完成:${"★".repeat(stars)}${"☆".repeat(3-stars)},安全落地 ${state.landed} 架。`;}else els.notice.textContent=`班次未达标:需要至少 ${current().target} 架安全落地。`;renderAll();return stars;}
|
||||
function selectShift(i){if(i>profile.unlocked||state.mode==="playing")return;selectedShift=i;state=makeState();selected=null;renderAll();}
|
||||
function renderSide(){const s=current(),ap=airport();els.shiftList.innerHTML=SHIFTS.map((x,i)=>`<button class="shift ${i===selectedShift?"active":""}" data-shift="${i}" ${i>profile.unlocked||state.mode==="playing"?"disabled":""}><b>${i+1}. ${x.name}</b><small>${AIRPORTS[x.airport].name}</small><span class="stars">${"★".repeat(profile.stars[i])}${"☆".repeat(3-profile.stars[i])}</span></button>`).join("");els.shiftList.querySelectorAll("[data-shift]").forEach(b=>b.onclick=()=>selectShift(+b.dataset.shift));els.shiftTitle.textContent=`${ap.name} · ${s.name}`;els.brief.innerHTML=`<div><span>天气</span><b>${s.weather}${s.wind?` · 漂移 ${s.wind>0?"+":""}${s.wind}`:""}</b></div><div><span>航班计划</span><b>${s.flights.length} 架 / ${s.duration} 秒</b></div><div><span>跑道</span><b>${s.closed?`${s.closed} 临时关闭`:"A / B 均开放"}</b></div><div><span>限制区</span><b>${ap.zones.length?ap.zones.map(z=>z.label).join("、"):"无"}</b></div>`;els.goals.innerHTML=`<div class="goal ${state.landed>=s.target?"pass":""}">目标落地:${state.landed}/${s.target}</div><div class="goal ${state.incidents===0?"pass":""}">无间隔、限制区或移交事件:${state.incidents}</div><div class="goal ${state.priorityLanded===state.priorityTotal?"pass":""}">优先航班全部落地:${state.priorityLanded}/${state.priorityTotal}</div>`;els.start.disabled=state.mode==="playing";els.end.disabled=state.mode!=="playing";els.end.textContent=state.mode==="result"?"已结算":"提前结算";els.selectedInfo.innerHTML=selected?`<b>${selected.id} · ${TYPES[selected.type].name}</b><small>航向 ${Math.round(selected.h)}° · FL${selected.alt} · ${selected.runway?`跑道 ${selected.runway}`:"未分配跑道"}${selected.cleared?" · 已许可进近":""}</small>`:`<b>未选择航班</b><small>点击雷达上的航班标记。</small>`;els.vector.disabled=!selected||state.vectorUsed;els.clear.disabled=!selected;els.totalStars.textContent=totalStars();els.clears.textContent=profile.clears;els.perfects.textContent=profile.perfects;}
|
||||
function renderHud(){const s=current();els.landed.textContent=state.landed;els.incident.textContent=state.incidents;els.traffic.textContent=state.planes.length;els.clock.textContent=`${String(Math.floor(state.clock/60)).padStart(2,"0")}:${String(Math.floor(state.clock%60)).padStart(2,"0")}`;els.weather.textContent=s.weather;els.priority.textContent=`${state.priorityLanded}/${state.priorityTotal}`;els.pause.textContent=state.mode==="paused"?"继续":"暂停";els.speed.textContent=`速度 ×${speed}`;}
|
||||
function draw(){const ap=airport(),s=current();const bg=g.createLinearGradient(0,0,960,650);bg.addColorStop(0,ap.theme[0]);bg.addColorStop(1,ap.theme[1]);g.fillStyle=bg;g.fillRect(0,0,960,650);g.strokeStyle="#ffffff16";g.lineWidth=1;for(let x=40;x<960;x+=60){g.beginPath();g.moveTo(x,0);g.lineTo(x,650);g.stroke()}for(let y=40;y<650;y+=60){g.beginPath();g.moveTo(0,y);g.lineTo(960,y);g.stroke()}g.strokeStyle="#92c8d344";for(const r of [90,180,270]){g.beginPath();g.arc(480,325,r,0,Math.PI*2);g.stroke()}
|
||||
for(const z of ap.zones){g.fillStyle="#d9665b25";g.strokeStyle="#e88a7b";g.beginPath();g.arc(z.x,z.y,z.r,0,Math.PI*2);g.fill();g.stroke();g.fillStyle="#ffd3cc";g.font="12px sans-serif";g.textAlign="center";g.fillText(`${z.label} FL${z.maxAlt}↓禁入`,z.x,z.y+4)}
|
||||
for(const [id,r] of Object.entries(ap.runways)){g.save();g.translate(r.x,r.y);g.rotate(r.h*Math.PI/180);g.fillStyle=s.closed===id?"#65424a":"#839198";g.fillRect(-92,-12,184,24);g.fillStyle="white";for(let x=-70;x<=70;x+=28)g.fillRect(x,-1,14,2);g.font="bold 14px sans-serif";g.textAlign="center";g.fillText(s.closed===id?`${id} ×`:id,0,5);g.restore()}
|
||||
for(const p of state.planes){const t=TYPES[p.type];g.save();g.translate(p.x,p.y);g.rotate(p.h*Math.PI/180);g.fillStyle=p===selected?"#ffe46d":p.cleared?"#75e4a8":t.color;g.beginPath();g.moveTo(17,0);g.lineTo(-12,-9);g.lineTo(-5,0);g.lineTo(-12,9);g.closePath();g.fill();g.restore();g.fillStyle="#eef8ff";g.font="11px sans-serif";g.textAlign="left";g.fillText(`${p.id} ${t.mark} FL${p.alt}${p.runway||"-"}`,p.x+13,p.y-12)}
|
||||
if(state.mode!=="playing"&&state.mode!=="paused"){g.fillStyle="#031018bb";g.fillRect(0,0,960,650);g.fillStyle="white";g.textAlign="center";g.font="bold 34px sans-serif";g.fillText(state.mode==="result"?"班次已结算":`${ap.name} · ${s.name}`,480,305);g.font="15px sans-serif";g.fillStyle="#c7dce4";g.fillText(state.mode==="result"?els.notice.textContent:"查看右侧简报后开始班次",480,340)}}
|
||||
function renderAll(){renderSide();renderHud();draw();}
|
||||
els.canvas.addEventListener("pointerdown",e=>{if(state.mode!=="playing")return;const r=els.canvas.getBoundingClientRect(),x=(e.clientX-r.left)*960/r.width,y=(e.clientY-r.top)*650/r.height;selected=state.planes.slice().sort((a,b)=>Math.hypot(a.x-x,a.y-y)-Math.hypot(b.x-x,b.y-y))[0]||null;if(selected&&Math.hypot(selected.x-x,selected.y-y)>75)selected=null;renderSide();draw();});
|
||||
document.querySelectorAll("[data-turn]").forEach(b=>b.onclick=()=>{if(selected){selected.h=(selected.h+ +b.dataset.turn+360)%360;renderAll();}});document.querySelectorAll("[data-alt]").forEach(b=>b.onclick=()=>{if(selected){selected.alt=clamp(selected.alt+ +b.dataset.alt,1,5);renderAll();}});document.querySelectorAll("[data-rw]").forEach(b=>b.onclick=()=>{if(!selected)return;const id=b.dataset.rw;if(current().closed===id){els.notice.textContent=`${id} 跑道当前关闭。`;return;}selected.runway=id;renderAll();});
|
||||
els.clear.onclick=()=>{if(!selected||!selected.runway){els.notice.textContent="先选择航班并分配开放跑道。";return;}selected.cleared=true;els.notice.textContent=`${selected.id} 已获准进近 ${selected.runway} 跑道。`;renderAll();};els.vector.onclick=()=>{if(!selected||state.vectorUsed)return;const r=airport().runways[selected.runway||Object.keys(airport().runways).find(id=>id!==current().closed)];selected.runway=Object.entries(airport().runways).find(([,x])=>x===r)[0];selected.h=r.h;selected.alt=1;selected.cleared=true;state.vectorUsed=true;els.notice.textContent=`引导已将 ${selected.id} 对准 ${selected.runway} 跑道。`;renderAll();};els.start.onclick=start;els.end.onclick=()=>finishShift(true);els.pause.onclick=()=>{if(state.mode==="playing")state.mode="paused";else if(state.mode==="paused")state.mode="playing";renderAll();};els.speed.onclick=()=>{speed=speed===1?2:speed===2?4:1;renderHud();};
|
||||
function checksum(s){let h=2166136261;for(let i=0;i<s.length;i++){h^=s.charCodeAt(i);h=Math.imul(h,16777619)}return (h>>>0).toString(36);}
|
||||
function encode(){const p=btoa(unescape(encodeURIComponent(JSON.stringify({v:2,u:profile.unlocked,s:profile.stars,b:profile.bestIncidents,c:profile.clears,p:profile.perfects}))));return `ATC2.${p}.${checksum(p)}`;}
|
||||
function decode(code){const p=code.trim().split(".");if(p.length!==3||p[0]!=="ATC2"||checksum(p[1])!==p[2])throw Error("塔台档案校验失败");const v=JSON.parse(decodeURIComponent(escape(atob(p[1]))));if(v.v!==2||!Array.isArray(v.s))throw Error("档案版本不兼容");return {v:2,unlocked:clamp(+v.u||0,0,8),stars:Array.from({length:9},(_,i)=>clamp(+v.s[i]||0,0,3)),bestIncidents:Array.from({length:9},(_,i)=>Number.isInteger(v.b?.[i])?Math.max(0,v.b[i]):null),clears:Math.max(0,+v.c||0),perfects:Math.max(0,+v.p||0)};}
|
||||
$("archiveBtn").onclick=()=>{els.archive.classList.remove("hidden");els.archiveText.value=encode();els.archiveFeedback.textContent="";};$("closeArchiveBtn").onclick=()=>els.archive.classList.add("hidden");$("exportBtn").onclick=async()=>{els.archiveText.value=encode();els.archiveText.select();try{await navigator.clipboard.writeText(els.archiveText.value);els.archiveFeedback.textContent="塔台档案已复制。";}catch(_){els.archiveFeedback.textContent="档案已生成,请手动复制。";}};$("importBtn").onclick=()=>{try{profile=decode(els.archiveText.value);save();selectedShift=Math.min(profile.unlocked,8);state=makeState();selected=null;renderAll();els.archiveFeedback.textContent="导入成功。";}catch(e){els.archiveFeedback.textContent=e.message;}};
|
||||
function validateContent(){const errors=[];if(AIRPORTS.length!==3)errors.push("airport count");if(SHIFTS.length!==9)errors.push("shift count");if(SHIFTS.some(s=>s.flights.length<5||s.target<4))errors.push("thin shift");if(SHIFTS.some(s=>s.closed&&!AIRPORTS[s.airport].runways[s.closed]))errors.push("closed runway");return {valid:!errors.length,errors,airports:AIRPORTS.length,shifts:SHIFTS.length,flights:SHIFTS.reduce((n,s)=>n+s.flights.length,0),types:Object.keys(TYPES).length};}
|
||||
window.__airTraffic={AIRPORTS,SHIFTS,TYPES,profile:()=>profile,state:()=>state,spawnPlane,step,finishShift,encode,decode,validateContent,renderAll,selectShift};
|
||||
function loop(t){const dt=Math.min(.05,(t-last)/1000||0);last=t;step(dt);if(state.mode!=="playing")draw();requestAnimationFrame(loop)}renderAll();requestAnimationFrame(loop);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
273
promo-video/scripts/check-atc-court-ember.mjs
Normal file
273
promo-video/scripts/check-atc-court-ember.mjs
Normal file
@@ -0,0 +1,273 @@
|
||||
import assert from "node:assert/strict";
|
||||
import http from "node:http";
|
||||
import { createReadStream } from "node:fs";
|
||||
import { mkdir, stat } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { chromium } from "playwright";
|
||||
|
||||
const here = path.dirname(fileURLToPath(import.meta.url));
|
||||
const rootDir = path.resolve(here, "..", "..");
|
||||
const outputDir = path.join(rootDir, "output", "atc-court-ember");
|
||||
const port = 4188;
|
||||
const failures = [];
|
||||
|
||||
const server = http.createServer(async (request, response) => {
|
||||
try {
|
||||
const pathname = decodeURIComponent(new URL(request.url, "http://local").pathname);
|
||||
if (pathname === "/favicon.ico") return response.writeHead(204).end();
|
||||
const target = path.resolve(rootDir, pathname.slice(1));
|
||||
if (!target.startsWith(rootDir + path.sep)) return response.writeHead(403).end("Forbidden");
|
||||
const info = await stat(target);
|
||||
if (!info.isFile()) throw new Error("Not a file");
|
||||
response.writeHead(200, {
|
||||
"content-type": target.endsWith(".html") ? "text/html; charset=utf-8" : "application/octet-stream",
|
||||
"cache-control": "no-store"
|
||||
});
|
||||
createReadStream(target).pipe(response);
|
||||
} catch {
|
||||
response.writeHead(404).end("Not found");
|
||||
}
|
||||
});
|
||||
|
||||
function observe(page) {
|
||||
page.on("pageerror", (error) => failures.push(`pageerror: ${error.message}`));
|
||||
page.on("console", (message) => {
|
||||
if (message.type() === "error") failures.push(`console: ${message.text()}`);
|
||||
});
|
||||
}
|
||||
|
||||
async function noOverflow(page, label) {
|
||||
const overflow = await page.evaluate(
|
||||
() => document.documentElement.scrollWidth - document.documentElement.clientWidth
|
||||
);
|
||||
assert.ok(overflow <= 4, `${label} horizontal overflow: ${overflow}px`);
|
||||
}
|
||||
|
||||
async function canvasSignal(page, selector) {
|
||||
return page.locator(selector).evaluate((canvas) => {
|
||||
const data = canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height).data;
|
||||
const colors = new Set();
|
||||
let opaque = 0;
|
||||
const stride = Math.max(4, Math.floor(data.length / 2200 / 4) * 4);
|
||||
for (let index = 0; index < data.length; index += stride) {
|
||||
if (data[index + 3] > 0) opaque += 1;
|
||||
colors.add(`${data[index] >> 4}:${data[index + 1] >> 4}:${data[index + 2] >> 4}`);
|
||||
}
|
||||
return { opaque, colors: colors.size };
|
||||
});
|
||||
}
|
||||
|
||||
async function moveCourtLine(page, target) {
|
||||
let current = await page.evaluate(() => window.__courtroom.run().line);
|
||||
while (current < target) {
|
||||
await page.locator("#nextBtn").click();
|
||||
current += 1;
|
||||
}
|
||||
while (current > target) {
|
||||
await page.locator("#prevBtn").click();
|
||||
current -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
await mkdir(outputDir, { recursive: true });
|
||||
await new Promise((resolve) => server.listen(port, "127.0.0.1", resolve));
|
||||
let browser;
|
||||
try {
|
||||
browser = await chromium.launch({ channel: "msedge", headless: true });
|
||||
} catch {
|
||||
browser = await chromium.launch({ headless: true });
|
||||
}
|
||||
|
||||
try {
|
||||
const desktop = await browser.newContext({ viewport: { width: 1440, height: 900 }, colorScheme: "dark" });
|
||||
|
||||
const atc = await desktop.newPage();
|
||||
observe(atc);
|
||||
await atc.goto(`http://127.0.0.1:${port}/air-traffic-control.html`, { waitUntil: "load" });
|
||||
await atc.waitForFunction(() => Boolean(window.__airTraffic));
|
||||
assert.deepEqual(
|
||||
await atc.evaluate(() => window.__airTraffic.validateContent()),
|
||||
{ valid: true, errors: [], airports: 3, shifts: 9, flights: 55, types: 4 },
|
||||
"ATC content audit"
|
||||
);
|
||||
await atc.locator("#startBtn").click();
|
||||
await atc.evaluate(() => {
|
||||
const api = window.__airTraffic;
|
||||
const state = api.state();
|
||||
const shift = api.SHIFTS[0];
|
||||
state.planes = [];
|
||||
state.next = shift.flights.length;
|
||||
state.clock = shift.flights.at(-1).at + 5;
|
||||
state.landed = shift.target - 1;
|
||||
state.priorityLanded = state.priorityTotal - 1;
|
||||
const plane = api.spawnPlane({ side: 0, type: "med", code: "TEST1" });
|
||||
plane.x = 375;
|
||||
plane.y = 250;
|
||||
plane.h = 0;
|
||||
plane.alt = 1;
|
||||
api.renderAll();
|
||||
});
|
||||
const canvasBox = await atc.locator("#radarCanvas").boundingBox();
|
||||
await atc.mouse.click(
|
||||
canvasBox.x + (375 / 960) * canvasBox.width,
|
||||
canvasBox.y + (250 / 650) * canvasBox.height
|
||||
);
|
||||
await atc.locator('[data-rw="A"]').click();
|
||||
await atc.locator("#clearBtn").click();
|
||||
await atc.evaluate(() => window.__airTraffic.step(0.5));
|
||||
assert.equal(await atc.evaluate(() => window.__airTraffic.profile().stars[0]), 3, "real ATC landing awards three stars");
|
||||
const atcCode = await atc.evaluate(() => window.__airTraffic.encode());
|
||||
assert.match(atcCode, /^ATC2\./, "ATC archive prefix");
|
||||
assert.equal(await atc.evaluate((code) => window.__airTraffic.decode(code).stars[0], atcCode), 3, "ATC archive round trip");
|
||||
const atcSignal = await canvasSignal(atc, "#radarCanvas");
|
||||
assert.ok(atcSignal.opaque > 30 && atcSignal.colors > 8, "ATC canvas signal");
|
||||
await noOverflow(atc, "ATC desktop");
|
||||
await atc.screenshot({ path: path.join(outputDir, "atc-desktop.png"), fullPage: true });
|
||||
|
||||
const court = await desktop.newPage();
|
||||
observe(court);
|
||||
await court.goto(`http://127.0.0.1:${port}/courtroom-clash.html`, { waitUntil: "load" });
|
||||
await court.waitForFunction(() => Boolean(window.__courtroom));
|
||||
assert.deepEqual(
|
||||
await court.evaluate(() => window.__courtroom.validateCases()),
|
||||
{ valid: true, errors: [], cases: 6, phases: 18, statements: 72, evidence: 30 },
|
||||
"court content audit"
|
||||
);
|
||||
for (let phaseIndex = 0; phaseIndex < 3; phaseIndex += 1) {
|
||||
const data = await court.evaluate((index) => {
|
||||
const courtCase = window.__courtroom.CASES[0];
|
||||
const phase = courtCase.phases[index];
|
||||
const evidence = courtCase.evidence.find((item) => item[0] === phase.answer[1]);
|
||||
let unlockLine = -1;
|
||||
if (evidence[4]) unlockLine = phase.lines.findIndex((line) => line[2] === phase.answer[1]);
|
||||
return { line: phase.answer[0], evidence: phase.answer[1], unlockLine };
|
||||
}, phaseIndex);
|
||||
if (data.unlockLine >= 0) {
|
||||
await moveCourtLine(court, data.unlockLine);
|
||||
await court.locator("#pressBtn").click();
|
||||
}
|
||||
await moveCourtLine(court, data.line);
|
||||
await court.locator(`[data-evidence="${data.evidence}"]`).click();
|
||||
await court.locator("#objectBtn").click();
|
||||
}
|
||||
const closing = await court.evaluate(() => window.__courtroom.CASES[0].close.answer);
|
||||
await court.locator("#culpritSelect").selectOption(String(closing[0]));
|
||||
await court.locator("#methodSelect").selectOption(String(closing[1]));
|
||||
await court.locator("#closeCaseBtn").click();
|
||||
assert.equal(await court.evaluate(() => window.__courtroom.profile().stars[0]), 3, "real court case awards three stars");
|
||||
const courtCode = await court.evaluate(() => window.__courtroom.encode());
|
||||
assert.match(courtCode, /^COURT2\./, "court archive prefix");
|
||||
assert.equal(await court.evaluate((code) => window.__courtroom.decode(code).stars[0], courtCode), 3, "court archive round trip");
|
||||
await noOverflow(court, "court desktop");
|
||||
await court.screenshot({ path: path.join(outputDir, "court-desktop.png"), fullPage: true });
|
||||
|
||||
const ember = await desktop.newPage();
|
||||
observe(ember);
|
||||
await ember.goto(`http://127.0.0.1:${port}/ember-tactics.html`, { waitUntil: "load" });
|
||||
await ember.waitForFunction(() => Boolean(window.__emberTactics));
|
||||
assert.deepEqual(
|
||||
await ember.evaluate(() => window.__emberTactics.validateContent()),
|
||||
{ valid: true, errors: [], missions: 9, heroes: 6, sigils: 8, objectiveTypes: 5 },
|
||||
"ember content audit"
|
||||
);
|
||||
await ember.locator("#startBtn").click();
|
||||
const beforeEnemy = await ember.evaluate(() => window.__emberTactics.state().enemies[0].hp);
|
||||
await ember.evaluate(() => {
|
||||
const api = window.__emberTactics;
|
||||
api.state().heroes[0].pos = 16;
|
||||
api.renderAll();
|
||||
});
|
||||
await ember.locator('[data-cell="16"]').click();
|
||||
await ember.locator('[data-cell="8"]').click();
|
||||
assert.ok(
|
||||
await ember.evaluate((before) => window.__emberTactics.state().enemies[0].hp < before, beforeEnemy),
|
||||
"real tactical attack damages enemy"
|
||||
);
|
||||
await ember.evaluate(() => {
|
||||
const api = window.__emberTactics;
|
||||
api.state().heroes[0].done = false;
|
||||
api.renderAll();
|
||||
});
|
||||
await ember.locator('[data-cell="16"]').click();
|
||||
await ember.locator("#skillBtn").click();
|
||||
assert.equal(await ember.evaluate(() => window.__emberTactics.state().enemies.length), 2, "real class skill defeats adjacent enemy");
|
||||
await ember.evaluate(() => {
|
||||
const api = window.__emberTactics;
|
||||
const state = api.state();
|
||||
state.enemies = [];
|
||||
state.lost = 0;
|
||||
state.turn = 1;
|
||||
api.finish(true);
|
||||
});
|
||||
assert.equal(await ember.evaluate(() => window.__emberTactics.profile().stars[0]), 3, "tactical mission awards three stars");
|
||||
const objectiveResults = await ember.evaluate(() => {
|
||||
const api = window.__emberTactics;
|
||||
api.profile().unlocked = 8;
|
||||
return api.MISSIONS.map((mission, index) => {
|
||||
api.selectMission(index);
|
||||
api.start();
|
||||
const state = api.state();
|
||||
if (mission.type === "eliminate" || mission.type === "boss") state.enemies = [];
|
||||
if (mission.type === "seal") state.sealed = [...mission.objectives];
|
||||
if (mission.type === "escape") state.escaped = 2;
|
||||
if (mission.type === "defend") state.turn = mission.rounds + 1;
|
||||
api.checkOutcome();
|
||||
return { type: mission.type, mode: state.mode };
|
||||
});
|
||||
});
|
||||
assert.equal(objectiveResults.every((item) => item.mode === "result"), true, "all tactical objective types can resolve");
|
||||
const emberCode = await ember.evaluate(() => window.__emberTactics.encode());
|
||||
assert.match(emberCode, /^EMBER2\./, "ember archive prefix");
|
||||
assert.equal(await ember.evaluate((code) => window.__emberTactics.decode(code).stars[0], emberCode), 3, "ember archive round trip");
|
||||
await noOverflow(ember, "ember desktop");
|
||||
await ember.screenshot({ path: path.join(outputDir, "ember-desktop.png"), fullPage: true });
|
||||
assert.deepEqual(failures, [], "desktop browser errors");
|
||||
await desktop.close();
|
||||
|
||||
const mobile = await browser.newContext({
|
||||
viewport: { width: 390, height: 844 },
|
||||
screen: { width: 390, height: 844 },
|
||||
isMobile: true,
|
||||
hasTouch: true,
|
||||
deviceScaleFactor: 2,
|
||||
colorScheme: "dark"
|
||||
});
|
||||
const cases = [
|
||||
["air-traffic-control.html", "__airTraffic", async (page) => {
|
||||
await page.locator("#startBtn").tap();
|
||||
assert.equal(await page.evaluate(() => window.__airTraffic.state().mode), "playing", "ATC mobile start");
|
||||
}],
|
||||
["courtroom-clash.html", "__courtroom", async (page) => {
|
||||
await page.locator("#pressBtn").tap();
|
||||
assert.equal(await page.evaluate(() => window.__courtroom.run().presses), 1, "court mobile press");
|
||||
}],
|
||||
["ember-tactics.html", "__emberTactics", async (page) => {
|
||||
await page.locator("#startBtn").tap();
|
||||
await page.locator('[data-cell="56"]').tap();
|
||||
assert.equal(await page.evaluate(() => window.__emberTactics.state().selected?.type), "knight", "ember mobile selection");
|
||||
}]
|
||||
];
|
||||
for (const [file, api, interact] of cases) {
|
||||
const page = await mobile.newPage();
|
||||
observe(page);
|
||||
await page.goto(`http://127.0.0.1:${port}/${file}`, { waitUntil: "load" });
|
||||
await page.waitForFunction((name) => Boolean(window[name]), api);
|
||||
await interact(page);
|
||||
await noOverflow(page, `${file} mobile`);
|
||||
await page.screenshot({ path: path.join(outputDir, file.replace(".html", "-mobile.png")), fullPage: true });
|
||||
await page.close();
|
||||
}
|
||||
assert.deepEqual(failures, [], "mobile browser errors");
|
||||
await mobile.close();
|
||||
|
||||
console.log(JSON.stringify({
|
||||
atc: { airports: 3, shifts: 9, flights: 55, archive: "ATC2" },
|
||||
court: { cases: 6, phases: 18, statements: 72, evidence: 30, archive: "COURT2" },
|
||||
ember: { missions: 9, heroes: 6, sigils: 8, objectiveTypes: 5, archive: "EMBER2" },
|
||||
failures
|
||||
}, null, 2));
|
||||
} finally {
|
||||
await browser.close();
|
||||
await new Promise((resolve) => server.close(resolve));
|
||||
}
|
||||
Reference in New Issue
Block a user