英雄改一下

This commit is contained in:
xiekaidong 2023-04-13 22:30:08 +08:00
parent 0d2e914210
commit 8424303c97
11 changed files with 133 additions and 107 deletions

View File

@ -16,7 +16,8 @@ local buff = {
[3]={ [3]={
["name"]="hurt", ["name"]="hurt",
["buff_type"]=3, ["buff_type"]=3,
["decr"]=3 ["decr"]=3,
["formula"]=1
}, },
[4]={ [4]={
["name"]="shield", ["name"]="shield",
@ -39,7 +40,8 @@ local buff = {
[7]={ [7]={
["name"]="wavehealp", ["name"]="wavehealp",
["buff_type"]=5, ["buff_type"]=5,
["decr"]=3 ["decr"]=3,
["formula"]=7
}, },
[8]={ [8]={
["name"]="atkp_add_connect", ["name"]="atkp_add_connect",
@ -68,6 +70,7 @@ local buff = {
["name"]="heal", ["name"]="heal",
["buff_type"]=5, ["buff_type"]=5,
["decr"]=3, ["decr"]=3,
["formula"]=8,
["fx_take"]={ ["fx_take"]={
4001 4001
} }
@ -76,6 +79,7 @@ local buff = {
["name"]="hit_heal", ["name"]="hit_heal",
["buff_type"]=5, ["buff_type"]=5,
["decr"]=3, ["decr"]=3,
["formula"]=9,
["fx_take"]={ ["fx_take"]={
4001 4001
} }
@ -83,27 +87,32 @@ local buff = {
[14]={ [14]={
["name"]="hurt_red", ["name"]="hurt_red",
["buff_type"]=3, ["buff_type"]=3,
["decr"]=3 ["decr"]=3,
["formula"]=2
}, },
[15]={ [15]={
["name"]="hurt_yellow", ["name"]="hurt_yellow",
["buff_type"]=3, ["buff_type"]=3,
["decr"]=3 ["decr"]=3,
["formula"]=3
}, },
[16]={ [16]={
["name"]="hurt_green", ["name"]="hurt_green",
["buff_type"]=3, ["buff_type"]=3,
["decr"]=3 ["decr"]=3,
["formula"]=4
}, },
[17]={ [17]={
["name"]="hurt_blue", ["name"]="hurt_blue",
["buff_type"]=3, ["buff_type"]=3,
["decr"]=3 ["decr"]=3,
["formula"]=5
}, },
[18]={ [18]={
["name"]="hurt_purple", ["name"]="hurt_purple",
["buff_type"]=3, ["buff_type"]=3,
["decr"]=3 ["decr"]=3,
["formula"]=6
}, },
[19]={ [19]={
["name"]="red_atkp_dec", ["name"]="red_atkp_dec",
@ -137,12 +146,12 @@ local buff = {
}, },
[24]={ [24]={
["name"]="random_atkp_dec", ["name"]="random_atkp_dec",
["buff_type"]=9, ["buff_type"]=7,
["decr"]=1 ["decr"]=1
}, },
[25]={ [25]={
["name"]="board_make", ["name"]="board_make",
["buff_type"]=9, ["buff_type"]=7,
["decr"]=3 ["decr"]=3
}, },
[26]={ [26]={
@ -177,7 +186,7 @@ local buff = {
}, },
[31]={ [31]={
["name"]="atk_times_add", ["name"]="atk_times_add",
["buff_type"]=9, ["buff_type"]=7,
["decr"]=1 ["decr"]=1
} }
} }

View File

@ -11,18 +11,6 @@ local LocalizationGlobalConst =
BTN_TEXT_CANCEL = "BTN_TEXT_CANCEL", BTN_TEXT_CANCEL = "BTN_TEXT_CANCEL",
BTN_TEXT_OK = "BTN_TEXT_OK", BTN_TEXT_OK = "BTN_TEXT_OK",
BATTLE_DESC_1 = "BATTLE_DESC_1", 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 return LocalizationGlobalConst

View File

@ -12,7 +12,7 @@ local skill_rogue = {
["maxnum"]=500 ["maxnum"]=500
} }
}, },
["icon"]="1" ["icon"]=1
}, },
[2]={ [2]={
["universal"]=1, ["universal"]=1,
@ -27,7 +27,7 @@ local skill_rogue = {
["maxnum"]=1200 ["maxnum"]=1200
} }
}, },
["icon"]="1" ["icon"]=1
}, },
[3]={ [3]={
["universal"]=1, ["universal"]=1,
@ -42,7 +42,7 @@ local skill_rogue = {
["maxnum"]=2000 ["maxnum"]=2000
} }
}, },
["icon"]="1" ["icon"]=1
}, },
[4]={ [4]={
["universal"]=1, ["universal"]=1,
@ -57,7 +57,7 @@ local skill_rogue = {
["maxnum"]=500 ["maxnum"]=500
} }
}, },
["icon"]="2" ["icon"]=2
}, },
[5]={ [5]={
["universal"]=1, ["universal"]=1,
@ -72,7 +72,7 @@ local skill_rogue = {
["maxnum"]=1200 ["maxnum"]=1200
} }
}, },
["icon"]="2" ["icon"]=2
}, },
[6]={ [6]={
["universal"]=1, ["universal"]=1,
@ -87,7 +87,7 @@ local skill_rogue = {
["maxnum"]=2000 ["maxnum"]=2000
} }
}, },
["icon"]="2" ["icon"]=2
}, },
[7]={ [7]={
["universal"]=1, ["universal"]=1,
@ -102,7 +102,7 @@ local skill_rogue = {
["maxnum"]=500 ["maxnum"]=500
} }
}, },
["icon"]="3" ["icon"]=3
}, },
[8]={ [8]={
["universal"]=1, ["universal"]=1,
@ -117,7 +117,7 @@ local skill_rogue = {
["maxnum"]=1200 ["maxnum"]=1200
} }
}, },
["icon"]="3" ["icon"]=3
}, },
[9]={ [9]={
["universal"]=1, ["universal"]=1,
@ -132,7 +132,7 @@ local skill_rogue = {
["maxnum"]=2000 ["maxnum"]=2000
} }
}, },
["icon"]="3" ["icon"]=3
}, },
[10]={ [10]={
["universal"]=1, ["universal"]=1,
@ -147,7 +147,7 @@ local skill_rogue = {
["maxnum"]=500 ["maxnum"]=500
} }
}, },
["icon"]="4" ["icon"]=4
}, },
[11]={ [11]={
["universal"]=1, ["universal"]=1,
@ -162,7 +162,7 @@ local skill_rogue = {
["maxnum"]=1200 ["maxnum"]=1200
} }
}, },
["icon"]="4" ["icon"]=4
}, },
[12]={ [12]={
["universal"]=1, ["universal"]=1,
@ -177,7 +177,7 @@ local skill_rogue = {
["maxnum"]=2000 ["maxnum"]=2000
} }
}, },
["icon"]="4" ["icon"]=4
}, },
[13]={ [13]={
["universal"]=1, ["universal"]=1,
@ -192,7 +192,7 @@ local skill_rogue = {
["maxnum"]=500 ["maxnum"]=500
} }
}, },
["icon"]="5" ["icon"]=5
}, },
[14]={ [14]={
["universal"]=1, ["universal"]=1,
@ -207,7 +207,7 @@ local skill_rogue = {
["maxnum"]=1200 ["maxnum"]=1200
} }
}, },
["icon"]="5" ["icon"]=5
}, },
[15]={ [15]={
["universal"]=1, ["universal"]=1,
@ -222,7 +222,7 @@ local skill_rogue = {
["maxnum"]=2000 ["maxnum"]=2000
} }
}, },
["icon"]="5" ["icon"]=5
}, },
[16]={ [16]={
["universal"]=1, ["universal"]=1,
@ -237,7 +237,7 @@ local skill_rogue = {
["maxnum"]=500 ["maxnum"]=500
} }
}, },
["icon"]="6" ["icon"]=6
}, },
[17]={ [17]={
["universal"]=1, ["universal"]=1,
@ -252,7 +252,7 @@ local skill_rogue = {
["maxnum"]=1200 ["maxnum"]=1200
} }
}, },
["icon"]="6" ["icon"]=6
}, },
[18]={ [18]={
["universal"]=1, ["universal"]=1,
@ -267,7 +267,7 @@ local skill_rogue = {
["maxnum"]=2000 ["maxnum"]=2000
} }
}, },
["icon"]="6" ["icon"]=6
}, },
[19]={ [19]={
["universal"]=1, ["universal"]=1,
@ -284,7 +284,7 @@ local skill_rogue = {
} }
}, },
["obj"]=1, ["obj"]=1,
["icon"]="7" ["icon"]=7
}, },
[20]={ [20]={
["universal"]=1, ["universal"]=1,
@ -299,7 +299,7 @@ local skill_rogue = {
["maxnum"]=500 ["maxnum"]=500
} }
}, },
["icon"]="8" ["icon"]=8
}, },
[21]={ [21]={
["universal"]=1, ["universal"]=1,
@ -314,7 +314,7 @@ local skill_rogue = {
["maxnum"]=500 ["maxnum"]=500
} }
}, },
["icon"]="9" ["icon"]=9
}, },
[22]={ [22]={
["universal"]=1, ["universal"]=1,
@ -329,7 +329,7 @@ local skill_rogue = {
["maxnum"]=1200 ["maxnum"]=1200
} }
}, },
["icon"]="9" ["icon"]=9
}, },
[23]={ [23]={
["universal"]=1, ["universal"]=1,
@ -344,7 +344,7 @@ local skill_rogue = {
["maxnum"]=2000 ["maxnum"]=2000
} }
}, },
["icon"]="9" ["icon"]=9
}, },
[24]={ [24]={
["universal"]=1, ["universal"]=1,
@ -361,7 +361,7 @@ local skill_rogue = {
} }
}, },
["obj"]=1, ["obj"]=1,
["icon"]="10" ["icon"]=10
}, },
[25]={ [25]={
["universal"]=1, ["universal"]=1,
@ -376,7 +376,7 @@ local skill_rogue = {
["maxnum"]=100 ["maxnum"]=100
} }
}, },
["icon"]="11" ["icon"]=11
}, },
[26]={ [26]={
["universal"]=1, ["universal"]=1,
@ -391,7 +391,7 @@ local skill_rogue = {
["maxnum"]=1000 ["maxnum"]=1000
} }
}, },
["icon"]="12" ["icon"]=12
}, },
[27]={ [27]={
["universal"]=1, ["universal"]=1,
@ -406,7 +406,7 @@ local skill_rogue = {
["maxnum"]=1000 ["maxnum"]=1000
} }
}, },
["icon"]="13" ["icon"]=13
}, },
[28]={ [28]={
["universal"]=1, ["universal"]=1,
@ -421,7 +421,7 @@ local skill_rogue = {
["maxnum"]=1000 ["maxnum"]=1000
} }
}, },
["icon"]="14" ["icon"]=14
}, },
[29]={ [29]={
["universal"]=1, ["universal"]=1,
@ -437,7 +437,7 @@ local skill_rogue = {
} }
}, },
["obj"]=1, ["obj"]=1,
["icon"]="20" ["icon"]=20
}, },
[30]={ [30]={
["universal"]=1, ["universal"]=1,
@ -453,7 +453,7 @@ local skill_rogue = {
["range"]=2 ["range"]=2
} }
}, },
["icon"]="15" ["icon"]=15
}, },
[31]={ [31]={
["universal"]=1, ["universal"]=1,
@ -469,7 +469,7 @@ local skill_rogue = {
["range"]=4 ["range"]=4
} }
}, },
["icon"]="15" ["icon"]=15
}, },
[32]={ [32]={
["universal"]=1, ["universal"]=1,
@ -485,7 +485,7 @@ local skill_rogue = {
["range"]=5 ["range"]=5
} }
}, },
["icon"]="15" ["icon"]=15
}, },
[33]={ [33]={
["universal"]=1, ["universal"]=1,
@ -501,7 +501,7 @@ local skill_rogue = {
["range"]=2 ["range"]=2
} }
}, },
["icon"]="16" ["icon"]=16
}, },
[34]={ [34]={
["universal"]=1, ["universal"]=1,
@ -517,7 +517,7 @@ local skill_rogue = {
["range"]=4 ["range"]=4
} }
}, },
["icon"]="16" ["icon"]=16
}, },
[35]={ [35]={
["universal"]=1, ["universal"]=1,
@ -533,7 +533,7 @@ local skill_rogue = {
["range"]=5 ["range"]=5
} }
}, },
["icon"]="16" ["icon"]=16
}, },
[36]={ [36]={
["universal"]=1, ["universal"]=1,
@ -549,7 +549,7 @@ local skill_rogue = {
["range"]=2 ["range"]=2
} }
}, },
["icon"]="17" ["icon"]=17
}, },
[37]={ [37]={
["universal"]=1, ["universal"]=1,
@ -565,7 +565,7 @@ local skill_rogue = {
["range"]=4 ["range"]=4
} }
}, },
["icon"]="17" ["icon"]=17
}, },
[38]={ [38]={
["universal"]=1, ["universal"]=1,
@ -581,7 +581,7 @@ local skill_rogue = {
["range"]=5 ["range"]=5
} }
}, },
["icon"]="17" ["icon"]=17
}, },
[39]={ [39]={
["universal"]=1, ["universal"]=1,
@ -597,7 +597,7 @@ local skill_rogue = {
["range"]=2 ["range"]=2
} }
}, },
["icon"]="18" ["icon"]=18
}, },
[40]={ [40]={
["universal"]=1, ["universal"]=1,
@ -613,7 +613,7 @@ local skill_rogue = {
["range"]=4 ["range"]=4
} }
}, },
["icon"]="18" ["icon"]=18
}, },
[41]={ [41]={
["universal"]=1, ["universal"]=1,
@ -629,7 +629,7 @@ local skill_rogue = {
["range"]=5 ["range"]=5
} }
}, },
["icon"]="18" ["icon"]=18
}, },
[42]={ [42]={
["universal"]=1, ["universal"]=1,
@ -645,7 +645,7 @@ local skill_rogue = {
["range"]=2 ["range"]=2
} }
}, },
["icon"]="19" ["icon"]=19
}, },
[43]={ [43]={
["universal"]=1, ["universal"]=1,
@ -661,7 +661,7 @@ local skill_rogue = {
["range"]=4 ["range"]=4
} }
}, },
["icon"]="19" ["icon"]=19
}, },
[44]={ [44]={
["universal"]=1, ["universal"]=1,
@ -677,7 +677,7 @@ local skill_rogue = {
["range"]=5 ["range"]=5
} }
}, },
["icon"]="19" ["icon"]=19
}, },
[200101]={ [200101]={
["limit_times"]=1, ["limit_times"]=1,
@ -695,7 +695,7 @@ local skill_rogue = {
["range"]=1 ["range"]=1
} }
}, },
["icon"]="200101" ["icon"]=200101
}, },
[200102]={ [200102]={
["limit_times"]=2, ["limit_times"]=2,
@ -706,7 +706,7 @@ local skill_rogue = {
1000 1000
}, },
["skill_position"]=3, ["skill_position"]=3,
["icon"]="200102" ["icon"]=200102
}, },
[200103]={ [200103]={
["limit_times"]=1, ["limit_times"]=1,
@ -723,7 +723,7 @@ local skill_rogue = {
} }
}, },
["obj"]=2, ["obj"]=2,
["icon"]="200103" ["icon"]=200103
}, },
[200201]={ [200201]={
["limit_times"]=1, ["limit_times"]=1,
@ -734,7 +734,7 @@ local skill_rogue = {
21 21
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="200201" ["icon"]=200201
}, },
[200202]={ [200202]={
["limit_times"]=2, ["limit_times"]=2,
@ -745,7 +745,7 @@ local skill_rogue = {
1000 1000
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="200202" ["icon"]=200202
}, },
[200203]={ [200203]={
["limit_times"]=1, ["limit_times"]=1,
@ -756,7 +756,7 @@ local skill_rogue = {
1 1
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="200203" ["icon"]=200203
}, },
[200301]={ [200301]={
["limit_times"]=1, ["limit_times"]=1,
@ -764,7 +764,7 @@ local skill_rogue = {
["qlt"]=3, ["qlt"]=3,
["type"]=4, ["type"]=4,
["skill_position"]=4, ["skill_position"]=4,
["icon"]="200301" ["icon"]=200301
}, },
[200302]={ [200302]={
["limit_times"]=3, ["limit_times"]=3,
@ -775,7 +775,7 @@ local skill_rogue = {
1000 1000
}, },
["skill_position"]=4, ["skill_position"]=4,
["icon"]="200302" ["icon"]=200302
}, },
[200303]={ [200303]={
["limit_times"]=2, ["limit_times"]=2,
@ -789,7 +789,7 @@ local skill_rogue = {
["range"]=2 ["range"]=2
} }
}, },
["icon"]="200303" ["icon"]=200303
}, },
[200401]={ [200401]={
["limit_times"]=1, ["limit_times"]=1,
@ -797,7 +797,7 @@ local skill_rogue = {
["qlt"]=3, ["qlt"]=3,
["type"]=4, ["type"]=4,
["skill_position"]=5, ["skill_position"]=5,
["icon"]="200401" ["icon"]=200401
}, },
[200402]={ [200402]={
["limit_times"]=2, ["limit_times"]=2,
@ -809,7 +809,7 @@ local skill_rogue = {
1000 1000
}, },
["skill_position"]=5, ["skill_position"]=5,
["icon"]="200402" ["icon"]=200402
}, },
[200403]={ [200403]={
["limit_times"]=1, ["limit_times"]=1,
@ -821,7 +821,7 @@ local skill_rogue = {
1 1
}, },
["skill_position"]=5, ["skill_position"]=5,
["icon"]="200403" ["icon"]=200403
}, },
[200501]={ [200501]={
["limit_times"]=1, ["limit_times"]=1,
@ -839,7 +839,7 @@ local skill_rogue = {
["range"]=1 ["range"]=1
} }
}, },
["icon"]="200501" ["icon"]=200501
}, },
[200502]={ [200502]={
["limit_times"]=2, ["limit_times"]=2,
@ -850,7 +850,7 @@ local skill_rogue = {
1000 1000
}, },
["skill_position"]=1, ["skill_position"]=1,
["icon"]="200502" ["icon"]=200502
}, },
[200503]={ [200503]={
["limit_times"]=1, ["limit_times"]=1,
@ -866,7 +866,7 @@ local skill_rogue = {
["round"]=1 ["round"]=1
} }
}, },
["icon"]="200503" ["icon"]=200503
}, },
[200601]={ [200601]={
["limit_times"]=1, ["limit_times"]=1,
@ -874,7 +874,7 @@ local skill_rogue = {
["qlt"]=3, ["qlt"]=3,
["type"]=4, ["type"]=4,
["skill_position"]=3, ["skill_position"]=3,
["icon"]="200601" ["icon"]=200601
}, },
[200602]={ [200602]={
["limit_times"]=2, ["limit_times"]=2,
@ -885,7 +885,7 @@ local skill_rogue = {
1000 1000
}, },
["skill_position"]=3, ["skill_position"]=3,
["icon"]="200602" ["icon"]=200602
}, },
[200603]={ [200603]={
["limit_times"]=1, ["limit_times"]=1,
@ -901,7 +901,7 @@ local skill_rogue = {
["round"]=1 ["round"]=1
} }
}, },
["icon"]="200603" ["icon"]=200603
}, },
[200701]={ [200701]={
["limit_times"]=1, ["limit_times"]=1,
@ -912,7 +912,7 @@ local skill_rogue = {
71 71
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="200701" ["icon"]=200701
}, },
[200702]={ [200702]={
["limit_times"]=2, ["limit_times"]=2,
@ -923,7 +923,7 @@ local skill_rogue = {
1000 1000
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="200702" ["icon"]=200702
}, },
[200703]={ [200703]={
["limit_times"]=1, ["limit_times"]=1,
@ -934,7 +934,7 @@ local skill_rogue = {
72 72
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="200703" ["icon"]=200703
}, },
[200801]={ [200801]={
["limit_times"]=1, ["limit_times"]=1,
@ -945,7 +945,7 @@ local skill_rogue = {
81 81
}, },
["skill_position"]=4, ["skill_position"]=4,
["icon"]="200801" ["icon"]=200801
}, },
[200802]={ [200802]={
["limit_times"]=2, ["limit_times"]=2,
@ -956,7 +956,7 @@ local skill_rogue = {
1000 1000
}, },
["skill_position"]=4, ["skill_position"]=4,
["icon"]="200802" ["icon"]=200802
}, },
[200803]={ [200803]={
["limit_times"]=1, ["limit_times"]=1,
@ -968,7 +968,7 @@ local skill_rogue = {
1 1
}, },
["skill_position"]=4, ["skill_position"]=4,
["icon"]="200803" ["icon"]=200803
} }
} }
local config = { local config = {

View File

@ -24,6 +24,9 @@ local localization_global =
["HERO_DESC_3"] = "攻击力", ["HERO_DESC_3"] = "攻击力",
["HERO_DESC_4"] = "升级", ["HERO_DESC_4"] = "升级",
["HERO_DESC_5"] = "激活", ["HERO_DESC_5"] = "激活",
["HERO_DESC_6"] = "已解锁",
["HERO_DESC_7"] = "未解锁",
} }
return localization_global return localization_global

