Skip to content

Conversation

@HardyNLee
Copy link
Contributor

介绍

将游戏配置文件 config.txt 更改为 JSON 文件, 并统一命名格式为小驼峰, 以便未来更好地拓展

更改

  • config.txt 改为 config.json, 位置不变, 修改相关加载路径与逻辑
  • 修改游戏配置全局变量名为小驼峰, 与配置文件命名对齐
  • parser 新增一个 IWebgalConfig 接口, 以便以后与编辑器对齐

其他

  • 由于新接口 IWebgalConfig 在 parser 里, 故需要先 build 一下 parser 否则拿不到新的接口
  • 需要发布 webgal-parser 后才能开始编辑器提 PR

@gemini-code-assist
Copy link

Summary of Changes

Hello @HardyNLee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在通过将游戏配置文件从旧的 config.txt 格式转换为现代的 config.json 格式来现代化游戏配置管理。这一更改不仅提高了配置的可读性和可扩展性,还统一了配置项的命名规范为小驼峰格式。此外,还引入了一个新的 IWebgalConfig 接口,为未来的编辑器集成奠定了基础,从而简化了配置管理和开发流程。

Highlights

  • 配置文件格式更新: 将游戏配置文件从 config.txt 迁移至 config.json,以提升可读性和可扩展性。
  • 命名规范统一: 统一游戏配置的全局变量名为小驼峰格式,与新的 JSON 配置文件保持一致。
  • 新增配置接口: 在 parser 模块中新增 IWebgalConfig 接口,为未来与编辑器集成做准备。
  • 配置加载逻辑重构: 更新了游戏配置的加载逻辑,以支持 JSON 格式的解析和变量设置。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

你好, 感谢你的贡献!这次的 PR 很好地将游戏配置从自定义的 .txt 格式迁移到了更标准、更易于扩展的 JSON 格式。相关的代码修改, 如统一命名为小驼峰, 也做得很好, 增强了代码的一致性。我发现了一些可以改进的地方, 主要涉及类型安全和代码健壮性, 请查看我的具体评论。

import { getFastSaveFromStorage, getSavesFromStorage } from '@/Core/controller/storage/savesController';
import { logger } from '@/Core/util/logger';
import axios from 'axios';
import { IWebgalConfig } from 'webgal-parser/build/types/configParser/configParser';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这里的导入路径 webgal-parser/build/types/configParser/configParser 直接依赖于 webgal-parser 包的内部构建结构。这种做法比较脆弱, 如果 webgal-parser 的构建过程或目录结构发生变化, 可能会导致构建失败。更健壮的做法是在 webgal-parser 包的主入口文件中导出 IWebgalConfig 接口, 然后从包本身导入 (例如 import { IWebgalConfig } from 'webgal-parser')。这为包提供了一个更稳定的公共 API。

Comment on lines +44 to +64
} else {
dispatch(
setGlobalVar({
key: key,
value: String(value),
}),
);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这个 else 代码块会将所有未明确处理的类型(例如, 对象)转换为字符串。如果将来配置中添加了嵌套对象, 它将被转换为 "[object Object]" 并存入全局变量, 这可能不是预期的行为。为了使代码更健壮, 建议对不支持的类型抛出错误或至少记录一个警告, 以防止意外行为。

@HardyNLee HardyNLee force-pushed the feat/game-config-json branch from 78cd6d6 to 4f258c3 Compare November 14, 2025 05:20
@HardyNLee HardyNLee force-pushed the feat/game-config-json branch from 4f258c3 to 8565d40 Compare November 14, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant