diff --git a/docs/.vitepress/cache/deps/_metadata.json b/docs/.vitepress/cache/deps/_metadata.json index e5d9b15..4b1af75 100644 --- a/docs/.vitepress/cache/deps/_metadata.json +++ b/docs/.vitepress/cache/deps/_metadata.json @@ -1,25 +1,25 @@ { - "hash": "74ecdc37", - "configHash": "1c302118", + "hash": "f04df328", + "configHash": "15e8eca7", "lockfileHash": "42b6a898", - "browserHash": "b3e735e5", + "browserHash": "342224e2", "optimized": { "vue": { "src": "../../../node_modules/vue/dist/vue.runtime.esm-bundler.js", "file": "vue.js", - "fileHash": "74f911f6", + "fileHash": "c87f1bc4", "needsInterop": false }, "vitepress > @vue/devtools-api": { "src": "../../../node_modules/@vue/devtools-api/dist/index.js", "file": "vitepress___@vue_devtools-api.js", - "fileHash": "673694b5", + "fileHash": "4ddc9988", "needsInterop": false }, "vitepress > @vueuse/core": { "src": "../../../node_modules/@vueuse/core/dist/index.js", "file": "vitepress___@vueuse_core.js", - "fileHash": "6334babc", + "fileHash": "3d4a475e", "needsInterop": false } }, diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 757c3f3..a93efd4 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -1,113 +1,240 @@ import { defineConfig } from 'vitepress' -// https://vitepress.dev/reference/site-config export default defineConfig({ title: "GFramework", description: "面向游戏开发场景的模块化 C# 框架", base: "/GFramework/", - themeConfig: { - logo: '/logo-icon.png', - // https://vitepress.dev/reference/default-theme-config - nav: [ - { text: '首页', link: '/' }, - { text: '入门指南', link: '/getting-started/installation' }, - { text: 'Core', link: '/core/overview' }, - { text: 'Game', link: '/game/overview' }, - { text: 'Godot', link: '/godot/overview' }, - { text: '源码生成器', link: '/source-generators/overview' }, - { text: '教程', link: '/tutorials/basic-tutorial' }, - { text: 'API参考', link: '/api-reference/core-api' } - ], + vite: { + plugins: [ + { + name: 'catch-all-404', + configureServer(server) { + return () => { + server.middlewares.use((req, res, next) => { + const url = req.url || '' - sidebar: { - '/getting-started/': [ - { - text: '入门指南', - items: [ - { text: '安装配置', link: '/getting-started/installation' }, - { text: '快速开始', link: '/getting-started/quick-start' }, - { text: '架构概览', link: '/getting-started/architecture-overview' } - ] + // 排除这些路径 + const excludePaths = [ + '/@vite', + '/@fs', + '/node_modules', + '/__vite', + '/public' + ] + + // 如果是资源文件或特殊路径,跳过 + if (excludePaths.some(path => url.startsWith(path)) || + url.includes('.') || + url.startsWith('/GFramework/')) { + return next() + } + + // 其他路径重定向到 404 + res.writeHead(302, { Location: '/GFramework/404' }) + res.end() + }) + } } - ], - '/core/': [ - { - text: 'Core 核心框架', - items: [ - { text: '概览', link: '/core/overview' }, - { text: '架构组件', link: '/core/architecture/architecture' }, - { text: '命令查询系统', link: '/core/command-query/commands' }, - { text: '事件系统', link: '/core/events/event-bus' }, - { text: '属性系统', link: '/core/property/bindable-property' }, - { text: '工具类', link: '/core/utilities/ioc-container' } + } + ], + server: { + strictPort: false, + // 添加中间件处理不带斜杠的情况 + proxy: {} + } + }, + locales: { + root: { + label: '简体中文', + lang: 'zh-CN', + link: '/zh-CN/', + themeConfig: { + logo: '/logo-icon.png', + + search: { + provider: 'local', + options: { + translations: { + button: { + buttonText: '搜索文档', + buttonAriaLabel: '搜索文档' + }, + modal: { + noResultsText: '无法找到相关结果', + resetButtonTitle: '清除查询条件', + footer: { + selectText: '选择', + navigateText: '切换', + closeText: '关闭' + } + } + } + } + }, + + nav: [ + { text: '首页', link: '/zh-CN/' }, + { text: '入门指南', link: '/zh-CN/getting-started/installation' }, + { text: 'Core', link: '/zh-CN/core/overview' }, + { text: 'Game', link: '/zh-CN/game/overview' }, + { text: 'Godot', link: '/zh-CN/godot/overview' }, + { text: '源码生成器', link: '/zh-CN/source-generators/overview' }, + { text: '教程', link: '/zh-CN/tutorials/basic-tutorial' }, + { text: 'API参考', link: '/zh-CN/api-reference/core-api' } + ], + + sidebar: { + '/zh-CN/getting-started/': [ + { + text: '入门指南', + items: [ + { text: '安装配置', link: '/zh-CN/getting-started/installation' }, + { text: '快速开始', link: '/zh-CN/getting-started/quick-start' }, + { text: '架构概览', link: '/zh-CN/getting-started/architecture-overview' } + ] + } + ], + '/zh-CN/core/': [ + { + text: 'Core 核心框架', + items: [ + { text: '概览', link: '/zh-CN/core/overview' }, + { text: '架构组件', link: '/zh-CN/core/architecture/architecture' }, + { text: '命令查询系统', link: '/zh-CN/core/command-query/commands' }, + { text: '事件系统', link: '/zh-CN/core/events/event-bus' }, + { text: '属性系统', link: '/zh-CN/core/property/bindable-property' }, + { text: '工具类', link: '/zh-CN/core/utilities/ioc-container' } + ] + } + ], + '/zh-CN/game/': [ + { + text: 'Game 游戏模块', + items: [ + { text: '概览', link: '/zh-CN/game/overview' }, + { text: '模块系统', link: '/zh-CN/game/modules/architecture-modules' }, + { text: '存储系统', link: '/zh-CN/game/storage/scoped-storage' }, + { text: '资源管理', link: '/zh-CN/game/assets/asset-catalog' }, + { text: '序列化', link: '/zh-CN/game/serialization/json-serializer' } + ] + } + ], + '/zh-CN/godot/': [ + { + text: 'Godot 集成', + items: [ + { text: '概览', link: '/zh-CN/godot/overview' }, + { text: '集成指南', link: '/zh-CN/godot/integration/architecture-integration' }, + { text: '节点扩展', link: '/zh-CN/godot/node-extensions/node-extensions' }, + { text: '对象池', link: '/zh-CN/godot/pooling/node-pool' }, + { text: '日志系统', link: '/zh-CN/godot/logging/godot-logger' } + ] + } + ], + '/zh-CN/source-generators/': [ + { + text: '源码生成器', + items: [ + { text: '概览', link: '/zh-CN/source-generators/overview' }, + { text: '日志生成器', link: '/zh-CN/source-generators/logging-generator' }, + { text: '枚举扩展', link: '/zh-CN/source-generators/enum-extensions' }, + { text: '规则生成器', link: '/zh-CN/source-generators/rule-generator' } + ] + } + ], + '/zh-CN/tutorials/': [ + { + text: '教程', + items: [ + { text: '基础教程', link: '/zh-CN/tutorials/basic-tutorial' }, + { text: '高级模式', link: '/zh-CN/tutorials/advanced-patterns' }, + { text: '最佳实践', link: '/zh-CN/tutorials/best-practices' } + ] + } + ], + '/zh-CN/api-reference/': [ + { + text: 'API 参考', + items: [ + { text: 'Core API', link: '/zh-CN/api-reference/core-api' }, + { text: 'Game API', link: '/zh-CN/api-reference/game-api' }, + { text: 'Godot API', link: '/zh-CN/api-reference/godot-api' }, + { text: '生成器 API', link: '/zh-CN/api-reference/generators-api' } + ] + } ] + }, + + socialLinks: [ + { icon: 'github', link: 'https://github.com/GeWuYou/GFramework' } + ], + + footer: { + message: '基于 Apache 2.0 许可证发布', + copyright: 'Copyright © 2026 GeWuYou' + }, + + outlineTitle: '页面导航', + lastUpdatedText: '最后更新于', + darkModeSwitchLabel: '主题', + sidebarMenuLabel: '菜单', + returnToTopLabel: '回到顶部', + + docFooter: { + prev: '上一页', + next: '下一页' } - ], - '/game/': [ - { - text: 'Game 游戏模块', - items: [ - { text: '概览', link: '/game/overview' }, - { text: '模块系统', link: '/game/modules/architecture-modules' }, - { text: '存储系统', link: '/game/storage/scoped-storage' }, - { text: '资源管理', link: '/game/assets/asset-catalog' }, - { text: '序列化', link: '/game/serialization/json-serializer' } - ] - } - ], - '/godot/': [ - { - text: 'Godot 集成', - items: [ - { text: '概览', link: '/godot/overview' }, - { text: '集成指南', link: '/godot/integration/architecture-integration' }, - { text: '节点扩展', link: '/godot/node-extensions/node-extensions' }, - { text: '对象池', link: '/godot/pooling/node-pool' }, - { text: '日志系统', link: '/godot/logging/godot-logger' } - ] - } - ], - '/source-generators/': [ - { - text: '源码生成器', - items: [ - { text: '概览', link: '/source-generators/overview' }, - { text: '日志生成器', link: '/source-generators/logging-generator' }, - { text: '枚举扩展', link: '/source-generators/enum-extensions' }, - { text: '规则生成器', link: '/source-generators/rule-generator' } - ] - } - ], - '/tutorials/': [ - { - text: '教程', - items: [ - { text: '基础教程', link: '/tutorials/basic-tutorial' }, - { text: '高级模式', link: '/tutorials/advanced-patterns' }, - { text: '最佳实践', link: '/tutorials/best-practices' } - ] - } - ], - '/api-reference/': [ - { - text: 'API 参考', - items: [ - { text: 'Core API', link: '/api-reference/core-api' }, - { text: 'Game API', link: '/api-reference/game-api' }, - { text: 'Godot API', link: '/api-reference/godot-api' }, - { text: '生成器 API', link: '/api-reference/generators-api' } - ] - } - ] + } }, - socialLinks: [ - { icon: 'github', link: 'https://github.com/GeWuYou/GFramework' } - ], - - footer: { - message: '基于 Apache 2.0 许可证发布', - copyright: 'Copyright © 2026 GeWuYou' + // 未来添加英文版本时取消注释 + /* + en: { + label: 'English', + lang: 'en-US', + link: '/en/', + themeConfig: { + logo: '/logo-icon.png', + + search: { + provider: 'local' + }, + + nav: [ + { text: 'Home', link: '/en/' }, + { text: 'Getting Started', link: '/en/getting-started/installation' }, + { text: 'Core', link: '/en/core/overview' }, + { text: 'Game', link: '/en/game/overview' }, + { text: 'Godot', link: '/en/godot/overview' }, + { text: 'Source Generators', link: '/en/source-generators/overview' }, + { text: 'Tutorials', link: '/en/tutorials/basic-tutorial' }, + { text: 'API Reference', link: '/en/api-reference/core-api' } + ], + + sidebar: { + '/en/getting-started/': [ + { + text: 'Getting Started', + items: [ + { text: 'Installation', link: '/en/getting-started/installation' }, + { text: 'Quick Start', link: '/en/getting-started/quick-start' }, + { text: 'Architecture Overview', link: '/en/getting-started/architecture-overview' } + ] + } + ], + // ... 其他英文侧边栏配置 + }, + + socialLinks: [ + { icon: 'github', link: 'https://github.com/GeWuYou/GFramework' } + ], + + footer: { + message: 'Released under the Apache 2.0 License', + copyright: 'Copyright © 2026 GeWuYou' + } + } } + */ } -}) +}) \ No newline at end of file diff --git a/docs/404.md b/docs/404.md new file mode 100644 index 0000000..bfca57e --- /dev/null +++ b/docs/404.md @@ -0,0 +1,133 @@ +--- +layout: page +--- + + + + + +
+

404

+

Page Not Found / 页面未找到

+

The page you are looking for does not exist.
您访问的页面不存在。

+ +

+ Auto redirecting in {{ countdown }} seconds
+ {{ countdown }} 秒后自动跳转 +

+
+

📚 您可能想访问:

+ +
+
+ +
+
+``` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 2829fcb..8b0c7e9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,38 +1,42 @@ ---- -# https://vitepress.dev/reference/default-theme-home-page -layout: home - -hero: - name: "GFramework" - text: "面向游戏开发场景的模块化 C# 框架" - tagline: 基于清洁架构和CQRS模式的现代化游戏开发框架 - image: - src: /logo.png - alt: GFramework Logo - actions: - - theme: brand - text: 快速开始 - link: /getting-started/quick-start - - theme: alt - text: 架构概览 - link: /getting-started/architecture-overview - - theme: alt - text: API 参考 - link: /api-reference/core-api - -features: - - title: 🏗️ 清洁架构 - details: 基于Model-View-Controller-System-Utility五层架构,实现清晰的职责分离和高内聚低耦合 - - title: 🔧 CQRS模式 - details: 命令查询职责分离,提供类型安全的命令和查询系统,支持可撤销操作 - - title: 📡 事件驱动 - details: 强大的事件总线系统,支持类型安全的事件发布订阅,实现组件间松耦合通信 - - title: 🎮 Godot集成 - details: 深度集成Godot引擎,提供丰富的节点扩展方法和对象池化支持 - - title: 🔄 响应式编程 - details: 可绑定属性系统,自动化的数据绑定和UI更新机制 - - title: ⚡ 源码生成器 - details: 基于Roslyn的源码生成器,自动生成日志、枚举扩展等样板代码 - +--- +layout: page --- + + +
+

🌐 Language Selection / 语言选择

+
+ + 简体中文 🇨🇳 + + + +
+

+ Auto-redirecting... / 自动跳转中... +

+
\ No newline at end of file diff --git a/docs/api-reference/core-api.md b/docs/zh-CN/api-reference/core-api.md similarity index 100% rename from docs/api-reference/core-api.md rename to docs/zh-CN/api-reference/core-api.md diff --git a/docs/api-reference/game-api.md b/docs/zh-CN/api-reference/game-api.md similarity index 100% rename from docs/api-reference/game-api.md rename to docs/zh-CN/api-reference/game-api.md diff --git a/docs/api-reference/godot-api.md b/docs/zh-CN/api-reference/godot-api.md similarity index 100% rename from docs/api-reference/godot-api.md rename to docs/zh-CN/api-reference/godot-api.md diff --git a/docs/api-reference/source-generators-api.md b/docs/zh-CN/api-reference/source-generators-api.md similarity index 100% rename from docs/api-reference/source-generators-api.md rename to docs/zh-CN/api-reference/source-generators-api.md diff --git a/docs/best-practices/architecture-patterns.md b/docs/zh-CN/best-practices/architecture-patterns.md similarity index 100% rename from docs/best-practices/architecture-patterns.md rename to docs/zh-CN/best-practices/architecture-patterns.md diff --git a/docs/core/architecture.md b/docs/zh-CN/core/architecture.md similarity index 100% rename from docs/core/architecture.md rename to docs/zh-CN/core/architecture.md diff --git a/docs/core/command.md b/docs/zh-CN/core/command.md similarity index 100% rename from docs/core/command.md rename to docs/zh-CN/core/command.md diff --git a/docs/core/controller.md b/docs/zh-CN/core/controller.md similarity index 100% rename from docs/core/controller.md rename to docs/zh-CN/core/controller.md diff --git a/docs/core/environment.md b/docs/zh-CN/core/environment.md similarity index 100% rename from docs/core/environment.md rename to docs/zh-CN/core/environment.md diff --git a/docs/core/events.md b/docs/zh-CN/core/events.md similarity index 100% rename from docs/core/events.md rename to docs/zh-CN/core/events.md diff --git a/docs/core/extensions.md b/docs/zh-CN/core/extensions.md similarity index 100% rename from docs/core/extensions.md rename to docs/zh-CN/core/extensions.md diff --git a/docs/core/ioc.md b/docs/zh-CN/core/ioc.md similarity index 100% rename from docs/core/ioc.md rename to docs/zh-CN/core/ioc.md diff --git a/docs/core/logging.md b/docs/zh-CN/core/logging.md similarity index 100% rename from docs/core/logging.md rename to docs/zh-CN/core/logging.md diff --git a/docs/core/model.md b/docs/zh-CN/core/model.md similarity index 100% rename from docs/core/model.md rename to docs/zh-CN/core/model.md diff --git a/docs/core/overview.md b/docs/zh-CN/core/overview.md similarity index 100% rename from docs/core/overview.md rename to docs/zh-CN/core/overview.md diff --git a/docs/core/pool.md b/docs/zh-CN/core/pool.md similarity index 100% rename from docs/core/pool.md rename to docs/zh-CN/core/pool.md diff --git a/docs/core/property.md b/docs/zh-CN/core/property.md similarity index 100% rename from docs/core/property.md rename to docs/zh-CN/core/property.md diff --git a/docs/core/query.md b/docs/zh-CN/core/query.md similarity index 100% rename from docs/core/query.md rename to docs/zh-CN/core/query.md diff --git a/docs/core/rule.md b/docs/zh-CN/core/rule.md similarity index 100% rename from docs/core/rule.md rename to docs/zh-CN/core/rule.md diff --git a/docs/core/system.md b/docs/zh-CN/core/system.md similarity index 100% rename from docs/core/system.md rename to docs/zh-CN/core/system.md diff --git a/docs/core/utility.md b/docs/zh-CN/core/utility.md similarity index 100% rename from docs/core/utility.md rename to docs/zh-CN/core/utility.md diff --git a/docs/game/overview.md b/docs/zh-CN/game/overview.md similarity index 100% rename from docs/game/overview.md rename to docs/zh-CN/game/overview.md diff --git a/docs/game/setting.md b/docs/zh-CN/game/setting.md similarity index 100% rename from docs/game/setting.md rename to docs/zh-CN/game/setting.md diff --git a/docs/getting-started/architecture-overview.md b/docs/zh-CN/getting-started/architecture-overview.md similarity index 100% rename from docs/getting-started/architecture-overview.md rename to docs/zh-CN/getting-started/architecture-overview.md diff --git a/docs/getting-started/installation.md b/docs/zh-CN/getting-started/installation.md similarity index 100% rename from docs/getting-started/installation.md rename to docs/zh-CN/getting-started/installation.md diff --git a/docs/getting-started/quick-start.md b/docs/zh-CN/getting-started/quick-start.md similarity index 100% rename from docs/getting-started/quick-start.md rename to docs/zh-CN/getting-started/quick-start.md diff --git a/docs/godot/extensions.md b/docs/zh-CN/godot/extensions.md similarity index 100% rename from docs/godot/extensions.md rename to docs/zh-CN/godot/extensions.md diff --git a/docs/godot/overview.md b/docs/zh-CN/godot/overview.md similarity index 100% rename from docs/godot/overview.md rename to docs/zh-CN/godot/overview.md diff --git a/docs/godot/setting.md b/docs/zh-CN/godot/setting.md similarity index 100% rename from docs/godot/setting.md rename to docs/zh-CN/godot/setting.md diff --git a/docs/godot/signal.md b/docs/zh-CN/godot/signal.md similarity index 100% rename from docs/godot/signal.md rename to docs/zh-CN/godot/signal.md diff --git a/docs/godot/storage.md b/docs/zh-CN/godot/storage.md similarity index 100% rename from docs/godot/storage.md rename to docs/zh-CN/godot/storage.md diff --git a/docs/zh-CN/index.md b/docs/zh-CN/index.md new file mode 100644 index 0000000..2829fcb --- /dev/null +++ b/docs/zh-CN/index.md @@ -0,0 +1,38 @@ +--- +# https://vitepress.dev/reference/default-theme-home-page +layout: home + +hero: + name: "GFramework" + text: "面向游戏开发场景的模块化 C# 框架" + tagline: 基于清洁架构和CQRS模式的现代化游戏开发框架 + image: + src: /logo.png + alt: GFramework Logo + actions: + - theme: brand + text: 快速开始 + link: /getting-started/quick-start + - theme: alt + text: 架构概览 + link: /getting-started/architecture-overview + - theme: alt + text: API 参考 + link: /api-reference/core-api + +features: + - title: 🏗️ 清洁架构 + details: 基于Model-View-Controller-System-Utility五层架构,实现清晰的职责分离和高内聚低耦合 + - title: 🔧 CQRS模式 + details: 命令查询职责分离,提供类型安全的命令和查询系统,支持可撤销操作 + - title: 📡 事件驱动 + details: 强大的事件总线系统,支持类型安全的事件发布订阅,实现组件间松耦合通信 + - title: 🎮 Godot集成 + details: 深度集成Godot引擎,提供丰富的节点扩展方法和对象池化支持 + - title: 🔄 响应式编程 + details: 可绑定属性系统,自动化的数据绑定和UI更新机制 + - title: ⚡ 源码生成器 + details: 基于Roslyn的源码生成器,自动生成日志、枚举扩展等样板代码 + +--- + diff --git a/docs/source-generators/overview.md b/docs/zh-CN/source-generators/overview.md similarity index 100% rename from docs/source-generators/overview.md rename to docs/zh-CN/source-generators/overview.md diff --git a/docs/tutorials/advanced-patterns.md b/docs/zh-CN/tutorials/advanced-patterns.md similarity index 100% rename from docs/tutorials/advanced-patterns.md rename to docs/zh-CN/tutorials/advanced-patterns.md diff --git a/docs/tutorials/basic-tutorial.md b/docs/zh-CN/tutorials/basic-tutorial.md similarity index 100% rename from docs/tutorials/basic-tutorial.md rename to docs/zh-CN/tutorials/basic-tutorial.md diff --git a/docs/tutorials/getting-started.md b/docs/zh-CN/tutorials/getting-started.md similarity index 100% rename from docs/tutorials/getting-started.md rename to docs/zh-CN/tutorials/getting-started.md diff --git a/docs/tutorials/godot-integration.md b/docs/zh-CN/tutorials/godot-integration.md similarity index 100% rename from docs/tutorials/godot-integration.md rename to docs/zh-CN/tutorials/godot-integration.md