PGRData/Script/matrix/xui/xuidraw/xuidrawtools/XUiDrawCharacterRecord.lua

46 lines
No EOL
1.2 KiB
Lua

local list
local Record = function()
local charList = XDataCenter.CharacterManager.GetOwnCharacterList()
list = {}
for i = 1, #charList do
table.insert(list, charList[i].Id)
end
end
local IsOwnCharacter = function(id)
if not list then
XLog.Warning("Haven't record character list yet.")
return
end
if XArrangeConfigs.GetType(id) ~= XArrangeConfigs.Types.Character then
return false
end
for i = 1, #list do
if list[i] == id then
return true
end
end
table.insert(list, id)
return false
end
local GetDecomposeData = function(goods)
local characterId = goods.TemplateId
local template = XCharacterConfigs.GetCharacterTemplate(characterId)
local characterType = XCharacterConfigs.GetCharacterType(characterId)
local decomposeCount = XCharacterConfigs.GetDecomposeCount(characterType, goods.Quality)
return { TemplateId = template.ItemId, Count = decomposeCount }
end
local CharacterRecord = {}
CharacterRecord.Record = Record
CharacterRecord.IsOwnCharacter = IsOwnCharacter
CharacterRecord.GetDecomposeData = GetDecomposeData
return CharacterRecord