View File

@ -43,8 +43,8 @@ function HeroManager:getActiveRogueLvs()
return self.activeRogueLvs return self.activeRogueLvs
end end
function HeroManager:upgradeHero(heroId) function HeroManager:upgradeHero(heroId, heroEntity)
local heroEntity = DataManager.HeroData:getHeroById(heroId) local heroEntity = heroEntity or DataManager.HeroData:getHeroById(heroId)
if not heroEntity then if not heroEntity then
return return
end end
@ -67,6 +67,7 @@ function HeroManager:upgradeHero(heroId)
if result.status == 0 then if result.status == 0 then
GFunc.addCosts(result.costs, BIReport.ITEM_GET_TYPE.UPGRADE_HERO) GFunc.addCosts(result.costs, BIReport.ITEM_GET_TYPE.UPGRADE_HERO)
DataManager.HeroData:setHeroLv(result.heroId, result.lv) DataManager.HeroData:setHeroLv(result.heroId, result.lv)
DataManager.HeroData:setDirty()
end end
end) end)
end end

View File

@ -25,11 +25,11 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act
end) end)
if activeCount > 0 and index == 1 then if activeCount > 0 and index == 1 then
self.title:setVisible(true) self.title:setVisible(true)
self.titleTx:setText("临时文本:已解锁") self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_6))
self:getBaseObject():setSizeDeltaY(H.HAS_TITLE) self:getBaseObject():setSizeDeltaY(H.HAS_TITLE)
elseif index == math.ceil(activeCount / 4) + 1 then elseif index == math.ceil(activeCount / 4) + 1 then
self.title:setVisible(true) self.title:setVisible(true)
self.titleTx:setText("临时文本:未解锁") self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_7))
self:getBaseObject():setSizeDeltaY(H.HAS_TITLE) self:getBaseObject():setSizeDeltaY(H.HAS_TITLE)
else else
self.title:setVisible(false) self.title:setVisible(false)
@ -57,11 +57,13 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act
if heroStartIndex <= activeCount then if heroStartIndex <= activeCount then
self.heroCells[i]:setVisible(false) self.heroCells[i]:setVisible(false)
else else
local heroId = heroList[heroIndex]
local heroEntity = DataManager.HeroData:getHeroById(heroId)
self.heroCells[i]:setVisible(true) self.heroCells[i]:setVisible(true)
self.heroCells[i]:refreshWithCfgId(heroList[heroIndex], true) self.heroCells[i]:refresh(heroEntity, true)
self.heroCells[i]:addClickListener(function() self.heroCells[i]:addClickListener(function()
if func then if func then
func(self.heroCells[i], heroList[heroIndex]) func(self.heroCells[i], heroId)
end end
end) end)
end end

