英雄养成

This commit is contained in:
xiekaidong 2023-04-13 21:13:43 +08:00
parent 72199d8993
commit d1b80d3527
31 changed files with 706 additions and 174 deletions

View File

@ -116,6 +116,7 @@ BIReport.RUNE_OPT_TYPE = {
BIReport.ITEM_GET_TYPE = { BIReport.ITEM_GET_TYPE = {
NEW_PLAYER_INITIAL = "NewPlayerInitial", -- 新玩家创号自带 NEW_PLAYER_INITIAL = "NewPlayerInitial", -- 新玩家创号自带
UPGRADE_HERO = "UpgradeHero"
} }
BIReport.ADS_CLICK_TYPE = { BIReport.ADS_CLICK_TYPE = {
@ -744,32 +745,19 @@ function BIReport:postGemGet(bigNum, getType, itemId)
end end
-- 钻石使用 -- 钻石使用
function BIReport:postGemUse(bigNum, getType, itemId) function BIReport:postGemUse(num, getType, itemId)
-- CoinNum 代币数量 -- CoinNum 代币数量 减少代币时 Int 使用代币数量
-- Type 使用类型 -- Type 使用类型 String Box=开启宝箱、复活=Revive、天赋升级=Talent、Equip=装备升级
-- CoinsType 代币类型 -- CoinsType 代币类型 String Gold=金币、Gems=钻石
-- IsNew 是否是新用户 -- IsNew 是否是新用户 Boolean 是否为当天新用户True = 是False = 否
-- MaxLevel 最大关卡 -- MaxChapter 最大章节 Int 已解锁的最大章节
local itemBigNum = DataManager.BagData.ItemData:getItemBigNumById(itemId)
local args = { local args = {
type = getType, type = getType,
-- coin_value = bigNum.value, coin_num = num,
-- coin_unit = bigNum.unit,
coin_type = BIReport.COIN_TYPE[itemId], coin_type = BIReport.COIN_TYPE[itemId],
-- coin_all_value = itemBigNum.value, coin_all = DataManager.BagData.ItemData:getItemNumById(itemId),
-- coin_all_unit = itemBigNum.unit, -- max_chapter = DataManager.StageData:getNewChapterId(),
} }
if itemId == GConst.ItemConst.ITEM_ID_GEM then
args.coin_value = BigNumOpt.bigNum2Num(bigNum)
args.coin_unit = 0
args.coin_all_value = BigNumOpt.bigNum2Num(itemBigNum)
args.coin_all_unit = 0
else
args.coin_value = bigNum.value
args.coin_unit = bigNum.unit
args.coin_all_value = itemBigNum.value
args.coin_all_unit = itemBigNum.unit
end
self:report(EVENT_NAME_COIN_USE, args) self:report(EVENT_NAME_COIN_USE, args)
BIReport:printArgsStr(EVENT_NAME_COIN_USE, args) BIReport:printArgsStr(EVENT_NAME_COIN_USE, args)
end end

View File

@ -85,7 +85,7 @@ function DataManager:initWithServerData(data)
self.PlayerData:init(data.PlayerData) self.PlayerData:init(data.PlayerData)
self.ChapterData:init(data.ChapterData) self.ChapterData:init(data.ChapterData)
self.HeroData:init(data.HeroData) self.HeroData:init(data.HeroData)
self.BagData:init(data) self.BagData:init(data.BagData)
self.FormationData:init(data.FormationData) self.FormationData:init(data.FormationData)
self:scheduleGlobal() self:scheduleGlobal()

View File

@ -12,6 +12,7 @@ local MODULE_PATHS = {
TaskManager = "app/module/task/task_manager", TaskManager = "app/module/task/task_manager",
BattleManager = "app/module/battle/battle_manager", BattleManager = "app/module/battle/battle_manager",
FormationManager = "app/module/formation/formation_manager", FormationManager = "app/module/formation/formation_manager",
HeroManager = "app/module/hero/hero_manager",
} }
-- 这里的key对应func_open里的id -- 这里的key对应func_open里的id

View File

@ -11,6 +11,18 @@ 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

@ -11,6 +11,19 @@ local localization_global =
["BTN_TEXT_CANCEL"] = "取消", ["BTN_TEXT_CANCEL"] = "取消",
["BTN_TEXT_OK"] = "确定", ["BTN_TEXT_OK"] = "确定",
["BATTLE_DESC_1"] = "是否退出战斗", ["BATTLE_DESC_1"] = "是否退出战斗",
["ITEM_NOT_ENOUGH"] = "{0}不足",
["START_DESC"] = "开始",
["ELEMENT_NAME_1"] = "红色元素",
["ELEMENT_NAME_2"] = "黄色元素",
["ELEMENT_NAME_3"] = "绿色元素",
["ELEMENT_NAME_4"] = "蓝色元素",
["ELEMENT_NAME_5"] = "紫色元素",
["HERO_DESC_1"] = "等级{0}",
["HERO_DESC_2"] = "生命",
["HERO_DESC_3"] = "攻击力",
["HERO_DESC_4"] = "升级",
["HERO_DESC_5"] = "激活",
} }
return localization_global return localization_global

View File

