diff --git a/lua/app/config/buff.lua b/lua/app/config/buff.lua index 61d968b2..5d93e6d7 100644 --- a/lua/app/config/buff.lua +++ b/lua/app/config/buff.lua @@ -16,7 +16,8 @@ local buff = { [3]={ ["name"]="hurt", ["buff_type"]=3, - ["decr"]=3 + ["decr"]=3, + ["formula"]=1 }, [4]={ ["name"]="shield", @@ -39,7 +40,8 @@ local buff = { [7]={ ["name"]="wavehealp", ["buff_type"]=5, - ["decr"]=3 + ["decr"]=3, + ["formula"]=7 }, [8]={ ["name"]="atkp_add_connect", @@ -68,6 +70,7 @@ local buff = { ["name"]="heal", ["buff_type"]=5, ["decr"]=3, + ["formula"]=8, ["fx_take"]={ 4001 } @@ -76,6 +79,7 @@ local buff = { ["name"]="hit_heal", ["buff_type"]=5, ["decr"]=3, + ["formula"]=9, ["fx_take"]={ 4001 } @@ -83,27 +87,32 @@ local buff = { [14]={ ["name"]="hurt_red", ["buff_type"]=3, - ["decr"]=3 + ["decr"]=3, + ["formula"]=2 }, [15]={ ["name"]="hurt_yellow", ["buff_type"]=3, - ["decr"]=3 + ["decr"]=3, + ["formula"]=3 }, [16]={ ["name"]="hurt_green", ["buff_type"]=3, - ["decr"]=3 + ["decr"]=3, + ["formula"]=4 }, [17]={ ["name"]="hurt_blue", ["buff_type"]=3, - ["decr"]=3 + ["decr"]=3, + ["formula"]=5 }, [18]={ ["name"]="hurt_purple", ["buff_type"]=3, - ["decr"]=3 + ["decr"]=3, + ["formula"]=6 }, [19]={ ["name"]="red_atkp_dec", @@ -137,12 +146,12 @@ local buff = { }, [24]={ ["name"]="random_atkp_dec", - ["buff_type"]=9, + ["buff_type"]=7, ["decr"]=1 }, [25]={ ["name"]="board_make", - ["buff_type"]=9, + ["buff_type"]=7, ["decr"]=3 }, [26]={ @@ -177,7 +186,7 @@ local buff = { }, [31]={ ["name"]="atk_times_add", - ["buff_type"]=9, + ["buff_type"]=7, ["decr"]=1 } } diff --git a/lua/app/config/localization/localization_global_const.lua b/lua/app/config/localization/localization_global_const.lua index 8bc688cb..934df81e 100644 --- a/lua/app/config/localization/localization_global_const.lua +++ b/lua/app/config/localization/localization_global_const.lua @@ -11,18 +11,6 @@ local LocalizationGlobalConst = BTN_TEXT_CANCEL = "BTN_TEXT_CANCEL", BTN_TEXT_OK = "BTN_TEXT_OK", BATTLE_DESC_1 = "BATTLE_DESC_1", - - ITEM_NOT_ENOUGH = "ITEM_NOT_ENOUGH", - START_DESC = "START_DESC", - ["ELEMENT_NAME_2"] = "ELEMENT_NAME_2", - ["ELEMENT_NAME_3"] = "ELEMENT_NAME_3", - ["ELEMENT_NAME_4"] = "ELEMENT_NAME_4", - ["ELEMENT_NAME_5"] = "ELEMENT_NAME_5", - ["HERO_DESC_1"] = "HERO_DESC_1", - ["HERO_DESC_2"] = "HERO_DESC_2", - ["HERO_DESC_3"] = "HERO_DESC_3", - ["HERO_DESC_4"] = "HERO_DESC_4", - ["HERO_DESC_5"] = "HERO_DESC_5", } return LocalizationGlobalConst \ No newline at end of file diff --git a/lua/app/config/skill_rogue.lua b/lua/app/config/skill_rogue.lua index 014993f7..2263bba7 100644 --- a/lua/app/config/skill_rogue.lua +++ b/lua/app/config/skill_rogue.lua @@ -12,7 +12,7 @@ local skill_rogue = { ["maxnum"]=500 } }, - ["icon"]="1" + ["icon"]=1 }, [2]={ ["universal"]=1, @@ -27,7 +27,7 @@ local skill_rogue = { ["maxnum"]=1200 } }, - ["icon"]="1" + ["icon"]=1 }, [3]={ ["universal"]=1, @@ -42,7 +42,7 @@ local skill_rogue = { ["maxnum"]=2000 } }, - ["icon"]="1" + ["icon"]=1 }, [4]={ ["universal"]=1, @@ -57,7 +57,7 @@ local skill_rogue = { ["maxnum"]=500 } }, - ["icon"]="2" + ["icon"]=2 }, [5]={ ["universal"]=1, @@ -72,7 +72,7 @@ local skill_rogue = { ["maxnum"]=1200 } }, - ["icon"]="2" + ["icon"]=2 }, [6]={ ["universal"]=1, @@ -87,7 +87,7 @@ local skill_rogue = { ["maxnum"]=2000 } }, - ["icon"]="2" + ["icon"]=2 }, [7]={ ["universal"]=1, @@ -102,7 +102,7 @@ local skill_rogue = { ["maxnum"]=500 } }, - ["icon"]="3" + ["icon"]=3 }, [8]={ ["universal"]=1, @@ -117,7 +117,7 @@ local skill_rogue = { ["maxnum"]=1200 } }, - ["icon"]="3" + ["icon"]=3 }, [9]={ ["universal"]=1, @@ -132,7 +132,7 @@ local skill_rogue = { ["maxnum"]=2000 } }, - ["icon"]="3" + ["icon"]=3 }, [10]={ ["universal"]=1, @@ -147,7 +147,7 @@ local skill_rogue = { ["maxnum"]=500 } }, - ["icon"]="4" + ["icon"]=4 }, [11]={ ["universal"]=1, @@ -162,7 +162,7 @@ local skill_rogue = { ["maxnum"]=1200 } }, - ["icon"]="4" + ["icon"]=4 }, [12]={ ["universal"]=1, @@ -177,7 +177,7 @@ local skill_rogue = { ["maxnum"]=2000 } }, - ["icon"]="4" + ["icon"]=4 }, [13]={ ["universal"]=1, @@ -192,7 +192,7 @@ local skill_rogue = { ["maxnum"]=500 } }, - ["icon"]="5" + ["icon"]=5 }, [14]={ ["universal"]=1, @@ -207,7 +207,7 @@ local skill_rogue = { ["maxnum"]=1200 } }, - ["icon"]="5" + ["icon"]=5 }, [15]={ ["universal"]=1, @@ -222,7 +222,7 @@ local skill_rogue = { ["maxnum"]=2000 } }, - ["icon"]="5" + ["icon"]=5 }, [16]={ ["universal"]=1, @@ -237,7 +237,7 @@ local skill_rogue = { ["maxnum"]=500 } }, - ["icon"]="6" + ["icon"]=6 }, [17]={ ["universal"]=1, @@ -252,7 +252,7 @@ local skill_rogue = { ["maxnum"]=1200 } }, - ["icon"]="6" + ["icon"]=6 }, [18]={ ["universal"]=1, @@ -267,7 +267,7 @@ local skill_rogue = { ["maxnum"]=2000 } }, - ["icon"]="6" + ["icon"]=6 }, [19]={ ["universal"]=1, @@ -284,7 +284,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]="7" + ["icon"]=7 }, [20]={ ["universal"]=1, @@ -299,7 +299,7 @@ local skill_rogue = { ["maxnum"]=500 } }, - ["icon"]="8" + ["icon"]=8 }, [21]={ ["universal"]=1, @@ -314,7 +314,7 @@ local skill_rogue = { ["maxnum"]=500 } }, - ["icon"]="9" + ["icon"]=9 }, [22]={ ["universal"]=1, @@ -329,7 +329,7 @@ local skill_rogue = { ["maxnum"]=1200 } }, - ["icon"]="9" + ["icon"]=9 }, [23]={ ["universal"]=1, @@ -344,7 +344,7 @@ local skill_rogue = { ["maxnum"]=2000 } }, - ["icon"]="9" + ["icon"]=9 }, [24]={ ["universal"]=1, @@ -361,7 +361,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]="10" + ["icon"]=10 }, [25]={ ["universal"]=1, @@ -376,7 +376,7 @@ local skill_rogue = { ["maxnum"]=100 } }, - ["icon"]="11" + ["icon"]=11 }, [26]={ ["universal"]=1, @@ -391,7 +391,7 @@ local skill_rogue = { ["maxnum"]=1000 } }, - ["icon"]="12" + ["icon"]=12 }, [27]={ ["universal"]=1, @@ -406,7 +406,7 @@ local skill_rogue = { ["maxnum"]=1000 } }, - ["icon"]="13" + ["icon"]=13 }, [28]={ ["universal"]=1, @@ -421,7 +421,7 @@ local skill_rogue = { ["maxnum"]=1000 } }, - ["icon"]="14" + ["icon"]=14 }, [29]={ ["universal"]=1, @@ -437,7 +437,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]="20" + ["icon"]=20 }, [30]={ ["universal"]=1, @@ -453,7 +453,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]="15" + ["icon"]=15 }, [31]={ ["universal"]=1, @@ -469,7 +469,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]="15" + ["icon"]=15 }, [32]={ ["universal"]=1, @@ -485,7 +485,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]="15" + ["icon"]=15 }, [33]={ ["universal"]=1, @@ -501,7 +501,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]="16" + ["icon"]=16 }, [34]={ ["universal"]=1, @@ -517,7 +517,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]="16" + ["icon"]=16 }, [35]={ ["universal"]=1, @@ -533,7 +533,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]="16" + ["icon"]=16 }, [36]={ ["universal"]=1, @@ -549,7 +549,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]="17" + ["icon"]=17 }, [37]={ ["universal"]=1, @@ -565,7 +565,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]="17" + ["icon"]=17 }, [38]={ ["universal"]=1, @@ -581,7 +581,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]="17" + ["icon"]=17 }, [39]={ ["universal"]=1, @@ -597,7 +597,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]="18" + ["icon"]=18 }, [40]={ ["universal"]=1, @@ -613,7 +613,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]="18" + ["icon"]=18 }, [41]={ ["universal"]=1, @@ -629,7 +629,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]="18" + ["icon"]=18 }, [42]={ ["universal"]=1, @@ -645,7 +645,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]="19" + ["icon"]=19 }, [43]={ ["universal"]=1, @@ -661,7 +661,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]="19" + ["icon"]=19 }, [44]={ ["universal"]=1, @@ -677,7 +677,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]="19" + ["icon"]=19 }, [200101]={ ["limit_times"]=1, @@ -695,7 +695,7 @@ local skill_rogue = { ["range"]=1 } }, - ["icon"]="200101" + ["icon"]=200101 }, [200102]={ ["limit_times"]=2, @@ -706,7 +706,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=3, - ["icon"]="200102" + ["icon"]=200102 }, [200103]={ ["limit_times"]=1, @@ -723,7 +723,7 @@ local skill_rogue = { } }, ["obj"]=2, - ["icon"]="200103" + ["icon"]=200103 }, [200201]={ ["limit_times"]=1, @@ -734,7 +734,7 @@ local skill_rogue = { 21 }, ["skill_position"]=2, - ["icon"]="200201" + ["icon"]=200201 }, [200202]={ ["limit_times"]=2, @@ -745,7 +745,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=2, - ["icon"]="200202" + ["icon"]=200202 }, [200203]={ ["limit_times"]=1, @@ -756,7 +756,7 @@ local skill_rogue = { 1 }, ["skill_position"]=2, - ["icon"]="200203" + ["icon"]=200203 }, [200301]={ ["limit_times"]=1, @@ -764,7 +764,7 @@ local skill_rogue = { ["qlt"]=3, ["type"]=4, ["skill_position"]=4, - ["icon"]="200301" + ["icon"]=200301 }, [200302]={ ["limit_times"]=3, @@ -775,7 +775,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=4, - ["icon"]="200302" + ["icon"]=200302 }, [200303]={ ["limit_times"]=2, @@ -789,7 +789,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]="200303" + ["icon"]=200303 }, [200401]={ ["limit_times"]=1, @@ -797,7 +797,7 @@ local skill_rogue = { ["qlt"]=3, ["type"]=4, ["skill_position"]=5, - ["icon"]="200401" + ["icon"]=200401 }, [200402]={ ["limit_times"]=2, @@ -809,7 +809,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=5, - ["icon"]="200402" + ["icon"]=200402 }, [200403]={ ["limit_times"]=1, @@ -821,7 +821,7 @@ local skill_rogue = { 1 }, ["skill_position"]=5, - ["icon"]="200403" + ["icon"]=200403 }, [200501]={ ["limit_times"]=1, @@ -839,7 +839,7 @@ local skill_rogue = { ["range"]=1 } }, - ["icon"]="200501" + ["icon"]=200501 }, [200502]={ ["limit_times"]=2, @@ -850,7 +850,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=1, - ["icon"]="200502" + ["icon"]=200502 }, [200503]={ ["limit_times"]=1, @@ -866,7 +866,7 @@ local skill_rogue = { ["round"]=1 } }, - ["icon"]="200503" + ["icon"]=200503 }, [200601]={ ["limit_times"]=1, @@ -874,7 +874,7 @@ local skill_rogue = { ["qlt"]=3, ["type"]=4, ["skill_position"]=3, - ["icon"]="200601" + ["icon"]=200601 }, [200602]={ ["limit_times"]=2, @@ -885,7 +885,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=3, - ["icon"]="200602" + ["icon"]=200602 }, [200603]={ ["limit_times"]=1, @@ -901,7 +901,7 @@ local skill_rogue = { ["round"]=1 } }, - ["icon"]="200603" + ["icon"]=200603 }, [200701]={ ["limit_times"]=1, @@ -912,7 +912,7 @@ local skill_rogue = { 71 }, ["skill_position"]=2, - ["icon"]="200701" + ["icon"]=200701 }, [200702]={ ["limit_times"]=2, @@ -923,7 +923,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=2, - ["icon"]="200702" + ["icon"]=200702 }, [200703]={ ["limit_times"]=1, @@ -934,7 +934,7 @@ local skill_rogue = { 72 }, ["skill_position"]=2, - ["icon"]="200703" + ["icon"]=200703 }, [200801]={ ["limit_times"]=1, @@ -945,7 +945,7 @@ local skill_rogue = { 81 }, ["skill_position"]=4, - ["icon"]="200801" + ["icon"]=200801 }, [200802]={ ["limit_times"]=2, @@ -956,7 +956,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=4, - ["icon"]="200802" + ["icon"]=200802 }, [200803]={ ["limit_times"]=1, @@ -968,7 +968,7 @@ local skill_rogue = { 1 }, ["skill_position"]=4, - ["icon"]="200803" + ["icon"]=200803 } } local config = { diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua index 1b1104c5..3b16bbb2 100644 --- a/lua/app/config/strings/cn/global.lua +++ b/lua/app/config/strings/cn/global.lua @@ -24,6 +24,9 @@ local localization_global = ["HERO_DESC_3"] = "攻击力", ["HERO_DESC_4"] = "升级", ["HERO_DESC_5"] = "激活", + + ["HERO_DESC_6"] = "已解锁", + ["HERO_DESC_7"] = "未解锁", } return localization_global \ No newline at end of file diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index 9eb9004a..b56c90c4 100644 --- a/lua/app/module/hero/hero_manager.lua +++ b/lua/app/module/hero/hero_manager.lua @@ -43,8 +43,8 @@ function HeroManager:getActiveRogueLvs() return self.activeRogueLvs end -function HeroManager:upgradeHero(heroId) - local heroEntity = DataManager.HeroData:getHeroById(heroId) +function HeroManager:upgradeHero(heroId, heroEntity) + local heroEntity = heroEntity or DataManager.HeroData:getHeroById(heroId) if not heroEntity then return end @@ -67,6 +67,7 @@ function HeroManager:upgradeHero(heroId) if result.status == 0 then GFunc.addCosts(result.costs, BIReport.ITEM_GET_TYPE.UPGRADE_HERO) DataManager.HeroData:setHeroLv(result.heroId, result.lv) + DataManager.HeroData:setDirty() end end) end diff --git a/lua/app/ui/hero/cell/hero_list_cell.lua b/lua/app/ui/hero/cell/hero_list_cell.lua index 46327806..ac1976a9 100644 --- a/lua/app/ui/hero/cell/hero_list_cell.lua +++ b/lua/app/ui/hero/cell/hero_list_cell.lua @@ -25,11 +25,11 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act end) if activeCount > 0 and index == 1 then self.title:setVisible(true) - self.titleTx:setText("临时文本:已解锁") + self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_6)) self:getBaseObject():setSizeDeltaY(H.HAS_TITLE) elseif index == math.ceil(activeCount / 4) + 1 then self.title:setVisible(true) - self.titleTx:setText("临时文本:未解锁") + self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_7)) self:getBaseObject():setSizeDeltaY(H.HAS_TITLE) else self.title:setVisible(false) @@ -57,11 +57,13 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act if heroStartIndex <= activeCount then self.heroCells[i]:setVisible(false) else + local heroId = heroList[heroIndex] + local heroEntity = DataManager.HeroData:getHeroById(heroId) self.heroCells[i]:setVisible(true) - self.heroCells[i]:refreshWithCfgId(heroList[heroIndex], true) + self.heroCells[i]:refresh(heroEntity, true) self.heroCells[i]:addClickListener(function() if func then - func(self.heroCells[i], heroList[heroIndex]) + func(self.heroCells[i], heroId) end end) end diff --git a/lua/app/ui/hero/hero_comp.lua b/lua/app/ui/hero/hero_comp.lua index a41eeba3..26b405c2 100644 --- a/lua/app/ui/hero/hero_comp.lua +++ b/lua/app/ui/hero/hero_comp.lua @@ -10,8 +10,8 @@ function HeroComp:init() return HERO_LIST_CELL end) self.scrollRect:addRefreshCallback(function(index, cell) - cell:refresh(index, self.heroList, self.stageFormation, self.allHeroCount, self.activeCount, function(cell) - self:onClickHero(cell, self.heroList[index]) + cell:refresh(index, self.heroList, self.stageFormation, self.allHeroCount, self.activeCount, function(cell, heroId) + self:onClickHero(cell, heroId) end) end) self.heroList = {} @@ -108,7 +108,7 @@ function HeroComp:sortHeroList() table.sort(self.heroList, function(a, b) heroA = HeroData:getHeroById(a) heroB = HeroData:getHeroById(b) - if heroA and heroB then + if heroA:isActived() and heroB:isActived() then if heroA:getLv() == heroB:getLv() then if heroA:getQlt() == heroB:getQlt() then return a > b @@ -118,9 +118,9 @@ function HeroComp:sortHeroList() else return heroA:getLv() > heroB:getLv() end - elseif heroA and heroB == nil then + elseif heroA:isActived() and not heroB:isActived() then return true - elseif heroB and heroA == nil then + elseif heroB:isActived() and not heroA:isActived() then return false else return a > b @@ -145,6 +145,7 @@ function HeroComp:onClickHero(cell, heroId) self.largeHeroCell:refresh(entity, self.stageFormation[entity:getMatchType()] == heroId) else ModuleManager.HeroManager:showHeroDetailUI(heroId) + self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X) end else self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X) diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index ef4c8e54..2427eb28 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -108,7 +108,7 @@ function HeroDetailUI:_addListeners() end) uiMap["hero_detail_ui.bg.up_btn"]:addClickListener(function() - ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId()) + ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId(), self.heroEntity) end) end diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua index 3543e8e5..a31a228a 100644 --- a/lua/app/ui/main_city/component/main_comp.lua +++ b/lua/app/ui/main_city/component/main_comp.lua @@ -121,6 +121,7 @@ function MainComp:refreshStageFormaion() if formation[i] then local heroEntity = DataManager.HeroData:getHeroById(formation[i]) if heroEntity then + heroCell:setVisible(true) heroCell:refresh(heroEntity) heroCell:addClickListener(function() ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId()) diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 6388a3f3..88e1c717 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -108,6 +108,12 @@ function MainCityUI:_bind() end end) + self:bind(DataManager.HeroData, "isDirty", function(binder, value) + if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then + self.subComps[self.selectedIndex]:refresh() + end + end) + -- self:bind(DataManager.BagData.ItemData, "dirty", function(binder, value) -- UIManager:refreshCurrencyBarTxt() -- end) diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index 201a9394..4ac5f175 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -4,6 +4,7 @@ local HeroData = class("HeroData", BaseData) function HeroData:ctor() self.heroes = {} self.data.activeCount = 0 + self.data.isDirty = false end function HeroData:clear() @@ -23,11 +24,21 @@ function HeroData:addHero(cfgId, lv) if self.heroes[cfgId] then return end - self.heroes[cfgId] = HeroEntity:create(cfgId, lv) + self.heroes[cfgId] = self:getEntity(cfgId, lv) self.data.activeCount = self.data.activeCount + 1 end +function HeroData:getEntity(cfgId, lv) + return HeroEntity:create(cfgId, lv) +end + function HeroData:getHeroById(id) + if not id then + return + end + if not self.heroes[id] then + self.heroes[id] = self:getEntity(id, 0) + end return self.heroes[id] end @@ -40,11 +51,15 @@ function HeroData:getActiveHeroCount() end function HeroData:setHeroLv(id, lv) - if not self.heroes[id] then - self:addHero(id, lv) - return + local entity = self:getHeroById(id) + if not entity:isActived() then + self.data.activeCount = self.data.activeCount + 1 end - self.heroes[id]:setLv(lv) + entity:setLv(lv) +end + +function HeroData:setDirty() + self.data.isDirty = not self.data.isDirty end return HeroData \ No newline at end of file