refactor: 高内聚低耦合 - 配置集中化与 i18n 统一

结构优化:
- 新增 mobile-game/config.js:集中模块静态配置(资源路径、排行榜端点、
  hero meta、子标签页定义),消除散落在各组件的硬编码
- 新增 composables/useLocale.js:共享语言辅助(t/isZh/pick),
  消除 6 个组件各自重复定义的 L() helper
- 文案全部迁入 i18n locale(mobileGame 命名空间),消除模板内联 L('中','英')
- 数据文件 versions.js 去除 {zh,en} 对象,文案改由 i18n 键(tracks/versions)取
- 各组件改为读 config + t(),不再直接 useI18n,降低与 i18n 实现的耦合

headless 验证:中文(hero/meta/team/timeline/3D置顶) + 英文切换 + 切回中文 全通过
This commit is contained in:
Zikai
2026-07-12 16:08:25 +00:00
parent b3556b8639
commit c6dad2b79a
14 changed files with 341 additions and 273 deletions

View File

@@ -2,19 +2,96 @@
// 只看中文的访客不会下载此文件。
export default {
app: {
title: 'Zikai',
nav: {
projects: 'Projects',
language: 'Language'
}
title: 'Zikai'
},
common: {
loading: 'Loading…',
comingSoon: 'Coming soon',
notAvailable: 'Not available',
backToTop: 'Back to top'
notAvailable: 'Not available'
},
tabs: {
mobileGame: 'Mobile Game Project'
},
mobileGame: {
hero: {
title: 'Mobile Game Project',
desc: 'A cross-semester Unity mobile-game capstone: 448 built the game (WebGL + Android APK), 449 built the showcase site and player leaderboard. Iterated across versions, from a character controller to a gyroscope-controlled 3D rolling-ball game, with ML-Agents reinforcement-learning experiments.'
},
meta: {
course: 'Miami University · Capstone 448 / 449',
stack: 'Stack',
stackValue: 'Unity · C# · WebGL · Android · PHP',
period: 'Period',
periodValue: '2022'
},
overview: {
label: 'Overview',
title: 'From character controller to gyro ball',
p1: 'The project spans courses 448 and 449. 448 built the game with Unity, producing browser-playable WebGL builds and installable Android APKs; 449 built the showcase site and a PHP+MySQL player leaderboard. The game evolved along several parallel lines, from 2D character controllers and platformers, ultimately shifting to a gyroscope-controlled 3D rolling ball, with ML-Agents reinforcement-learning experiments.',
p2: 'Gameplay iterated across versions: early builds were keyboard-controlled 2D character controllers with health/power stats; the final version became a gyroscope-tilt 3D rolling-ball game with falling snowflake bricks and bouncing yellow bricks.'
},
subtabs: {
team: 'Team · Leaderboard',
iterations: 'Iterations',
experiment: 'Experiment'
},
team: {
label: 'Team',
title: 'Members'
},
leaderboard: {
label: 'Leaderboard',
title: 'Top 30 Scores',
colRank: '#',
colName: 'Name',
colScore: 'Score',
noScores: 'No scores yet',
error: 'Leaderboard service unavailable'
},
iterations: {
label: 'Version History',
title: 'Iteration Record',
colControls: 'Controls',
colNote: 'Note',
colUnity: 'Unity',
playWebgl: 'Play WebGL',
downloadApk: 'Download APK',
pivotText: 'Earlier parallel lines: 2D'
},
experiment: {
label: 'Experiment',
title: 'ML-Agents Reinforcement Learning Demo',
caption: 'Capsules trained via ML-Agents to keep the ball from falling and to navigate obstacles.'
},
tracks: {
'roll-a-ball': {
name: '3D Rolling Ball (Final Form)',
desc: 'The final form as the project shifted from 2D to 3D. Tilt the phone to roll the ball; snowflake bricks fall, yellow bricks bounce.'
},
'zikai-ui': {
name: 'zikai-ui Character Controller',
desc: 'The most iterated line. A 2D character with health/power stats; controls evolved from mouse, QWER/ASDF keys, finally to WASD.'
},
'main': {
name: 'main Character Controller',
desc: '2D character controller; upgraded Unity 2020 -> 2021, added on-screen buttons and jump.'
},
'doby': {
name: 'DobyAdventure',
desc: '2D side-scrolling platformer: collect coins, score, health, touch joystick.'
}
},
versions: {
'zikai-0.0.0': { control: 'Left mouse: operate, Right mouse: track', note: 'Early mouse-controlled prototype' },
'zikai-0.0.1': { control: 'Health Q/W/E/R, Power A/S/D/F', note: 'Introduced health/power stat system' },
'zikai-0.0.2': { control: 'Same as 0.0.1', note: 'Build artifact renaming' },
'zikai-0.0.3': { control: 'WASD move, J jump, K fly (testing)', note: 'Switched to WASD, latest of this line' },
'main-0.0.0': { control: 'Character controller', note: 'Baseline' },
'main-0.0.1': { control: 'WASD move, K jump', note: 'Upgraded Unity, added on-screen buttons' },
'hongXiang-0.0.0': { control: 'A/D move, jump, collect coins', note: '2D platformer' },
'ball': { control: 'Tilt phone to move, tilt up/tap to jump', note: 'Final version, project shifted to 3D rolling ball' }
},
screenshots: {
caption: 'Screenshot {n}'
}
}
}