英雄技能
This commit is contained in:
parent
15edce3169
commit
9a2a667282
@ -656,6 +656,9 @@ local LocalizationGlobalConst =
|
||||
MAIN_BTN_4 = "MAIN_BTN_4",
|
||||
MAIN_BTN_5 = "MAIN_BTN_5",
|
||||
CHAPTER_BOX_DESC_1 = "CHAPTER_BOX_DESC_1",
|
||||
LV_UNLOCK = "LV_UNLOCK",
|
||||
HERO_DESC_13 = "HERO_DESC_13",
|
||||
HERO_DESC_14 = "HERO_DESC_14",
|
||||
}
|
||||
|
||||
return LocalizationGlobalConst
|
||||
@ -656,6 +656,9 @@ local localization_global =
|
||||
["MAIN_BTN_4"] = "公司",
|
||||
["MAIN_BTN_5"] = "玩法",
|
||||
["CHAPTER_BOX_DESC_1"] = "击败第{0}波敌人获得",
|
||||
["LV_UNLOCK"] = "{0}级解锁",
|
||||
["HERO_DESC_13"] = "相关英雄:",
|
||||
["HERO_DESC_14"] = "英雄等级达到{0}",
|
||||
}
|
||||
|
||||
return localization_global
|
||||
@ -12,6 +12,10 @@ function HeroManager:showHeroUnlockUI(heroIdList)
|
||||
UIManager:showUI("app/ui/hero/hero_unlock_ui", {heroIdList = heroIdList})
|
||||
end
|
||||
|
||||
function HeroManager:showHeroSkillInfoUI(heroEntity, idx, buffId)
|
||||
UIManager:showUI("app/ui/hero/hero_skill_info_ui", {heroEntity = heroEntity, idx = idx, buffId = buffId})
|
||||
end
|
||||
|
||||
function HeroManager:upgradeHero(heroId, heroEntity, level)
|
||||
local heroEntity = heroEntity or DataManager.HeroData:getHeroById(heroId)
|
||||
if not heroEntity then
|
||||
@ -174,4 +178,9 @@ function HeroManager:getMonsterName(monsterBaseId)
|
||||
return I18N:getText("monster_base", monsterBaseId, "name")
|
||||
end
|
||||
|
||||
function HeroManager:getSkillRogueComboHero(skillId)
|
||||
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
|
||||
return cfg and cfg.combo_hero
|
||||
end
|
||||
|
||||
return HeroManager
|
||||
20
lua/app/ui/hero/cell/hero_cell.lua
Normal file
20
lua/app/ui/hero/cell/hero_cell.lua
Normal file
@ -0,0 +1,20 @@
|
||||
local HeroCell = class("HeroCell", BaseCell)
|
||||
|
||||
function HeroCell:init()
|
||||
local uiMap = self.baseObject:genAllChildren()
|
||||
-- 通用
|
||||
self.icon = uiMap["hero_cell.icon"]
|
||||
self.matchImg = uiMap["hero_cell.match_img"]
|
||||
end
|
||||
|
||||
function HeroCell:refresh(heroId)
|
||||
local heroEntity = DataManager.HeroData:getHeroById(heroId)
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, heroEntity:getIcon())
|
||||
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroEntity:getMatchType()])
|
||||
end
|
||||
|
||||
function HeroCell:setActive(active)
|
||||
self.baseObject:setActive(active)
|
||||
end
|
||||
|
||||
return HeroCell
|
||||
10
lua/app/ui/hero/cell/hero_cell.lua.meta
Normal file
10
lua/app/ui/hero/cell/hero_cell.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a73bd9f4c8cd24473acccd275653eb38
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -122,13 +122,14 @@ function HeroInfoComp:refresh(checkLevel)
|
||||
local nextLvUp = self.heroEntity:getNextRougeLvUp(i)
|
||||
skillBg:addClickListener(function()
|
||||
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
|
||||
ModuleManager.TipsManager:showSkillTips(skillIcon, cfg.buff_id, skillId)
|
||||
-- ModuleManager.TipsManager:showSkillTips(skillIcon, cfg.buff_id, skillId)
|
||||
ModuleManager.HeroManager:showHeroSkillInfoUI(self.heroEntity, i, cfg.buff_id)
|
||||
end)
|
||||
skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
|
||||
skillBg:setTouchEnable(true)
|
||||
if skillUnlcokLv > lv then
|
||||
-- skillLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, skillLvs[i] or 0))
|
||||
skillLv:setText(skillUnlcokLv .. "级解锁")
|
||||
skillLv:setText(I18N:getGlobalText(I18N.GlobalConst.LV_UNLOCK, skillUnlcokLv))
|
||||
skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, "frame_0")
|
||||
else
|
||||
if nextLvUp then
|
||||
|
||||
170
lua/app/ui/hero/hero_skill_info_ui.lua
Normal file
170
lua/app/ui/hero/hero_skill_info_ui.lua
Normal file
@ -0,0 +1,170 @@
|
||||
local HeroSkillInfoUI = class("HeroSkillInfoUI", BaseUI)
|
||||
|
||||
local HERO_CELL = "app/ui/hero/cell/hero_cell"
|
||||
|
||||
function HeroSkillInfoUI:isFullScreen()
|
||||
return false
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/hero/hero_skill_info_ui.prefab"
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:onPressBackspace()
|
||||
self:closeUI()
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:ctor(parmas)
|
||||
self.heroEntity = parmas.heroEntity
|
||||
self.idx = parmas.idx or 1
|
||||
self.buffId = parmas.buffId
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:onLoadRootComplete()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
|
||||
uiMap["hero_skill_info_ui.content.btn_close"]:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
|
||||
self.titleTx = uiMap["hero_skill_info_ui.content.tx_title"]
|
||||
self.descTx = uiMap["hero_skill_info_ui.content.desc_tx"]
|
||||
self.skillIcon = uiMap["hero_skill_info_ui.content.skill_icon"]
|
||||
self.icon = uiMap["hero_skill_info_ui.content.skill_icon.icon"]
|
||||
self.skillDescTx = uiMap["hero_skill_info_ui.content.skill_icon.desc_tx"]
|
||||
self.heroNode = uiMap["hero_skill_info_ui.content.hero_node"]
|
||||
-- self.descTx1 = uiMap["hero_skill_info_ui.content.hero_node.desc_tx_1"]
|
||||
self.unlockBg = uiMap["hero_skill_info_ui.content.unlock_bg"]
|
||||
self.unlockTx = uiMap["hero_skill_info_ui.content.unlock_bg.unlock_tx"]
|
||||
self.buffNode = uiMap["hero_skill_info_ui.content.buff_node"]
|
||||
self.content = uiMap["hero_skill_info_ui.content"]
|
||||
self.line2 = uiMap["hero_skill_info_ui.content.line_2"]
|
||||
|
||||
self.heroCells = {}
|
||||
self.buffImgs = {}
|
||||
self.buffTxs = {}
|
||||
for i = 1, 2 do
|
||||
self.heroCells[i] = uiMap["hero_skill_info_ui.content.hero_node.hero_cell_" .. i]:addLuaComponent(HERO_CELL)
|
||||
self.buffImgs[i] = uiMap["hero_skill_info_ui.content.buff_node.buff_img_" .. i]
|
||||
self.buffTxs[i] = uiMap["hero_skill_info_ui.content.buff_node.buff_tx_" .. i]
|
||||
end
|
||||
self.skillDescTxs = {}
|
||||
for i = 1, 3 do
|
||||
self.skillDescTxs[i] = uiMap["hero_skill_info_ui.content.skill_desc_tx_" .. i]
|
||||
end
|
||||
|
||||
uiMap["hero_skill_info_ui.content.hero_node.desc_tx_1"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_13))
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:onRefresh()
|
||||
self.height = 0
|
||||
self:refreshSkillIcon()
|
||||
self:refreshSkillDesc()
|
||||
self:refreshSkillBuff()
|
||||
self:refreshSkillHero()
|
||||
self.height = self.height + 36
|
||||
self.content:setSizeDeltaY(self.height)
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:refreshSkillIcon()
|
||||
local skillInfo, currIdx = self.heroEntity:getRogueSkillListByIdx(self.idx)
|
||||
self.titleTx:setText(currIdx .. "/" .. #skillInfo)
|
||||
|
||||
local lv = self.heroEntity:getLv()
|
||||
local skillUnlcokLv = skillInfo[1][1]
|
||||
local skillId = skillInfo[1][2]
|
||||
-- self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
|
||||
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
|
||||
if skillUnlcokLv > lv then
|
||||
-- self.skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, "frame_0")
|
||||
self.skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, "frame_0")
|
||||
|
||||
self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.LV_UNLOCK, skillUnlcokLv))
|
||||
local meshProComp = self.unlockTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
|
||||
local contentWidth = meshProComp.preferredWidth
|
||||
self.unlockBg:setSizeDeltaX(contentWidth + 22)
|
||||
self.unlockBg:setActive(true)
|
||||
else
|
||||
self.unlockBg:setActive(false)
|
||||
self.skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueBg(skillId, true))
|
||||
end
|
||||
|
||||
self.descTx:setText(ModuleManager.HeroManager:getSkillDesc(self.heroEntity:getBaseSkill()))
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:refreshSkillDesc()
|
||||
local skillInfo, currIdx = self.heroEntity:getRogueSkillListByIdx(self.idx)
|
||||
|
||||
local posY = -324
|
||||
for i = 1, 3 do
|
||||
local skillUnlcokLv = skillInfo[i][1]
|
||||
local skillId = skillInfo[i][2]
|
||||
local lvStr = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_14, skillUnlcokLv)
|
||||
local skillStr = ModuleManager.HeroManager:getSkillRogueDesc(skillId)
|
||||
if currIdx >= i then
|
||||
self.skillDescTxs[i]:setText("<color=#FFFFFF>" .. lvStr .. "</color><color=#FFA44B> " .. skillStr .. "</color>")
|
||||
else
|
||||
self.skillDescTxs[i]:setText("<color=#B4B4B4>" .. lvStr .. "</color><color=#B4B4B4> " .. skillStr .. "</color>")
|
||||
end
|
||||
self.skillDescTxs[i]:setAnchoredPositionY(posY)
|
||||
local meshProComp = self.skillDescTxs[i]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
|
||||
local contentHeight = meshProComp.preferredHeight
|
||||
posY = posY - contentHeight - 18
|
||||
end
|
||||
|
||||
self.line2:setAnchoredPositionY(posY + 4)
|
||||
self.height = -posY
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:refreshSkillBuff()
|
||||
if not self.buffId then
|
||||
self.buffNode:setActive(false)
|
||||
return
|
||||
else
|
||||
local posY = 0
|
||||
self.buffNode:setActive(true)
|
||||
self.buffNode:setAnchoredPositionY(-self.height)
|
||||
for i = 1, 2 do
|
||||
if self.buffId[i] then
|
||||
self.buffImgs[i]:setActive(true)
|
||||
self.buffTxs[i]:setActive(true)
|
||||
local buffInfo = ConfigManager:getConfigWithOtherKey("buff", "name")[self.buffId[i]]
|
||||
self.buffTxs[i]:setText(I18N:getTextWithOtherKey("buff", "name", buffInfo.name, "tips_desc"))
|
||||
self.buffImgs[i]:setSprite(GConst.ATLAS_PATH.ICON_BUFF, buffInfo.icon)
|
||||
self.buffImgs[i]:setAnchoredPositionY(posY - 20)
|
||||
self.buffTxs[i]:setAnchoredPositionY(posY - 8)
|
||||
|
||||
local meshProComp = self.buffTxs[i]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
|
||||
local contentHeight = meshProComp.preferredHeight
|
||||
posY = posY - contentHeight - 10
|
||||
else
|
||||
self.buffImgs[i]:setActive(false)
|
||||
self.buffTxs[i]:setActive(false)
|
||||
end
|
||||
end
|
||||
self.height = self.height - posY
|
||||
end
|
||||
end
|
||||
|
||||
function HeroSkillInfoUI:refreshSkillHero()
|
||||
local skillInfo = self.heroEntity:getRogueSkillList()[self.idx]
|
||||
local skillId = skillInfo[2]
|
||||
local combaHero = ModuleManager.HeroManager:getSkillRogueComboHero(skillId)
|
||||
if combaHero then
|
||||
self.heroNode:setActive(true)
|
||||
for i = 1, 2 do
|
||||
if combaHero[i] then
|
||||
self.heroCells[i]:setActive(true)
|
||||
self.heroCells[i]:refresh(combaHero[i])
|
||||
else
|
||||
self.heroCells[i]:setActive(false)
|
||||
end
|
||||
end
|
||||
self.height = self.height + 164
|
||||
else
|
||||
self.heroNode:setActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
return HeroSkillInfoUI
|
||||
10
lua/app/ui/hero/hero_skill_info_ui.lua.meta
Normal file
10
lua/app/ui/hero/hero_skill_info_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c8ca2389726845138771602e50956f1
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -550,6 +550,20 @@ function HeroEntity:getRogueSkillList()
|
||||
return self.rogueSkillList
|
||||
end
|
||||
|
||||
function HeroEntity:getRogueSkillListByIdx(idx)
|
||||
local ids = self.config["rouge_skill_" .. idx]
|
||||
local lv = 0
|
||||
if ids then
|
||||
for i = 1, #ids do
|
||||
if self.data.lv >= ids[i][1]then
|
||||
lv = i
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return ids, lv
|
||||
end
|
||||
|
||||
function HeroEntity:getNextRougeLvUp(idx)
|
||||
local ids = self.config["rouge_skill_" .. idx]
|
||||
if ids then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user