fix: EN切换失效、删除贡献者描述、版本按演进线分组(2D->3D)

- fix(i18n): composition 模式下响应式 locale 在 i18n.global 上(非 i18n.locale),
  loadLocaleAsync 与 useI18nLazy 改用 i18n.global.locale;
  useI18nLazy.current 改为派生自全局 locale 的 computed(单一数据源);
  各组件 useI18n() 加 useScope:'global' 确保读到同一 composer。
  headless 验证:默认中文(不下载EN chunk)->点EN加载en.[hash].js并切英文->切回中文 全通过
- content: 删除 MobileGame 概览中「主要贡献者 Zikai Wang... Hongxiang He...」句子
- timeline: 版本数据改为多演进线并行(zikai-ui/main/doby/roll-a-ball),
  每线带 2D/3D 形态标记,3D 线前显示「形态转变:2D -> 3D 滚球」转折标记
This commit is contained in:
Zikai
2026-07-12 15:03:04 +00:00
parent 15af291da0
commit e8dee338ed
11 changed files with 273 additions and 105 deletions

View File

@@ -11,8 +11,8 @@
},
"dependencies": {
"vue": "^3.4.21",
"vue-router": "^4.3.0",
"vue-i18n": "^9.13.1"
"vue-i18n": "^9.13.1",
"vue-router": "^4.3.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",

View File

@@ -2,6 +2,7 @@
import { useI18nLazy } from '../composables/useI18nLazy.js'
const { current, switching, switchLocale } = useI18nLazy()
// current 直接派生自全局 locale无需 useI18n
const locales = [
{ code: 'zh-CN', label: '中' },

View File

@@ -1,17 +1,19 @@
import { ref } from 'vue'
import { loadLocaleAsync } from '../i18n/index.js'
import { ref, computed } from 'vue'
import i18n, { loadLocaleAsync } from '../i18n/index.js'
const current = ref('zh-CN')
const switching = ref(false)
// 语言懒加载切换逻辑
// current 派生自全局 i18n composer 的 localecomposition 模式下在 i18n.global
// 与各组件内 useI18n({ useScope: 'global' }) 读到的是同一个 ref。
export function useI18nLazy() {
const current = computed(() => i18n.global.locale.value)
async function switchLocale(locale) {
if (switching.value || current.value === locale) return
switching.value = true
try {
await loadLocaleAsync(locale)
current.value = locale
} finally {
switching.value = false
}

View File

@@ -22,9 +22,10 @@ const loadedLocales = new Set(['zh-CN'])
* 之后切换仅在已加载集合内完成(无网络请求)。
*/
export async function loadLocaleAsync(locale) {
if (i18n.locale.value === locale) return
// composition 模式下响应式 locale 在 i18n.global
if (i18n.global.locale.value === locale) return
if (loadedLocales.has(locale)) {
i18n.locale.value = locale
i18n.global.locale.value = locale
document.documentElement.setAttribute('lang', locale)
return
}
@@ -35,14 +36,14 @@ export async function loadLocaleAsync(locale) {
messages = (await import('./locales/en.js')).default
} else {
// 未知语言回退到中文
i18n.locale.value = 'zh-CN'
i18n.global.locale.value = 'zh-CN'
document.documentElement.setAttribute('lang', 'zh-CN')
return
}
i18n.mergeLocaleMessage(locale, messages)
i18n.global.mergeLocaleMessage(locale, messages)
loadedLocales.add(locale)
i18n.locale.value = locale
i18n.global.locale.value = locale
document.documentElement.setAttribute('lang', locale)
}

View File

@@ -6,7 +6,7 @@ import VersionTimeline from './components/VersionTimeline.vue'
import TeamCard from './components/TeamCard.vue'
import Leaderboard from './components/Leaderboard.vue'
const { locale } = useI18n()
const { locale } = useI18n({ useScope: 'global' })
const L = (zh, en) => (locale.value === 'zh-CN' ? zh : en)
// 站点根绝对路径,用绑定避免被 Vite 当作构建期静态资源解析
const videoPoster = '/448/2.jpg'
@@ -28,14 +28,14 @@ const videoSrc = '/448/ml/449ml.mp4'
</h2>
<p>
{{ L(
'项目跨越 448 与 449 两门课程。448 用 Unity 开发游戏本体,产出可浏览器试玩的 WebGL 构建与可安装的 Android APK449 搭建展示网站与基于 PHP+MySQL 的玩家分数排行榜。主要贡献者 Zikai Wangzikai-ui / main / Roll-a-Ball 系列)与 Hongxiang He2D DobyAdventure。',
'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. Main contributors: Zikai Wang (zikai-ui / main / Roll-a-Ball series) and Hongxiang He (2D DobyAdventure).'
'项目跨越 448 与 449 两门课程。448 用 Unity 开发游戏本体,产出可浏览器试玩的 WebGL 构建与可安装的 Android APK449 搭建展示网站与基于 PHP+MySQL 的玩家分数排行榜。游戏经历多条并行演进线,从 2D 角色控制器与平台跳跃,最终转向手机陀螺仪操控的 3D 滚球,并尝试用 ML-Agents 做强化学习实验。',
'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.'
) }}
</p>
<p>
{{ L(
'玩法经过多版本迭代:早期是键盘控制生命/能量的角色控制器,最终版改为手机陀螺仪倾斜操控的 3D 滚球,含雪花砖掉落、黄色砖弹跳等机制。还用 Unity ML-Agents 做了强化学习实验。',
'Gameplay iterated across versions: early builds were keyboard-controlled 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. ML-Agents reinforcement-learning experiments were also conducted.'
'玩法经过多版本迭代:早期是键盘控制生命/能量的 2D 角色控制器,最终版改为手机陀螺仪倾斜操控的 3D 滚球,含雪花砖掉落、黄色砖弹跳等机制。',
'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.'
) }}
</p>
</div>

View File

@@ -2,7 +2,7 @@
import Tag from '../../../components/ui/Tag.vue'
import { useI18n } from 'vue-i18n'
const { locale } = useI18n()
const { locale } = useI18n({ useScope: 'global' })
const meta = {
course: { zh: '迈阿密大学 · 毕设 448 / 449', en: 'Miami University · Capstone 448 / 449' },

View File

@@ -2,7 +2,7 @@
import { ref, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
const { locale, t } = useI18n()
const { locale, t } = useI18n({ useScope: 'global' })
const rows = ref([])
const state = ref('loading') // loading | ok | error

View File

@@ -3,7 +3,7 @@ import { ref, onMounted, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { screenshots } from '../data/versions.js'
const { locale } = useI18n()
const { locale } = useI18n({ useScope: 'global' })
const current = ref(0)
let timer = null

View File

@@ -2,7 +2,7 @@
import { useI18n } from 'vue-i18n'
import { team } from '../data/team.js'
const { locale } = useI18n()
const { locale } = useI18n({ useScope: 'global' })
const L = (obj) => (locale.value === 'zh-CN' ? obj.zh : obj.en)
</script>

View File

@@ -1,29 +1,59 @@
<script setup>
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { versions } from '../data/versions.js'
import { versions, tracks } from '../data/versions.js'
const { locale } = useI18n()
const { locale } = useI18n({ useScope: 'global' })
const L = (obj) => (locale.value === 'zh-CN' ? obj.zh : obj.en)
// 按演进线分组;同一线内按 order 排序;线之间按各自最早 order 排序
const grouped = computed(() => {
return tracks
.map((t) => {
const items = versions
.filter((v) => v.track === t.id)
.sort((a, b) => a.order - b.order)
return { track: t, items }
})
.filter((g) => g.items.length > 0)
.sort((a, b) => Math.min(...a.items.map((i) => i.order)) - Math.min(...b.items.map((i) => i.order)))
})
// 标记 3D 转折3D 线之前的最后一条 2D 线结尾,提示形态转变
const is3D = (track) => track.form === '3D'
</script>
<template>
<div class="timeline">
<div
v-for="(v, i) in versions"
v-for="(g, gi) in grouped"
:key="g.track.id"
class="timeline__track"
:class="{ 'timeline__track--3d': is3D(g.track) }"
>
<!-- 线标题 -->
<div class="timeline__track-head">
<span class="timeline__form" :class="{ 'is-3d': is3D(g.track) }">{{ g.track.form }}</span>
<span class="timeline__track-name">{{ L(g.track.name) }}</span>
</div>
<p class="timeline__track-desc">{{ L(g.track.desc) }}</p>
<!-- 该线下的版本 -->
<div class="timeline__items">
<div
v-for="(v, i) in g.items"
:key="v.id"
class="timeline__item"
>
<div class="timeline__marker">
<span class="timeline__dot"></span>
<span v-if="i < versions.length - 1" class="timeline__line"></span>
<span v-if="i < g.items.length - 1" class="timeline__line"></span>
</div>
<div class="timeline__body">
<div class="timeline__head">
<span class="timeline__series">{{ v.series }}</span>
<span class="timeline__version">v{{ v.version }}</span>
<span class="timeline__product">{{ v.product }}</span>
</div>
<div class="timeline__product">{{ v.product }}</div>
<div class="timeline__row">
<span class="timeline__label">{{ locale === 'zh-CN' ? '操作' : 'Controls' }}</span>
<span>{{ L(v.control) }}</span>
@@ -47,46 +77,102 @@ const L = (obj) => (locale.value === 'zh-CN' ? obj.zh : obj.en)
</div>
</div>
</div>
<!-- 2D -> 3D 转折标记仅出现在第一条 3D 线之前 -->
<div v-if="is3D(g.track) && gi > 0" class="timeline__pivot">
<span class="timeline__pivot-line"></span>
<span class="timeline__pivot-text">
{{ locale === 'zh-CN' ? '形态转变2D → 3D 滚球' : 'Form shift: 2D → 3D rolling ball' }}
</span>
<span class="timeline__pivot-line"></span>
</div>
</div>
</div>
</template>
<style scoped>
.timeline {
position: relative;
display: flex;
flex-direction: column;
gap: var(--space-xl);
}
.timeline__track--3d {
padding-top: var(--space-sm);
}
.timeline__track-head {
display: flex;
align-items: center;
gap: var(--space-sm);
margin-bottom: var(--space-xs);
}
.timeline__form {
display: inline-flex;
align-items: center;
padding: 2px 10px;
font-size: 0.74rem;
font-weight: 600;
border-radius: 999px;
background: var(--surface-2);
color: var(--text-secondary);
letter-spacing: 0.04em;
}
.timeline__form.is-3d {
background: var(--accent-weak);
color: var(--accent);
}
.timeline__track-name {
font-weight: 600;
font-size: 1.05rem;
color: var(--text-primary);
}
.timeline__track-desc {
font-size: 0.9rem;
color: var(--text-secondary);
margin: 0 0 var(--space-md);
max-width: 640px;
}
.timeline__items {
padding-left: 4px;
}
.timeline__item {
display: flex;
gap: var(--space-md);
padding-bottom: var(--space-lg);
padding-bottom: var(--space-md);
}
.timeline__marker {
position: relative;
flex: 0 0 16px;
flex: 0 0 14px;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 4px;
padding-top: 6px;
}
.timeline__dot {
width: 12px;
height: 12px;
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--bg);
border: 2px solid var(--accent);
flex: 0 0 12px;
flex: 0 0 10px;
}
.timeline__track--3d .timeline__dot {
background: var(--accent);
}
.timeline__line {
flex: 1;
width: 2px;
background: var(--border);
margin-top: 4px;
min-height: 24px;
min-height: 20px;
}
.timeline__body {
flex: 1;
padding: var(--space-md) var(--space-lg);
padding: var(--space-sm) var(--space-md);
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius);
border-radius: var(--radius-sm);
box-shadow: var(--shadow-sm);
transition: box-shadow var(--transition);
}
@@ -97,37 +183,32 @@ const L = (obj) => (locale.value === 'zh-CN' ? obj.zh : obj.en)
display: flex;
align-items: baseline;
gap: var(--space-sm);
margin-bottom: 2px;
}
.timeline__series {
font-weight: 600;
color: var(--text-primary);
font-size: 1.02rem;
margin-bottom: var(--space-xs);
}
.timeline__version {
font-family: var(--font-mono);
font-size: 0.85rem;
font-size: 0.82rem;
color: var(--accent);
background: var(--accent-weak);
padding: 1px 8px;
border-radius: 6px;
font-weight: 600;
}
.timeline__product {
font-size: 0.85rem;
font-size: 0.82rem;
color: var(--text-tertiary);
margin-bottom: var(--space-sm);
}
.timeline__row {
display: flex;
gap: var(--space-sm);
font-size: 0.9rem;
font-size: 0.88rem;
color: var(--text-secondary);
padding: 2px 0;
padding: 1px 0;
}
.timeline__label {
flex: 0 0 48px;
flex: 0 0 52px;
color: var(--text-tertiary);
font-size: 0.82rem;
font-size: 0.8rem;
}
.timeline__mono {
font-family: var(--font-mono);
@@ -135,7 +216,27 @@ const L = (obj) => (locale.value === 'zh-CN' ? obj.zh : obj.en)
.timeline__links {
display: flex;
gap: var(--space-md);
margin-top: var(--space-sm);
font-size: 0.88rem;
margin-top: var(--space-xs);
font-size: 0.85rem;
}
/* 2D -> 3D 转折标记 */
.timeline__pivot {
display: flex;
align-items: center;
gap: var(--space-md);
margin: var(--space-md) 0 0;
}
.timeline__pivot-line {
flex: 1;
height: 1px;
background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}
.timeline__pivot-text {
font-size: 0.8rem;
font-weight: 600;
color: var(--accent);
white-space: nowrap;
letter-spacing: 0.02em;
}
</style>

View File

@@ -1,92 +1,155 @@
// 448 各版本数据(来自对构建产物与 index.html 的分析)
//
// 项目是多条线并行演进的且经历了「2D -> 3D 滚球」的形态转变:
// - zikai-ui 线0.0.0 -> 0.0.32D 角色控制器,键盘控制生命/能量,最终改 WASD
// - main 线0.0.0 -> 0.0.12D 角色控制器,升级 Unity加屏幕按键
// - doby 线0.0.02D 平台跳跃Hongxiang He
// - roll-a-ball 线0.0.23D 滚球,陀螺仪操控 —— 项目从 2D 转向 3D 的最终形态
//
// track 字段标识所属演进线form 标识 2D/3Dorder 用于时间线排序(按发布先后)。
export const tracks = [
{
id: 'zikai-ui',
name: { zh: 'zikai-ui 角色控制器', en: 'zikai-ui Character Controller' },
form: '2D',
desc: {
zh: '迭代次数最多的线。2D 角色带生命/能量属性操作方式从鼠标、QWER/ASDF 键盘最终改为 WASD。',
en: 'The most iterated line. A 2D character with health/power stats; controls evolved from mouse, QWER/ASDF keys, finally to WASD.'
}
},
{
id: 'main',
name: { zh: 'main 角色控制器', en: 'main Character Controller' },
form: '2D',
desc: {
zh: '2D 角色控制器,从 Unity 2020 升级到 2021新增屏幕按键与跳跃。',
en: '2D character controller; upgraded Unity 2020 -> 2021, added on-screen buttons and jump.'
}
},
{
id: 'doby',
name: { zh: 'DobyAdventure', en: 'DobyAdventure' },
form: '2D',
desc: {
zh: '2D 横版平台跳跃,吃金币、计分、血量、触屏摇杆。',
en: '2D side-scrolling platformer: collect coins, score, health, touch joystick.'
}
},
{
id: 'roll-a-ball',
name: { zh: '3D 滚球(最终形态)', en: '3D Rolling Ball (Final Form)' },
form: '3D',
desc: {
zh: '项目从 2D 转向 3D 的最终形态。手机陀螺仪倾斜操控滚球,含雪花砖掉落、黄色砖弹跳等机制。',
en: 'The final form as the project shifted from 2D to 3D. Tilt the phone to roll the ball; snowflake bricks fall, yellow bricks bounce.'
}
}
]
export const versions = [
// zikai-ui 线
{
id: 'zikai-0.0.0',
series: 'zikai-ui',
track: 'zikai-ui',
version: '0.0.0',
unity: '',
unity: '-',
product: 'My project / 1.0.2',
webgl: '/448/zikai-0.0.0/',
apk: null,
control: { zh: '鼠标左键操作、右键追踪', en: 'Left mouse: operate, Right mouse: track' },
note: { zh: '早期鼠标控制原型', en: 'Early mouse-controlled prototype' }
note: { zh: '早期鼠标控制原型', en: 'Early mouse-controlled prototype' },
order: 1
},
{
id: 'zikai-0.0.1',
series: 'zikai-ui',
track: 'zikai-ui',
version: '0.0.1',
unity: '2020.3.30f1',
product: 'zikai-ui / 1.0.2',
webgl: '/448/zikai-0.0.1/',
apk: '/448/zikai-0.0.1/zikai.apk',
control: { zh: '生命 Q/W/E/R、能量 A/S/D/F', en: 'Health Q/W/E/R, Power A/S/D/F' },
note: { zh: '引入生命/能量属性系统', en: 'Introduced health/power stat system' }
note: { zh: '引入生命/能量属性系统', en: 'Introduced health/power stat system' },
order: 2
},
{
id: 'zikai-0.0.2',
series: 'zikai-ui',
track: 'zikai-ui',
version: '0.0.2',
unity: '2020.3.30f1',
product: 'zikai-ui / 1.0.2',
webgl: '/448/zikai-0.0.2/',
apk: '/448/zikai-0.0.2/zikai.apk',
control: { zh: '同 0.0.1', en: 'Same as 0.0.1' },
note: { zh: '构建产物重命名整理', en: 'Build artifact renaming' }
note: { zh: '构建产物重命名整理', en: 'Build artifact renaming' },
order: 3
},
{
id: 'zikai-0.0.3',
series: 'zikai-ui',
track: 'zikai-ui',
version: '0.0.3',
unity: '2020.3.30f1',
product: 'zikai-ui / 1.0.2.5',
webgl: '/448/zikai-0.0.3/',
apk: '/448/zikai-0.0.3/zikai.apk',
control: { zh: 'WASD 移动、J 跳跃、K 飞行(测试)', en: 'WASD move, J jump, K fly (testing)' },
note: { zh: '改为 WASD 操作,最新版', en: 'Switched to WASD, latest version' }
note: { zh: '改为 WASD 操作,本线最新版', en: 'Switched to WASD, latest of this line' },
order: 4
},
// main 线
{
id: 'main-0.0.0',
series: 'main',
track: 'main',
version: '0.0.0',
unity: '2020.3.30f1',
product: 'zikai-main / 1.0.2.6',
webgl: '/448/main-0.0.0/',
apk: '/448/main-0.0.0.apk',
control: { zh: '角色控制器', en: 'Character controller' },
note: { zh: '基线版本', en: 'Baseline' }
note: { zh: '基线版本', en: 'Baseline' },
order: 2
},
{
id: 'main-0.0.1',
series: 'main',
track: 'main',
version: '0.0.1',
unity: '2021.3.12f1',
product: 'beta / 1.0.2',
webgl: '/448/main-0.0.1/',
apk: '/448/main-0.0.1/zikai.apk',
control: { zh: 'WASD 移动、K 跳跃', en: 'WASD move, K jump' },
note: { zh: '升级 Unity新增屏幕按键', en: 'Upgraded Unity, added on-screen buttons' }
},
{
id: 'ball',
series: 'roll-a-ball',
version: '0.0.2',
unity: '2021.3.12f1',
product: '3dRoingBallt2 / 0.0.2',
webgl: '/448/ball/',
apk: '/448/203wangz199.apk',
control: { zh: '手机陀螺仪倾斜移动、上倾/点击跳跃', en: 'Tilt phone to move, tilt up/tap to jump' },
note: { zh: '最终版本3D 滚球', en: 'Final version, 3D rolling ball' }
note: { zh: '升级 Unity新增屏幕按键', en: 'Upgraded Unity, added on-screen buttons' },
order: 5
},
// doby 线
{
id: 'hongXiang-0.0.0',
series: 'doby',
track: 'doby',
version: '0.0.0',
unity: '2021.2.10f1',
product: 'DobyAdventure',
webgl: null,
apk: '/448/hongXiang-0.0.0/2D game.apk',
control: { zh: 'A/D 移动、跳跃、吃金币', en: 'A/D move, jump, collect coins' },
note: { zh: '2D 平台跳跃Hongxiang He', en: '2D platformer (Hongxiang He)' }
note: { zh: '2D 平台跳跃', en: '2D platformer' },
order: 3
},
// roll-a-ball 线3D项目形态转变
{
id: 'ball',
track: 'roll-a-ball',
version: '0.0.2',
unity: '2021.3.12f1',
product: '3dRoingBallt2 / 0.0.2',
webgl: '/448/ball/',
apk: '/448/203wangz199.apk',
control: { zh: '手机陀螺仪倾斜移动、上倾/点击跳跃', en: 'Tilt phone to move, tilt up/tap to jump' },
note: { zh: '最终版本,项目转向 3D 滚球', en: 'Final version, project shifted to 3D rolling ball' },
order: 6
}
]