hero
This commit is contained in:
parent
2b33cf3ab1
commit
d719ceeb74
@ -152,21 +152,6 @@ function HeroManager:getSkillRoguePosition(skillId)
|
|||||||
return cfg and cfg.skill_position
|
return cfg and cfg.skill_position
|
||||||
end
|
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)
|
function HeroManager:getMonsterName(monsterBaseId)
|
||||||
if not I18N:getConfig("monster_base") then
|
if not I18N:getConfig("monster_base") then
|
||||||
return
|
return
|
||||||
|
|||||||
@ -193,6 +193,8 @@ local ProtoMsgType = {
|
|||||||
[2921084933] = "ChapterArmorChallengeSettlementRsp",
|
[2921084933] = "ChapterArmorChallengeSettlementRsp",
|
||||||
[2964758488] = "TournWaveBountyClaimReq",
|
[2964758488] = "TournWaveBountyClaimReq",
|
||||||
[2964760321] = "TournWaveBountyClaimRsp",
|
[2964760321] = "TournWaveBountyClaimRsp",
|
||||||
|
[2989494846] = "HeroStarReq",
|
||||||
|
[2989496679] = "HeroStarRsp",
|
||||||
[3003864530] = "ActTriggerGiftNtf",
|
[3003864530] = "ActTriggerGiftNtf",
|
||||||
[3013273736] = "PVPRankHeroesReq",
|
[3013273736] = "PVPRankHeroesReq",
|
||||||
[3013275569] = "PVPRankHeroesRsp",
|
[3013275569] = "PVPRankHeroesRsp",
|
||||||
@ -520,6 +522,8 @@ local ProtoMsgType = {
|
|||||||
ChapterArmorChallengeSettlementRsp = 2921084933,
|
ChapterArmorChallengeSettlementRsp = 2921084933,
|
||||||
TournWaveBountyClaimReq = 2964758488,
|
TournWaveBountyClaimReq = 2964758488,
|
||||||
TournWaveBountyClaimRsp = 2964760321,
|
TournWaveBountyClaimRsp = 2964760321,
|
||||||
|
HeroStarReq = 2989494846,
|
||||||
|
HeroStarRsp = 2989496679,
|
||||||
ActTriggerGiftNtf = 3003864530,
|
ActTriggerGiftNtf = 3003864530,
|
||||||
PVPRankHeroesReq = 3013273736,
|
PVPRankHeroesReq = 3013273736,
|
||||||
PVPRankHeroesRsp = 3013275569,
|
PVPRankHeroesRsp = 3013275569,
|
||||||
@ -847,6 +851,8 @@ local ProtoMsgType = {
|
|||||||
ChapterArmorChallengeSettlementRsp = "ChapterArmorChallengeSettlementRsp",
|
ChapterArmorChallengeSettlementRsp = "ChapterArmorChallengeSettlementRsp",
|
||||||
TournWaveBountyClaimReq = "TournWaveBountyClaimReq",
|
TournWaveBountyClaimReq = "TournWaveBountyClaimReq",
|
||||||
TournWaveBountyClaimRsp = "TournWaveBountyClaimRsp",
|
TournWaveBountyClaimRsp = "TournWaveBountyClaimRsp",
|
||||||
|
HeroStarReq = "HeroStarReq",
|
||||||
|
HeroStarRsp = "HeroStarRsp",
|
||||||
ActTriggerGiftNtf = "ActTriggerGiftNtf",
|
ActTriggerGiftNtf = "ActTriggerGiftNtf",
|
||||||
PVPRankHeroesReq = "PVPRankHeroesReq",
|
PVPRankHeroesReq = "PVPRankHeroesReq",
|
||||||
PVPRankHeroesRsp = "PVPRankHeroesRsp",
|
PVPRankHeroesRsp = "PVPRankHeroesRsp",
|
||||||
|
|||||||
@ -40,7 +40,7 @@ function HeroInfoComp:init()
|
|||||||
self.skill = {}
|
self.skill = {}
|
||||||
self.skillIcon = {}
|
self.skillIcon = {}
|
||||||
self.skillDesc = {}
|
self.skillDesc = {}
|
||||||
for i = 1, 7 do
|
for i = 1, 4 do
|
||||||
self.skill[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i]
|
self.skill[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i]
|
||||||
self.skillIcon[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".icon"]
|
self.skillIcon[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".icon"]
|
||||||
self.skillDesc[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".desc"]
|
self.skillDesc[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".desc"]
|
||||||
@ -120,33 +120,40 @@ function HeroInfoComp:refresh(checkLevel)
|
|||||||
end
|
end
|
||||||
self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
|
self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
|
||||||
|
|
||||||
local activeCount = self.heroEntity:getActiveRogueCount()
|
|
||||||
local skillList = self.heroEntity:getRogueSkillList()
|
local skillList = self.heroEntity:getRogueSkillList()
|
||||||
local skillLvs = ModuleManager.HeroManager:getActiveRogueLvs()
|
local lv = self.heroEntity:getLv()
|
||||||
for i = 1, 7 do
|
for i = 1, 4 do
|
||||||
local skillId = skillList[i]
|
local skillInfo = skillList[i]
|
||||||
if skillId then
|
if skillInfo then
|
||||||
|
local skillUnlcokLv = skillInfo[1]
|
||||||
|
local skillId = skillInfo[2]
|
||||||
local skillBg = self.skill[i]
|
local skillBg = self.skill[i]
|
||||||
local skillIcon = self.skillIcon[i]
|
local skillIcon = self.skillIcon[i]
|
||||||
local skillLv = self.skillDesc[i]
|
local skillLv = self.skillDesc[i]
|
||||||
|
local nextLvUp = self.heroEntity:getNextRougeLvUp(i)
|
||||||
skillBg:addClickListener(function()
|
skillBg:addClickListener(function()
|
||||||
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
|
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
|
||||||
ModuleManager.TipsManager:showSkillTips(skillIcon, cfg.buff_id, skillId)
|
ModuleManager.TipsManager:showSkillTips(skillIcon, cfg.buff_id, skillId)
|
||||||
end)
|
end)
|
||||||
skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
|
skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
|
||||||
skillBg:setTouchEnable(true)
|
skillBg:setTouchEnable(true)
|
||||||
if i > activeCount then
|
if skillUnlcokLv > lv then
|
||||||
skillLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, skillLvs[i] or 0))
|
-- 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")
|
skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, "frame_0")
|
||||||
else
|
else
|
||||||
skillLv:setText(GConst.EMPTY_STRING)
|
if nextLvUp then
|
||||||
skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueBg(skillId, true))
|
skillLv:setText(nextLvUp .. "提升")
|
||||||
if i == activeCount and isLvChange and self.heroEntity:getLv() == skillLvs[i] then
|
else
|
||||||
local x, y = skillBg:fastGetAnchoredPosition()
|
skillLv:setText(GConst.EMPTY_STRING)
|
||||||
self.spineObjSkill:setAnchoredPosition(x, y)
|
|
||||||
self.spineObjSkill:setVisible(true)
|
|
||||||
self.spineObjSkill:playAnim("idle", false, true)
|
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
@ -181,6 +188,8 @@ function HeroInfoComp:refresh(checkLevel)
|
|||||||
hpStr = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
|
hpStr = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
|
||||||
atkStr = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
|
atkStr = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
|
||||||
end
|
end
|
||||||
|
local costId = self.heroEntity:getLvUpCostId()
|
||||||
|
self.imgUpIcon:setSprite(GFunc.getIconRes(costId))
|
||||||
self.txUpdesc:setText(str)
|
self.txUpdesc:setText(str)
|
||||||
self.txUpNum:setText(materials[2])
|
self.txUpNum:setText(materials[2])
|
||||||
self.txHp:setText(hpStr)
|
self.txHp:setText(hpStr)
|
||||||
|
|||||||
@ -109,7 +109,7 @@ function HeroData:updateSelfHeroEquipsAndRunes(entity)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function HeroData:getEntity(heroStruct)
|
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
|
end
|
||||||
|
|
||||||
function HeroData:getHeroById(id)
|
function HeroData:getHeroById(id)
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
local HeroEntity = class("HeroEntity", BaseData)
|
local HeroEntity = class("HeroEntity", BaseData)
|
||||||
local ATTR_NAME = GConst.BattleConst.ATTR_NAME
|
local ATTR_NAME = GConst.BattleConst.ATTR_NAME
|
||||||
|
|
||||||
function HeroEntity:ctor(cfgId, lv, skin)
|
function HeroEntity:ctor(cfgId, lv, skin, star)
|
||||||
self.cfgId = cfgId
|
self.cfgId = cfgId
|
||||||
self.data.isDirty = false
|
self.data.isDirty = false
|
||||||
self.data.lv = lv
|
self.data.lv = lv
|
||||||
self.data.skin = skin
|
self.data.skin = skin
|
||||||
|
self.data.star = star
|
||||||
self.config = ConfigManager:getConfig("hero")[self.cfgId]
|
self.config = ConfigManager:getConfig("hero")[self.cfgId]
|
||||||
self.beginLv = self.config.begin_lv -- 初始等级
|
self.beginLv = self.config.begin_lv -- 初始等级
|
||||||
|
|
||||||
@ -498,6 +499,10 @@ function HeroEntity:getHurtNum()
|
|||||||
return self.config.hurt_num
|
return self.config.hurt_num
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroEntity:getLvUpCostId()
|
||||||
|
return self.config.level_id
|
||||||
|
end
|
||||||
|
|
||||||
function HeroEntity:getName()
|
function HeroEntity:getName()
|
||||||
return ModuleManager.HeroManager:getHeroName(self:getCfgId())
|
return ModuleManager.HeroManager:getHeroName(self:getCfgId())
|
||||||
end
|
end
|
||||||
@ -507,15 +512,15 @@ function HeroEntity:getDesc()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function HeroEntity:getActiveRogueCount()
|
-- function HeroEntity:getActiveRogueCount()
|
||||||
local lvInfo = ConfigManager:getConfig("hero_level")[self.data.lv]
|
-- local lvInfo = ConfigManager:getConfig("hero_level")[self.data.lv]
|
||||||
if not lvInfo then
|
-- if not lvInfo then
|
||||||
return 0
|
-- return 0
|
||||||
end
|
-- end
|
||||||
--@TODO 123123
|
-- --@TODO 123123
|
||||||
-- return lvInfo.unlock_skill
|
-- -- return lvInfo.unlock_skill
|
||||||
return 0
|
-- return 0
|
||||||
end
|
-- end
|
||||||
|
|
||||||
function HeroEntity:getUnlockRogueId()
|
function HeroEntity:getUnlockRogueId()
|
||||||
return self.config.rouge_skill
|
return self.config.rouge_skill
|
||||||
@ -526,9 +531,14 @@ function HeroEntity:getRogueSkillList()
|
|||||||
self.rogueSkillList = {}
|
self.rogueSkillList = {}
|
||||||
local count = 1
|
local count = 1
|
||||||
while true do
|
while true do
|
||||||
local id = self.config["rouge_skill_" .. count]
|
local ids = self.config["rouge_skill_" .. count]
|
||||||
if id then
|
if ids then
|
||||||
table.insert(self.rogueSkillList, id)
|
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
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -539,16 +549,27 @@ function HeroEntity:getRogueSkillList()
|
|||||||
return self.rogueSkillList
|
return self.rogueSkillList
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getActiveRogueSkills()
|
function HeroEntity:getNextRougeLvUp(idx)
|
||||||
local list = {}
|
local ids = self.config["rouge_skill_" .. idx]
|
||||||
for i = 1, self:getActiveRogueCount() do
|
if ids then
|
||||||
local id = self:getRogueSkillList()[i]
|
for i,v in ipairs(ids) do
|
||||||
if id then
|
if self.data.lv < ids[i][1] then
|
||||||
table.insert(list, id)
|
return ids[i][1]
|
||||||
else
|
end
|
||||||
break
|
|
||||||
end
|
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
|
return list
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user