@ -163,6 +163,7 @@ GConst.TYPEOF_LUA_CLASS = {
ITEM_CELL = "app/ui/common/cell/item_cell", ITEM_CELL = "app/ui/common/cell/item_cell",
HERO_CELL = "app/ui/common/cell/hero_cell", HERO_CELL = "app/ui/common/cell/hero_cell",
REWARD_CELL = "app/ui/common/cell/reward_cell", REWARD_CELL = "app/ui/common/cell/reward_cell",
LARGE_HERO_CELL = "app/ui/common/cell/large_hero_cell",
} }
GConst.ATLAS_PATH = { GConst.ATLAS_PATH = {
@ -173,6 +174,7 @@ GConst.ATLAS_PATH = {
UI_LOGIN = "assets/arts/atlas/ui/login.asset", UI_LOGIN = "assets/arts/atlas/ui/login.asset",
ICON_SKILL = "assets/arts/atlas/icon/skill.asset", ICON_SKILL = "assets/arts/atlas/icon/skill.asset",
ICON_HERO = "assets/arts/atlas/icon/hero.asset", ICON_HERO = "assets/arts/atlas/icon/hero.asset",
ICON_SKILL_BUFF = "assets/arts/atlas/icon/skill_buff.asset",
} }
GConst.TOUCH_EVENT = { GConst.TOUCH_EVENT = {

View File

@ -599,6 +599,7 @@ end
function GFunc.showItemNotEnough(itemId) function GFunc.showItemNotEnough(itemId)
local gemTextInfo = I18N:getConfig("item")[itemId] local gemTextInfo = I18N:getConfig("item")[itemId]
Logger.printTable(gemTextInfo)
if gemTextInfo then if gemTextInfo then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ITEM_NOT_ENOUGH, gemTextInfo.name)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ITEM_NOT_ENOUGH, gemTextInfo.name))
end end
@ -611,6 +612,22 @@ function GFunc.showJewelryNotEnough(itemId)
end end
end end
function GFunc.checkCost(id, num, showToast, giftType)
if num <= 0 then
BIReport:postDataException(id, num, giftType)
-- return false
end
local count = DataManager.BagData.ItemData:getItemNumById(id)
if count < num then
if showToast then
GFunc.showItemNotEnough(id)
end
return false
else
return true
end
end
function GFunc.checkCostNum(id, num, giftType) function GFunc.checkCostNum(id, num, giftType)
if num <= 0 then if num <= 0 then
BIReport:postDataException(id, num, giftType) BIReport:postDataException(id, num, giftType)

View File

@ -2,7 +2,7 @@
local BattleManager = class("BattleManager", BaseModule) local BattleManager = class("BattleManager", BaseModule)
local BattleConst = GConst.BattleConst local BattleConst = GConst.BattleConst
BattleManager.SKILL_HERO_CFG = ConfigManager:getConfig("skill_hero") BattleManager.SKILL_HERO_CFG = ConfigManager:getConfig("skill")
local BATTLE_CONTROLLER_BASE = "app/module/battle/controller/battle_controller" local BATTLE_CONTROLLER_BASE = "app/module/battle/controller/battle_controller"

View File

@ -0,0 +1,74 @@
local HeroManager = class("HeroManager", BaseModule)
function HeroManager:showHeroDetailUI(heroId)
UIManager:showUI("app/ui/hero/hero_detail_ui", {heroId = heroId})
end
function HeroManager:getMatchTypeIcon(matchType)
return GConst.HeroConst.MATCH_ICON_NAME[matchType]
end
function HeroManager:getMatchTypeName(matchType)
return I18N:getGlobalText("ELEMENT_NAME_" .. matchType)
end
function HeroManager:getSkillDesc(skillId)
return I18N:getConfig("skill")[skillId].desc
end
function HeroManager:getSkillIcon(skillId)
return ConfigManager:getConfig("skill")[skillId].icon
end
function HeroManager:getSkillRogueDesc(skillId)
return I18N:getConfig("skill_rogue")[skillId].desc
end
function HeroManager:getSkillRogueIcon(skillId)
return ConfigManager:getConfig("skill_rogue")[skillId].icon
end
function HeroManager:getActiveRogueLvs()
if not self.activeRogueLvs then
self.activeRogueLvs = {}
local lvMap = {}
for lv, info in ipairs(ConfigManager:getConfig("hero_level")) do
if not lvMap[info.unlock_skill] then
table.insert(self.activeRogueLvs, lv)
lvMap[info.unlock_skill] = true
end
end
end
return self.activeRogueLvs
end
function HeroManager:upgradeHero(heroId)
local heroEntity = DataManager.HeroData:getHeroById(heroId)
if not heroEntity then
return
end
local materials = heroEntity:getLvUpMaterials()
if not materials or not materials[2] then
return
end
local fragmentCost = materials[1] or 0
if not GFunc.checkCost(heroEntity:getFramentId(), fragmentCost, true) then
return
end
if not heroEntity:canLvUp() then
return
end
ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPGRADE_HERO, {heroId = heroId}, function(result)
if result.status == 0 then
GFunc.addCosts(result.costs, BIReport.ITEM_GET_TYPE.UPGRADE_HERO)
DataManager.HeroData:setHeroLv(result.heroId, result.lv)
end
end)
end
return HeroManager

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 043758738c8f026498f9ccf0fa929a26
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -14,10 +14,19 @@ function ServerHeroData:addHero(id, lv)
if self.data.heroes[idStr] then if self.data.heroes[idStr] then
return return
end end
self.data.heroes[idStr] = { self.data.heroes[idStr] = {
cfg_id = id, cfg_id = id,
lv = lv, lv = lv,
} }
end end
function ServerHeroData:upgradeHero(heroId)
local idStr = tostring(heroId)
if not self.data.heroes[idStr] then
self:addHero(heroId, 0)
end
self.data.heroes[idStr].lv = self.data.heroes[idStr].lv + 1
end
return ServerHeroData return ServerHeroData

