From 9a2a6672823e43589cc0ea945365e5a23cb5d7e3 Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Mon, 18 Aug 2025 18:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../localization_global_const.lua | 3 + lua/app/config/strings/cn/global.lua | 3 + lua/app/module/hero/hero_manager.lua | 9 + lua/app/ui/hero/cell/hero_cell.lua | 20 +++ lua/app/ui/hero/cell/hero_cell.lua.meta | 10 ++ lua/app/ui/hero/hero_info_comp.lua | 5 +- lua/app/ui/hero/hero_skill_info_ui.lua | 170 ++++++++++++++++++ lua/app/ui/hero/hero_skill_info_ui.lua.meta | 10 ++ lua/app/userdata/hero/hero_entity.lua | 14 ++ 9 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 lua/app/ui/hero/cell/hero_cell.lua create mode 100644 lua/app/ui/hero/cell/hero_cell.lua.meta create mode 100644 lua/app/ui/hero/hero_skill_info_ui.lua create mode 100644 lua/app/ui/hero/hero_skill_info_ui.lua.meta diff --git a/lua/app/config/localization/localization_global_const.lua b/lua/app/config/localization/localization_global_const.lua index d017137e..6b3f0e80 100644 --- a/lua/app/config/localization/localization_global_const.lua +++ b/lua/app/config/localization/localization_global_const.lua @@ -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 \ No newline at end of file diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua index 5096fd3d..c7aa4495 100644 --- a/lua/app/config/strings/cn/global.lua +++ b/lua/app/config/strings/cn/global.lua @@ -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 \ No newline at end of file diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index 56c9336d..8953461e 100644 --- a/lua/app/module/hero/hero_manager.lua +++ b/lua/app/module/hero/hero_manager.lua @@ -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 \ No newline at end of file diff --git a/lua/app/ui/hero/cell/hero_cell.lua b/lua/app/ui/hero/cell/hero_cell.lua new file mode 100644 index 00000000..07c907de --- /dev/null +++ b/lua/app/ui/hero/cell/hero_cell.lua @@ -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 diff --git a/lua/app/ui/hero/cell/hero_cell.lua.meta b/lua/app/ui/hero/cell/hero_cell.lua.meta new file mode 100644 index 00000000..74986c86 --- /dev/null +++ b/lua/app/ui/hero/cell/hero_cell.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: a73bd9f4c8cd24473acccd275653eb38 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/hero/hero_info_comp.lua b/lua/app/ui/hero/hero_info_comp.lua index f0c72935..7ae0f5a2 100644 --- a/lua/app/ui/hero/hero_info_comp.lua +++ b/lua/app/ui/hero/hero_info_comp.lua @@ -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 diff --git a/lua/app/ui/hero/hero_skill_info_ui.lua b/lua/app/ui/hero/hero_skill_info_ui.lua new file mode 100644 index 00000000..3935f595 --- /dev/null +++ b/lua/app/ui/hero/hero_skill_info_ui.lua @@ -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("" .. lvStr .. " " .. skillStr .. "") + else + self.skillDescTxs[i]:setText("" .. lvStr .. " " .. skillStr .. "") + 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 \ No newline at end of file diff --git a/lua/app/ui/hero/hero_skill_info_ui.lua.meta b/lua/app/ui/hero/hero_skill_info_ui.lua.meta new file mode 100644 index 00000000..b3f44ead --- /dev/null +++ b/lua/app/ui/hero/hero_skill_info_ui.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5c8ca2389726845138771602e50956f1 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index 922f8197..1773be4d 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -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