diff --git a/lua/app/userdata/collection/collection_data.lua b/lua/app/userdata/collection/collection_data.lua index 4937af9b..f718d211 100644 --- a/lua/app/userdata/collection/collection_data.lua +++ b/lua/app/userdata/collection/collection_data.lua @@ -15,17 +15,12 @@ end -- 初始化英雄图鉴数据 function CollectionData:initCollectHero(data) - if data == nil then - return - end - if EDITOR_MODE then Logger.logHighlight("更新英雄图鉴数据") Logger.printTable(data) end self:initAllDataClass() - self.datas[GConst.CollectionConst.TYPE.HERO] = data self.dataCollects[GConst.CollectionConst.TYPE.HERO]:init(data) self:setDirty(GConst.CollectionConst.TYPE.HERO) end @@ -36,9 +31,6 @@ function CollectionData:initAllDataClass() self.dataCollects = {} self.dataCollects[GConst.CollectionConst.TYPE.HERO] = require "app/userdata/collection/collection_hero_entity":create() end - if self.datas == nil then - self.datas = {} - end end function CollectionData:setDirty(collectionType) @@ -51,9 +43,6 @@ function CollectionData:isOpen(collectionType) if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.COLLECT, true) then return false end - if collectionType and (not self.datas or not self.datas[collectionType]) then - return false - end return true end diff --git a/lua/app/userdata/collection/collection_hero_entity.lua b/lua/app/userdata/collection/collection_hero_entity.lua index a986f6e3..96d714bc 100644 --- a/lua/app/userdata/collection/collection_hero_entity.lua +++ b/lua/app/userdata/collection/collection_hero_entity.lua @@ -5,8 +5,13 @@ local CollectionHeroEntity = class("CollectionHeroEntity", CollectBaseEntity) -- 初始化服务器数据 function CollectionHeroEntity:init(data) - self.curlevel = data.level - self.curPoint = data.point + if data then + self.curlevel = data.level or 0 + self.curPoint = data.point or 0 + else + self.curlevel = 0 + self.curPoint = 0 + end end -- 是否有红点