View File

@ -204,18 +204,6 @@ function ServerItemData:_addItem(id, num, getType)
ServerGameData.PlayerData:setVit(finalNum) ServerGameData.PlayerData:setVit(finalNum)
end end
self.data.items[idStr].count = finalNum self.data.items[idStr].count = finalNum
if num < 0 then
if id == GConst.ItemConst.ITEM_ID_GEM then
ServerGameData.TaskData:addTaskProgress(GConst.TASK_TYPE.TASK_GEM_COST, -num)
end
end
getType = getType or ""
if num > 0 and id == GConst.ItemConst.ITEM_ID_GOLD and
getType ~= GConst.ServerDataConst.DATA_OP_BEHAVIOR.EQUIP_RESOLVE and
getType ~= GConst.ServerDataConst.DATA_OP_BEHAVIOR.EQUIP_REBACK then
ServerGameData.TaskData:addTaskProgress(GConst.TASK_TYPE.TASK_GOLD_GET, num)
end
end end
return ServerItemData return ServerItemData

View File

@ -0,0 +1,65 @@
local ServerHeroManager = {}
function ServerHeroManager:onUpgradeHero(params, callback)
local result = {
status = 1
}
if params == nil then
if callback then
callback(result)
end
return
end
local heroId = params.heroId
local heroCfg = ConfigManager:getConfig("hero")[heroId]
if heroId and heroCfg then
local ServerGameData = ServerDataManager:getServerGameData()
local ItemData = ServerGameData.BagData.ItemData
local heroInfo = ServerGameData.HeroData:getHeroByCfgId(heroId) or {cfg_id = heroId, lv = 0}
local lv = heroInfo.lv + 1
if lv < heroCfg.begin_lv then
lv = heroCfg.begin_lv
end
local nextLvInfo = ConfigManager:getConfig("hero_level")[lv]
if not nextLvInfo then
return
end
local fieldName = "cost_" .. heroCfg.qlt
nextLvInfo = nextLvInfo[fieldName]
local fragmentCost = nextLvInfo[1] or 0
if not ItemData:tryAddItem(heroCfg.item_id, -fragmentCost) then
return
end
local goldCost = nextLvInfo[2] or 0
if not ItemData:tryAddItem(GConst.ItemConst.ITEM_ID_GOLD, -goldCost) then
return
end
local costs = {
{
type = GConst.REWARD_TYPE.ITEM,
id = heroCfg.item_id,
num = fragmentCost
},
{
type = GConst.REWARD_TYPE.ITEM,
id = GConst.ItemConst.ITEM_ID_GOLD,
num = goldCost
}
}
ServerGameData.HeroData:upgradeHero(heroId)
result.heroId = heroId
result.lv = lv
result.costs = ServerGameData:addCosts(costs)
result.status = 0
end
if callback then
callback(result)
end
end
return ServerHeroManager

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b697148ece07e2f4c873aa1bd9589e59
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -8,7 +8,8 @@ ServerDataConst.REWARD_TYPE = {
ServerDataConst.DATA_OP_BEHAVIOR = { ServerDataConst.DATA_OP_BEHAVIOR = {
SYNC_DATA = "SYNC_DATA", SYNC_DATA = "SYNC_DATA",
CROSS_DAY = "CROSS_DAY", CROSS_DAY = "CROSS_DAY",
UPDATE_FORMATION = "UPDATE_FORMATION" UPDATE_FORMATION = "UPDATE_FORMATION",
UPGRADE_HERO = "UPGRADE_HERO",
} }
return ServerDataConst return ServerDataConst

View File

@ -4,6 +4,7 @@ local ServerDataManager = {}
function ServerDataManager:init() function ServerDataManager:init()
self.ServerFormationManager = require("app/server/manager/server_formation_manager") self.ServerFormationManager = require("app/server/manager/server_formation_manager")
self.HeroManager = require("app/server/manager/server_hero_manager")
end end
function ServerDataManager:saveData() function ServerDataManager:saveData()
@ -60,6 +61,7 @@ end
ServerDataManager.OP_FUNC = { ServerDataManager.OP_FUNC = {
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.SYNC_DATA] = function (...) ServerDataManager:onSyncData(...) end, [GConst.ServerDataConst.DATA_OP_BEHAVIOR.SYNC_DATA] = function (...) ServerDataManager:onSyncData(...) end,
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPDATE_FORMATION] = function (...) ServerDataManager.ServerFormationManager:updateFormation(...) end, [GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPDATE_FORMATION] = function (...) ServerDataManager.ServerFormationManager:updateFormation(...) end,
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPGRADE_HERO] = function (...) ServerDataManager.HeroManager:onUpgradeHero(...) end,
} }
function ServerDataManager:dealGM(params, callback) function ServerDataManager:dealGM(params, callback)
@ -77,6 +79,7 @@ function ServerDataManager:dealGM(params, callback)
return return
end end
ServerGameData.BagData.ItemData:addItem(id, count) ServerGameData.BagData.ItemData:addItem(id, count)
ServerGameData.BagData.ItemData:saveLocalData()
if id == GConst.ItemConst.ITEM_ID_EXP then if id == GConst.ItemConst.ITEM_ID_EXP then
ServerGameData.PlayerData:addExp(count) ServerGameData.PlayerData:addExp(count)
end end
@ -145,4 +148,8 @@ function ServerDataManager:dealGM(params, callback)
end end
end end
function ServerDataManager:getServerGameData()
return ServerGameData
end
return ServerDataManager return ServerDataManager

