英雄背景替换修改出发位置

zhangqiang 2020-08-25 15:11:32 +08:00
parent 4117095996
commit f19188797f
2 changed files with 29 additions and 27 deletions

View File

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

View File

@ -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()
-- --是否为最大等级