commit a3f61a29d0d071687ab8beb1e43c7ffb52798116 Author: zpx Date: Fri Nov 20 15:13:11 2026 +0800 添加登录功能 diff --git a/.creator/templates/typescript/Custom Script Template Help Documentation.url b/.creator/templates/typescript/Custom Script Template Help Documentation.url new file mode 100644 index 0000000..7606df0 --- /dev/null +++ b/.creator/templates/typescript/Custom Script Template Help Documentation.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://docs.cocos.com/creator/manual/en/scripting/setup.html#custom-script-template \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f94747d --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ + +#/////////////////////////// +# Cocos Creator Project +#/////////////////////////// + +/library/ +/temp/ +/local/ +/build/ +/profiles/ +/common-key/ +/native/engine/android/**/*/assets +/美术资源/source-res/ +#////////////////////////// +# NPM +#////////////////////////// +node_modules/ + +#////////////////////////// +# VSCode +#////////////////////////// +.vscode/ + +#////////////////////////// +# WebStorm +#////////////////////////// +.idea/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..c5b3b20 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,55 @@ +# 项目开发规则 + +## 协作状态机 + +- 每个新需求默认进入“需求理解、讨论阶段”,不是实施阶段。 +- 需求理解阶段允许读取代码、配置、Git 状态、场景数据和资源信息,以便理解需求并制定可靠方案。 +- 讨论阶段允许读取代码、配置、Git 状态、场景数据和资源信息,以便理解需求并制定可靠方案。 +- 讨论阶段禁止修改、创建、删除、移动或格式化文件;禁止复制资源、安装依赖、保存场景、启动构建以及调用任何会改变项目状态的工具。 +- 收到需求后,先完整理解需求和边界,再说明实现方案、取舍、风险、预计修改范围和验证方式。 +- 讨论回复结尾必须标记:`当前状态:等待“开始实施”授权`。 +- 只有当用户发送一条去除首尾空白后完全等于 `开始实施` 的单独消息时,才进入实施阶段。 +- `可以`、`没问题`、`没有异议`、`继续`、`按这个方案`、`确认方案` 等表达都不构成实施授权。 +- 不得根据语气、上下文或方案已达成一致而推断用户授权实施。 +- 进入实施阶段后,只执行已讨论并获准的范围。需求范围发生实质变化时,重新回到讨论阶段。 +- 用户说“先分析”“先讨论”“不要修改”时,始终保持讨论阶段。 + +## 项目范围 + +- 这是一个 PinK 工程,使用 TypeScript 和 2D 竖屏界面;项目元数据中的 3d 类型不代表玩法使用 3D。 +- 修改必须限定在已获准的功能范围内。 +- 除非任务确实需要,否则不要扫描 `node_modules`、`dist` 或大型资源目录。 +- 只加载当前任务需要的 Skill,不要预先读取整套 Skill。 +- 永久禁止加载、读取或执行 `skill-game-factory` 及任何 Factory 命令或状态工作流;此前已加载的 Factory 指令不适用于本项目。 +- `E:\ProjectPhaser\ricochet-circuit` 严格只读:仅可读取源码、包配置或执行只读 Git 命令;禁止修改文件、安装依赖、构建、测试、同步及任何可能写入该目录的命令。 +- 保留用户已有修改,不清理或覆盖无关工作区内容。 + +## PinK 场景与资源 + +- 使用 PinK 场景、资源及构建工具;场景编辑前明确绑定目标场景。 +- 场景通过领域工具创建、修改与保存,不手工编辑 `.scene` 文件。 +- 脚本资源通过资源工具创建,后续 TypeScript 逻辑使用文本补丁维护。 +- 占位版界面由场景组件生成,符号 ID 与显示分离,后续可替换美术。 +- 查询后再修改节点或组件属性,完整写入值类型;完成一批场景修改后保存并复核。 +- 操作结果不确定时先查询状态,不盲目重试。保留用户已有场景修改。 +- 如果工程连接失效或目标项目错误,停止相关操作并报告阻塞。 + +## Token 与工具调用控制 + +- 先形成批量修改计划,再执行工具调用;不要为每个对象分别开启一个工具回合。 +- 能通过对象数据、坐标和场景尺寸验证时,不获取截图。 +- 每个功能阶段默认最多获取两次截图:必要的修改前基准图和最终验收图。 +- 同一张截图最多读取一次,不要重复使用 `view_image` 查看相同图片。 +- 不要把图片二进制、Base64、大型完整 JSON 或无关终端输出带入上下文。 +- 使用定向搜索和有限输出,不要重复读取已经掌握且没有变化的内容。 +- 如果任务明显变成多个独立阶段,完成当前阶段后先总结,再建议新建会话继续。 + +## 验证 + +- 依赖和脚本命令统一使用 `pnpm@11.17.0`,根目录维护唯一的 `pnpm-lock.yaml`;当前没有原生子工程,不要创建 npm/yarn 锁文件。 +- 首次运行先在当前项目根目录执行 `pnpm install`;依赖构建脚本仅允许 `pnpm-workspace.yaml` 中明确批准的 `esbuild`。 +- 本地运行使用 PinK 场景预览;不要假设当前工程包含独立 Web 开发服务器。 +- 修改 TypeScript 后运行 `pnpm typecheck`。 +- 修改行为逻辑后运行 `pnpm test`。 +- 可能影响编译或资源的修改完成后通过 PinK 构建工具构建,未指定平台时使用 `web-mobile`。 +- 只执行与本次修改风险相匹配的验证,并报告未执行的命令及原因。 \ No newline at end of file diff --git a/assets/.gitkeep b/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/assets/Welcome.scene b/assets/Welcome.scene new file mode 100644 index 0000000..56add44 --- /dev/null +++ b/assets/Welcome.scene @@ -0,0 +1,1854 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "Welcome", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_name": "Welcome", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + } + ], + "_active": true, + "_components": [], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "autoReleaseAssets": false, + "_globals": { + "__id__": 43 + }, + "_id": "478fdf39-37fe-4d07-9770-f088728b9215" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 5 + }, + { + "__id__": 8 + } + ], + "_active": true, + "_components": [ + { + "__id__": 38 + }, + { + "__id__": 39 + }, + { + "__id__": 40 + }, + { + "__id__": 41 + }, + { + "__id__": 42 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 540, + "y": 960, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "beI88Z2HpFELqR4T5EMHpg" + }, + { + "__type__": "cc.Node", + "_name": "Camera", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 4 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 1000 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "ebFwiq8gBFaYpqYbdoDODe" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": null, + "_projection": 0, + "_priority": 0, + "_fov": 45, + "_fovAxis": 0, + "_orthoHeight": 185.35714285714286, + "_near": 0, + "_far": 2000, + "_color": { + "__type__": "cc.Color", + "r": 55, + "g": 0, + "b": 34, + "a": 255 + }, + "_depth": 1, + "_stencil": 0, + "_clearFlags": 7, + "_rect": { + "__type__": "cc.Rect", + "x": 0, + "y": 0, + "width": 1, + "height": 1 + }, + "_aperture": 19, + "_shutter": 7, + "_iso": 0, + "_screenScale": 1, + "_visibility": 1108344832, + "_targetTexture": null, + "_postProcess": null, + "_usePostProcess": false, + "_cameraType": -1, + "_trackingType": 0, + "_id": "63WIch3o5BEYRlXzTT0oWc" + }, + { + "__type__": "cc.Node", + "_name": "OrchardBackdrop", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 6 + }, + { + "__id__": 7 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "26KRKy6gBFz4ZFiySVXg2B" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 1080, + "height": 1920 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "dazBWjvj9AyKS+12KbNUBA" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f2e507ec-c69a-4484-82df-bf893aca4975@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": false, + "_useGrayscale": false, + "_atlas": null, + "_id": "5a67Wd225LT5m/CmLyHDb/" + }, + { + "__type__": "cc.Node", + "_name": "WelcomeComposition", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 9 + }, + { + "__id__": 12 + }, + { + "__id__": 15 + }, + { + "__id__": 19 + }, + { + "__id__": 22 + }, + { + "__id__": 25 + }, + { + "__id__": 29 + }, + { + "__id__": 33 + } + ], + "_active": true, + "_components": [ + { + "__id__": 36 + }, + { + "__id__": 37 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "66/Ssu9CtLmLPr/pSyYKdT" + }, + { + "__type__": "cc.Node", + "_name": "BrandMark", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 11 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 4, + "y": 466.5, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "b5lySJubRMArv2NYdKvETB" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 982, + "height": 643 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "18BpD8klRHNJ+YkvWN8iSl" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "6d00a053-6087-49e8-8dd2-41de217646ae@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": false, + "_useGrayscale": false, + "_atlas": null, + "_id": "e1XAqfXnVFGKi+MPVQtlEC" + }, + { + "__type__": "cc.Node", + "_name": "FruitArrangement", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 13 + }, + { + "__id__": 14 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -7.5, + "y": -78, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "8d1HDktLJFK7/Jt3H8ziyY" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 12 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 991, + "height": 456 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "e0X7nAyI9KvpjL1U8mRrHa" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 12 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "eb8cef2e-799f-4599-ad1a-ce004b28dbc8@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": false, + "_useGrayscale": false, + "_atlas": null, + "_id": "1ex9jbHAVMtYvFhdJ+6tLX" + }, + { + "__type__": "cc.Node", + "_name": "GuestAccess", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 16 + }, + { + "__id__": 17 + }, + { + "__id__": 18 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -1.5, + "y": -460, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "fe+x7Ad5ZPlIyj0ARgmVvK" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 15 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 1027, + "height": 268 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "9fskPYz6ZPpIYJ+UHBpVOW" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 15 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "68253d33-6386-4047-aa78-8fed637aac12@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": false, + "_useGrayscale": false, + "_atlas": null, + "_id": "a4JljgcytJD4KdeXLwGKeE" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 15 + }, + "_enabled": true, + "__prefab": null, + "clickEvents": [], + "_interactable": true, + "_transition": 3, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 0.97, + "_target": null, + "_id": "59rEZvUuBIUr1XbqFfKFl2" + }, + { + "__type__": "cc.Node", + "_name": "AuthenticationStatus", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 20 + }, + { + "__id__": 21 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -692, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "401asA0wdCA501tss6GW6f" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 19 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 50 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "40F5LFnsJDeal4g/LqMCLk" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 19 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 250, + "g": 250, + "b": 250, + "a": 255 + }, + "_string": "", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 43, + "_fontSize": 25, + "_fontFamily": "Arial", + "_lineHeight": 33, + "_overflow": 2, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "53ciarGRpMxLHsRdF/skjM" + }, + { + "__type__": "cc.Node", + "_name": "GuestReassurance", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 23 + }, + { + "__id__": 24 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -618, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "f1w6X4WzVDl5u8bVAQHnJh" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 22 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 780, + "height": 90 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "e23lIuOOVC+LZBLnZ0oYxO" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 22 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 250, + "g": 250, + "b": 250, + "a": 255 + }, + "_string": "No account needed", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 79, + "_fontSize": 56, + "_fontFamily": "Arial", + "_lineHeight": 64, + "_overflow": 2, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": true, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "73gKwVyFZKGJjVRPSRY4pl" + }, + { + "__type__": "cc.Node", + "_name": "PrivacyLink", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 26 + }, + { + "__id__": 27 + }, + { + "__id__": 28 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -190, + "y": -765, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "a8/yyGJRtB+7TzHw9VLO6E" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 300, + "height": 88 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "44XAa4Q7tPWqFGKWvkSXVC" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 250, + "g": 250, + "b": 250, + "a": 255 + }, + "_string": "Privacy Policy", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 54, + "_fontSize": 38, + "_fontFamily": "Arial", + "_lineHeight": 46, + "_overflow": 2, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": true, + "_isUnderline": true, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "c7IiVpHvlO5a2tcNujeID5" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": null, + "clickEvents": [], + "_interactable": true, + "_transition": 0, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": null, + "_id": "37gXqluXZCZoEHu+s7PJlu" + }, + { + "__type__": "cc.Node", + "_name": "TermsLink", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 30 + }, + { + "__id__": 31 + }, + { + "__id__": 32 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 179, + "y": -765, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "c6ZKVFAO5P3rKzPti4DakM" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 29 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 340, + "height": 88 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "99HYsVOP5AuICzwHVEvSbq" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 29 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 250, + "g": 250, + "b": 250, + "a": 255 + }, + "_string": "Terms of Service", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 54, + "_fontSize": 38, + "_fontFamily": "Arial", + "_lineHeight": 46, + "_overflow": 2, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": true, + "_isUnderline": true, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "685koAsO1CFpN4yuinV5RL" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 29 + }, + "_enabled": true, + "__prefab": null, + "clickEvents": [], + "_interactable": true, + "_transition": 0, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": null, + "_id": "6d2rE2cXNA3ZNYzrRPcvRJ" + }, + { + "__type__": "cc.Node", + "_name": "LegalDivider", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 34 + }, + { + "__id__": 35 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -10, + "y": -765, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "87HxrYUElPzYd7p8XpzYkR" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 28, + "height": 76 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "2dWrrr0kVMb4NxDxH2BmRO" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 236, + "g": 0, + "b": 136, + "a": 255 + }, + "_string": "|", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 79, + "_fontSize": 56, + "_fontFamily": "Arial", + "_lineHeight": 64, + "_overflow": 2, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "8aD8Sg3aNLL6AuDaIP70xt" + }, + { + "__type__": "e7144AjWzJMWYnovmYcmf4J", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": null, + "guestButton": { + "__id__": 18 + }, + "statusLabel": { + "__id__": 21 + }, + "_id": "9fQQ+SNOtN160HbwzlwEha" + }, + { + "__type__": "7f182CUOBZECbSSdxsFnMI7", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": null, + "privacyButton": { + "__id__": 28 + }, + "termsButton": { + "__id__": 32 + }, + "notice": { + "__id__": 21 + }, + "privacyUrl": "", + "termsUrl": "", + "_id": "c3ujDR7IRHVpX7n0QWR5qv" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 1080, + "height": 1920 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "d6rUX5yfhMlKoWX2bSbawx" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_cameraComponent": { + "__id__": 4 + }, + "_alignCanvasWithScreen": true, + "_id": "12O/ljcVlEqLmVm3U2gEOQ" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": false, + "__prefab": null, + "_alignFlags": 0, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 5.684341886080802e-14, + "_bottom": 5.684341886080802e-14, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "c5V1EV8IpMtrIvY1OE9t2u" + }, + { + "__type__": "34049bQR0xGeJ7ht3Uakg4F", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_id": "55JCBGXk5Jr5GP5EaY5s2n" + }, + { + "__type__": "c8bc8qriOVHj68HAPMr1mo6", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_id": "02VbCZGqVK94/vLEHGBckY" + }, + { + "__type__": "cc.SceneGlobals", + "ambient": { + "__id__": 44 + }, + "shadows": { + "__id__": 45 + }, + "_skybox": { + "__id__": 46 + }, + "fog": { + "__id__": 47 + }, + "octree": { + "__id__": 48 + }, + "skin": { + "__id__": 49 + }, + "lightProbeInfo": { + "__id__": 50 + }, + "postSettings": { + "__id__": 51 + }, + "bakedWithStationaryMainLight": false, + "bakedWithHighpLightmap": false + }, + { + "__type__": "cc.AmbientInfo", + "_skyColorHDR": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0.520833125 + }, + "_skyColor": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0.520833125 + }, + "_skyIllumHDR": 20000, + "_skyIllum": 20000, + "_groundAlbedoHDR": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0 + }, + "_groundAlbedo": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0 + }, + "_skyColorLDR": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.5, + "z": 0.8, + "w": 1 + }, + "_skyIllumLDR": 20000, + "_groundAlbedoLDR": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.2, + "z": 0.2, + "w": 1 + } + }, + { + "__type__": "cc.ShadowsInfo", + "_enabled": false, + "_type": 0, + "_normal": { + "__type__": "cc.Vec3", + "x": 0, + "y": 1, + "z": 0 + }, + "_distance": 0, + "_planeBias": 1, + "_shadowColor": { + "__type__": "cc.Color", + "r": 76, + "g": 76, + "b": 76, + "a": 255 + }, + "_maxReceived": 4, + "_size": { + "__type__": "cc.Vec2", + "x": 512, + "y": 512 + } + }, + { + "__type__": "cc.SkyboxInfo", + "_envLightingType": 0, + "_envmapHDR": null, + "_envmap": null, + "_envmapLDR": null, + "_diffuseMapHDR": null, + "_diffuseMapLDR": null, + "_enabled": false, + "_useHDR": true, + "_editableMaterial": null, + "_reflectionHDR": null, + "_reflectionLDR": null, + "_rotationAngle": 0 + }, + { + "__type__": "cc.FogInfo", + "_type": 0, + "_fogColor": { + "__type__": "cc.Color", + "r": 200, + "g": 200, + "b": 200, + "a": 255 + }, + "_enabled": false, + "_fogDensity": 0.3, + "_fogStart": 0.5, + "_fogEnd": 300, + "_fogAtten": 5, + "_fogTop": 1.5, + "_fogRange": 1.2, + "_accurate": false + }, + { + "__type__": "cc.OctreeInfo", + "_enabled": false, + "_minPos": { + "__type__": "cc.Vec3", + "x": -1024, + "y": -1024, + "z": -1024 + }, + "_maxPos": { + "__type__": "cc.Vec3", + "x": 1024, + "y": 1024, + "z": 1024 + }, + "_depth": 8 + }, + { + "__type__": "cc.SkinInfo", + "_enabled": false, + "_blurRadius": 0.01, + "_sssIntensity": 3 + }, + { + "__type__": "cc.LightProbeInfo", + "_giScale": 1, + "_giSamples": 1024, + "_bounces": 2, + "_reduceRinging": 0, + "_showProbe": true, + "_showWireframe": true, + "_showConvex": false, + "_data": null, + "_lightProbeSphereVolume": 1 + }, + { + "__type__": "cc.PostSettingsInfo", + "_toneMappingType": 0 + } +] \ No newline at end of file diff --git a/assets/Welcome.scene.meta b/assets/Welcome.scene.meta new file mode 100644 index 0000000..6b1842a --- /dev/null +++ b/assets/Welcome.scene.meta @@ -0,0 +1,11 @@ +{ + "ver": "1.1.50", + "importer": "scene", + "imported": true, + "uuid": "478fdf39-37fe-4d07-9770-f088728b9215", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login.meta b/assets/login.meta new file mode 100644 index 0000000..219313f --- /dev/null +++ b/assets/login.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "a7d4d258-9358-4240-acf9-74b73e71cd0c", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts.meta b/assets/login/scripts.meta new file mode 100644 index 0000000..21738a1 --- /dev/null +++ b/assets/login/scripts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "4a204ac2-aeae-49b2-91f2-cf05cab13ef5", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestContracts.ts b/assets/login/scripts/GuestContracts.ts new file mode 100644 index 0000000..51ebbe0 --- /dev/null +++ b/assets/login/scripts/GuestContracts.ts @@ -0,0 +1,40 @@ +/** 登录边界与可注入端口。 / Login contracts and injectable ports. */ +export interface GuestSettings { + origin: string; + product: string; + deviceType: 'iphone' | 'ipad'; + registerDevice: string; + timeoutMs: number; +} +export interface GuestSession { guestId: string; token: string; expires: number } +export interface TextStorage { + getItem(key: string): string | null; + setItem(key: string, value: string): void; +} +export interface GuestAccountStore { + identity(create: () => string): string; + save(session: GuestSession): void; +} +export interface GuestPayload { + guest_id: string; + pkg: string; + device_type: 'iphone' | 'ipad'; + register_device: string; + install_fb: boolean; + gyroscope_not_spinning: boolean; +} +export interface GuestSigner { + headers(payload: GuestPayload): Record; +} +export interface GuestTransport { + post(path: string, body: object, headers: Record, signal?: AbortSignal): Promise>; +} +export interface GuestLogin { signIn(signal?: AbortSignal): Promise } +export type GuestFailure = 'configuration' | 'identity' | 'storage' | 'network' | 'timeout' | 'cancelled' | 'response' | 'verification' | 'rejected'; +/** 只向界面提供固定消息,避免泄漏服务器原文或凭据。 / Expose fixed messages, never raw server data or credentials. */ +export class GuestError extends Error { + constructor(readonly kind: GuestFailure, message: string) { super(message); this.name = 'GuestError'; } +} +export function assertNotCancelled(signal?: AbortSignal): void { + if (signal?.aborted) throw new GuestError('cancelled', 'Sign-in cancelled.'); +} diff --git a/assets/login/scripts/GuestContracts.ts.meta b/assets/login/scripts/GuestContracts.ts.meta new file mode 100644 index 0000000..6a62d60 --- /dev/null +++ b/assets/login/scripts/GuestContracts.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "a16fec42-51b1-45d6-b6c0-8746ded67408", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestHttpClient.ts b/assets/login/scripts/GuestHttpClient.ts new file mode 100644 index 0000000..2830fe7 --- /dev/null +++ b/assets/login/scripts/GuestHttpClient.ts @@ -0,0 +1,49 @@ +import { assertNotCancelled, GuestError, GuestTransport } from './GuestContracts'; + +/** 请求与响应读取共用期限,取消后隔离迟到结果。 / One deadline covers fetch and response parsing; ignore late results after cancellation. */ +export class GuestHttpClient implements GuestTransport { + constructor(private readonly origin: string, private readonly timeoutMs: number, private readonly fetcher: typeof fetch) { + if (!/^https:\/\/[^\s/@?#:\\]+(?::\d+)?$/.test(origin) || !Number.isFinite(timeoutMs) || timeoutMs <= 0) { + throw new GuestError('configuration', 'Guest service configuration is unavailable.'); + } + } + async post(path: string, body: object, headers: Record, signal?: AbortSignal): Promise> { + assertNotCancelled(signal); + const request = new AbortController(); + let timer: ReturnType | undefined; + let cancel = () => {}; + const interruption = new Promise((_, reject) => { + cancel = () => { reject(new GuestError('cancelled', 'Sign-in cancelled.')); request.abort(); }; + signal?.addEventListener('abort', cancel, { once: true }); + timer = setTimeout(() => { reject(new GuestError('timeout', 'Sign-in timed out. Please retry.')); request.abort(); }, this.timeoutMs); + }); + try { + return await Promise.race([interruption, this.exchange(path, body, headers, request.signal)]); + } catch (error) { + if (error instanceof GuestError) throw error; + throw new GuestError('network', 'Unable to connect. Please check your connection and retry.'); + } finally { + if (timer !== undefined) clearTimeout(timer); + signal?.removeEventListener('abort', cancel); + } + } + private async exchange(path: string, body: object, headers: Record, signal: AbortSignal): Promise> { + const response = await this.fetcher(this.origin + path, { + method: 'POST', headers: { 'Content-Type': 'application/json', ...headers }, + credentials: 'omit', body: JSON.stringify(body), signal, + }); + if (!response.ok) throw new GuestError('network', 'Guest service is unavailable. Please retry.'); + let data: unknown; + try { data = await response.json(); } + catch { throw new GuestError('response', 'Invalid sign-in response. Please retry.'); } + if (!data || typeof data !== 'object' || Array.isArray(data)) throw new GuestError('response', 'Invalid sign-in response. Please retry.'); + const result = data as Record; + if (result.code !== 0) { + if (result.code === 401 && typeof result.msg === 'string' && /\brequest_sign_invalid\b/.test(result.msg)) { + throw new GuestError('verification', 'Sign-in verification failed. Check the device clock or signing configuration.'); + } + throw new GuestError('rejected', 'Guest sign-in was rejected. Please retry.'); + } + return result; + } +} diff --git a/assets/login/scripts/GuestHttpClient.ts.meta b/assets/login/scripts/GuestHttpClient.ts.meta new file mode 100644 index 0000000..b034a91 --- /dev/null +++ b/assets/login/scripts/GuestHttpClient.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "9ca9729a-e1df-45ea-81b2-ef11b40f297f", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestLegalLinks.ts b/assets/login/scripts/GuestLegalLinks.ts new file mode 100644 index 0000000..d914fe6 --- /dev/null +++ b/assets/login/scripts/GuestLegalLinks.ts @@ -0,0 +1,27 @@ +import { _decorator, Button, Component, Label, sys } from 'cc'; +const { ccclass, property } = _decorator; + +/** 法律链接单独绑定,不混入认证服务;缺地址时显示真实状态。 / Bind legal links separately from authentication and report missing URLs honestly. */ +@ccclass('GuestLegalLinks') +export class GuestLegalLinks extends Component { + @property({ type: Button }) privacyButton: Button | null = null; + @property({ type: Button }) termsButton: Button | null = null; + @property({ type: Label }) notice: Label | null = null; + @property privacyUrl = ''; + @property termsUrl = ''; + onLoad(): void { + this.privacyButton?.node.on(Button.EventType.CLICK, this.openPrivacy, this); + this.termsButton?.node.on(Button.EventType.CLICK, this.openTerms, this); + } + private openPrivacy(): void { this.open(this.privacyUrl, 'Privacy policy is not available yet.'); } + private openTerms(): void { this.open(this.termsUrl, 'Terms of service are not available yet.'); } + private open(url: string, unavailable: string): void { + if (/^https:\/\/[^\s]+$/i.test(url)) { sys.openURL(url); return; } + // 未配置不伪造页面,也不启动登录或覆盖游客会话。 / Never invent a page, trigger login or overwrite the guest session when unconfigured. + if (this.notice) { this.notice.string = unavailable; this.notice.node.active = true; } + } + onDestroy(): void { + if (this.privacyButton?.isValid) this.privacyButton.node.off(Button.EventType.CLICK, this.openPrivacy, this); + if (this.termsButton?.isValid) this.termsButton.node.off(Button.EventType.CLICK, this.openTerms, this); + } +} diff --git a/assets/login/scripts/GuestLegalLinks.ts.meta b/assets/login/scripts/GuestLegalLinks.ts.meta new file mode 100644 index 0000000..ca9fc97 --- /dev/null +++ b/assets/login/scripts/GuestLegalLinks.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "7f182094-3816-4409-b492-771b059cc23b", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestLoginPresenter.ts b/assets/login/scripts/GuestLoginPresenter.ts new file mode 100644 index 0000000..504014f --- /dev/null +++ b/assets/login/scripts/GuestLoginPresenter.ts @@ -0,0 +1,53 @@ +import { GuestError, GuestLogin, GuestSession } from './GuestContracts'; +export type LoginPhase = 'idle' | 'signing-in' | 'authenticated' | 'failed'; +export interface LoginState { phase: LoginPhase; message: string; enabled: boolean } +export interface LoginViewPort { render(state: LoginState): void } + +/** 独立于引擎的交互状态机,方便测试连点与销毁。 / Engine-independent interaction state machine for repeated-click and lifecycle tests. */ +export class GuestLoginPresenter { + private operation: AbortController | null = null; + private disposed = false; + private authenticated = false; + constructor(private readonly view: LoginViewPort, private readonly service: () => GuestLogin, + private readonly completed: (session: GuestSession) => void) {} + async submit(): Promise { + if (this.disposed || this.operation || this.authenticated) return; + if (typeof AbortController === 'undefined') { + this.view.render({ phase: 'failed', message: 'Secure sign-in is unavailable on this platform.', enabled: true }); + return; + } + const operation = new AbortController(); + this.operation = operation; + let authenticated: GuestSession | null = null; + try { + this.view.render({ phase: 'signing-in', message: 'Signing in...', enabled: false }); + const session = await this.service().signIn(operation.signal); + if (!this.isCurrent(operation)) return; + this.authenticated = true; + authenticated = session; + } catch (error) { + if (!this.isCurrent(operation)) return; + const message = error instanceof GuestError ? error.message : 'Unable to sign in. Please retry.'; + this.view.render({ phase: 'failed', message, enabled: true }); + } finally { + if (this.operation === operation) this.operation = null; + } + if (authenticated) { + // 成功通知异常不能回滚已保存的认证状态。 / Presentation failures must not turn committed authentication into a login failure. + try { + this.view.render({ phase: 'authenticated', message: 'Signed in successfully.', enabled: false }); + this.completed(authenticated); + } catch { /* 保留已认证状态且不输出会话。 / Retain authentication without logging the session. */ } + } + } + cancel(): void { + const operation = this.operation; + this.operation = null; + operation?.abort(); + if (!this.disposed && !this.authenticated) this.view.render({ phase: 'idle', message: '', enabled: true }); + } + dispose(): void { this.disposed = true; this.cancel(); } + private isCurrent(operation: AbortController): boolean { + return !this.disposed && this.operation === operation && !operation.signal.aborted; + } +} diff --git a/assets/login/scripts/GuestLoginPresenter.ts.meta b/assets/login/scripts/GuestLoginPresenter.ts.meta new file mode 100644 index 0000000..a512fa4 --- /dev/null +++ b/assets/login/scripts/GuestLoginPresenter.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "4f3bdd87-5f8e-4b02-8fcf-1f852e5170c1", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestLoginService.ts b/assets/login/scripts/GuestLoginService.ts new file mode 100644 index 0000000..df0f8b7 --- /dev/null +++ b/assets/login/scripts/GuestLoginService.ts @@ -0,0 +1,43 @@ +import { assertNotCancelled, GuestAccountStore, GuestError, GuestLogin, GuestPayload, GuestSession, GuestSettings, GuestSigner, GuestTransport } from './GuestContracts'; +import { GUEST_REGISTRATION_PATH } from './GuestSignature'; + +/** 两步认证的应用服务;不依赖场景或平台全局对象。 / Two-step authentication service independent of scenes and platform globals. */ +export class GuestLoginService implements GuestLogin { + private current: Promise | null = null; + constructor(private readonly settings: GuestSettings, private readonly accounts: GuestAccountStore, + private readonly signer: GuestSigner, private readonly transport: GuestTransport, private readonly makeIdentity: () => string) {} + signIn(signal?: AbortSignal): Promise { + // 合并请求由首次调用者拥有;已取消的新调用者不加入等待。 / The first caller owns a coalesced request; an already-cancelled caller never joins. + if (signal?.aborted) return Promise.reject(new GuestError('cancelled', 'Sign-in cancelled.')); + if (this.current) return this.current; + const operation = this.authenticate(signal); + this.current = operation; + const release = () => { if (this.current === operation) this.current = null; }; + void operation.then(release, release); + return operation; + } + private async authenticate(signal?: AbortSignal): Promise { + assertNotCancelled(signal); + if (!this.settings.product.trim() || !['iphone', 'ipad'].includes(this.settings.deviceType) || + !['web', 'android-google', 'ios'].includes(this.settings.registerDevice)) { + throw new GuestError('configuration', 'Guest service configuration is unavailable.'); + } + const guestId = this.accounts.identity(this.makeIdentity); + const body: GuestPayload = { + guest_id: guestId, pkg: this.settings.product, device_type: this.settings.deviceType, + register_device: this.settings.registerDevice, install_fb: false, gyroscope_not_spinning: false, + }; + await this.transport.post(GUEST_REGISTRATION_PATH, body, this.signer.headers(body), signal); + assertNotCancelled(signal); + // 换 token 不携带签名或认证头;始终使用同一游客身份。 / Exchange without signature/auth headers using the same identity. + const response = await this.transport.post('/account/login', { guest_id: guestId, pkg: this.settings.product }, {}, signal); + assertNotCancelled(signal); + const value = response.data; + if (!value || typeof value !== 'object' || Array.isArray(value)) throw new GuestError('response', 'Invalid sign-in response. Please retry.'); + const data = value as Record; + if (typeof data.token !== 'string' || !data.token.trim()) throw new GuestError('response', 'Invalid sign-in response. Please retry.'); + const session: GuestSession = { guestId, token: data.token, expires: typeof data.expires === 'number' && Number.isFinite(data.expires) ? data.expires : 0 }; + this.accounts.save(session); + return session; + } +} diff --git a/assets/login/scripts/GuestLoginService.ts.meta b/assets/login/scripts/GuestLoginService.ts.meta new file mode 100644 index 0000000..30e4285 --- /dev/null +++ b/assets/login/scripts/GuestLoginService.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "d1086204-c49f-4b6a-b552-41c197bc2c48", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestLoginView.ts b/assets/login/scripts/GuestLoginView.ts new file mode 100644 index 0000000..866e373 --- /dev/null +++ b/assets/login/scripts/GuestLoginView.ts @@ -0,0 +1,40 @@ +import { _decorator, Button, Component, Label } from 'cc'; +import type { GuestSession } from './GuestContracts'; +import { GuestLoginPresenter, LoginState, LoginViewPort } from './GuestLoginPresenter'; +import { createGuestLogin } from './GuestRuntime'; +const { ccclass, property } = _decorator; + +/** 场景适配组件,只负责控件绑定与状态展示。 / Scene adapter responsible only for control bindings and rendering state. */ +@ccclass('GuestLoginView') +export class GuestLoginView extends Component implements LoginViewPort { + static readonly AUTHENTICATED = 'guest-authenticated'; + @property({ type: Button }) guestButton: Button | null = null; + @property({ type: Label }) statusLabel: Label | null = null; + private presenter: GuestLoginPresenter | null = null; + private session: GuestSession | null = null; + get signedIn(): boolean { return this.session !== null; } + onLoad(): void { + if (!this.guestButton || !this.statusLabel) return; + this.presenter = new GuestLoginPresenter(this, createGuestLogin, session => { + this.session = session; + // 事件不包含 token,后续流程按需读取受控会话存储。 / Do not expose the token in UI events; future flow can read the session store. + this.node.emit(GuestLoginView.AUTHENTICATED); + }); + this.guestButton.node.on(Button.EventType.CLICK, this.submit, this); + this.render({ phase: 'idle', message: '', enabled: true }); + } + private submit(): void { void this.presenter?.submit(); } + render(state: LoginState): void { + if (this.guestButton) this.guestButton.interactable = state.enabled; + if (this.statusLabel) { + this.statusLabel.string = state.message; + this.statusLabel.node.active = state.message.length > 0; + } + } + onDisable(): void { this.presenter?.cancel(); } + onDestroy(): void { + this.presenter?.dispose(); + if (this.guestButton?.isValid) this.guestButton.node.off(Button.EventType.CLICK, this.submit, this); + this.session = null; + } +} diff --git a/assets/login/scripts/GuestLoginView.ts.meta b/assets/login/scripts/GuestLoginView.ts.meta new file mode 100644 index 0000000..9d99769 --- /dev/null +++ b/assets/login/scripts/GuestLoginView.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "e7144023-5b32-4c59-89e8-be661c99fe09", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestRuntime.ts b/assets/login/scripts/GuestRuntime.ts new file mode 100644 index 0000000..1133b7b --- /dev/null +++ b/assets/login/scripts/GuestRuntime.ts @@ -0,0 +1,36 @@ +import { sys } from 'cc'; +import signing from '../../../common-key/common_key.json'; +import { GuestError, GuestLogin, GuestSettings } from './GuestContracts'; +import { GuestHttpClient } from './GuestHttpClient'; +import { GuestLoginService } from './GuestLoginService'; +import { GuestSessionStore } from './GuestSessionStore'; +import { HmacGuestSigner } from './GuestSignature'; + +/** 沿用已确认的服务配置,本地身份使用 Fruit Pop 命名空间。 / Reuse the approved service configuration with a Fruit Pop storage namespace. */ +export const GUEST_SERVICE = { origin: 'https://gate.vivarisdigitalgate.com', product: 'VeryWellSlots', timeoutMs: 30000 } as const; +export function guestDeviceType(userAgent: string, touchPoints: number): 'iphone' | 'ipad' { + return /iPad|Tablet/i.test(userAgent) || (/Macintosh/i.test(userAgent) && touchPoints > 1) ? 'ipad' : 'iphone'; +} +/** 只能使用安全随机源,不降级到 Math.random。 / Require secure randomness; never fall back to Math.random. */ +export function secureGuestId(): string { + if (!globalThis.crypto || typeof globalThis.crypto.getRandomValues !== 'function') { + throw new GuestError('configuration', 'Secure sign-in is unavailable on this platform.'); + } + const bytes = new Uint8Array(16); + globalThis.crypto.getRandomValues(bytes); + return Array.from(bytes, value => value.toString(16).padStart(2, '0')).join(''); +} +/** 组合根:在这里连接配置、平台能力与独立领域服务。 / Composition root connecting configuration, platform ports and the independent service. */ +export function createGuestLogin(): GuestLogin { + if (typeof globalThis.fetch !== 'function' || typeof AbortController === 'undefined') { + throw new GuestError('configuration', 'Network sign-in is unavailable on this platform.'); + } + const settings: GuestSettings = { + ...GUEST_SERVICE, + deviceType: typeof navigator === 'undefined' ? 'iphone' : guestDeviceType(navigator.userAgent, navigator.maxTouchPoints || 0), + registerDevice: sys.isNative ? (sys.os === sys.OS.ANDROID ? 'android-google' : 'ios') : 'web', + }; + return new GuestLoginService(settings, new GuestSessionStore(sys.localStorage, settings.origin, settings.product), + new HmacGuestSigner(signing.key, secureGuestId), + new GuestHttpClient(settings.origin, settings.timeoutMs, globalThis.fetch.bind(globalThis)), secureGuestId); +} diff --git a/assets/login/scripts/GuestRuntime.ts.meta b/assets/login/scripts/GuestRuntime.ts.meta new file mode 100644 index 0000000..86c6742 --- /dev/null +++ b/assets/login/scripts/GuestRuntime.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "bd61a17b-2d5d-4c42-b294-56d7d1faa08c", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestSessionStore.ts b/assets/login/scripts/GuestSessionStore.ts new file mode 100644 index 0000000..fe9d04f --- /dev/null +++ b/assets/login/scripts/GuestSessionStore.ts @@ -0,0 +1,34 @@ +import { GuestAccountStore, GuestError, GuestSession, TextStorage } from './GuestContracts'; + +/** 按产品和服务隔离身份,成功会话单独提交。 / Isolate identities by product/service and commit successful sessions separately. */ +export class GuestSessionStore implements GuestAccountStore { + readonly identityKey: string; + readonly sessionKey: string; + constructor(private readonly storage: TextStorage, origin: string, product: string) { + const scope = encodeURIComponent(`${origin.replace(/\/+$/, '')}|${product}`); + this.identityKey = `fruit-pop.auth.identity.v1.${scope}`; + this.sessionKey = `fruit-pop.auth.session.v1.${scope}`; + } + identity(create: () => string): string { + try { + const existing = this.storage.getItem(this.identityKey); + const identity = existing ?? create(); + if (typeof identity !== 'string' || !/^[a-zA-Z0-9-]{16,128}$/.test(identity)) { + throw new GuestError('identity', 'Unable to restore a secure guest identity.'); + } + if (existing === null) this.writeVerified(this.identityKey, identity); + return identity; + } catch (error) { throw this.storageError(error); } + } + save(session: GuestSession): void { + try { this.writeVerified(this.sessionKey, JSON.stringify(session)); } + catch (error) { throw this.storageError(error); } + } + private writeVerified(key: string, text: string): void { + this.storage.setItem(key, text); + if (this.storage.getItem(key) !== text) throw new GuestError('storage', 'Unable to save guest data. Please retry.'); + } + private storageError(error: unknown): GuestError { + return error instanceof GuestError ? error : new GuestError('storage', 'Guest storage is unavailable. Please retry.'); + } +} diff --git a/assets/login/scripts/GuestSessionStore.ts.meta b/assets/login/scripts/GuestSessionStore.ts.meta new file mode 100644 index 0000000..ba96227 --- /dev/null +++ b/assets/login/scripts/GuestSessionStore.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "4c8e112f-a077-4804-8336-a8e2fb14fbf3", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/GuestSignature.ts b/assets/login/scripts/GuestSignature.ts new file mode 100644 index 0000000..d675bee --- /dev/null +++ b/assets/login/scripts/GuestSignature.ts @@ -0,0 +1,28 @@ +import { hmac } from '@noble/hashes/hmac'; +import { sha256 } from '@noble/hashes/sha2'; +import { GuestError, GuestPayload, GuestSigner } from './GuestContracts'; +export const GUEST_REGISTRATION_PATH = '/account/v2/guest/login'; + +/** 协议签名,不负责发送请求或读取配置。 / Protocol signing without transport or configuration access. */ +export class HmacGuestSigner implements GuestSigner { + constructor(private readonly secret: string, private readonly nonce: () => string, private readonly clock: () => number = Date.now) { + if (typeof secret !== 'string' || !secret.trim()) throw new GuestError('configuration', 'Guest signing configuration is unavailable.'); + } + headers(payload: GuestPayload): Record { + const timestamp = String(Math.floor(this.clock() / 1000)); + const nonce = this.nonce(); + if (!/^\d+$/.test(timestamp) || !Number.isSafeInteger(Number(timestamp)) || Number(timestamp) <= 0 || !/^[a-zA-Z0-9-]{16,128}$/.test(nonce)) { + throw new GuestError('configuration', 'Unable to prepare a secure sign-in request.'); + } + // 仅签白名单;false 必须参与,空 uid 是第五行。 / Sign only allowed fields; include false and the empty fifth uid line. + const fields: Record = { + guest_id: payload.guest_id, pkg: payload.pkg, device_type: payload.device_type, + register_device: payload.register_device, install_fb: String(payload.install_fb), + gyroscope_not_spinning: String(payload.gyroscope_not_spinning), + }; + const canonical = Object.keys(fields).filter(key => fields[key] !== '').sort().map(key => `${key}=${fields[key]}`).join('&'); + const message = ['POST', GUEST_REGISTRATION_PATH, timestamp, nonce, '', canonical].join('\n'); + const signature = Array.from(hmac(sha256, this.secret, message), value => value.toString(16).padStart(2, '0')).join(''); + return { 'X-Timestamp': timestamp, 'X-Nonce': nonce, 'X-Sign': signature }; + } +} diff --git a/assets/login/scripts/GuestSignature.ts.meta b/assets/login/scripts/GuestSignature.ts.meta new file mode 100644 index 0000000..0d80df8 --- /dev/null +++ b/assets/login/scripts/GuestSignature.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "ba15ae6b-94f5-454f-a584-b5decaa0f66e", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/WelcomeLayoutAuthoring.ts b/assets/login/scripts/WelcomeLayoutAuthoring.ts new file mode 100644 index 0000000..c7f8368 --- /dev/null +++ b/assets/login/scripts/WelcomeLayoutAuthoring.ts @@ -0,0 +1,71 @@ +import { _decorator, Button, Canvas, Color, Component, Label, Node, Sprite, UITransform, Widget } from 'cc'; +import { EDITOR } from 'cc/env'; +const { ccclass, executeInEditMode, property } = _decorator; + +/** 仅按显式开关校准已存在节点,不在运行时重建界面。 / Explicit editor-only calibration of existing nodes; never rebuild UI at runtime. */ +@ccclass('WelcomeLayoutAuthoring') +@executeInEditMode +export class WelcomeLayoutAuthoring extends Component { + @property + get applyReferenceLayout(): boolean { return false; } + set applyReferenceLayout(value: boolean) { + if (!EDITOR || !value) return; + const canvas = this.node; + const group = this.child(canvas, 'WelcomeComposition'); + const widget = canvas.getComponent(Widget); + if (widget) { widget.alignFlags = 0; widget.enabled = false; } + // 保存的设计画布与项目设置保持一致,运行适配仍由独立组件负责。 / Persist the design canvas; the viewport component owns runtime adaptation. + canvas.getComponent(UITransform)!.setContentSize(1080, 1920); + canvas.setPosition(540, 960, 0); + const camera = canvas.getChildByName('Camera'); + if (!canvas.getComponent(Canvas) || !camera) throw new Error('Welcome canvas is unavailable.'); + const backdrop = this.child(canvas, 'OrchardBackdrop'); + this.box(backdrop, 0, 0, 1080, 1920); + backdrop.setSiblingIndex(1); + this.sprite(backdrop); + this.box(this.child(group, 'BrandMark'), 4, 466.5, 982, 643); + this.box(this.child(group, 'FruitArrangement'), -7.5, -78, 991, 456); + this.box(this.child(group, 'GuestAccess'), -1.5, -460, 1027, 268); + for (const name of ['BrandMark', 'FruitArrangement', 'GuestAccess']) this.sprite(this.child(group, name)); + const button = this.child(group, 'GuestAccess').getComponent(Button); + if (button) { button.transition = Button.Transition.SCALE; button.zoomScale = .97; } + this.text(this.child(group, 'GuestReassurance'), 'No account needed', 0, -618, 780, 90, 56); + this.text(this.child(group, 'PrivacyLink'), 'Privacy Policy', -190, -765, 300, 88, 38, true); + this.text(this.child(group, 'TermsLink'), 'Terms of Service', 179, -765, 340, 88, 38, true); + this.text(this.child(group, 'LegalDivider'), '|', -10, -765, 28, 76, 56); + this.child(group, 'LegalDivider').getComponent(Label)!.color = new Color(236, 0, 136, 255); + const status = this.child(group, 'AuthenticationStatus'); + this.text(status, '', 0, -692, 960, 50, 25); + status.active = false; + } + private child(parent: Node, name: string): Node { + const node = parent.getChildByName(name); + if (!node) throw new Error(`Missing welcome node: ${name}`); + return node; + } + private box(node: Node, x: number, y: number, width: number, height: number): void { + node.setPosition(x, y, 0); + node.setScale(1, 1, 1); + node.getComponent(UITransform)!.setContentSize(width, height); + } + private sprite(node: Node): void { + const sprite = node.getComponent(Sprite)!; + sprite.sizeMode = Sprite.SizeMode.CUSTOM; + sprite.trim = false; + } + private text(node: Node, text: string, x: number, y: number, width: number, height: number, font: number, underline = false): void { + const label = node.getComponent(Label)!; + label.overflow = Label.Overflow.SHRINK; + label.string = text; + label.fontFamily = 'Arial'; + label.fontSize = font; + label.lineHeight = font + 8; + label.horizontalAlign = Label.HorizontalAlign.CENTER; + label.verticalAlign = Label.VerticalAlign.CENTER; + label.enableWrapText = true; + label.isBold = false; + label.isUnderline = underline; + label.color = new Color(250, 250, 250, 255); + this.box(node, x, y, width, height); + } +} diff --git a/assets/login/scripts/WelcomeLayoutAuthoring.ts.meta b/assets/login/scripts/WelcomeLayoutAuthoring.ts.meta new file mode 100644 index 0000000..d767c9f --- /dev/null +++ b/assets/login/scripts/WelcomeLayoutAuthoring.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "c8bc8aab-88e5-478f-af07-00f32bd66a3a", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/scripts/WelcomeViewport.ts b/assets/login/scripts/WelcomeViewport.ts new file mode 100644 index 0000000..2dd62b5 --- /dev/null +++ b/assets/login/scripts/WelcomeViewport.ts @@ -0,0 +1,24 @@ +import { _decorator, Component, ResolutionPolicy, UITransform, view } from 'cc'; +const { ccclass } = _decorator; + +/** 保持完整设计画布;装饰背景等比覆盖额外区域。 / Preserve the entire design canvas and cover extra space with the decorative backdrop. */ +@ccclass('WelcomeViewport') +export class WelcomeViewport extends Component { + private frameKey = ''; + onEnable(): void { this.fit(); } + update(): void { this.fit(); } + private fit(): void { + const frame = view.getFrameSize(); + if (frame.width <= 0 || frame.height <= 0) return; + const key = `${frame.width}:${frame.height}`; + if (key === this.frameKey) return; + this.frameKey = key; + const short = frame.height / frame.width < 1920 / 1080; + view.setDesignResolutionSize(1080, 1920, short ? ResolutionPolicy.FIXED_HEIGHT : ResolutionPolicy.FIXED_WIDTH); + const visible = view.getVisibleSize(); + // 主体切图保持原设计坐标,只有背景按覆盖比例放大。 / Keep foreground design coordinates and scale only the background to cover. + this.node.getComponent(UITransform)?.setContentSize(visible); + const cover = Math.max(visible.width / 1080, visible.height / 1920); + this.node.getChildByName('OrchardBackdrop')?.setScale(cover, cover, 1); + } +} diff --git a/assets/login/scripts/WelcomeViewport.ts.meta b/assets/login/scripts/WelcomeViewport.ts.meta new file mode 100644 index 0000000..c506ed1 --- /dev/null +++ b/assets/login/scripts/WelcomeViewport.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "340496d0-474c-4678-9ee1-b7751a920e05", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/visuals.meta b/assets/login/visuals.meta new file mode 100644 index 0000000..f057a04 --- /dev/null +++ b/assets/login/visuals.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "7a77c3d9-8836-41ca-a555-ef1c92144aae", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/login/visuals/brand-lockup.png b/assets/login/visuals/brand-lockup.png new file mode 100644 index 0000000..c556e59 Binary files /dev/null and b/assets/login/visuals/brand-lockup.png differ diff --git a/assets/login/visuals/brand-lockup.png.meta b/assets/login/visuals/brand-lockup.png.meta new file mode 100644 index 0000000..7cb64aa --- /dev/null +++ b/assets/login/visuals/brand-lockup.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "6d00a053-6087-49e8-8dd2-41de217646ae", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "6d00a053-6087-49e8-8dd2-41de217646ae@6c48a", + "displayName": "brand-lockup", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "6d00a053-6087-49e8-8dd2-41de217646ae", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "6d00a053-6087-49e8-8dd2-41de217646ae@f9941", + "displayName": "brand-lockup", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": -0.5, + "offsetY": 0, + "trimX": 14, + "trimY": 4, + "width": 941, + "height": 627, + "rawWidth": 970, + "rawHeight": 635, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -470.5, + -313.5, + 0, + 470.5, + -313.5, + 0, + -470.5, + 313.5, + 0, + 470.5, + 313.5, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 14, + 631, + 955, + 631, + 14, + 4, + 955, + 4 + ], + "nuv": [ + 0.01443298969072165, + 0.006299212598425197, + 0.9845360824742269, + 0.006299212598425197, + 0.01443298969072165, + 0.9937007874015747, + 0.9845360824742269, + 0.9937007874015747 + ], + "minPos": [ + -470.5, + -313.5, + 0 + ], + "maxPos": [ + 470.5, + 313.5, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "6d00a053-6087-49e8-8dd2-41de217646ae@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": true, + "redirect": "6d00a053-6087-49e8-8dd2-41de217646ae@6c48a" + } +} diff --git a/assets/login/visuals/guest-access-pill.png b/assets/login/visuals/guest-access-pill.png new file mode 100644 index 0000000..ea0ee7b Binary files /dev/null and b/assets/login/visuals/guest-access-pill.png differ diff --git a/assets/login/visuals/guest-access-pill.png.meta b/assets/login/visuals/guest-access-pill.png.meta new file mode 100644 index 0000000..55aebd9 --- /dev/null +++ b/assets/login/visuals/guest-access-pill.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "68253d33-6386-4047-aa78-8fed637aac12", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "68253d33-6386-4047-aa78-8fed637aac12@6c48a", + "displayName": "guest-access-pill", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "68253d33-6386-4047-aa78-8fed637aac12", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "68253d33-6386-4047-aa78-8fed637aac12@f9941", + "displayName": "guest-access-pill", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0.5, + "offsetY": -0.5, + "trimX": 34, + "trimY": 4, + "width": 893, + "height": 243, + "rawWidth": 960, + "rawHeight": 250, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -446.5, + -121.5, + 0, + 446.5, + -121.5, + 0, + -446.5, + 121.5, + 0, + 446.5, + 121.5, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 34, + 246, + 927, + 246, + 34, + 3, + 927, + 3 + ], + "nuv": [ + 0.035416666666666666, + 0.012, + 0.965625, + 0.012, + 0.035416666666666666, + 0.984, + 0.965625, + 0.984 + ], + "minPos": [ + -446.5, + -121.5, + 0 + ], + "maxPos": [ + 446.5, + 121.5, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "68253d33-6386-4047-aa78-8fed637aac12@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": true, + "redirect": "68253d33-6386-4047-aa78-8fed637aac12@6c48a" + } +} diff --git a/assets/login/visuals/orchard-backdrop.jpg b/assets/login/visuals/orchard-backdrop.jpg new file mode 100644 index 0000000..dd7dd57 Binary files /dev/null and b/assets/login/visuals/orchard-backdrop.jpg differ diff --git a/assets/login/visuals/orchard-backdrop.jpg.meta b/assets/login/visuals/orchard-backdrop.jpg.meta new file mode 100644 index 0000000..632e9cf --- /dev/null +++ b/assets/login/visuals/orchard-backdrop.jpg.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "f2e507ec-c69a-4484-82df-bf893aca4975", + "files": [ + ".jpg", + ".json" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "f2e507ec-c69a-4484-82df-bf893aca4975@6c48a", + "displayName": "orchard-backdrop", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "f2e507ec-c69a-4484-82df-bf893aca4975", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "f2e507ec-c69a-4484-82df-bf893aca4975@f9941", + "displayName": "orchard-backdrop", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1080, + "height": 1920, + "rawWidth": 1080, + "rawHeight": 1920, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -540, + -960, + 0, + 540, + -960, + 0, + -540, + 960, + 0, + 540, + 960, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 1920, + 1080, + 1920, + 0, + 0, + 1080, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -540, + -960, + 0 + ], + "maxPos": [ + 540, + 960, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "f2e507ec-c69a-4484-82df-bf893aca4975@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": false, + "redirect": "f2e507ec-c69a-4484-82df-bf893aca4975@6c48a" + } +} diff --git a/assets/login/visuals/orchard-cluster.png b/assets/login/visuals/orchard-cluster.png new file mode 100644 index 0000000..e0390be Binary files /dev/null and b/assets/login/visuals/orchard-cluster.png differ diff --git a/assets/login/visuals/orchard-cluster.png.meta b/assets/login/visuals/orchard-cluster.png.meta new file mode 100644 index 0000000..9f71e0a --- /dev/null +++ b/assets/login/visuals/orchard-cluster.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "eb8cef2e-799f-4599-ad1a-ce004b28dbc8", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "eb8cef2e-799f-4599-ad1a-ce004b28dbc8@6c48a", + "displayName": "orchard-cluster", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "eb8cef2e-799f-4599-ad1a-ce004b28dbc8", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "eb8cef2e-799f-4599-ad1a-ce004b28dbc8@f9941", + "displayName": "orchard-cluster", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": -0.5, + "trimX": 7, + "trimY": 3, + "width": 976, + "height": 450, + "rawWidth": 990, + "rawHeight": 455, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -488, + -225, + 0, + 488, + -225, + 0, + -488, + 225, + 0, + 488, + 225, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 7, + 452, + 983, + 452, + 7, + 2, + 983, + 2 + ], + "nuv": [ + 0.007070707070707071, + 0.004395604395604396, + 0.9929292929292929, + 0.004395604395604396, + 0.007070707070707071, + 0.9934065934065934, + 0.9929292929292929, + 0.9934065934065934 + ], + "minPos": [ + -488, + -225, + 0 + ], + "maxPos": [ + 488, + 225, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "eb8cef2e-799f-4599-ad1a-ce004b28dbc8@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": true, + "redirect": "eb8cef2e-799f-4599-ad1a-ce004b28dbc8@6c48a" + } +} diff --git a/assets/login/visuals/welcome-layout-guide.png b/assets/login/visuals/welcome-layout-guide.png new file mode 100644 index 0000000..a76d9e5 Binary files /dev/null and b/assets/login/visuals/welcome-layout-guide.png differ diff --git a/assets/login/visuals/welcome-layout-guide.png.meta b/assets/login/visuals/welcome-layout-guide.png.meta new file mode 100644 index 0000000..a4204c3 --- /dev/null +++ b/assets/login/visuals/welcome-layout-guide.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "a84750b2-a709-417c-8980-fa56cab27d2c", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "a84750b2-a709-417c-8980-fa56cab27d2c@6c48a", + "displayName": "welcome-layout-guide", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "a84750b2-a709-417c-8980-fa56cab27d2c", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "a84750b2-a709-417c-8980-fa56cab27d2c@f9941", + "displayName": "welcome-layout-guide", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1080, + "height": 1920, + "rawWidth": 1080, + "rawHeight": 1920, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -540, + -960, + 0, + 540, + -960, + 0, + -540, + 960, + 0, + 540, + 960, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 1920, + 1080, + 1920, + 0, + 0, + 1080, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -540, + -960, + 0 + ], + "maxPos": [ + 540, + 960, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "a84750b2-a709-417c-8980-fa56cab27d2c@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": false, + "redirect": "a84750b2-a709-417c-8980-fa56cab27d2c@6c48a" + } +} diff --git a/docs/guest-login.md b/docs/guest-login.md new file mode 100644 index 0000000..e992e25 --- /dev/null +++ b/docs/guest-login.md @@ -0,0 +1,68 @@ +# Fruit Pop 游客登录 + +本阶段仅实现登录场景、两步游客认证及本地会话保存,不包含加载页或游戏主界面。 + +## 场景与美术 + +- 启动场景为 assets/Welcome.scene;项目设计分辨率为 1080×1920。 +- WelcomeComposition 下的 BrandMark、FruitArrangement、GuestAccess 是独立可编辑节点。 +- 使用未裁剪透明切图,位置和尺寸来自新版 1080×1920 参考图的多尺度像素匹配。 +- OrchardBackdrop 使用装饰背景,位于主体之后;长短屏等比覆盖,不拉伸前景。 +- Canvas 保存尺寸为 1080×1920,位置为 (540, 960),根 Widget 已取消旧屏幕尺寸对齐。 +- GuestReassurance、PrivacyLink、TermsLink 和 LegalDivider 为独立可编辑文字;链接带下划线。 +- 导入后的目录和图片已重新命名;原始美术文件保持不变。 +- WelcomeViewport 对长屏固定宽度、短屏固定高度,完整保留画布并避免切图变形。 + +## 模块职责 / Module responsibilities + +- GuestContracts:类型、端口与固定错误消息 / Types, ports and fixed error messages. +- GuestSignature:白名单字段的 HMAC-SHA256 签名 / HMAC-SHA256 signing of allowed fields. +- GuestHttpClient:请求、响应、超时和取消 / Requests, responses, deadlines and cancellation. +- GuestSessionStore:独立身份命名空间及会话提交 / Isolated identity namespace and session persistence. +- GuestLoginService:两步认证编排 / Two-step authentication orchestration. +- GuestLoginPresenter:交互状态、防连点及生命周期 / Interaction state, duplicate-click prevention and lifecycle. +- GuestRuntime:连接平台、配置与依赖 / Connect platform capabilities, configuration and dependencies. +- GuestLoginView:场景控件绑定与展示 / Scene bindings and state rendering. +- GuestLegalLinks:法律链接独立交互,未配置网址时仅提示 / Independent legal links with honest missing-URL feedback. +- WelcomeLayoutAuthoring:显式编辑校准,不在运行时生成界面 / Explicit editor calibration without runtime UI generation. +- WelcomeViewport:画布适配 / Viewport adaptation. + +## 协议与配置 + +按已确认要求沿用参考项目 HTTPS 服务、VeryWellSlots 服务端 pkg 与本机签名配置。 +本机 common-key/common_key.json 已复制至本项目并加入忽略规则;测试不读取该文件。 + +1. POST /account/v2/guest/login:携带 X-Timestamp、X-Nonce、X-Sign,不携带 Authorization。 +2. POST /account/login:使用同一个 guest_id 与 pkg,不携带签名头,取得完整 token 后保存。 + +签名使用 LF 分隔的六行,空 uid 为第五行;字段按键排序、false 参与签名、无额外 URL 编码。 +每次按钮登录重新认证;游客身份保持不变,nonce 重新生成,不复用缓存 token 作为认证成功。 +本地存储前缀为 fruit-pop.auth,按服务地址与产品隔离。重登失败不覆盖旧成功会话。 +首次调用者拥有同一服务实例的合并请求及其取消信号;界面层禁止并发提交。 + +认证成功后显示 Signed in successfully. 并发出不含 token 的 guest-authenticated 事件,供后续加载功能衔接。 +当前不添加加载场景,也不自动跳转。 + +## 验证记录 + +- pnpm@11.17.0 安装;类型检查、离线行为测试与布局契约测试。 +- web-mobile 发布构建成功,输出 build/web-mobile-guest-login。 +- 发布页真实游客认证:两步接口均 HTTP 200,界面进入认证成功状态,身份与保存会话一致。 +- 真实服务存在响应波动,后续一次请求达到超时;按钮恢复可重试,不把失败显示为成功。 +- 发布页注入验签失败响应:固定提示、恢复按钮、旧会话保留;测试完成恢复真实网络实现。 +- 540×960、390×844、390×640 及横向窗口完成运行时结构检查,切图不拉伸且完整可见。 + +当前验收范围为网页发布版。没有生成原生子工程或 Android 安装包;原生安全随机、网络适配及真机验证留到对应阶段。 +客户端签名材料会进入编译产物;忽略本机文件只防止误提交,不表示客户端密钥不可提取。 + +## 新版参考图修复 + +- 改用完整装饰背景,重新校准 Logo、水果和更宽的游客按钮。 +- 加入 No account needed 和法律链接;尚无真实政策网址时显示固定提示,不虚构跳转。 +- 登录状态提示移至说明文字与法律链接之间。 +- 已同步保存画布与项目设计分辨率;类型、布局和行为验证在本轮重新执行。 +- 最终发布目录为 build/web-mobile-welcome-revised;类型检查和 15 项测试全部通过。 +- 新版发布页两步真实游客认证均返回 HTTP 200,认证完成状态和会话保存通过核对。 +- 540×960、390×844、390×640 核对前景完整、不变形、背景覆盖完整;法律链接点击提示正确。 +- 自动验收页处于隐藏状态时会暂停帧回调,仅测试页面临时恢复调度;该处理未进入项目代码或构建产物。 +- 旧输出目录重建曾因 ENOTEMPTY 失败;改用新的最终目录成功构建,未删除旧产物。 \ No newline at end of file diff --git a/fruit-pop-rules-v1.md b/fruit-pop-rules-v1.md new file mode 100644 index 0000000..38c9521 --- /dev/null +++ b/fruit-pop-rules-v1.md @@ -0,0 +1,45 @@ +# Fruit Pop — Slots 规则初版 v1.0 + +这是一份待确认的玩法设计与数学模型,并非已实现游戏。规则与 UI 视觉稿存在差异时,以本文为准;赔率和概率需上线前复核。 + +## 玩法与货币 +- 仅有一种虚拟金币,不可提现、转让或兑换现实物品。 +- 初始赠送 100,000 金币;每个 UTC 自然日可免费领取 20,000 金币一次,重置时间为 00:00 UTC;领取后显示下一次重置倒计时。旋转中奖可赢取金币;不设连续签到、广告视频或充值。 +- 5 列 × 3 行,固定 20 条有效赔付线,每条线从左到右各经过每列一个格子。总下注为 1,000 / 2,000 / 5,000 / 10,000 / 20,000 / 50,000,单线下注 = 总下注 ÷ 20。每次普通旋转扣除一次总下注。 +- 普通符号在一条线上从最左列起连续出现 3、4 或 5 个时中奖。每条线只支付最高的一组;所有中奖线的金额相加。同一个位置可以参与多条不同的线。 + +## 10 种符号与支付表 +下列 8 种普通符号的数字是单线下注倍数。每个可见格独立按下表权重抽取,任何转动或余额不会改变权重,合计 100。 + +| 普通符号 | 3 连 | 4 连 | 5 连 | 每格权重 | +|---|---:|---:|---:|---:| +| 7 | 45 | 158 | 675 | 3 | +| 铃铛 | 36 | 113 | 450 | 5 | +| BAR | 27 | 90 | 360 | 7 | +| 草莓 | 18 | 54 | 203 | 10 | +| 蓝莓 | 14 | 45 | 158 | 11 | +| 李子 | 9 | 27 | 90 | 13 | +| 樱桃 | 5 | 18 | 68 | 15 | +| 西瓜 | 5 | 14 | 45 | 30 | + +另有 WILD 权重 2、SCATTER 权重 4。WILD 可代替上述 8 种普通符号,不能代替 SCATTER;本身没有独立赔付。若同一条线可形成多个符号组合,取该线最高赔付;全 WILD 时按 7 的相应倍数结算。SCATTER 不属于普通樱桃,使用带 SCATTER 标识的樱桃图标,无普通线赔付。 + +示例:总下注 2,000,则单线下注 100。某线从左起有 5 个樱桃,该线赢取 100 × 68 = 6,800 金币;其他中奖线另行相加。 + +## 20 条赔付线 +T=上排、M=中排、B=下排;每组从左到右表示 5 列。 +1. MMMMM 2. TTTTT 3. BBBBB 4. TMBMT 5. BMTMB +6. MTTTM 7. MBBBM 8. MTBTM 9. MBTBM 10. TMMMT +11. BMMMB 12. TTMMB 13. BBMMT 14. TMMBB 15. BMMTT +16. MTMMM 17. MBMMM 18. MMMTM 19. MMMBM 20. MTMBM + +## SCATTER 与免费旋转 +- 一次普通旋转的 15 个格子任意位置出现 3 个 SCATTER 得 8 次、4 个得 12 次、5 个及以上得 16 次免费旋转;免费旋转不会额外扣除金币,沿用触发时总下注和赔付线。 +- 每次免费旋转,从 5 列中等概率选择 1 列;该列的非 SCATTER 符号全部变为 WILD,SCATTER 保持原样。展示变化后的结果并按常规赔付线结算。 +- 免费旋转内的 SCATTER 不再次触发免费旋转;免费旋转完成后展示累计赢取金币。免费旋转期间锁定下注,不可调整。 + +## 自动旋转 +玩家可选择 10、25、50 或 100 次;每次普通旋转照常扣除总下注。主按钮显示 STOP,点击后完成当前旋转并停止。余额不足、离开游戏或触发免费旋转时停止自动旋转;免费旋转结束后不会自动恢复,玩家可重新开启。 + +## 概率核算 +按上述每格独立权重、20 条固定线、赔率表及免费旋转规则精确枚举单线结果并计算 SCATTER 分布:普通旋转基础线赔付期望为总下注的约 58.0661%;免费旋转贡献约 37.2746%;合计理论 RTP 约 95.3407%。这是长期数学期望,不是单次或短期承诺。每次普通旋转触发免费旋转的概率约为 2.0292%。所有数字是设计初版,需独立复核和模拟后才可用于正式游戏。 diff --git a/package.json b/package.json new file mode 100644 index 0000000..17c2bd1 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "fruit-pop-googleplay", + "type": "3d", + "version": "1.0.0", + "private": true, + "packageManager": "pnpm@11.17.0", + "scripts": { + "typecheck": "tsc --noEmit -p tsconfig.tests.json", + "test": "tsx --test tests/*.test.ts" + }, + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "devDependencies": { + "@types/node": "22.15.30", + "tsx": "4.20.3", + "typescript": "5.8.3" + }, + "uuid": "", + "creator": { + "version": "unknow" + }, + "pink": { + "uuid": "39d627e8-7de7-41b7-80d7-bf7a0a58b628", + "version": "1.127.0", + "from": "pink" + }, + "cocos": { + "version": "4.0.0-beta.1" + }, + "cli": { + "version": "0.2.0-beta.1" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..19820c0 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,352 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@noble/hashes': + specifier: 1.8.0 + version: 1.8.0 + devDependencies: + '@types/node': + specifier: 22.15.30 + version: 22.15.30 + tsx: + specifier: 4.20.3 + version: 4.20.3 + typescript: + specifier: 5.8.3 + version: 5.8.3 + +packages: + + '@esbuild/aix-ppc64@0.25.12': + resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.25.12': + resolution: {integrity: sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.25.12': + resolution: {integrity: sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.25.12': + resolution: {integrity: sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.25.12': + resolution: {integrity: sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.25.12': + resolution: {integrity: sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.25.12': + resolution: {integrity: sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.25.12': + resolution: {integrity: sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.25.12': + resolution: {integrity: sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.25.12': + resolution: {integrity: sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.25.12': + resolution: {integrity: sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.25.12': + resolution: {integrity: sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.25.12': + resolution: {integrity: sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.25.12': + resolution: {integrity: sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.25.12': + resolution: {integrity: sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.25.12': + resolution: {integrity: sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.25.12': + resolution: {integrity: sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.25.12': + resolution: {integrity: sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.12': + resolution: {integrity: sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.25.12': + resolution: {integrity: sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.25.12': + resolution: {integrity: sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.25.12': + resolution: {integrity: sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.25.12': + resolution: {integrity: sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.25.12': + resolution: {integrity: sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.25.12': + resolution: {integrity: sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.25.12': + resolution: {integrity: sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@noble/hashes@1.8.0': + resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} + engines: {node: ^14.21.3 || >=16} + + '@types/node@22.15.30': + resolution: {integrity: sha512-6Q7lr06bEHdlfplU6YRbgG1SFBdlsfNC4/lX+SkhiTs0cpJkOElmWls8PxDFv4yY/xKb8Y6SO0OmSX4wgqTZbA==} + + esbuild@0.25.12: + resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==} + engines: {node: '>=18'} + hasBin: true + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-tsconfig@4.14.3: + resolution: {integrity: sha512-++QEw4DIY7WGoukz+/+A/8dGYPT9l9yIadnmSgZ8Rjr3YVSVDipQSO9CdnJo9ePqFqUUqh+wk9uIaoiAwsiPkA==} + + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + + tsx@4.20.3: + resolution: {integrity: sha512-qjbnuR9Tr+FJOMBqJCW5ehvIo/buZq7vH7qD7JziU98h6l3qGy0a/yPFjwO+y0/T7GFpNgNAvEcPPVfyT8rrPQ==} + engines: {node: '>=18.0.0'} + hasBin: true + + typescript@5.8.3: + resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + +snapshots: + + '@esbuild/aix-ppc64@0.25.12': + optional: true + + '@esbuild/android-arm64@0.25.12': + optional: true + + '@esbuild/android-arm@0.25.12': + optional: true + + '@esbuild/android-x64@0.25.12': + optional: true + + '@esbuild/darwin-arm64@0.25.12': + optional: true + + '@esbuild/darwin-x64@0.25.12': + optional: true + + '@esbuild/freebsd-arm64@0.25.12': + optional: true + + '@esbuild/freebsd-x64@0.25.12': + optional: true + + '@esbuild/linux-arm64@0.25.12': + optional: true + + '@esbuild/linux-arm@0.25.12': + optional: true + + '@esbuild/linux-ia32@0.25.12': + optional: true + + '@esbuild/linux-loong64@0.25.12': + optional: true + + '@esbuild/linux-mips64el@0.25.12': + optional: true + + '@esbuild/linux-ppc64@0.25.12': + optional: true + + '@esbuild/linux-riscv64@0.25.12': + optional: true + + '@esbuild/linux-s390x@0.25.12': + optional: true + + '@esbuild/linux-x64@0.25.12': + optional: true + + '@esbuild/netbsd-arm64@0.25.12': + optional: true + + '@esbuild/netbsd-x64@0.25.12': + optional: true + + '@esbuild/openbsd-arm64@0.25.12': + optional: true + + '@esbuild/openbsd-x64@0.25.12': + optional: true + + '@esbuild/openharmony-arm64@0.25.12': + optional: true + + '@esbuild/sunos-x64@0.25.12': + optional: true + + '@esbuild/win32-arm64@0.25.12': + optional: true + + '@esbuild/win32-ia32@0.25.12': + optional: true + + '@esbuild/win32-x64@0.25.12': + optional: true + + '@noble/hashes@1.8.0': {} + + '@types/node@22.15.30': + dependencies: + undici-types: 6.21.0 + + esbuild@0.25.12: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.12 + '@esbuild/android-arm': 0.25.12 + '@esbuild/android-arm64': 0.25.12 + '@esbuild/android-x64': 0.25.12 + '@esbuild/darwin-arm64': 0.25.12 + '@esbuild/darwin-x64': 0.25.12 + '@esbuild/freebsd-arm64': 0.25.12 + '@esbuild/freebsd-x64': 0.25.12 + '@esbuild/linux-arm': 0.25.12 + '@esbuild/linux-arm64': 0.25.12 + '@esbuild/linux-ia32': 0.25.12 + '@esbuild/linux-loong64': 0.25.12 + '@esbuild/linux-mips64el': 0.25.12 + '@esbuild/linux-ppc64': 0.25.12 + '@esbuild/linux-riscv64': 0.25.12 + '@esbuild/linux-s390x': 0.25.12 + '@esbuild/linux-x64': 0.25.12 + '@esbuild/netbsd-arm64': 0.25.12 + '@esbuild/netbsd-x64': 0.25.12 + '@esbuild/openbsd-arm64': 0.25.12 + '@esbuild/openbsd-x64': 0.25.12 + '@esbuild/openharmony-arm64': 0.25.12 + '@esbuild/sunos-x64': 0.25.12 + '@esbuild/win32-arm64': 0.25.12 + '@esbuild/win32-ia32': 0.25.12 + '@esbuild/win32-x64': 0.25.12 + + fsevents@2.3.3: + optional: true + + get-tsconfig@4.14.3: + dependencies: + resolve-pkg-maps: 1.0.0 + + resolve-pkg-maps@1.0.0: {} + + tsx@4.20.3: + dependencies: + esbuild: 0.25.12 + get-tsconfig: 4.14.3 + optionalDependencies: + fsevents: 2.3.3 + + typescript@5.8.3: {} + + undici-types@6.21.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..6810e3a --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +allowBuilds: + esbuild: true \ No newline at end of file diff --git a/settings/cocos.config.json b/settings/cocos.config.json new file mode 100644 index 0000000..022610f --- /dev/null +++ b/settings/cocos.config.json @@ -0,0 +1,18 @@ +{ + "scene": { + "tick": false + }, + "version": "1.0.0", + "$schema": "../temp/cocos.config.schema.json", + "engine": { + "designResolution": { + "width": 1080, + "height": 1920 + } + }, + "builder": { + "common": { + "startScene": "478fdf39-37fe-4d07-9770-f088728b9215" + } + } +} diff --git a/tests/guest-login.test.ts b/tests/guest-login.test.ts new file mode 100644 index 0000000..b3b2389 --- /dev/null +++ b/tests/guest-login.test.ts @@ -0,0 +1,149 @@ +import { test } from 'node:test'; +import { strict as assert } from 'node:assert'; +import { createHmac } from 'node:crypto'; +import { GuestError, GuestPayload, GuestSession, GuestSettings } from '../assets/login/scripts/GuestContracts'; +import { GuestHttpClient } from '../assets/login/scripts/GuestHttpClient'; +import { GuestLoginPresenter, LoginState } from '../assets/login/scripts/GuestLoginPresenter'; +import { GuestLoginService } from '../assets/login/scripts/GuestLoginService'; +import { GuestSessionStore } from '../assets/login/scripts/GuestSessionStore'; +import { HmacGuestSigner } from '../assets/login/scripts/GuestSignature'; + +// 测试只使用公开假数据,不加载本机签名配置。 / Use public fixtures only; never load the local signing configuration. +const settings: GuestSettings = { origin: 'https://example.test', product: 'FruitFixture', deviceType: 'iphone', registerDevice: 'web', timeoutMs: 50 }; +const identity = '0123456789abcdef0123456789abcdef'; +const session: GuestSession = { guestId: identity, token: 'Bearer fixture.token', expires: 1234 }; +const payload: GuestPayload = { guest_id: identity, pkg: '测试&game', device_type: 'iphone', register_device: 'web', install_fb: false, gyroscope_not_spinning: false }; +function memory() { + const values = new Map(); + return { values, getItem: (key: string) => values.get(key) ?? null, setItem: (key: string, value: string) => { values.set(key, value); } }; +} +function response(value: unknown): Response { return { ok: true, json: async () => value } as Response; } +function deferred() { + let resolve!: (value: T) => void; + const promise = new Promise(yes => { resolve = yes; }); + return { promise, resolve }; +} +const failure = (kind: string) => (error: unknown) => error instanceof GuestError && error.kind === kind; + +test('signature matches independent HMAC with UTF-8, LF, empty uid and false fields', () => { + const signer = new HmacGuestSigner('public-test-key', () => identity, () => 1700000000000); + const fields = `device_type=iphone&guest_id=${identity}&gyroscope_not_spinning=false&install_fb=false&pkg=测试&game®ister_device=web`; + const text = `POST\n/account/v2/guest/login\n1700000000\n${identity}\n\n${fields}`; + const expected = createHmac('sha256', 'public-test-key').update(text, 'utf8').digest('hex'); + assert.deepEqual(signer.headers(payload), { 'X-Timestamp': '1700000000', 'X-Nonce': identity, 'X-Sign': expected }); + assert.throws(() => new HmacGuestSigner('', () => identity), failure('configuration')); + assert.throws(() => new HmacGuestSigner('test', () => 'short').headers(payload), failure('configuration')); +}); + +test('identity is stable and isolated from other products and origins', () => { + const storage = memory(); + const first = new GuestSessionStore(storage, settings.origin, settings.product); + assert.equal(first.identity(() => identity), identity); + assert.equal(first.identity(() => { throw Error('must not regenerate'); }), identity); + const another = new GuestSessionStore(storage, settings.origin, 'OtherProduct'); + assert.notEqual(first.identityKey, another.identityKey); + assert.notEqual(first.identityKey, new GuestSessionStore(storage, 'https://other.test', settings.product).identityKey); + first.save(session); + assert.deepEqual(JSON.parse(storage.getItem(first.sessionKey)!), session); +}); + +test('storage corruption and silent write failures stop authentication', () => { + const storage = memory(); + const accounts = new GuestSessionStore(storage, settings.origin, settings.product); + storage.setItem(accounts.identityKey, 'corrupt'); + assert.throws(() => accounts.identity(() => identity), failure('identity')); + const unavailable = new GuestSessionStore({ getItem: () => null, setItem: () => {} }, settings.origin, settings.product); + assert.throws(() => unavailable.identity(() => identity), failure('storage')); +}); + +test('two-step login signs only registration and preserves the complete token', async () => { + const storage = memory(); + const accounts = new GuestSessionStore(storage, settings.origin, settings.product); + const calls: { url: string; init: RequestInit }[] = []; + let nonce = 0; + const transport = new GuestHttpClient(settings.origin, 100, (async (url, init) => { + calls.push({ url: String(url), init: init! }); + return response(calls.length % 2 === 1 ? { code: 0 } : { code: 0, data: session }); + }) as typeof fetch); + const service = new GuestLoginService(settings, accounts, new HmacGuestSigner('fixture', () => identity + ++nonce), transport, () => identity); + assert.deepEqual(await service.signIn(), session); + assert.equal(calls[0].url, settings.origin + '/account/v2/guest/login'); + assert.equal(calls[1].url, settings.origin + '/account/login'); + assert.deepEqual(JSON.parse(String(calls[0].init.body)), { ...payload, pkg: settings.product }); + assert.deepEqual(JSON.parse(String(calls[1].init.body)), { guest_id: identity, pkg: settings.product }); + assert.ok((calls[0].init.headers as Record)['X-Sign']); + assert.deepEqual(calls[1].init.headers, { 'Content-Type': 'application/json' }); + assert.equal(calls[0].init.credentials, 'omit'); + await service.signIn(); + assert.notEqual((calls[0].init.headers as Record)['X-Nonce'], (calls[2].init.headers as Record)['X-Nonce']); + assert.equal(JSON.parse(storage.getItem(accounts.sessionKey)!).token, session.token); +}); + +test('concurrent calls coalesce; cancelled caller never joins', async () => { + const waiting = deferred>(); + let calls = 0; + const service = new GuestLoginService(settings, new GuestSessionStore(memory(), settings.origin, settings.product), + new HmacGuestSigner('fixture', () => identity), { post: async () => ++calls === 1 ? waiting.promise : { data: session } }, () => identity); + const first = service.signIn(); + assert.equal(first, service.signIn()); + const cancelled = new AbortController(); cancelled.abort(); + await assert.rejects(service.signIn(cancelled.signal), failure('cancelled')); + waiting.resolve({ code: 0 }); + assert.deepEqual(await first, session); assert.equal(calls, 2); +}); + +test('business failures and missing token preserve the previous saved session', async () => { + for (const value of [{ code: 17, msg: 'private message' }, { code: 0, data: {} }]) { + const storage = memory(); const accounts = new GuestSessionStore(storage, settings.origin, settings.product); accounts.save(session); + const service = new GuestLoginService(settings, accounts, new HmacGuestSigner('fixture', () => identity), + new GuestHttpClient(settings.origin, 100, (async () => response(value)) as typeof fetch), () => identity); + await assert.rejects(service.signIn(), error => error instanceof GuestError && !error.message.includes('private message')); + assert.deepEqual(JSON.parse(storage.getItem(accounts.sessionKey)!), session); + } +}); + +test('timeout covers response body parsing and cancellation ignores late registration', async () => { + const body = deferred(); + const timeout = new GuestHttpClient(settings.origin, 5, (async () => ({ ok: true, json: () => body.promise } as Response)) as typeof fetch); + await assert.rejects(timeout.post('/fixture', {}, {}), failure('timeout')); + body.resolve({ code: 0 }); + const waiting = deferred(); let calls = 0; + const storage = memory(); const accounts = new GuestSessionStore(storage, settings.origin, settings.product); + const service = new GuestLoginService(settings, accounts, new HmacGuestSigner('fixture', () => identity), + new GuestHttpClient(settings.origin, 100, (() => { calls++; return waiting.promise; }) as typeof fetch), () => identity); + const abort = new AbortController(); const login = service.signIn(abort.signal); abort.abort(); + await assert.rejects(login, failure('cancelled')); + waiting.resolve(response({ code: 0 })); await Promise.resolve(); + assert.equal(calls, 1); assert.equal(storage.getItem(accounts.sessionKey), null); +}); + +test('invalid JSON is a response error and verification errors hide server text', async () => { + const malformed = new GuestHttpClient(settings.origin, 100, (async () => new Response('invalid JSON')) as typeof fetch); + await assert.rejects(malformed.post('/fixture', {}, {}), failure('response')); + const rejected = new GuestHttpClient(settings.origin, 100, (async () => response({ code: 401, msg: 'request_sign_invalid secret details' })) as typeof fetch); + await assert.rejects(rejected.post('/fixture', {}, {}), error => error instanceof GuestError && error.kind === 'verification' && !error.message.includes('secret details')); +}); + +test('presenter ignores repeated clicks and keeps committed success if a listener throws', async () => { + const waiting = deferred(); const states: LoginState[] = []; let calls = 0; + const presenter = new GuestLoginPresenter({ render: state => states.push(state) }, + () => ({ signIn: () => { calls++; return waiting.promise; } }), () => { throw Error('listener'); }); + const login = presenter.submit(); await presenter.submit(); + assert.equal(calls, 1); assert.equal(states[0].enabled, false); + waiting.resolve(session); await login; + assert.equal(states.at(-1)?.phase, 'authenticated'); + await presenter.submit(); assert.equal(calls, 1); +}); + +test('presenter destruction prevents late success and failure allows retry', async () => { + const waiting = deferred(); const states: LoginState[] = []; let completed = 0; + const presenter = new GuestLoginPresenter({ render: state => states.push(state) }, () => ({ signIn: () => waiting.promise }), () => completed++); + const login = presenter.submit(); presenter.dispose(); waiting.resolve(session); await login; + assert.equal(completed, 0); assert.equal(states.length, 1); + let calls = 0; + const retry = new GuestLoginPresenter({ render: state => states.push(state) }, () => ({ signIn: async () => { + if (++calls === 1) throw new GuestError('network', 'Try again.'); return session; + } }), () => completed++); + await retry.submit(); assert.equal(states.at(-1)?.enabled, true); + await retry.submit(); assert.equal(completed, 1); +}); \ No newline at end of file diff --git a/tests/welcome-layout.test.ts b/tests/welcome-layout.test.ts new file mode 100644 index 0000000..f88463c --- /dev/null +++ b/tests/welcome-layout.test.ts @@ -0,0 +1,73 @@ +import { test } from 'node:test'; +import { strict as assert } from 'node:assert'; +import { readFileSync, readdirSync } from 'node:fs'; + +// 校验保存后的场景契约,不通过手工修改场景来修正测试。 / Verify the saved scene contract; never rewrite scenes to satisfy tests. +type Entry = Record; +const scene: Entry[] = JSON.parse(readFileSync('assets/Welcome.scene', 'utf8')); +const node = (name: string): Entry => scene.find(value => value.__type__ === 'cc.Node' && value._name === name)!; +const component = (name: string, type: string): Entry => node(name)._components.map((ref: Entry) => scene[ref.__id__]).find((value: Entry) => value.__type__ === type)!; + +test('project design resolution and start scene use the portrait login scene', () => { + const settings = JSON.parse(readFileSync('settings/cocos.config.json', 'utf8')); + assert.equal(settings.engine.designResolution.width, 1080); + assert.equal(settings.engine.designResolution.height, 1920); + assert.equal(settings.builder.common.startScene, JSON.parse(readFileSync('assets/Welcome.scene.meta', 'utf8')).uuid); + assert.equal(component('Canvas', 'cc.UITransform')._contentSize.width, 1080); + assert.equal(component('Canvas', 'cc.UITransform')._contentSize.height, 1920); + assert.equal(node('Canvas')._lpos.x, 540); + assert.equal(node('Canvas')._lpos.y, 960); + assert.equal(component('Canvas', 'cc.Widget')._alignFlags, 0); +}); + +test('reference artwork retains independent editable sprites, exact positions and proportions', () => { + for (const [name, x, y, width, height] of [ + ['BrandMark', 4, 466.5, 982, 643], + ['FruitArrangement', -7.5, -78, 991, 456], + ['GuestAccess', -1.5, -460, 1027, 268], + ] as const) { + const item = node(name), transform = component(name, 'cc.UITransform'), sprite = component(name, 'cc.Sprite'); + assert.ok(item, name); + assert.equal(item._lpos.x, x); assert.equal(item._lpos.y, y); + assert.equal(transform._contentSize.width, width); assert.equal(transform._contentSize.height, height); + assert.equal(sprite._isTrimmedMode, false); assert.equal(sprite._sizeMode, 0); + assert.ok(sprite._spriteFrame.__uuid__); + assert.equal(item._lscale.x, 1); assert.equal(item._lscale.y, 1); + } + assert.equal(node('AuthenticationStatus')._active, false); + assert.deepEqual(component('Camera', 'cc.Camera')._color, { __type__: 'cc.Color', r: 55, g: 0, b: 34, a: 255 }); +}); + +test('decorative backdrop is independent and behind the editable foreground', () => { + const children = node('Canvas')._children.map((ref: Entry) => scene[ref.__id__]._name); + assert.ok(children.indexOf('OrchardBackdrop') < children.indexOf('WelcomeComposition')); + const meta = JSON.parse(readFileSync('assets/login/visuals/orchard-backdrop.jpg.meta', 'utf8')); + assert.equal(component('OrchardBackdrop', 'cc.Sprite')._spriteFrame.__uuid__, meta.uuid + '@f9941'); + assert.equal(component('OrchardBackdrop', 'cc.UITransform')._contentSize.width, 1080); + assert.equal(component('OrchardBackdrop', 'cc.UITransform')._contentSize.height, 1920); +}); + +test('reference footer is editable, underlined and separated from authentication notices', () => { + assert.equal(component('GuestReassurance', 'cc.Label')._string, 'No account needed'); + assert.equal(component('PrivacyLink', 'cc.Label')._string, 'Privacy Policy'); + assert.equal(component('TermsLink', 'cc.Label')._string, 'Terms of Service'); + assert.equal(component('PrivacyLink', 'cc.Label')._isUnderline, true); + assert.equal(component('TermsLink', 'cc.Label')._isUnderline, true); + const controller = node('WelcomeComposition')._components.map((ref: Entry) => scene[ref.__id__]).find((value: Entry) => value.privacyButton); + assert.equal(scene[controller.privacyButton.__id__].__type__, 'cc.Button'); + assert.equal(scene[controller.termsButton.__id__].__type__, 'cc.Button'); + assert.equal(scene[controller.notice.__id__].__type__, 'cc.Label'); + assert.equal(controller.privacyUrl, ''); assert.equal(controller.termsUrl, ''); + const status = node('AuthenticationStatus'), height = component('AuthenticationStatus', 'cc.UITransform')._contentSize.height; + assert.ok(status._lpos.y + height / 2 < node('GuestReassurance')._lpos.y - 45); + assert.ok(status._lpos.y - height / 2 > node('PrivacyLink')._lpos.y + 44); +}); + +test('login view has explicit button/status bindings and no source artwork filenames', () => { + const controller = node('WelcomeComposition')._components.map((ref: Entry) => scene[ref.__id__]).find((value: Entry) => value.guestButton); + assert.equal(scene[controller.guestButton.__id__].__type__, 'cc.Button'); + assert.equal(scene[controller.statusLabel.__id__].__type__, 'cc.Label'); + const names = readdirSync('assets/login/visuals').filter(name => !name.endsWith('.meta')).sort(); + assert.deepEqual(names, ['brand-lockup.png', 'guest-access-pill.png', 'orchard-backdrop.jpg', 'orchard-cluster.png', 'welcome-layout-guide.png']); + assert.ok(readFileSync('.gitignore', 'utf8').includes('/common-key/')); +}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..51c1563 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,6 @@ +{ + /* Base configuration. Do not edit this field. */ + "extends": "./temp/tsconfig.cocos.json" + + /* Add your custom configuration here. */ +} diff --git a/tsconfig.tests.json b/tsconfig.tests.json new file mode 100644 index 0000000..31731f2 --- /dev/null +++ b/tsconfig.tests.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "target": "ES2020", + "module": "CommonJS", + "moduleResolution": "node", + "strict": true, + "strictNullChecks": true, + "noImplicitAny": true, + "strictPropertyInitialization": true, + "skipLibCheck": true, + "lib": ["ES2020", "DOM"], + "types": ["node", "./temp/declarations/cc", "./temp/declarations/cc.env"], + "resolveJsonModule": true, + "esModuleInterop": true, + "noEmit": true + }, + "include": ["assets/**/*.ts", "tests/**/*.ts"], + "exclude": ["node_modules", "library", "temp/programming", "build"] +} \ No newline at end of file diff --git a/美术资源/00-loading-screen/00-loading-screen.png b/美术资源/00-loading-screen/00-loading-screen.png new file mode 100644 index 0000000..6508e55 Binary files /dev/null and b/美术资源/00-loading-screen/00-loading-screen.png differ diff --git a/美术资源/00-loading-screen/loading-fill-70.png b/美术资源/00-loading-screen/loading-fill-70.png new file mode 100644 index 0000000..b39ee2b Binary files /dev/null and b/美术资源/00-loading-screen/loading-fill-70.png differ diff --git a/美术资源/00-loading-screen/loading-track.png b/美术资源/00-loading-screen/loading-track.png new file mode 100644 index 0000000..94563f7 Binary files /dev/null and b/美术资源/00-loading-screen/loading-track.png differ diff --git a/美术资源/01-guest-login/01-guest-login.png b/美术资源/01-guest-login/01-guest-login.png new file mode 100644 index 0000000..a76d9e5 Binary files /dev/null and b/美术资源/01-guest-login/01-guest-login.png differ diff --git a/美术资源/01-guest-login/background.jpg b/美术资源/01-guest-login/background.jpg new file mode 100644 index 0000000..dd7dd57 Binary files /dev/null and b/美术资源/01-guest-login/background.jpg differ diff --git a/美术资源/01-guest-login/fruit.png b/美术资源/01-guest-login/fruit.png new file mode 100644 index 0000000..e0390be Binary files /dev/null and b/美术资源/01-guest-login/fruit.png differ diff --git a/美术资源/01-guest-login/guest-button.png b/美术资源/01-guest-login/guest-button.png new file mode 100644 index 0000000..ea0ee7b Binary files /dev/null and b/美术资源/01-guest-login/guest-button.png differ diff --git a/美术资源/01-guest-login/logo.png b/美术资源/01-guest-login/logo.png new file mode 100644 index 0000000..c556e59 Binary files /dev/null and b/美术资源/01-guest-login/logo.png differ diff --git a/美术资源/02-main-screen/02-main-screen.png b/美术资源/02-main-screen/02-main-screen.png new file mode 100644 index 0000000..cc036f7 Binary files /dev/null and b/美术资源/02-main-screen/02-main-screen.png differ diff --git a/美术资源/02-main-screen/symbols/bar.png b/美术资源/02-main-screen/symbols/bar.png new file mode 100644 index 0000000..eba2d22 Binary files /dev/null and b/美术资源/02-main-screen/symbols/bar.png differ diff --git a/美术资源/02-main-screen/symbols/bell.png b/美术资源/02-main-screen/symbols/bell.png new file mode 100644 index 0000000..fca6b75 Binary files /dev/null and b/美术资源/02-main-screen/symbols/bell.png differ diff --git a/美术资源/02-main-screen/symbols/blueberry.png b/美术资源/02-main-screen/symbols/blueberry.png new file mode 100644 index 0000000..70c136e Binary files /dev/null and b/美术资源/02-main-screen/symbols/blueberry.png differ diff --git a/美术资源/02-main-screen/symbols/cherry.png b/美术资源/02-main-screen/symbols/cherry.png new file mode 100644 index 0000000..9063bda Binary files /dev/null and b/美术资源/02-main-screen/symbols/cherry.png differ diff --git a/美术资源/02-main-screen/symbols/plum.png b/美术资源/02-main-screen/symbols/plum.png new file mode 100644 index 0000000..c7460de Binary files /dev/null and b/美术资源/02-main-screen/symbols/plum.png differ diff --git a/美术资源/02-main-screen/symbols/scatter.png b/美术资源/02-main-screen/symbols/scatter.png new file mode 100644 index 0000000..8fe31af Binary files /dev/null and b/美术资源/02-main-screen/symbols/scatter.png differ diff --git a/美术资源/02-main-screen/symbols/seven.png b/美术资源/02-main-screen/symbols/seven.png new file mode 100644 index 0000000..b8dece4 Binary files /dev/null and b/美术资源/02-main-screen/symbols/seven.png differ diff --git a/美术资源/02-main-screen/symbols/strawberry.png b/美术资源/02-main-screen/symbols/strawberry.png new file mode 100644 index 0000000..c3a11fa Binary files /dev/null and b/美术资源/02-main-screen/symbols/strawberry.png differ diff --git a/美术资源/02-main-screen/symbols/watermelon.png b/美术资源/02-main-screen/symbols/watermelon.png new file mode 100644 index 0000000..c4f1ef0 Binary files /dev/null and b/美术资源/02-main-screen/symbols/watermelon.png differ diff --git a/美术资源/02-main-screen/symbols/wild.png b/美术资源/02-main-screen/symbols/wild.png new file mode 100644 index 0000000..6fe3de1 Binary files /dev/null and b/美术资源/02-main-screen/symbols/wild.png differ diff --git a/美术资源/02-main-screen/ui/auto-spin-no-count.png b/美术资源/02-main-screen/ui/auto-spin-no-count.png new file mode 100644 index 0000000..2eb3f34 Binary files /dev/null and b/美术资源/02-main-screen/ui/auto-spin-no-count.png differ diff --git a/美术资源/02-main-screen/ui/auto.png b/美术资源/02-main-screen/ui/auto.png new file mode 100644 index 0000000..78ae706 Binary files /dev/null and b/美术资源/02-main-screen/ui/auto.png differ diff --git a/美术资源/02-main-screen/ui/background.jpg b/美术资源/02-main-screen/ui/background.jpg new file mode 100644 index 0000000..7360457 Binary files /dev/null and b/美术资源/02-main-screen/ui/background.jpg differ diff --git a/美术资源/02-main-screen/ui/bet_label.png b/美术资源/02-main-screen/ui/bet_label.png new file mode 100644 index 0000000..88f2ad3 Binary files /dev/null and b/美术资源/02-main-screen/ui/bet_label.png differ diff --git a/美术资源/02-main-screen/ui/bet_panel.png b/美术资源/02-main-screen/ui/bet_panel.png new file mode 100644 index 0000000..55e1cd1 Binary files /dev/null and b/美术资源/02-main-screen/ui/bet_panel.png differ diff --git a/美术资源/02-main-screen/ui/coin_bar.png b/美术资源/02-main-screen/ui/coin_bar.png new file mode 100644 index 0000000..1fa1f20 Binary files /dev/null and b/美术资源/02-main-screen/ui/coin_bar.png differ diff --git a/美术资源/02-main-screen/ui/current-win-no-number.png b/美术资源/02-main-screen/ui/current-win-no-number.png new file mode 100644 index 0000000..af5ef14 Binary files /dev/null and b/美术资源/02-main-screen/ui/current-win-no-number.png differ diff --git a/美术资源/02-main-screen/ui/free-spins-banner-empty.png b/美术资源/02-main-screen/ui/free-spins-banner-empty.png new file mode 100644 index 0000000..62ce5d8 Binary files /dev/null and b/美术资源/02-main-screen/ui/free-spins-banner-empty.png differ diff --git a/美术资源/02-main-screen/ui/free_coins.png b/美术资源/02-main-screen/ui/free_coins.png new file mode 100644 index 0000000..db3d123 Binary files /dev/null and b/美术资源/02-main-screen/ui/free_coins.png differ diff --git a/美术资源/02-main-screen/ui/logo.png b/美术资源/02-main-screen/ui/logo.png new file mode 100644 index 0000000..a100a71 Binary files /dev/null and b/美术资源/02-main-screen/ui/logo.png differ diff --git a/美术资源/02-main-screen/ui/minus.png b/美术资源/02-main-screen/ui/minus.png new file mode 100644 index 0000000..d10113e Binary files /dev/null and b/美术资源/02-main-screen/ui/minus.png differ diff --git a/美术资源/02-main-screen/ui/paytable.png b/美术资源/02-main-screen/ui/paytable.png new file mode 100644 index 0000000..3a4ea76 Binary files /dev/null and b/美术资源/02-main-screen/ui/paytable.png differ diff --git a/美术资源/02-main-screen/ui/plus.png b/美术资源/02-main-screen/ui/plus.png new file mode 100644 index 0000000..eb42421 Binary files /dev/null and b/美术资源/02-main-screen/ui/plus.png differ diff --git a/美术资源/02-main-screen/ui/reel.png b/美术资源/02-main-screen/ui/reel.png new file mode 100644 index 0000000..73ca5c9 Binary files /dev/null and b/美术资源/02-main-screen/ui/reel.png differ diff --git a/美术资源/02-main-screen/ui/settings.png b/美术资源/02-main-screen/ui/settings.png new file mode 100644 index 0000000..cadbbe6 Binary files /dev/null and b/美术资源/02-main-screen/ui/settings.png differ diff --git a/美术资源/02-main-screen/ui/spin-disabled.png b/美术资源/02-main-screen/ui/spin-disabled.png new file mode 100644 index 0000000..3a51a21 Binary files /dev/null and b/美术资源/02-main-screen/ui/spin-disabled.png differ diff --git a/美术资源/02-main-screen/ui/spin.png b/美术资源/02-main-screen/ui/spin.png new file mode 100644 index 0000000..1505a4c Binary files /dev/null and b/美术资源/02-main-screen/ui/spin.png differ diff --git a/美术资源/02-main-screen/ui/stop-button.png b/美术资源/02-main-screen/ui/stop-button.png new file mode 100644 index 0000000..a3bf77f Binary files /dev/null and b/美术资源/02-main-screen/ui/stop-button.png differ diff --git a/美术资源/02-main-screen/ui/text-auto-spins.png b/美术资源/02-main-screen/ui/text-auto-spins.png new file mode 100644 index 0000000..42171f2 Binary files /dev/null and b/美术资源/02-main-screen/ui/text-auto-spins.png differ diff --git a/美术资源/02-main-screen/ui/text-free-spins.png b/美术资源/02-main-screen/ui/text-free-spins.png new file mode 100644 index 0000000..ea741d4 Binary files /dev/null and b/美术资源/02-main-screen/ui/text-free-spins.png differ diff --git a/美术资源/02-main-screen/ui/text-left.png b/美术资源/02-main-screen/ui/text-left.png new file mode 100644 index 0000000..2670ef5 Binary files /dev/null and b/美术资源/02-main-screen/ui/text-left.png differ diff --git a/美术资源/02-main-screen/ui/total-win-no-number.png b/美术资源/02-main-screen/ui/total-win-no-number.png new file mode 100644 index 0000000..790899b Binary files /dev/null and b/美术资源/02-main-screen/ui/total-win-no-number.png differ diff --git a/美术资源/02-main-screen/ui/win_label.png b/美术资源/02-main-screen/ui/win_label.png new file mode 100644 index 0000000..48567d6 Binary files /dev/null and b/美术资源/02-main-screen/ui/win_label.png differ diff --git a/美术资源/02-main-screen/ui/win_panel.png b/美术资源/02-main-screen/ui/win_panel.png new file mode 100644 index 0000000..503cf77 Binary files /dev/null and b/美术资源/02-main-screen/ui/win_panel.png differ diff --git a/美术资源/03-settings/03-settings.png b/美术资源/03-settings/03-settings.png new file mode 100644 index 0000000..2e06c12 Binary files /dev/null and b/美术资源/03-settings/03-settings.png differ diff --git a/美术资源/03-settings/button-close.png b/美术资源/03-settings/button-close.png new file mode 100644 index 0000000..1d02e67 Binary files /dev/null and b/美术资源/03-settings/button-close.png differ diff --git a/美术资源/03-settings/button-how-to-play.png b/美术资源/03-settings/button-how-to-play.png new file mode 100644 index 0000000..f57ce3a Binary files /dev/null and b/美术资源/03-settings/button-how-to-play.png differ diff --git a/美术资源/03-settings/panel.png b/美术资源/03-settings/panel.png new file mode 100644 index 0000000..fc77427 Binary files /dev/null and b/美术资源/03-settings/panel.png differ diff --git a/美术资源/03-settings/row-music.png b/美术资源/03-settings/row-music.png new file mode 100644 index 0000000..ddb3873 Binary files /dev/null and b/美术资源/03-settings/row-music.png differ diff --git a/美术资源/03-settings/row-sound.png b/美术资源/03-settings/row-sound.png new file mode 100644 index 0000000..fb32fd7 Binary files /dev/null and b/美术资源/03-settings/row-sound.png differ diff --git a/美术资源/03-settings/row-vibration.png b/美术资源/03-settings/row-vibration.png new file mode 100644 index 0000000..d4d7a6f Binary files /dev/null and b/美术资源/03-settings/row-vibration.png differ diff --git a/美术资源/03-settings/switch-off.png b/美术资源/03-settings/switch-off.png new file mode 100644 index 0000000..fcb4a9e Binary files /dev/null and b/美术资源/03-settings/switch-off.png differ diff --git a/美术资源/03-settings/switch-on.png b/美术资源/03-settings/switch-on.png new file mode 100644 index 0000000..961ce93 Binary files /dev/null and b/美术资源/03-settings/switch-on.png differ diff --git a/美术资源/03-settings/title-settings.png b/美术资源/03-settings/title-settings.png new file mode 100644 index 0000000..2ca258f Binary files /dev/null and b/美术资源/03-settings/title-settings.png differ diff --git a/美术资源/03-settings/title-underline.png b/美术资源/03-settings/title-underline.png new file mode 100644 index 0000000..ebf6203 Binary files /dev/null and b/美术资源/03-settings/title-underline.png differ diff --git a/美术资源/05-auto-spin-setup/05-auto-spin-setup.png b/美术资源/05-auto-spin-setup/05-auto-spin-setup.png new file mode 100644 index 0000000..bcb313e Binary files /dev/null and b/美术资源/05-auto-spin-setup/05-auto-spin-setup.png differ diff --git a/美术资源/05-auto-spin-setup/auto_spin_title.png b/美术资源/05-auto-spin-setup/auto_spin_title.png new file mode 100644 index 0000000..0e9b77d Binary files /dev/null and b/美术资源/05-auto-spin-setup/auto_spin_title.png differ diff --git a/美术资源/05-auto-spin-setup/cherry_decoration.png b/美术资源/05-auto-spin-setup/cherry_decoration.png new file mode 100644 index 0000000..74f5d64 Binary files /dev/null and b/美术资源/05-auto-spin-setup/cherry_decoration.png differ diff --git a/美术资源/05-auto-spin-setup/count_100_normal.png b/美术资源/05-auto-spin-setup/count_100_normal.png new file mode 100644 index 0000000..48e5983 Binary files /dev/null and b/美术资源/05-auto-spin-setup/count_100_normal.png differ diff --git a/美术资源/05-auto-spin-setup/count_100_selected.png b/美术资源/05-auto-spin-setup/count_100_selected.png new file mode 100644 index 0000000..58b7cef Binary files /dev/null and b/美术资源/05-auto-spin-setup/count_100_selected.png differ diff --git a/美术资源/05-auto-spin-setup/count_10_normal.png b/美术资源/05-auto-spin-setup/count_10_normal.png new file mode 100644 index 0000000..d6128b2 Binary files /dev/null and b/美术资源/05-auto-spin-setup/count_10_normal.png differ diff --git a/美术资源/05-auto-spin-setup/count_10_selected.png b/美术资源/05-auto-spin-setup/count_10_selected.png new file mode 100644 index 0000000..0cf593f Binary files /dev/null and b/美术资源/05-auto-spin-setup/count_10_selected.png differ diff --git a/美术资源/05-auto-spin-setup/count_25_normal.png b/美术资源/05-auto-spin-setup/count_25_normal.png new file mode 100644 index 0000000..4ef1ee1 Binary files /dev/null and b/美术资源/05-auto-spin-setup/count_25_normal.png differ diff --git a/美术资源/05-auto-spin-setup/count_25_selected.png b/美术资源/05-auto-spin-setup/count_25_selected.png new file mode 100644 index 0000000..a9db117 Binary files /dev/null and b/美术资源/05-auto-spin-setup/count_25_selected.png differ diff --git a/美术资源/05-auto-spin-setup/count_50_normal.png b/美术资源/05-auto-spin-setup/count_50_normal.png new file mode 100644 index 0000000..7a14f27 Binary files /dev/null and b/美术资源/05-auto-spin-setup/count_50_normal.png differ diff --git a/美术资源/05-auto-spin-setup/count_50_selected.png b/美术资源/05-auto-spin-setup/count_50_selected.png new file mode 100644 index 0000000..8949641 Binary files /dev/null and b/美术资源/05-auto-spin-setup/count_50_selected.png differ diff --git a/美术资源/05-auto-spin-setup/popup_background.png b/美术资源/05-auto-spin-setup/popup_background.png new file mode 100644 index 0000000..868e96d Binary files /dev/null and b/美术资源/05-auto-spin-setup/popup_background.png differ diff --git a/美术资源/05-auto-spin-setup/start_auto_spin.png b/美术资源/05-auto-spin-setup/start_auto_spin.png new file mode 100644 index 0000000..c67f857 Binary files /dev/null and b/美术资源/05-auto-spin-setup/start_auto_spin.png differ diff --git a/美术资源/font/golden-numbers.fnt b/美术资源/font/golden-numbers.fnt new file mode 100644 index 0000000..c67be30 --- /dev/null +++ b/美术资源/font/golden-numbers.fnt @@ -0,0 +1,17 @@ +info face="Fruit Pop Golden Numbers" size=128 bold=1 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0 +common lineHeight=128 base=112 scaleW=1568 scaleH=128 pages=1 packed=0 +page id=0 file="golden-numbers.png" +chars count=12 +char id=44 x=37 y=67 width=38 height=48 xoffset=0 yoffset=67 xadvance=42 page=0 chnl=15 +char id=46 x=262 y=71 width=36 height=41 xoffset=0 yoffset=71 xadvance=40 page=0 chnl=15 +char id=48 x=461 y=8 width=85 height=104 xoffset=0 yoffset=8 xadvance=89 page=0 chnl=15 +char id=49 x=577 y=8 width=78 height=104 xoffset=0 yoffset=8 xadvance=82 page=0 chnl=15 +char id=50 x=688 y=8 width=80 height=104 xoffset=0 yoffset=8 xadvance=84 page=0 chnl=15 +char id=51 x=800 y=8 width=79 height=104 xoffset=0 yoffset=8 xadvance=83 page=0 chnl=15 +char id=52 x=908 y=8 width=88 height=104 xoffset=0 yoffset=8 xadvance=92 page=0 chnl=15 +char id=53 x=1023 y=8 width=82 height=104 xoffset=0 yoffset=8 xadvance=86 page=0 chnl=15 +char id=54 x=1134 y=8 width=84 height=104 xoffset=0 yoffset=8 xadvance=88 page=0 chnl=15 +char id=55 x=1246 y=8 width=83 height=104 xoffset=0 yoffset=8 xadvance=87 page=0 chnl=15 +char id=56 x=1358 y=8 width=83 height=104 xoffset=0 yoffset=8 xadvance=87 page=0 chnl=15 +char id=57 x=1470 y=8 width=83 height=104 xoffset=0 yoffset=8 xadvance=87 page=0 chnl=15 +kernings count=0 diff --git a/美术资源/font/golden-numbers.png b/美术资源/font/golden-numbers.png new file mode 100644 index 0000000..ee75e4f Binary files /dev/null and b/美术资源/font/golden-numbers.png differ