View File

@ -152,6 +152,39 @@ function ServerGameData:addRewards(cfgRewards, getType)
return rewards return rewards
end end
-- 根据配置表添加奖励
function ServerGameData:addCosts(cfgRewards, getType)
local rewards = {}
if cfgRewards then
local count = #TempRewards
for i = 1, count do
table.remove(TempRewards)
end
for _, reward in ipairs(cfgRewards) do
table.insert(TempRewards, reward)
end
count = #TempRewards
for i = 1, count do
local reward = table.remove(TempRewards)
local newReward = self:getNewReward()
local rewardType = GFunc.getRewardType(reward)
newReward.type = rewardType
if rewardType == GConst.ServerDataConst.REWARD_TYPE.ITEM then
self.BagData.ItemData:addItemCost(reward, getType)
local rewardId = GFunc.getRewardId(reward)
local rewardNum = GFunc.getRewardNum(reward)
newReward.item = {
id = rewardId,
num = rewardNum
}
end
table.insert(rewards, newReward)
end
end
return rewards
end
function ServerGameData:getNewReward() function ServerGameData:getNewReward()
local rewards = { local rewards = {
type = 0, type = 0,

View File

@ -6,6 +6,9 @@ function HeroCell:init()
self.heroBg = uiMap["hero_cell.hero_bg"] self.heroBg = uiMap["hero_cell.hero_bg"]
self.check = uiMap["hero_cell.hero_bg.mask"] self.check = uiMap["hero_cell.hero_bg.mask"]
self.matchImg = uiMap["hero_cell.hero_bg.match_img"] self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
self.progress = uiMap["hero_cell.hero_bg.progress"]
self.progressTx = uiMap["hero_cell.hero_bg.progress_tx"]
self.lvTx = uiMap["hero_cell.hero_bg.lv_tx"]
self.isGray = false self.isGray = false
self.baseObject:addClickListener(function() self.baseObject:addClickListener(function()
if self.clickCallback then if self.clickCallback then
@ -17,11 +20,27 @@ end
function HeroCell:refresh(heroEntity, isGray) function HeroCell:refresh(heroEntity, isGray)
local heroInfo = heroEntity:getConfig() local heroInfo = heroEntity:getConfig()
self:_refresh(heroInfo, isGray) self:_refresh(heroInfo, isGray)
local materials = heroEntity:getLvUpMaterials() or {}
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroEntity:getFramentId())
local needFragmentCount = materials[1] or 1
self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount)
self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv()))
end end
function HeroCell:refreshWithCfgId(id, isGray) function HeroCell:refreshWithCfgId(id, isGray)
local heroInfo = ConfigManager:getConfig("hero")[id] local heroInfo = ConfigManager:getConfig("hero")[id]
self:_refresh(heroInfo, isGray) self:_refresh(heroInfo, isGray)
local lv = heroInfo.begin_lv
local lvInfo = ConfigManager:getConfig("hero_level")[lv]
local materials = lvInfo["cost_" .. heroInfo.qlt]
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroInfo.item_id)
local needFragmentCount = materials[1] or 1
self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount)
self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv))
end end
function HeroCell:_refresh(heroInfo, isGray) function HeroCell:_refresh(heroInfo, isGray)

View File

@ -6,28 +6,36 @@ function LargeHeroCell:init()
self.heroBg = uiMap["hero_cell.hero_bg"] self.heroBg = uiMap["hero_cell.hero_bg"]
self.check = uiMap["hero_cell.hero_bg.mask"] self.check = uiMap["hero_cell.hero_bg.mask"]
self.matchImg = uiMap["hero_cell.hero_bg.match_img"] self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
self.infoBtnDesc = uiMap["large_hero_cell.hero_bg.info_btn.desc"]
self.useBtn = uiMap["large_hero_cell.hero_bg.use_btn.desc"]
self.isGray = false self.isGray = false
uiMap["large_hero_cell.hero_bg.info_btn"]:addClickListener(function() uiMap["large_hero_cell.hero_bg.info_btn"]:addClickListener(function()
if self.clickCallback1 then if not self.heroId or not self.matchType then
self.clickCallback1() return
end end
ModuleManager.HeroManager:showHeroDetailUI(self.heroId)
end) end)
uiMap["large_hero_cell.hero_bg.use_btn"]:addClickListener(function() uiMap["large_hero_cell.hero_bg.use_btn"]:addClickListener(function()
if self.clickCallback1 then if not self.heroId or not self.matchType then
self.clickCallback1() return
end end
ModuleManager.FormationManager:upHeroToStageFormation(self.heroId, self.matchType)
end) end)
end end
function LargeHeroCell:refresh(heroEntity, isGray) function LargeHeroCell:refresh(heroEntity, isGray)
self.heroId = heroEntity:getCfgId()
self.matchType = heroEntity:getMatchType()
local heroInfo = heroEntity:getConfig() local heroInfo = heroEntity:getConfig()
self:_refresh(heroInfo, isGray) self:_refresh(heroInfo, isGray)
end end
function LargeHeroCell:refreshWithCfgId(id, isGray) function LargeHeroCell:refreshWithCfgId(id, isGray)
local heroInfo = ConfigManager:getConfig("hero")[id] local heroInfo = ConfigManager:getConfig("hero")[id]
self.heroId = id
self.matchType = heroInfo.position
self:_refresh(heroInfo, isGray) self:_refresh(heroInfo, isGray)
end end
@ -47,9 +55,8 @@ function LargeHeroCell:showCheck(visible)
self.check:setVisible(visible) self.check:setVisible(visible)
end end
function LargeHeroCell:addClickListener(btn1Callback, btn2Callback) function LargeHeroCell:addClickListener(func)
self.clickCallback1 = btn1Callback self.baseObject:addClickListener(func)
self.clickCallback2 = btn2Callback
end end
function LargeHeroCell:setVisible(visible) function LargeHeroCell:setVisible(visible)

