This commit is contained in:
puxuan 2025-05-24 23:49:11 +08:00
parent 2b33cf3ab1
commit d719ceeb74
5 changed files with 73 additions and 52 deletions

View File

@ -152,21 +152,6 @@ function HeroManager:getSkillRoguePosition(skillId)
return cfg and cfg.skill_position
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:getMonsterName(monsterBaseId)
if not I18N:getConfig("monster_base") then
return

View File

@ -193,6 +193,8 @@ local ProtoMsgType = {
[2921084933] = "ChapterArmorChallengeSettlementRsp",
[2964758488] = "TournWaveBountyClaimReq",
[2964760321] = "TournWaveBountyClaimRsp",
[2989494846] = "HeroStarReq",
[2989496679] = "HeroStarRsp",
[3003864530] = "ActTriggerGiftNtf",
[3013273736] = "PVPRankHeroesReq",
[3013275569] = "PVPRankHeroesRsp",
@ -520,6 +522,8 @@ local ProtoMsgType = {
ChapterArmorChallengeSettlementRsp = 2921084933,
TournWaveBountyClaimReq = 2964758488,
TournWaveBountyClaimRsp = 2964760321,
HeroStarReq = 2989494846,
HeroStarRsp = 2989496679,
ActTriggerGiftNtf = 3003864530,
PVPRankHeroesReq = 3013273736,
PVPRankHeroesRsp = 3013275569,
@ -847,6 +851,8 @@ local ProtoMsgType = {
ChapterArmorChallengeSettlementRsp = "ChapterArmorChallengeSettlementRsp",
TournWaveBountyClaimReq = "TournWaveBountyClaimReq",
TournWaveBountyClaimRsp = "TournWaveBountyClaimRsp",
HeroStarReq = "HeroStarReq",
HeroStarRsp = "HeroStarRsp",
ActTriggerGiftNtf = "ActTriggerGiftNtf",
PVPRankHeroesReq = "PVPRankHeroesReq",
PVPRankHeroesRsp = "PVPRankHeroesRsp",

View File

@ -40,7 +40,7 @@ function HeroInfoComp:init()
self.skill = {}
self.skillIcon = {}
self.skillDesc = {}
for i = 1, 7 do
for i = 1, 4 do
self.skill[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i]
self.skillIcon[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".icon"]
self.skillDesc[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".desc"]
@ -120,33 +120,40 @@ function HeroInfoComp:refresh(checkLevel)
end
self.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, 7 do
local skillId = skillList[i]
if skillId then
local lv = self.heroEntity:getLv()
for i = 1, 4 do
local skillInfo = skillList[i]
if skillInfo then
local skillUnlcokLv = skillInfo[1]
local skillId = skillInfo[2]
local skillBg = self.skill[i]
local skillIcon = self.skillIcon[i]
local skillLv = self.skillDesc[i]
local nextLvUp = self.heroEntity:getNextRougeLvUp(i)
skillBg:addClickListener(function()
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
ModuleManager.TipsManager:showSkillTips(skillIcon, cfg.buff_id, skillId)
end)
skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
skillBg:setTouchEnable(true)
if i > activeCount then
skillLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, skillLvs[i] or 0))
if skillUnlcokLv > lv then
-- skillLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, skillLvs[i] or 0))
skillLv:setText(skillUnlcokLv .. "级解锁")
skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, "frame_0")
else
skillLv:setText(GConst.EMPTY_STRING)
skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueBg(skillId, true))
if i == activeCount and isLvChange and self.heroEntity:getLv() == skillLvs[i] then
local x, y = skillBg:fastGetAnchoredPosition()
self.spineObjSkill:setAnchoredPosition(x, y)
self.spineObjSkill:setVisible(true)
self.spineObjSkill:playAnim("idle", false, true)
if nextLvUp then
skillLv:setText(nextLvUp .. "提升")
else
skillLv:setText(GConst.EMPTY_STRING)
end
skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueBg(skillId, true))
-- if i == activeCount and isLvChange and self.heroEntity:getLv() == skillLvs[i] then
-- local x, y = skillBg:fastGetAnchoredPosition()
-- self.spineObjSkill:setAnchoredPosition(x, y)
-- self.spineObjSkill:setVisible(true)
-- self.spineObjSkill:playAnim("idle", false, true)
-- end
end
end
end
@ -181,6 +188,8 @@ function HeroInfoComp:refresh(checkLevel)
hpStr = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
atkStr = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
end
local costId = self.heroEntity:getLvUpCostId()
self.imgUpIcon:setSprite(GFunc.getIconRes(costId))
self.txUpdesc:setText(str)
self.txUpNum:setText(materials[2])
self.txHp:setText(hpStr)

