PGRData/Script/matrix/xconfig/XFubenAssignConfigs.lua

70 lines
2.2 KiB
Lua
Raw Normal View History

XFubenAssignConfigs = XFubenAssignConfigs or {}
local ChapterTemplates = {}
local GroupTemplates = {}
local TeamInfoTemplates = {}
2024-09-01 20:49:41 +00:00
-- 字典
local GroupChapterIdDic = {}
function XFubenAssignConfigs.Init()
ChapterTemplates = XTableManager.ReadByIntKey("Share/Fuben/Assign/AssignChapter.tab", XTable.XTableAssignChapter, "ChapterId")
GroupTemplates = XTableManager.ReadAllByIntKey("Share/Fuben/Assign/AssignGroup.tab", XTable.XTableAssignGroup, "GroupId")
TeamInfoTemplates = XTableManager.ReadByIntKey("Share/Fuben/Assign/AssignTeamInfo.tab", XTable.XTableAssignTeamInfo, "Id")
2024-09-01 20:49:41 +00:00
XFubenAssignConfigs.CreateChapterGroupIdDic()
end
function XFubenAssignConfigs.GetChapterTemplates()
return ChapterTemplates
end
function XFubenAssignConfigs.GetGroupTemplates()
return GroupTemplates
end
function XFubenAssignConfigs.GetTeamInfoTemplates()
return TeamInfoTemplates
end
function XFubenAssignConfigs.GetChapterTemplateById(id)
local config = ChapterTemplates[id]
if not config then
XLog.ErrorTableDataNotFound("XFubenAssignConfigs.GetChapterTemplateById",
"AssignChapter", "Share/Fuben/Assign/AssignChapter.tab", "Id", tostring(id))
end
return config
end
function XFubenAssignConfigs.GetGroupTemplateById(id)
local config = GroupTemplates[id]
if not config then
XLog.ErrorTableDataNotFound("XFubenAssignConfigs.GetGroupTemplateById",
"AssignGroup", "Share/Fuben/Assign/AssignGroup.tab", "Id", tostring(id))
end
return config
end
function XFubenAssignConfigs.GetTeamInfoTemplateById(id)
local config = TeamInfoTemplates[id]
if not config then
XLog.ErrorTableDataNotFound("XFubenAssignConfigs.GetTeamInfoTemplateById",
"AssignTeamInfo", "Share/Fuben/Assign/AssignTeamInfo.tab", "Id", tostring(id))
end
return config
2024-09-01 20:49:41 +00:00
end
-- 构建/获取自定义字典
function XFubenAssignConfigs.CreateChapterGroupIdDic()
for chapterId, v in pairs(ChapterTemplates) do
for _, groupId in pairs(v.GroupId) do
GroupChapterIdDic[groupId] = chapterId
end
end
end
function XFubenAssignConfigs.GetChapterIdByGroupId(groupId)
return GroupChapterIdDic[groupId]
end