View File

@ -17,7 +17,12 @@ function HeroListCell:init()
self.titleTx = self.uiMap["hero_list_cell.title.title_desc"] self.titleTx = self.uiMap["hero_list_cell.title.title_desc"]
end end
function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, activeCount) function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, activeCount, func)
self.baseObject:addClickListener(function()
if func then
func()
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("临时文本:已解锁")
@ -44,7 +49,9 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act
self.heroCells[i]:refresh(heroEntity, false) self.heroCells[i]:refresh(heroEntity, false)
self.heroCells[i]:showCheck(stageFormation[matchType] == heroId) self.heroCells[i]:showCheck(stageFormation[matchType] == heroId)
self.heroCells[i]:addClickListener(function() self.heroCells[i]:addClickListener(function()
ModuleManager.FormationManager:upHeroToStageFormation(heroId, matchType) if func then
func(self.heroCells[i], heroId)
end
end) end)
elseif heroIndex <= allHeroCount then elseif heroIndex <= allHeroCount then
if heroStartIndex <= activeCount then if heroStartIndex <= activeCount then
@ -52,6 +59,11 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act
else else
self.heroCells[i]:setVisible(true) self.heroCells[i]:setVisible(true)
self.heroCells[i]:refreshWithCfgId(heroList[heroIndex], true) self.heroCells[i]:refreshWithCfgId(heroList[heroIndex], true)
self.heroCells[i]:addClickListener(function()
if func then
func(self.heroCells[i], heroList[heroIndex])
end
end)
end end
else else
self.heroCells[i]:setVisible(false) self.heroCells[i]:setVisible(false)

View File

@ -1,6 +1,7 @@
local HeroComp = class("HeroComp", LuaComponent) local HeroComp = class("HeroComp", LuaComponent)
local HERO_LIST_CELL = "app/ui/hero/cell/hero_list_cell" local HERO_LIST_CELL = "app/ui/hero/cell/hero_list_cell"
local OUT_SCREEN_X = 10000
function HeroComp:init() function HeroComp:init()
self.uiMap = self:getBaseObject():genAllChildren() self.uiMap = self:getBaseObject():genAllChildren()
@ -9,7 +10,9 @@ 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) cell:refresh(index, self.heroList, self.stageFormation, self.allHeroCount, self.activeCount, function(cell)
self:onClickHero(cell, self.heroList[index])
end)
end) end)
self.heroList = {} self.heroList = {}
local heroCfg = ConfigManager:getConfig("hero") local heroCfg = ConfigManager:getConfig("hero")
@ -31,6 +34,12 @@ function HeroComp:init()
self.uiMap["hero_ui.formation.hero_5.add"], self.uiMap["hero_ui.formation.hero_5.add"],
} }
self.heroSpineList = {} self.heroSpineList = {}
self.largeHeroCell = CellManager:addCellComp(self.uiMap["hero_ui.scrollrect.viewport.content.large_hero_cell"], GConst.TYPEOF_LUA_CLASS.LARGE_HERO_CELL)
self.content = self.uiMap["hero_ui.scrollrect.viewport.content"]
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
self.content:addClickListener(function()
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
end)
end end
function HeroComp:refresh() function HeroComp:refresh()
@ -119,4 +128,27 @@ function HeroComp:sortHeroList()
end) end)
end end
function HeroComp:onClickHero(cell, heroId)
if not cell or not heroId then
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
return
end
local entity = DataManager.HeroData:getHeroById(heroId)
if entity then
if entity:isActived() then
local targetPos = cell:getBaseObject():getTransform().position
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos)
targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.content:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
self.largeHeroCell:getBaseObject():setAnchoredPosition(targetPos.x, targetPos.y)
self.largeHeroCell:getBaseObject():getTransform():SetAsLastSibling()
self.largeHeroCell:refresh(entity, self.stageFormation[entity:getMatchType()] == heroId)
else
ModuleManager.HeroManager:showHeroDetailUI(heroId)
end
else
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
end
end
return HeroComp return HeroComp

View File

