From f19188797f5e6239fa2e4122febfb01697a88ca1 Mon Sep 17 00:00:00 2001 From: zhangqiang <657634622@qq.com> Date: Tue, 25 Aug 2020 15:11:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E8=83=8C=E6=99=AF=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E4=BF=AE=E6=94=B9=E5=87=BA=E5=8F=91=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HandBook/HandBookHeroInfoPanel.lua | 26 +++++++++------- .../~Lua/Modules/RoleInfo/RoleInfoPanel.lua | 30 +++++++++---------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/HandBook/HandBookHeroInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/HandBook/HandBookHeroInfoPanel.lua index ca15aec2ed..5381fec7d0 100644 --- a/Assets/ManagedResources/~Lua/Modules/HandBook/HandBookHeroInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/HandBook/HandBookHeroInfoPanel.lua @@ -21,9 +21,9 @@ local _rightStar=0 function HandBookHeroInfoPanel:InitComponent() self.btnBack = Util.GetGameObject(self.transform, "btnBack") - self.bgImageList = {} + this.bgImageList = {} for i = 1, 4 do - self.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di ("..i..")") + this.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di ("..i..")") end self.curObj= Util.GetGameObject(self.transform, "curObj") self.leftObj= Util.GetGameObject(self.transform, "leftObj") @@ -185,17 +185,11 @@ function HandBookHeroInfoPanel:OnShow() self:SetSelectBtn(self.btnStart, Language[11097]) --self.curLiveObj = self:LoadHerolive(heroConFigData,self.curObj) self.dragView:SetDragGO(this.curLiveObj) - + this.SetPanelBg(heroConFigData) end --展示英雄信息 第一个参数1 属性面板 2 故事面板 第二个参数 1初始 2 6星和10星 第三个参数 显示星级 function HandBookHeroInfoPanel:OnShowHeroData(_type,_starType,_star) - for i = 1, 4 do - if heroConFigData.PropertyName == i then - self.bgImageList[i]:SetActive(true) - else - self.bgImageList[i]:SetActive(false) - end - end + self.dragView:SetDragGO(this.curLiveObj) type = _type @@ -420,6 +414,7 @@ function HandBookHeroInfoPanel:RightBtnOnClick() heroDatas = PlayerManager.heroHandBookListData[_curStar] end heroConFigData = heroDatas[index] + this.SetPanelBg(heroConFigData) if this.leftLiveObj then poolManager:UnLoadLive(GetResourcePath(leftHeroData.Live), this.leftLiveObj) this.leftLiveObj = nil @@ -463,7 +458,7 @@ function HandBookHeroInfoPanel:LeftBtnOnClick() heroDatas = PlayerManager.heroHandBookListData[_curStar] end heroConFigData = heroDatas[index] - + this.SetPanelBg(heroConFigData) if this.rightLiveObj then poolManager:UnLoadLive(GetResourcePath(rightHeroData.Live), this.rightLiveObj) this.rightLiveObj = nil @@ -548,6 +543,15 @@ function HandBookHeroInfoPanel:SortHeroNatural(heroList) end end) end +function this.SetPanelBg(heroData) + for i = 1, 4 do + if heroData.PropertyName == i then + this.bgImageList[i]:SetActive(true) + else + this.bgImageList[i]:SetActive(false) + end + end +end --界面销毁时调用(用于子类重写) function HandBookHeroInfoPanel:OnDestroy() diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua index 734f0ebe92..4d216e5094 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua @@ -44,9 +44,9 @@ local pinjieImage={"r_hero_pinjiebiao_01","r_hero_pinjiebiao_02"} --该死的品 function RoleInfoPanel:InitComponent() self.BtnBack = Util.GetGameObject(self.transform, "btnBack") - self.bgImageList = {} + this.bgImageList = {} for i = 1, 4 do - self.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di ("..i..")") + this.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di ("..i..")") end this.optionUp=Util.GetGameObject(self.gameObject,"optionUp")--上部按钮组 this.helpBtn = Util.GetGameObject(this.optionUp, "helpBtn") @@ -378,6 +378,7 @@ function RoleInfoPanel:OnShow() RoleInfoPanel:OnClickBtnInfo()--初始化是默认显示详情 this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.RoleInfo }) FixedUpdateBeat:Add(this.OnUpdate, self)--长按方法注册 + this.SetPanelBg(curHeroData.heroConfig) end --刷新面板 @@ -419,13 +420,6 @@ function this:LoadHerolive(_heroData, _objPoint) end --更新界面显示 function this:UpdatePanelData() - for i = 1, 4 do - if curHeroData.heroConfig.PropertyName == i then - self.bgImageList[i]:SetActive(true) - else - self.bgImageList[i]:SetActive(false) - end - end this:UpdateHeroInfoData()--详情 RoleInfoPanel:GetCurHeroUpLvOrUpStarSData()--获取升级 突破 进阶数据 this:UpdateHeroUpLvAndBreakData()--升级 @@ -436,13 +430,6 @@ function this:UpdatePanelData() RoleInfoPanel:SetSelectBtn(self.btnInfo, Language[11836]) return end - for i = 1, 4 do - if curHeroData.heroConfig.PropertyName == i then - self.bgImageList[i]:SetActive(true) - else - self.bgImageList[i]:SetActive(false) - end - end end --更新英雄情报数据 function this:UpdateHeroInfoData() @@ -1132,6 +1119,7 @@ function this:RightBtnOnClick() local oldIndexConfigData = heroDatas[index] index = (index + 1 <= #heroDatas and index + 1 or 1) curHeroData = heroDatas[index] + this.SetPanelBg(curHeroData.heroConfig) if this.leftLiveObj then poolManager:UnLoadLive(leftHeroData.live, this.leftLiveObj) this.leftLiveObj = nil @@ -1161,6 +1149,7 @@ function this:LeftBtnOnClick() local oldIndexConfigData = heroDatas[index] index = (index - 1 > 0 and index - 1 or #heroDatas) curHeroData = heroDatas[index] + this.SetPanelBg(curHeroData.heroConfig) if this.rightLiveObj then poolManager:UnLoadLive(rightHeroData.live, this.rightLiveObj) this.rightLiveObj = nil @@ -1571,6 +1560,15 @@ function RoleInfoPanel:OnEndDrag(Pointgo, data) end distance=0 end +function this.SetPanelBg(heroData) + for i = 1, 4 do + if heroData.PropertyName == i then + this.bgImageList[i]:SetActive(true) + else + this.bgImageList[i]:SetActive(false) + end + end +end --升级红点 --function RoleInfoPanel:LvUpBtnRedPoint() -- --是否为最大等级