View File

@ -10,8 +10,8 @@ function HeroComp:init()
return HERO_LIST_CELL return HERO_LIST_CELL
end) end)
self.scrollRect:addRefreshCallback(function(index, cell) self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(index, self.heroList, self.stageFormation, self.allHeroCount, self.activeCount, function(cell) cell:refresh(index, self.heroList, self.stageFormation, self.allHeroCount, self.activeCount, function(cell, heroId)
self:onClickHero(cell, self.heroList[index]) self:onClickHero(cell, heroId)
end) end)
end) end)
self.heroList = {} self.heroList = {}
@ -108,7 +108,7 @@ function HeroComp:sortHeroList()
table.sort(self.heroList, function(a, b) table.sort(self.heroList, function(a, b)
heroA = HeroData:getHeroById(a) heroA = HeroData:getHeroById(a)
heroB = HeroData:getHeroById(b) heroB = HeroData:getHeroById(b)
if heroA and heroB then if heroA:isActived() and heroB:isActived() then
if heroA:getLv() == heroB:getLv() then if heroA:getLv() == heroB:getLv() then
if heroA:getQlt() == heroB:getQlt() then if heroA:getQlt() == heroB:getQlt() then
return a > b return a > b
@ -118,9 +118,9 @@ function HeroComp:sortHeroList()
else else
return heroA:getLv() > heroB:getLv() return heroA:getLv() > heroB:getLv()
end end
elseif heroA and heroB == nil then elseif heroA:isActived() and not heroB:isActived() then
return true return true
elseif heroB and heroA == nil then elseif heroB:isActived() and not heroA:isActived() then
return false return false
else else
return a > b return a > b
@ -145,6 +145,7 @@ function HeroComp:onClickHero(cell, heroId)
self.largeHeroCell:refresh(entity, self.stageFormation[entity:getMatchType()] == heroId) self.largeHeroCell:refresh(entity, self.stageFormation[entity:getMatchType()] == heroId)
else else
ModuleManager.HeroManager:showHeroDetailUI(heroId) ModuleManager.HeroManager:showHeroDetailUI(heroId)
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
end end
else else
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X) self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)

View File

@ -108,7 +108,7 @@ function HeroDetailUI:_addListeners()
end) end)
uiMap["hero_detail_ui.bg.up_btn"]:addClickListener(function() 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)
end end

View File

@ -121,6 +121,7 @@ function MainComp:refreshStageFormaion()
if formation[i] then if formation[i] then
local heroEntity = DataManager.HeroData:getHeroById(formation[i]) local heroEntity = DataManager.HeroData:getHeroById(formation[i])
if heroEntity then if heroEntity then
heroCell:setVisible(true)
heroCell:refresh(heroEntity) heroCell:refresh(heroEntity)
heroCell:addClickListener(function() heroCell:addClickListener(function()
ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId()) ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId())

View File

@ -108,6 +108,12 @@ function MainCityUI:_bind()
end end
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) -- self:bind(DataManager.BagData.ItemData, "dirty", function(binder, value)
-- UIManager:refreshCurrencyBarTxt() -- UIManager:refreshCurrencyBarTxt()
-- end) -- end)

View File

@ -4,6 +4,7 @@ local HeroData = class("HeroData", BaseData)
function HeroData:ctor() function HeroData:ctor()
self.heroes = {} self.heroes = {}
self.data.activeCount = 0 self.data.activeCount = 0
self.data.isDirty = false
end end
function HeroData:clear() function HeroData:clear()
@ -23,11 +24,21 @@ function HeroData:addHero(cfgId, lv)
if self.heroes[cfgId] then if self.heroes[cfgId] then
return return
end end
self.heroes[cfgId] = HeroEntity:create(cfgId, lv) self.heroes[cfgId] = self:getEntity(cfgId, lv)
self.data.activeCount = self.data.activeCount + 1 self.data.activeCount = self.data.activeCount + 1
end end
function HeroData:getEntity(cfgId, lv)
return HeroEntity:create(cfgId, lv)
end
function HeroData:getHeroById(id) 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] return self.heroes[id]
end end
@ -40,11 +51,15 @@ function HeroData:getActiveHeroCount()
end end
function HeroData:setHeroLv(id, lv) function HeroData:setHeroLv(id, lv)
if not self.heroes[id] then local entity = self:getHeroById(id)
self:addHero(id, lv) if not entity:isActived() then
return self.data.activeCount = self.data.activeCount + 1
end end
self.heroes[id]:setLv(lv) entity:setLv(lv)
end
function HeroData:setDirty()
self.data.isDirty = not self.data.isDirty
end end
return HeroData return HeroData