@ -0,0 +1,121 @@
local HeroDetailUI = class("HeroDetailUI", BaseUI)
local DEFAULT_FACTOR = GConst.BattleConst.DEFAULT_FACTOR
function HeroDetailUI:isFullScreen()
return false
end
function HeroDetailUI:getPrefabPath()
return "assets/prefabs/ui/hero/hero_detail_ui.prefab"
end
function HeroDetailUI:ctor(parmas)
local heroId = parmas.heroId
self.heroEntity = DataManager.HeroData:getHeroById(heroId)
end
function HeroDetailUI:onLoadRootComplete()
self:_display()
self:_addListeners()
self:_bind()
end
function HeroDetailUI:_display()
local uiMap = self.root:genAllChildren()
uiMap["hero_detail_ui.bg.title_desc"]:setText(self.heroEntity:getName())
uiMap["hero_detail_ui.bg.lv_desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, self.heroEntity:getLv()))
uiMap["hero_detail_ui.bg.element_desc"]:setText(ModuleManager.HeroManager:getMatchTypeName(self.heroEntity:getMatchType()))
uiMap["hero_detail_ui.bg.skill_desc"]:setText(ModuleManager.HeroManager:getSkillDesc(self.heroEntity:getActiveSkill()))
uiMap["hero_detail_ui.bg.hp_name"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
uiMap["hero_detail_ui.bg.atk_name"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
-- uiMap["hero_detail_ui.bg.skill_icon"]:setSprite(GConst.ATLAS_PATH.ICON_SKILL, ModuleManager.HeroManager:getSkillIcon(self.heroEntity:getActiveSkill()))
uiMap["hero_detail_ui.bg.hero_icon"]:setSprite(GConst.ATLAS_PATH.ICON_HERO, self.heroEntity:getIcon())
uiMap["hero_detail_ui.bg.hero_element"]:setSprite(GConst.ATLAS_PATH.ICON_HERO, ModuleManager.HeroManager:getMatchTypeIcon(self.heroEntity:getMatchType()))
local materials = self.heroEntity:getLvUpMaterials() or {}
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(self.heroEntity:getFramentId())
local needFragmentCount = materials[1] or 1
uiMap["hero_detail_ui.bg.fragment_num"]:setText(fragmentCount .. "/" .. needFragmentCount)
uiMap["hero_detail_ui.bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
local activeCount = self.heroEntity:getActiveRogueCount()
local skillList = self.heroEntity:getRogueSkillList()
local skillLvs = ModuleManager.HeroManager:getActiveRogueLvs()
for i = 1, 3 do
local skillId = skillList[i]
if skillId then
local skillIcon = uiMap["hero_detail_ui.bg.skill_up_" .. i]
local skillLv = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".desc"]
skillIcon:addClickListener(function()
-- ModuleManager.TipsManager:show
GFunc.showToast(ModuleManager.HeroManager:getSkillRogueDesc(skillId))
end)
skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_BUFF, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
skillIcon:setImageGray(i > activeCount)
skillIcon:setTouchEnable(true)
if i > activeCount then
skillLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, skillLvs[i] or 0))
else
skillLv:setText(GConst.EMPTY_STRING)
end
end
end
uiMap["hero_detail_ui.bg.fragment_bg"]:setVisible(not self.heroEntity:isMaxLv())
local lv = self.heroEntity:getLv()
local str
local hpStr
local atkStr
if self.heroEntity:isActived() then
str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4)
local curHp = self.heroEntity:getCfgHp() // DEFAULT_FACTOR
local curAtk = self.heroEntity:getCfgAtk() // DEFAULT_FACTOR
local addHp = self.heroEntity:getCfgHp(lv + 1) // DEFAULT_FACTOR - curHp
local addAtk = self.heroEntity:getCfgAtk(lv + 1) // DEFAULT_FACTOR - curAtk
if addHp <= 0 then
hpStr = curHp
else
hpStr = curHp .. "<color=#82FF82>+" .. addHp .. "</color>"
end
if addAtk <= 0 then
atkStr = curAtk
else
atkStr = curAtk .. "<color=#82FF82>+" .. addAtk .. "</color>"
end
else
str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_5)
hpStr = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv())
atkStr = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv())
end
uiMap["hero_detail_ui.bg.up_btn.desc"]:setText(str)
uiMap["hero_detail_ui.bg.up_btn.num"]:setText(materials[2])
uiMap["hero_detail_ui.bg.up_btn.rp"]:setVisible(self.heroEntity:canLvUp())
uiMap["hero_detail_ui.bg.hp"]:setText(hpStr)
uiMap["hero_detail_ui.bg.atk"]:setText(atkStr)
uiMap["hero_detail_ui.bg.up_btn"]:setImageGray(not GFunc.checkCost(GConst.ItemConst.ITEM_ID_GOLD, materials[2] or 0))
uiMap["hero_detail_ui.bg.up_btn"]:setActive(not self.heroEntity:isMaxLv())
end
function HeroDetailUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["hero_detail_ui.bg.back_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["hero_detail_ui.bg.up_btn"]:addClickListener(function()
ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId())
end)
end
function HeroDetailUI:_bind()
self:bind(self.heroEntity, "lv", function()
self:_display()
end)
end
return HeroDetailUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9d56482e42e9d474287fb81d23e5a982
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

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

View File

@ -15,7 +15,7 @@ end
function BagData:init(data) function BagData:init(data)
if data then if data then
self.ItemData:init(data.ItemData) self.ItemData:init(data.ItemData.items)
else else
self.ItemData:init() self.ItemData:init()
end end

View File

