显示优化

This commit is contained in:
xiekaidong 2023-04-24 14:16:19 +08:00
parent de8328b809
commit 43ef1a5a8d
4 changed files with 41 additions and 11 deletions

View File

@ -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",

View File

@ -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("<color=%s>%s</color>", 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

View File

@ -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

View File

@ -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