feat: 增加已读历史记录能力,并支持区分已读文本,允许设置跳过是仅已读文本还是全部文本#930
feat: 增加已读历史记录能力,并支持区分已读文本,允许设置跳过是仅已读文本还是全部文本#930ChangeSuger wants to merge 6 commits intoOpenWebGAL:devfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements a read history system to track viewed text and introduces a skip mode to toggle between skipping only read content or all content. Key additions include a ReadHistoryManager using bitsets for efficient storage and UI updates to visually distinguish read text. Feedback focuses on addressing potential out-of-bounds errors in bitset management, preventing stack overflow issues when encoding large history data, and adding guard clauses for empty scenario names.
| const scenarioName = this.sceneManager.sceneData.currentScene.sceneName; | ||
| const index = this.sceneManager.sceneData.currentSentenceId; |
There was a problem hiding this comment.
If scenarioName is an empty string (which can happen during initialization or transition), the manager will attempt to record history for an invalid key. It's better to add a guard clause.
| const scenarioName = this.sceneManager.sceneData.currentScene.sceneName; | |
| const index = this.sceneManager.sceneData.currentSentenceId; | |
| const scenarioName = this.sceneManager.sceneData.currentScene.sceneName; | |
| if (!scenarioName) return; | |
| const index = this.sceneManager.sceneData.currentSentenceId; |
- 解决构建失败问题 - 兼容脚本变更可能导致的索引溢出问题
|
在 Terre 也测试了下,不管是开发调试还是导出后,新增的功能都能正常运作。唯一一个问题是已读文本的颜色设置涉及改模板的样式文件,在 Terre 中使用时似乎还需要修改 Terre 那边的模板的样式才能让已读文本展示相应的颜色,相关文件为 WebGAL_Classic/Stage/TextBox/textbox.scss |
基于目前 WebGal 的 Scene 记录逻辑而设计的已读历史记录功能,基于 sceneName 与 currentSentenceId 进行已读信息记录以及判断。该已读历史记录功能以单个 Scene 的脚本为单元进行已读历史记录,并使用 Uint8Array 来减少存储体积。
在已读历史记录功能及基础上,实现了以下能力: