V2.01.6 2025-10-03更新:错题本更新,现在打开错题记录开关本次错误题目会在答题结束后计入错题题库存储在根目录mistake_note文件夹下
for problem in json_array:
var problem_id = problem["id"]
# 跳过占位符题目
if "占位符" in problem["question"]:
if not header_added:
# 添加文件头信息
var header_problem = problem.duplicate()
header_problem["question"] = "错题集合 - 源自: " + file_name_ + " - 导出时间: " + time()
mistake_collection.append(header_problem)
header_added = true
continue
# 如果是错题,添加到集合中
if problem_id in mistakes:
var mistake_problem = problem.duplicate()
# 添加错题次数信息
if mistake_count_dict.has(problem_id):
mistake_problem["mistake_count"] = mistake_count_dict[problem_id]
else:
mistake_problem["mistake_count"] = 1
mistake_collection.append(mistake_problem)
if mistake_collection.size() <= 1: # 只有文件头,没有实际错题
return
# 生成文件名:原文件名_年月日_时分.json
var time_dict = Time.get_datetime_dict_from_system(false)
var filename_suffix = "%04d%02d%02d_%02d%02d" % [
time_dict["year"], time_dict["month"], time_dict["day"],
time_dict["hour"], time_dict["minute"]
]
var mistake_filename = file_name_ + "_mistakes_" + filename_suffix + ".json"
var mistake_file_path = exe_get_mistake_note_file().path_join(mistake_filename)
# 保存错题集合文件
var json_string = JSON.stringify(mistake_collection, "\t")
var file = FileAccess.open(mistake_file_path, FileAccess.WRITE)
if file:
file.store_string(json_string)
file.close()
print("错题集合已导出: ", mistake_file_path)
print("包含错题数量: ", mistake_collection.size() - 1) # 减去文件头
else:
print("错题集合导出失败: ", mistake_file_path)GDScript其中占位符部分记录本次做题信息,包括校验码,防止恶意的题库泄露。
if is_mistake_mode:
# 匹配格式:原文件名_mistakes_年月日_时分
var regex = RegEx.new()
regex.compile(".*_mistakes_\\d{8}_\\d{4}$")
should_show = regex.search(filename) != null
# 题库模式:不显示包含日期格式的文件
else:
# 排除包含日期格式的文件
var regex = RegEx.new()
regex.compile(".*_mistakes_\\d{8}_\\d{4}$")
should_show = regex.search(filename) == nullGDScriptRegEX 正则表达式的使用
这个正则表达式的含义:
.*– 匹配任意字符(除了换行符)0次或多次_mistakes_– 匹配固定的文本 “mistakes“\\d{8}– 匹配8个数字(年月日:20231225)_– 匹配下划线\\d{4}– 匹配4个数字(时分:0930)$– 匹配字符串的结尾
所以这个正则表达式匹配的是:任意文本 + “mistakes” + 8位数字 + “_” + 4位数字 的文件名格式。
常用的正则表达式符号:
| 符号 | 含义 | 例子 |
|---|---|---|
. | 匹配任意单个字符 | a.c 匹配 “abc”, “a c”, “a-c” |
* | 前一个字符0次或多次 | ab*c 匹配 “ac”, “abc”, “abbc” |
+ | 前一个字符1次或多次 | ab+c 匹配 “abc”, “abbc”(不匹配”ac”) |
? | 前一个字符0次或1次 | ab?c 匹配 “ac”, “abc” |
\d | 匹配数字 | \d+ 匹配 “123”, “45” |
\w | 匹配字母、数字、下划线 | \w+ 匹配 “hello”, “abc123” |
[] | 匹配括号内的任意字符 | [abc] 匹配 “a”, “b”, “c” |
^ | 匹配字符串开头 | ^Hello 匹配以”Hello”开头的字符串 |
$ | 匹配字符串结尾 | world$ 匹配以”world”结尾的字符串 |
{n} | 匹配前一个字符n次 | \d{4} 匹配4位数字 |
使用正则表达式 示例:
# 1. 创建RegEx对象
var regex = RegEx.new()
# 2. 编译正则表达式模式
regex.compile("你的模式")
# 3. 使用它来搜索或匹配
var result = regex.search("要搜索的文本")
# 检查是否匹配成功
if result:
print("找到匹配!")
print("匹配的内容:", result.get_string())
else:
print("没有找到匹配")
使用了正则表达式简化了代码
更新内容:
使用了新的变量让原有题库选择界面兼容了错题本,简化了软件逻辑和页面用量。
添加了 线下与线上两者验证方式,防止软件的随意盗用甚至是倒卖
优化了设置细节,读取外部文件不再由Debug模式统一管理而是不同的_Host进行管理。使必要部分可以读取和修改外部文件。
购买了正版验证配套验证服务。
已知的BUG
安卓版只能读取封装文件,使得不能进行做题历史记录和错题自动整理以及随意的背景更换。
安卓版不支持HTTP协议传输,导致只能进行封装的线下验证。
暂不支持IOS
计划中的更新
V2.01.X
推出收藏夹模块
兼容B型选择题、含图题目、填空题。
V2.0X.Y
社区功能
考试模式
…

