From 43ef1a5a8df642e4c61d514cc70489049976f4cc Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 24 Apr 2023 14:16:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/battle_const.lua | 8 ++++++++ lua/app/module/hero/hero_manager.lua | 15 +++++++++++---- .../ui/battle/cell/battle_select_skill_cell.lua | 17 ++++++++++++++++- lua/app/ui/hero/hero_detail_ui.lua | 12 ++++++------ 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 43648db3..77bf82fb 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -328,6 +328,14 @@ BattleConst.ELEMENT_TYPE = { PURPLE = 5 } +BattleConst.ELEMENT_COLOR = { + [BattleConst.ELEMENT_TYPE.RED] = "#FF9898", + [BattleConst.ELEMENT_TYPE.YELLOW] = "#FFFC28", + [BattleConst.ELEMENT_TYPE.GREEN] = "#3CFF28", + [BattleConst.ELEMENT_TYPE.BLUE] = "#28FFF7", + [BattleConst.ELEMENT_TYPE.PURPLE] = "#FFAEED" +} + BattleConst.ELEMENT_ICON = { [BattleConst.ELEMENT_TYPE.RED] = "red_1", [BattleConst.ELEMENT_TYPE.YELLOW] = "yellow_1", diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index c59cf968..774e4df0 100644 --- a/lua/app/module/hero/hero_manager.lua +++ b/lua/app/module/hero/hero_manager.lua @@ -49,8 +49,15 @@ function HeroManager:getMatchTypeIcon(matchType) return GConst.HeroConst.MATCH_ICON_NAME[matchType] end -function HeroManager:getMatchTypeName(matchType) - return I18N:getGlobalText("ELEMENT_NAME_" .. matchType) +function HeroManager:getMatchTypeName(matchType, needColor) + local name = I18N:getGlobalText("ELEMENT_NAME_" .. matchType) + if needColor then + local color = GConst.BattleConst.ELEMENT_COLOR[matchType] + if color then + name = string.format("%s", color, name) + end + end + return name end function HeroManager:getSkillDesc(skillId) @@ -95,8 +102,8 @@ end function HeroManager:getSkillRogueBg(skillId) local cfg = ConfigManager:getConfig("skill_rogue")[skillId] - if cfg.type == GConst.BattleConst.UNLOCK_SKILL_ROGUE_TYPE then -- 解锁技能类型 - return "frame_skill_" .. cfg.skill_position + if cfg.skill_position then -- 解锁技能类型 + return "frame_skill_0" end return cfg and "frame_" .. cfg.qlt end diff --git a/lua/app/ui/battle/cell/battle_select_skill_cell.lua b/lua/app/ui/battle/cell/battle_select_skill_cell.lua index ebdf7872..7c994a0a 100644 --- a/lua/app/ui/battle/cell/battle_select_skill_cell.lua +++ b/lua/app/ui/battle/cell/battle_select_skill_cell.lua @@ -18,7 +18,8 @@ function BattleSelectSkillCell:refresh(skillId, func) end local uiMap = self:getUIMap() - uiMap["skill_select_cell.desc"]:setText(ModuleManager.HeroManager:getSkillRogueDesc(skillId, self.value)) + local desc = uiMap["skill_select_cell.desc"] + desc:setText(ModuleManager.HeroManager:getSkillRogueDesc(skillId, self.value)) self:getBaseObject():addClickListener(function() func(self.value) end) @@ -28,6 +29,20 @@ function BattleSelectSkillCell:refresh(skillId, func) self.selectSkillCell:refresh(skillId, nil, valueStr) uiMap["skill_select_cell.img"]:setSprite(GConst.ATLAS_PATH.BATTLE, ModuleManager.HeroManager:getSkillRogueBattleBg(skillId)) + + local icon = uiMap["skill_select_cell.element_icon"] + + if cfg.skill_position then + local iconName = uiMap["skill_select_cell.element_icon.name"] + local atlas, iconSprite = ModuleManager.BattleManager:getElementIcon(cfg.skill_position) + icon:setVisible(true, 0.4) + icon:setSprite(atlas, iconSprite) + iconName:setText(ModuleManager.HeroManager:getMatchTypeName(cfg.skill_position, true)) + desc:setAnchoredPositionY(-15) + else + icon:setVisible(false, 0.4) + desc:setAnchoredPositionY(0) + end end return BattleSelectSkillCell \ No newline at end of file diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index 792d0c8c..65554468 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -2,11 +2,7 @@ local HeroDetailUI = class("HeroDetailUI", BaseUI) local DEFAULT_FACTOR = GConst.BattleConst.DEFAULT_FACTOR -local SKILL_BUFF_BG = { - [2] = "frame_1", - [3] = "frame_2", - [4] = "frame_3", -} +local BTN_ICON = {"common_btn_green_2", "common_btn_grey_2"} function HeroDetailUI:isFullScreen() return false @@ -109,7 +105,11 @@ function HeroDetailUI:_display() uiMap["hero_detail_ui.bg.atk"]:setText(atkStr) local btn = uiMap["hero_detail_ui.bg.up_btn"] - btn:setImageGray(not canLvUp) + if canLvUp then + btn:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[1]) + else + btn:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[2]) + end btn:setTouchEnable(true) btn:setActive(not self.heroEntity:isMaxLv()) end