@ -4,11 +4,8 @@ local ItemConst = require "app/module/item/item_const"
local ItemData = class("ItemData", BaseData) local ItemData = class("ItemData", BaseData)
local CACHE_ITEM = { local CACHE_ITEM = {
id = 0, cfg_id = 0,
count = { count = 0
value = 0,
unit = 0,
}
} }
function ItemData:ctor() function ItemData:ctor()
@ -25,8 +22,8 @@ function ItemData:init(data)
-- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas) -- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas)
-- elseif info.id == GConst.ItemConst.ITEM_ID_GOLD then -- elseif info.id == GConst.ItemConst.ITEM_ID_GOLD then
-- local parmas = {} -- local parmas = {}
-- parmas.gold_value = info.count.value -- parmas.gold_value = info.count
-- parmas.gold_unit = info.count.unit -- parmas.gold_unit = info.count
-- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas) -- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas)
-- end -- end
self:_add(info.cfg_id, info.count) self:_add(info.cfg_id, info.count)
@ -67,6 +64,16 @@ function ItemData:getItemBigNumById(id)
return num return num
end end
function ItemData:getItemNumById(id)
local num
if self.items[id] then
num = self.items[id]:getNum()
else
num = 0
end
return num
end
function ItemData:addItemReward(item, itemGetType) function ItemData:addItemReward(item, itemGetType)
CACHE_ITEM.cfg_id = GFunc.getRewardId(item) CACHE_ITEM.cfg_id = GFunc.getRewardId(item)
CACHE_ITEM.count = GFunc.getRewardNum(item) CACHE_ITEM.count = GFunc.getRewardNum(item)
@ -107,41 +114,41 @@ function ItemData:addItem(data, itemGetType)
self:_addItemNumById(data.cfg_id, data.count) self:_addItemNumById(data.cfg_id, data.count)
if data.cfg_id == GConst.ItemConst.ITEM_ID_GEM or data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD then -- if data.cfg_id == GConst.ItemConst.ITEM_ID_GEM or data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD then
if data.count.value < 0 then -- if data.count < 0 then
if data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD and itemGetType == BIReport.ITEM_GET_TYPE.TRAIN_UP then -- if data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD and itemGetType == BIReport.ITEM_GET_TYPE.TRAIN_UP then
else -- else
BIReport:postGemUse(data.count, itemGetType, data.cfg_id) -- BIReport:postGemUse(data.count, itemGetType, data.cfg_id)
if data.cfg_id == GConst.ItemConst.ITEM_ID_GEM then -- if data.cfg_id == GConst.ItemConst.ITEM_ID_GEM then
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserAdd("gem", data.count) -- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserAdd("gem", data.count)
elseif data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD then -- elseif data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD then
local goldNum = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GOLD) -- local goldNum = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GOLD)
local parmas = {} -- local parmas = {}
parmas.gold = goldNum -- parmas.gold = goldNum
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas) -- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas)
end -- end
end -- end
else -- else
if data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD and itemGetType == BIReport.ITEM_GET_TYPE.CHAPTER_DROP then -- if data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD and itemGetType == BIReport.ITEM_GET_TYPE.CHAPTER_DROP then
else -- else
BIReport:postGemGet(data.count, itemGetType, data.cfg_id) -- BIReport:postGemGet(data.count, itemGetType, data.cfg_id)
if data.cfg_id == GConst.ItemConst.ITEM_ID_GEM then -- if data.cfg_id == GConst.ItemConst.ITEM_ID_GEM then
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserAdd("gem", data.count) -- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserAdd("gem", data.count)
elseif data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD then -- elseif data.cfg_id == GConst.ItemConst.ITEM_ID_GOLD then
local goldNum = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GOLD) -- local goldNum = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GOLD)
local parmas = {} -- local parmas = {}
parmas.gold = goldNum -- parmas.gold = goldNum
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas) -- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas)
end -- end
end -- end
end -- end
else -- else
if data.count.value < 0 then -- if data.count < 0 then
BIReport:postItemUse(data.count, data.cfg_id, itemGetType) -- BIReport:postItemUse(data.count, data.cfg_id, itemGetType)
else -- else
BIReport:postItemGet(data.count, data.cfg_id, itemGetType) -- BIReport:postItemGet(data.count, data.cfg_id, itemGetType)
end -- end
end -- end
end end
function ItemData:addItemNumById(id, num, itemGetType) function ItemData:addItemNumById(id, num, itemGetType)

View File

@ -2,7 +2,7 @@ local BattleTeamEntity = require "app/userdata/battle/team/battle_team_entity"
local BattleData = class("BattleData", BaseData) local BattleData = class("BattleData", BaseData)
local SKILL_HERO_CFG = ConfigManager:getConfig("skill_hero") local SKILL_HERO_CFG = ConfigManager:getConfig("skill")
local BattleConst = GConst.BattleConst local BattleConst = GConst.BattleConst
local BATTLE_GRID_ENTITY = require "app/userdata/battle/battle_grid_entity" local BATTLE_GRID_ENTITY = require "app/userdata/battle/battle_grid_entity"
local BATTLE_BOARD_SKILL_ENTITY = require "app/userdata/battle/skill/battle_borad_skill_entity" local BATTLE_BOARD_SKILL_ENTITY = require "app/userdata/battle/skill/battle_borad_skill_entity"

View File

@ -13,7 +13,7 @@ function BattleBoardSkillEnity:refreshSkillId(skillId)
return return
end end
self.skillId = skillId self.skillId = skillId
self.config = ConfigManager:getConfig("skill_hero")[skillId] self.config = ConfigManager:getConfig("skill")[skillId]
end end
function BattleBoardSkillEnity:getSkillId() function BattleBoardSkillEnity:getSkillId()

