From 5e2e5b6f63dfd6e0ee4451db3a55e8bedaa76506 Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Thu, 26 Jun 2025 00:13:41 +0800 Subject: [PATCH] hero --- lua/app/ui/hero/hero_detail_ui.lua | 30 ++++++------ lua/app/ui/hero/hero_info_comp.lua | 74 +++++++++++++++--------------- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index 1d9e67ed..ef642968 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -32,13 +32,13 @@ end function HeroDetailUI:onLoadRootComplete() local uiMap = self.root:genAllChildren() - self.commonInfo = uiMap["hero_detail_ui.common"] + -- self.commonInfo = uiMap["hero_detail_ui.common"] self.heroInfo = uiMap["hero_detail_ui.hero_info"] self.starInfo = uiMap["hero_detail_ui.star_info"] self.skinInfo = uiMap["hero_detail_ui.skin_info"] - self.txTitle = uiMap["hero_detail_ui.common.img_title.tx_title"] - self.btnClose = uiMap["hero_detail_ui.common.btn_close"] - self.bg = uiMap["hero_detail_ui.common.bg.bg"] + self.titleTx = uiMap["hero_detail_ui.common.name_tx"] + self.closeBtn = uiMap["hero_detail_ui.common.close_btn"] + self.bg = uiMap["hero_detail_ui.common.bg"] self.btnHero = uiMap["hero_detail_ui.common.btns.btn_hero"] self.txHero1 = uiMap["hero_detail_ui.common.btns.btn_hero.tx_btn"] self.selectHero = uiMap["hero_detail_ui.common.btns.btn_hero.select"] @@ -57,10 +57,11 @@ function HeroDetailUI:onLoadRootComplete() self.btnRight = uiMap["hero_detail_ui.common.btn_right"] self.heroNode = uiMap["hero_detail_ui.hero_node"] - self.elementBg = uiMap["hero_detail_ui.hero_node.element_bg"] - self.elementDesc = uiMap["hero_detail_ui.hero_node.element_bg.element_desc"] - self.heroElement = uiMap["hero_detail_ui.hero_node.hero_element"] - self.spineObjAvatar = uiMap["hero_detail_ui.hero_node.ui_spine_obj_avatar"] + self.elementBg = uiMap["hero_detail_ui.common.hero_node.element_bg"] + self.elementDesc = uiMap["hero_detail_ui.common.hero_node.element_bg.element_desc_tx"] + self.heroElement = uiMap["hero_detail_ui.common.hero_node.hero_element"] + self.spineObjAvatar = uiMap["hero_detail_ui.common.hero_node.ui_spine_obj_avatar"] + self.powerTx = uiMap["hero_detail_ui.common.power_img.power_tx"] self.txHero1:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4)) self.txHero2:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4)) @@ -72,6 +73,7 @@ function HeroDetailUI:onLoadRootComplete() self.txStar2:setText("升星") self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN)) self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN)) + self.powerTx:setText(1313213) if not DataManager.HeroData:isStarOpen() then self.lockStar:setVisible(true) GFunc.centerImgAndTx(self.lockStar, self.txStar1, 5) @@ -103,7 +105,7 @@ function HeroDetailUI:onLoadRootComplete() self.panelType = GConst.HeroConst.PANEL_TYPE.SKIN self:refreshShow() end) - self.btnClose:addClickListener(function() + self.closeBtn:addClickListener(function() self:closeUI() end) self.btnLeft:addClickListener(function() @@ -191,7 +193,7 @@ function HeroDetailUI:changePage(panelType) end function HeroDetailUI:refreshShow() - self.txTitle:setText(self.heroEntity:getName()) + self.titleTx:setText(self.heroEntity:getName()) if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then self:showHeroInfo() elseif self.panelType == GConst.HeroConst.PANEL_TYPE.STAR then @@ -205,16 +207,16 @@ function HeroDetailUI:refreshShow() self.btnSkin:setActive(false) self.btnLeft:setActive(false) self.btnRight:setActive(false) - if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then - self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_LOOK_HERO) - end + -- if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then + -- self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_LOOK_HERO) + -- end else self.btnHero:setActive(true) self.btnStar:setActive(true) self.btnSkin:setActive(true) self.btnLeft:setActive(self:isShowLeftArrow()) self.btnRight:setActive(self:isShowRightArrow()) - self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_HERO) + -- self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_HERO) self:refreshRedPoint() end end diff --git a/lua/app/ui/hero/hero_info_comp.lua b/lua/app/ui/hero/hero_info_comp.lua index 0811cea6..3452e76e 100644 --- a/lua/app/ui/hero/hero_info_comp.lua +++ b/lua/app/ui/hero/hero_info_comp.lua @@ -1,16 +1,16 @@ local HeroInfoComp = class("HeroInfoComp", LuaComponent) local DEFAULT_FACTOR = GConst.BattleConst.DEFAULT_FACTOR -local BTN_ICON = {"common_btn_green_2", "common_btn_grey_2"} +local BTN_ICON = {"common_btn_blue_1", "common_btn_yellow_1", "common_btn_grey_1"} local SIZE_DELTA_Y_HERO = 942 local SIZE_DELTA_Y_LOOK = 802 function HeroInfoComp:init() local uiMap = self:getUIMap() - self.slider = uiMap["hero_info.fragment_bg.slider"] + -- self.slider = uiMap["hero_info.fragment_bg.slider"] self.imgSkill = uiMap["hero_info.skill_node.skill_icon"] - self.imgFragment = uiMap["hero_info.fragment_bg.fragment_icon"] + -- self.imgFragment = uiMap["hero_info.fragment_bg.fragment_icon"] self.btnUp = uiMap["hero_info.up.up_btn"] self.txUpdesc = uiMap["hero_info.up.up_btn.text"] self.btnUp5 = uiMap["hero_info.up.up_5_btn"] @@ -18,27 +18,27 @@ function HeroInfoComp:init() self.txLv = uiMap["hero_info.lv_desc"] self.txElement = uiMap["hero_info.element_bg.element_desc"] self.txSkill = uiMap["hero_info.skill_desc"] - self.btnSkillDesc = uiMap["hero_info.skill_desc.btn_skill_desc"] - self.txFragmentNum = uiMap["hero_info.fragment_bg.fragment_num"] - self.txHpName = uiMap["hero_info.bg_6.hp_name"] - self.txAtkName = uiMap["hero_info.atk_name"] - self.txHp = uiMap["hero_info.bg_6.hp"] - self.txAtk = uiMap["hero_info.atk"] - self.bgFragment = uiMap["hero_info.fragment_bg"] + self.btnskillDescTxs = uiMap["hero_info.skill_desc.btn_skill_desc"] + -- self.txFragmentNum = uiMap["hero_info.fragment_bg.fragment_num"] + self.txHpName = uiMap["hero_info.bg_6.hp_name_tx"] + self.txAtkName = uiMap["hero_info.bg_5.atk_name_tx"] + self.txHp = uiMap["hero_info.bg_6.hp_tx"] + self.txAtk = uiMap["hero_info.bg_5.atk_tx"] + -- self.bgFragment = uiMap["hero_info.fragment_bg"] self.spineObjSkill = uiMap["hero_info.ui_spine_obj_skill"] - self.spineObjLv = uiMap["hero_info.ui_spine_obj_lv"] + -- self.spineObjLv = uiMap["hero_info.ui_spine_obj_lv"] self.spineObj = uiMap["hero_info.ui_spine_obj"] self.upgrade = uiMap["hero_info.up"] self.bgElement = uiMap["hero_info.element_bg"] - self.btnAttr = uiMap["hero_info.bg_6.btn_attr"] + self.btnAttr = uiMap["hero_info.bg_6.attr_btn"] self.skill = {} self.skillIcon = {} - self.skillDesc = {} + self.skillDescTxs = {} for i = 1, 4 do self.skill[i] = uiMap["hero_info.skill_up_" .. i] self.skillIcon[i] = uiMap["hero_info.skill_up_" .. i .. ".icon"] - self.skillDesc[i] = uiMap["hero_info.skill_up_" .. i .. ".desc"] + self.skillDescTxs[i] = uiMap["hero_info.skill_up_" .. i .. ".desc_tx"] end self.costCells = {} @@ -47,7 +47,7 @@ function HeroInfoComp:init() end self.spineObjSkill:setVisible(false) - self.spineObjLv:setVisible(false) + -- self.spineObjLv:setVisible(false) self.spineObj:setVisible(false) self.txUpdesc:setText("升1级") self.txUpdesc5:setText("升5级") @@ -59,10 +59,10 @@ function HeroInfoComp:init() local canLvUpLv = self.heroEntity:getLvUpLv() ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId(), self.heroEntity, canLvUpLv) end) - self.btnSkillDesc:addClickListener(function() + self.btnskillDescTxs:addClickListener(function() local cfg = ConfigManager:getConfig("skill")[self.heroEntity:getBaseSkill()] if cfg.buff_id and #cfg.buff_id > 0 then - ModuleManager.TipsManager:showSkillTips(self.btnSkillDesc, cfg.buff_id) + ModuleManager.TipsManager:showSkillTips(self.btnskillDescTxs, cfg.buff_id) end end) self.btnAttr:addClickListener(function() @@ -97,14 +97,14 @@ function HeroInfoComp:refresh(checkLevel) local materials = self.heroEntity:getLvUpMaterials() or {} local fragmentCount = DataManager.BagData.ItemData:getItemNumById(self.heroEntity:getFragmentId()) local needFragmentCount = materials[1] or 1 - self.txFragmentNum:setText(fragmentCount .. "/" .. needFragmentCount) + -- self.txFragmentNum:setText(fragmentCount .. "/" .. needFragmentCount) - if fragmentCount >= needFragmentCount then - self.slider:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) - else - self.slider:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) - end - self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount + -- if fragmentCount >= needFragmentCount then + -- self.slider:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) + -- else + -- self.slider:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) + -- end + -- self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount local skillList = self.heroEntity:getRogueSkillList() local lv = self.heroEntity:getLv() @@ -115,7 +115,7 @@ function HeroInfoComp:refresh(checkLevel) local skillId = skillInfo[2] local skillBg = self.skill[i] local skillIcon = self.skillIcon[i] - local skillLv = self.skillDesc[i] + local skillLv = self.skillDescTxs[i] local nextLvUp = self.heroEntity:getNextRougeLvUp(i) skillBg:addClickListener(function() local cfg = ConfigManager:getConfig("skill_rogue")[skillId] @@ -144,10 +144,10 @@ function HeroInfoComp:refresh(checkLevel) end end - self.bgFragment:setVisible(not self.heroEntity:isMaxLv()) + -- self.bgFragment:setVisible(not self.heroEntity:isMaxLv()) local canLvUp = self.heroEntity:canLvUp() - self.imgFragment:setVisible(not canLvUp) + -- self.imgFragment:setVisible(not canLvUp) local lv = self.heroEntity:getLv() local str @@ -192,14 +192,14 @@ function HeroInfoComp:refresh(checkLevel) self.btnUp:removeRedPoint() end - self.spineObjLv:setVisible(canLvUp) + -- self.spineObjLv:setVisible(canLvUp) if canLvUp then self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[1]) - self.btnUp5:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[1]) - self.spineObjLv:playAnim("animation", true, false) - else - self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[2]) self.btnUp5:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[2]) + -- self.spineObjLv:playAnim("animation", true, false) + else + self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[3]) + self.btnUp5:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[3]) end self.btnUp:setTouchEnable(true) self.btnUp:setActive(not self.heroEntity:isMaxLv()) @@ -213,15 +213,15 @@ function HeroInfoComp:refresh(checkLevel) if self.onlyLook then -- 仅查看的不显示升级和激活按钮 self.upgrade:setVisible(false) - self.baseObject:setSizeDeltaY(SIZE_DELTA_Y_LOOK) - self.bgFragment:setVisible(false) - self.spineObjLv:setVisible(false) + -- self.baseObject:setSizeDeltaY(SIZE_DELTA_Y_LOOK) + -- self.bgFragment:setVisible(false) + -- self.spineObjLv:setVisible(false) self.txLv:setAnchoredPositionX(lvTxW / 2) else self.upgrade:setVisible(true) - self.baseObject:setSizeDeltaY(SIZE_DELTA_Y_HERO) + -- self.baseObject:setSizeDeltaY(SIZE_DELTA_Y_HERO) self.txLv:setAnchoredPositionX(-44) - self.bgFragment:setVisible(true) + -- self.bgFragment:setVisible(true) end end