View File

@ -109,7 +109,7 @@ function HeroData:updateSelfHeroEquipsAndRunes(entity)
end
function HeroData:getEntity(heroStruct)
return HeroEntity:create(heroStruct.id, heroStruct.level, heroStruct.skin)
return HeroEntity:create(heroStruct.id, heroStruct.level, heroStruct.skin, heroStruct.star)
end
function HeroData:getHeroById(id)

View File

@ -1,11 +1,12 @@
local HeroEntity = class("HeroEntity", BaseData)
local ATTR_NAME = GConst.BattleConst.ATTR_NAME
function HeroEntity:ctor(cfgId, lv, skin)
function HeroEntity:ctor(cfgId, lv, skin, star)
self.cfgId = cfgId
self.data.isDirty = false
self.data.lv = lv
self.data.skin = skin
self.data.star = star
self.config = ConfigManager:getConfig("hero")[self.cfgId]
self.beginLv = self.config.begin_lv -- 初始等级
@ -498,6 +499,10 @@ function HeroEntity:getHurtNum()
return self.config.hurt_num
end
function HeroEntity:getLvUpCostId()
return self.config.level_id
end
function HeroEntity:getName()
return ModuleManager.HeroManager:getHeroName(self:getCfgId())
end
@ -507,15 +512,15 @@ function HeroEntity:getDesc()
end
function HeroEntity:getActiveRogueCount()
local lvInfo = ConfigManager:getConfig("hero_level")[self.data.lv]
if not lvInfo then
return 0
end
--@TODO 123123
-- return lvInfo.unlock_skill
return 0
end
-- function HeroEntity:getActiveRogueCount()
-- local lvInfo = ConfigManager:getConfig("hero_level")[self.data.lv]
-- if not lvInfo then
-- return 0
-- end
-- --@TODO 123123
-- -- return lvInfo.unlock_skill
-- return 0
-- end
function HeroEntity:getUnlockRogueId()
return self.config.rouge_skill
@ -526,9 +531,14 @@ function HeroEntity:getRogueSkillList()
self.rogueSkillList = {}
local count = 1
while true do
local id = self.config["rouge_skill_" .. count]
if id then
table.insert(self.rogueSkillList, id)
local ids = self.config["rouge_skill_" .. count]
if ids then
for i = #ids, 1, -1 do
if self.data.lv >= ids[i][1] or i == 1 then
table.insert(self.rogueSkillList, ids[i])
break
end
end
else
break
end
@ -539,16 +549,27 @@ function HeroEntity:getRogueSkillList()
return self.rogueSkillList
end
function HeroEntity:getActiveRogueSkills()
local list = {}
for i = 1, self:getActiveRogueCount() do
local id = self:getRogueSkillList()[i]
if id then
table.insert(list, id)
else
break
function HeroEntity:getNextRougeLvUp(idx)
local ids = self.config["rouge_skill_" .. idx]
if ids then
for i,v in ipairs(ids) do
if self.data.lv < ids[i][1] then
return ids[i][1]
end
end
end
end
function HeroEntity:getActiveRogueSkills()
local list = {}
-- for i = 1, self:getActiveRogueCount() do
-- local id = self:getRogueSkillList()[i]
-- if id then
-- table.insert(list, id)
-- else
-- break
-- end
-- end
return list
end