# libnoname/noname architecture

> Architecture diagram of the GitHub repository libnoname/noname, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/libnoname/noname
- Repository: https://github.com/libnoname/noname

## Overview

无名杀是面向浏览器、桌面和移动 WebView 的卡牌游戏。玩家进入游戏后选择玩法与角色，随后由游戏事件和技能规则推进对局；模式、卡牌与武将内容构成主要玩法差异。仓库还包含联机通信、扩展资源编译以及各平台运行入口。部分核心玩法文件仅见于 SOURCE INDEX 或目录树，因此相应连接仅在有明确证据时绘出；未采样的玩法关系不作推断。

Main entry points: [`apps/core/mode/guozhan/src/main.js`](https://github.com/libnoname/noname/blob/main/apps/core/mode/guozhan/src/main.js) (国战模式), [`apps/core/noname/library/index.js`](https://github.com/libnoname/noname/blob/main/apps/core/noname/library/index.js) (游戏库与配置), [`apps/core/noname/library/element/GameEvent/GameEventManager.ts`](https://github.com/libnoname/noname/blob/main/apps/core/noname/library/element/GameEvent/GameEventManager.ts) (事件调度), [`apps/mobile/android/app/src/main/java/com/libnoname/noname/JsAwareAssetsPathHandler.kt`](https://github.com/libnoname/noname/blob/main/apps/mobile/android/app/src/main/java/com/libnoname/noname/JsAwareAssetsPathHandler.kt) (资源路径处理)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["对局玩法"]
  node_cards["卡牌规则<br/>[standard.js]"]
  node_characters["武将技能"]
  node_boss["Boss 模式<br/>[boss.js]"]
  node_guozhan["国战模式<br/>[main.js]"]
  node_guozhan_help["国战规则说明<br/>[App.js]"]
end

subgraph group_runtime["游戏运行时"]
  node_ui["游戏交互<br/>[index.js]"]
  node_library["游戏库与配置<br/>[index.js]"]
  node_events["事件调度"]
  node_game_events["游戏事件<br/>[gameEvent.ts]"]
  node_get["游戏查询工具<br/>[index.js]"]
end

subgraph group_online["联机与扩展"]
  node_client["联机客户端<br/>[client.js]"]
  node_server["房间服务器<br/>[createServer.ts]"]
  node_jit["扩展资源编译<br/>[index.ts]"]
end

subgraph group_platforms["平台适配"]
  node_fs["文件服务<br/>[index.ts]"]
  node_electron["桌面入口<br/>[main.ts]"]
  node_mobile["Android 入口<br/>[MainActivity.kt]"]
  node_asset_handler["资源路径处理"]
  node_overlay_store[("SAF 覆盖存储<br/>[SafOverlayStore.kt]")]
end

node_player(("玩家"))

node_player -.->|"操作"| node_ui
node_guozhan -.->|"使用规则"| node_cards
node_guozhan -.->|"读取武将"| node_characters
node_guozhan -.->|"展示说明"| node_guozhan_help
node_events -->|"管理事件"| node_game_events
node_library -.->|"导入事件管理器"| node_events
node_library -->|"导入客户端"| node_client
node_library -->|"使用查询工具"| node_get
node_guozhan -->|"调用查询"| node_get
node_guozhan -->|"读取游戏状态"| node_library
node_electron -->|"启动服务"| node_fs
node_mobile -->|"注册资源处理"| node_asset_handler
node_asset_handler -->|"查找覆盖文件"| node_overlay_store

click node_cards "https://github.com/libnoname/noname/blob/main/apps/core/card/standard.js"
click node_characters "https://github.com/libnoname/noname/tree/main/apps/core/character"
click node_boss "https://github.com/libnoname/noname/blob/main/apps/core/mode/boss.js"
click node_guozhan "https://github.com/libnoname/noname/blob/main/apps/core/mode/guozhan/src/main.js"
click node_guozhan_help "https://github.com/libnoname/noname/blob/main/apps/core/mode/guozhan/src/help/App.js"
click node_ui "https://github.com/libnoname/noname/blob/main/apps/core/noname/ui/click/index.js"
click node_library "https://github.com/libnoname/noname/blob/main/apps/core/noname/library/index.js"
click node_events "https://github.com/libnoname/noname/blob/main/apps/core/noname/library/element/GameEvent/GameEventManager.ts"
click node_game_events "https://github.com/libnoname/noname/blob/main/apps/core/noname/library/element/gameEvent.ts"
click node_get "https://github.com/libnoname/noname/blob/main/apps/core/noname/get/index.js"
click node_client "https://github.com/libnoname/noname/blob/main/apps/core/noname/library/element/client.js"
click node_server "https://github.com/libnoname/noname/blob/main/packages/server/src/server/createServer.ts"
click node_jit "https://github.com/libnoname/noname/blob/main/packages/jit/src/service-worker/index.ts"
click node_fs "https://github.com/libnoname/noname/blob/main/packages/fs/src/index.ts"
click node_electron "https://github.com/libnoname/noname/blob/main/apps/electron/app/main.ts"
click node_mobile "https://github.com/libnoname/noname/blob/main/apps/mobile/android/app/src/main/java/com/libnoname/noname/MainActivity.kt"
click node_asset_handler "https://github.com/libnoname/noname/blob/main/apps/mobile/android/app/src/main/java/com/libnoname/noname/JsAwareAssetsPathHandler.kt"
click node_overlay_store "https://github.com/libnoname/noname/blob/main/apps/mobile/android/app/src/main/java/com/libnoname/noname/SafOverlayStore.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cards,node_characters,node_boss,node_guozhan,node_guozhan_help toneBlue
class node_ui,node_library,node_events,node_game_events,node_get toneAmber
class node_client,node_server,node_jit toneMint
class node_fs,node_electron,node_mobile,node_asset_handler,node_overlay_store toneRose
class node_player toneIndigo
```

## Components

### 对局玩法

- [卡牌规则](https://github.com/libnoname/noname/blob/main/apps/core/card/standard.js): `apps/core/card/standard.js`
- [武将技能](https://github.com/libnoname/noname/tree/main/apps/core/character): `apps/core/character`
- [Boss 模式](https://github.com/libnoname/noname/blob/main/apps/core/mode/boss.js): `apps/core/mode/boss.js`
- [国战模式](https://github.com/libnoname/noname/blob/main/apps/core/mode/guozhan/src/main.js): `apps/core/mode/guozhan/src/main.js`
- [国战规则说明](https://github.com/libnoname/noname/blob/main/apps/core/mode/guozhan/src/help/App.js): `apps/core/mode/guozhan/src/help/App.js`

### 游戏运行时

- [游戏交互](https://github.com/libnoname/noname/blob/main/apps/core/noname/ui/click/index.js): `apps/core/noname/ui/click/index.js`
- [游戏库与配置](https://github.com/libnoname/noname/blob/main/apps/core/noname/library/index.js): `apps/core/noname/library/index.js`
- [事件调度](https://github.com/libnoname/noname/blob/main/apps/core/noname/library/element/GameEvent/GameEventManager.ts): `apps/core/noname/library/element/GameEvent/GameEventManager.ts`
- [游戏事件](https://github.com/libnoname/noname/blob/main/apps/core/noname/library/element/gameEvent.ts): `apps/core/noname/library/element/gameEvent.ts`
- [游戏查询工具](https://github.com/libnoname/noname/blob/main/apps/core/noname/get/index.js): `apps/core/noname/get/index.js`

### 联机与扩展

- [联机客户端](https://github.com/libnoname/noname/blob/main/apps/core/noname/library/element/client.js): `apps/core/noname/library/element/client.js`
- [房间服务器](https://github.com/libnoname/noname/blob/main/packages/server/src/server/createServer.ts): `packages/server/src/server/createServer.ts`
- [扩展资源编译](https://github.com/libnoname/noname/blob/main/packages/jit/src/service-worker/index.ts): `packages/jit/src/service-worker/index.ts`

### 平台适配

- [文件服务](https://github.com/libnoname/noname/blob/main/packages/fs/src/index.ts): `packages/fs/src/index.ts`
- [桌面入口](https://github.com/libnoname/noname/blob/main/apps/electron/app/main.ts): `apps/electron/app/main.ts`
- [Android 入口](https://github.com/libnoname/noname/blob/main/apps/mobile/android/app/src/main/java/com/libnoname/noname/MainActivity.kt): `apps/mobile/android/app/src/main/java/com/libnoname/noname/MainActivity.kt`
- [资源路径处理](https://github.com/libnoname/noname/blob/main/apps/mobile/android/app/src/main/java/com/libnoname/noname/JsAwareAssetsPathHandler.kt): `apps/mobile/android/app/src/main/java/com/libnoname/noname/JsAwareAssetsPathHandler.kt`
- [SAF 覆盖存储](https://github.com/libnoname/noname/blob/main/apps/mobile/android/app/src/main/java/com/libnoname/noname/SafOverlayStore.kt): `apps/mobile/android/app/src/main/java/com/libnoname/noname/SafOverlayStore.kt`

### Other components

- **玩家**

## Connections

- 玩家 → 游戏交互: 操作
- 国战模式 → 卡牌规则: 使用规则
- 国战模式 → 武将技能: 读取武将
- 国战模式 → 国战规则说明: 展示说明
- 事件调度 → 游戏事件: 管理事件 (evidence: `apps/core/noname/library/element/GameEvent/GameEventManager.ts`)
- 游戏库与配置 → 事件调度: 导入事件管理器
- 游戏库与配置 → 联机客户端: 导入客户端 (evidence: `apps/core/noname/library/index.js`)
- 游戏库与配置 → 游戏查询工具: 使用查询工具 (evidence: `apps/core/noname/library/index.js`)
- 国战模式 → 游戏查询工具: 调用查询 (evidence: `apps/core/mode/guozhan/src/main.js`)
- 国战模式 → 游戏库与配置: 读取游戏状态 (evidence: `apps/core/mode/guozhan/src/main.js`)
- 桌面入口 → 文件服务: 启动服务 (evidence: `apps/electron/app/main.ts`)
- Android 入口 → 资源路径处理: 注册资源处理 (evidence: `apps/mobile/android/app/src/main/java/com/libnoname/noname/MainActivity.kt`)
- 资源路径处理 → SAF 覆盖存储: 查找覆盖文件 (evidence: `apps/mobile/android/app/src/main/java/com/libnoname/noname/JsAwareAssetsPathHandler.kt`)