View File

@ -39,4 +39,12 @@ function HeroData:getActiveHeroCount()
return self.data.activeCount return self.data.activeCount
end end
function HeroData:setHeroLv(id, lv)
if not self.heroes[id] then
self:addHero(id, lv)
return
end
self.heroes[id]:setLv(lv)
end
return HeroData return HeroData

View File

@ -6,6 +6,7 @@ function HeroEntity:ctor(cfgId, lv)
self.data.lv = lv self.data.lv = lv
self.attrDirty = false self.attrDirty = false
self.config = ConfigManager:getConfig("hero")[self.cfgId] self.config = ConfigManager:getConfig("hero")[self.cfgId]
self.beginLv = self.config.begin_lv -- 初始等级
self.baseAttrOriginal = {} self.baseAttrOriginal = {}
self.allAttr = {} self.allAttr = {}
@ -41,6 +42,10 @@ function HeroEntity:getQlt()
return self.config.qlt return self.config.qlt
end end
function HeroEntity:getBeginLv()
return self.beginLv
end
function HeroEntity:getMatchType() function HeroEntity:getMatchType()
return self.config.position return self.config.position
end end
@ -62,13 +67,32 @@ function HeroEntity:updateAttr()
end end
function HeroEntity:updateBaseAttr() function HeroEntity:updateBaseAttr()
if self.data.lv <= 0 then self.baseAttrOriginal[GConst.ATTR_TYPE.hp] = self:getCfgHp()
self.baseAttrOriginal[GConst.ATTR_TYPE.hp] = 0 self.baseAttrOriginal[GConst.ATTR_TYPE.atk] = self:getCfgAtk()
self.baseAttrOriginal[GConst.ATTR_TYPE.atk] = 0 end
else
self.baseAttrOriginal[GConst.ATTR_TYPE.hp] = self.config.hp[self.data.lv] or self.config.hp[#self.config.hp] function HeroEntity:getCfgHp(lv)
self.baseAttrOriginal[GConst.ATTR_TYPE.atk] = self.config.atk[self.data.lv] or self.config.atk[#self.config.atk] lv = lv or self.data.lv
if lv > self:getMaxLv() then
lv = self:getMaxLv()
end end
if self.config and self.config.hp then
return self.config.hp[lv] or 0
end
return 0
end
function HeroEntity:getCfgAtk(lv)
lv = lv or self.data.lv
if lv > self:getMaxLv() then
lv = self:getMaxLv()
end
if self.config and self.config.atk then
return self.config.atk[lv] or 0
end
return 0
end end
function HeroEntity:getAtk() function HeroEntity:getAtk()
@ -83,6 +107,17 @@ function HeroEntity:setDirty()
self.attrDirty = true self.attrDirty = true
end end
function HeroEntity:isMaxLv()
return self.data.lv >= self:getMaxLv()
end
function HeroEntity:getMaxLv()
if not self.maxLv then
self.maxLv = ConfigManager:getConfigNum("hero_level")
end
return self.maxLv
end
function HeroEntity:canLvUp() function HeroEntity:canLvUp()
if self:isMaxLv() then if self:isMaxLv() then
return false return false
@ -93,21 +128,33 @@ function HeroEntity:canLvUp()
return false return false
end end
for _, reward in ipairs(cost) do local fragmentCost = cost[1] or 0
if not GFunc.checkCost(reward.id, reward.num, false) then if not GFunc.checkCost(self:getFramentId(), fragmentCost, false) then
return false return false
end end
local goldCost = cost[2] or 0
if not GFunc.checkCost(GConst.ItemConst.ITEM_ID_GOLD, goldCost, false) then
return false
end end
return true return true
end end
function HeroEntity:isActived()
return self.data.lv >= self:getBeginLv()
end
function HeroEntity:getLvUpMaterials() function HeroEntity:getLvUpMaterials()
local nextLvInfo = ConfigManager:getConfig("hero_up")[self.data.lv + 1] local lv = self.data.lv + 1
if lv < self:getBeginLv() then
lv = self:getBeginLv()
end
local nextLvInfo = ConfigManager:getConfig("hero_level")[lv]
if not nextLvInfo then if not nextLvInfo then
return return
end end
return nextLvInfo.exp local fieldName = "cost_" .. self:getQlt()
return nextLvInfo[fieldName]
end end
function HeroEntity:getConfig() function HeroEntity:getConfig()
@ -126,4 +173,40 @@ function HeroEntity:getHurtSkill()
return self.config.hurt_skill return self.config.hurt_skill
end end
function HeroEntity:getFramentId()
return self.config.item_id
end
function HeroEntity:getIcon()
return self.config.icon
end
function HeroEntity:getName()
return I18N:getConfig("hero")[self:getCfgId()].name
end
function HeroEntity:getActiveRogueCount()
local lvInfo = ConfigManager:getConfig("hero_level")[self.data.lv]
if not lvInfo then
return 0
end
return lvInfo.unlock_skill
end
function HeroEntity:getRogueSkillList()
if not self.rogueSkillList then
self.rogueSkillList = {}
for i = 1, 3 do
local id = self.config["rouge_skill_" .. i]
if id then
table.insert(self.rogueSkillList, id)
else
break
end
end
end
return self.rogueSkillList
end
return HeroEntity return HeroEntity