【特权优化】将界面顶部的特权等级移回-神将、背包界面修改,修复战斗和vip等级不及时刷新的问题

dev_chengFeng
gaoxin 2021-03-30 18:42:30 +08:00
parent 202658d6d9
commit 3cc0b51edd
6 changed files with 41 additions and 13494 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,9 @@ function BagPanel:InitComponent()
tabs1[i] = Util.GetGameObject(self.transform, "box/Btn" .. i)
tabs1RedPoint[i] = Util.GetGameObject(self.transform, "box/Btn" .. i .. "/redPoint")
end
if not this.playerInfoView then
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
end
this.selectBtn1 = Util.GetGameObject(self.gameObject, "selectBtn")
this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
@ -34,23 +37,6 @@ function BagPanel:InitComponent()
this.EffectOrginLayer = 0
this.mask = Util.GetGameObject(self.gameObject, "mask")
-- 嚣张的头像
this.level = Util.GetGameObject(self.gameObject, "LeftUp/headBox/lvFrame/lv"):GetComponent("Text")
this.playName = Util.GetGameObject(self.gameObject, "LeftUp/headBox/name"):GetComponent("Text")
this.expSliderValue = Util.GetGameObject(self.gameObject, "LeftUp/headBox/exp"):GetComponent("Slider")
this.expSliderValue.transform.localScale = Vector3.New(UIManager.adapterScale, 1, 1)
this.headBox = Util.GetGameObject(self.gameObject, "LeftUp/headBox")
this.headPos = Util.GetGameObject(self.gameObject, "LeftUp/headBox/headpos")
this.headRedpot = Util.GetGameObject(self.gameObject, "LeftUp/headBox/redpot")
this.teamPower = Util.GetGameObject(self.gameObject, "LeftUp/powerBtn/value"):GetComponent("Text")
-- 特权
this.vipPrivilegeBtn = Util.GetGameObject(self.gameObject, "LeftUp/vipPrivilege/vipPrivilegeBtn")
this.vipLevelText = Util.GetGameObject(this.vipPrivilegeBtn, "bg/vip"):GetComponent("Image")
this.vipRedPoint = Util.GetGameObject(self.gameObject, "LeftUp/vipPrivilege/redPoint")
screenAdapte(this.vipPrivilegeBtn)
--无信息图片
this.noneImage=Util.GetGameObject(self.gameObject,"NoneImage")
end
@ -93,19 +79,8 @@ function BagPanel:BindEvent()
end
end)
-- 点击你的猪头
Util.AddClick(this.headBox, function ()
UIManager.OpenPanel(UIName.SettingPanel)
end)
Util.AddClick(this.vipPrivilegeBtn, function()
UIManager.OpenPanel(UIName.VipPanelV2)
end)
BindRedPointObject(RedPointType.Bag_HeroDebris, tabs1RedPoint[ItemBaseType.HeroChip])
BindRedPointObject(RedPointType.Bag_BoxAndBlueprint, tabs1RedPoint[ItemBaseType.Special])
BindRedPointObject(RedPointType.Setting, this.headRedpot)
BindRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
end
@ -492,7 +467,6 @@ function BagPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Bag.OnTempBagChanged, this.BagGoldChangeCallBackOnClickTabBtn)
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.BagGoldChangeCallBackOnClickTabBtn)
Game.GlobalEvent:AddEvent(GameEvent.Bag.OnRefreshSoulPanelData, this.OnRefreshSoulPanelBagData)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnChangeName, this.FreshPlayerInfo)
Game.GlobalEvent:AddEvent(GameEvent.Bag.OnBagShowWarPowerChange, this.ShowWarPowerChange)
end
@ -502,7 +476,6 @@ function BagPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.OnTempBagChanged, this.BagGoldChangeCallBackOnClickTabBtn)
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.BagGoldChangeCallBackOnClickTabBtn)
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.OnRefreshSoulPanelData, this.OnRefreshSoulPanelBagData)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnChangeName, this.FreshPlayerInfo)
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.OnBagShowWarPowerChange, this.ShowWarPowerChange)
end
--界面打开时调用(用于子类重写)
@ -533,8 +506,6 @@ function BagPanel:OnShow()
BagManager.isBagPanel = true
this.SetBottomBarIsActive()
this.FreshPlayerInfo()
this.SetPlayerHead()
end
--特殊的开启条件
function this.SetBottomBarIsActive()
@ -555,32 +526,9 @@ function this.SetBottomBarIsActive()
end
end
-- 刷新玩家信息显示
function this.FreshPlayerInfo()
this.vipLevelText.sprite = VipManager.SetVipLevelImg()
this.level.text = PlayerManager.level
this.expSliderValue.value = PlayerManager.exp / PlayerManager.userLevelData[PlayerManager.level].Exp
this.playName.text = PlayerManager.nickName
this.teamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
end
-- 设置头像
function this.SetPlayerHead()
if not this.playerHead then
this.playerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, this.headPos.transform)
end
this.playerHead:SetHead(PlayerManager.head)
this.playerHead:SetFrame(HeadManager.GetCurFrameId())
this.playerHead:SetScale(Vector3.one * 0.9)
this.playerHead:SetPosition(Vector3.New(-5, 8, 0))
this.playerHead:SetLayer(this.sortingOrder)
this.playerHead:SetEffectScale(0.85)
end
local orginLayer
function BagPanel:OnSortingOrderChange()
Util.AddParticleSortLayer(this.ItemViewEffect, self.sortingOrder - this.EffectOrginLayer)
Util.AddParticleSortLayer(this.vipPrivilegeBtn, self.sortingOrder - this.EffectOrginLayer)
--特效层级重设
for i=1,#list do
@ -589,9 +537,9 @@ function BagPanel:OnSortingOrderChange()
orginLayer = this.sortingOrder
this.EffectOrginLayer = self.sortingOrder
this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder })
-- 头像层级
if this.playerHead then
this.playerHead:SetLayer(self.sortingOrder)
if this.playerInfoView then
this.playerInfoView:SetLayer(self.sortingOrder)
end
end
--界面关闭时调用(用于子类重写)
@ -799,6 +747,11 @@ function BagPanel:OnDestroy()
list={}
orginLayer2=0
orginLayer=0
if this.playerInfoView then
SubUIManager.Close(this.playerInfoView)
this.playerInfoView = nil
end
end
--跳转显示新手提示圈

View File

@ -175,6 +175,7 @@ function this:InitComponent()
if not this.playerInfoView then
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
this.playerInfoView:SetPrivilegeShow(true)
end
this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.transform)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)

View File

@ -33,6 +33,9 @@ function RoleListPanel:InitComponent()
--this.fenJieBtn:SetActive(false)
this.formationBtn = Util.GetGameObject(self.gameObject, "formationBtn")
if not this.playerInfoView then
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
end
this.BtView =SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
@ -42,26 +45,7 @@ function RoleListPanel:InitComponent()
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
-- 嚣张的头像
this.level = Util.GetGameObject(self.gameObject, "LeftUp/headBox/lvFrame/lv"):GetComponent("Text")
this.playName = Util.GetGameObject(self.gameObject, "LeftUp/headBox/name"):GetComponent("Text")
this.expSliderValue = Util.GetGameObject(self.gameObject, "LeftUp/headBox/exp"):GetComponent("Slider")
this.expSliderValue.transform.localScale = Vector3.New(UIManager.adapterScale, 1, 1)
this.headBox = Util.GetGameObject(self.gameObject, "LeftUp/headBox")
this.headPos = Util.GetGameObject(self.gameObject, "LeftUp/headBox/headpos")
this.headRedpot = Util.GetGameObject(self.gameObject, "LeftUp/headBox/redpot")
this.teamPower = Util.GetGameObject(self.gameObject, "LeftUp/powerBtn/value"):GetComponent("Text")
this.maxk = Util.GetGameObject(self.gameObject, "maxk")
-- 特权
this.vipPrivilegeBtn = Util.GetGameObject(self.gameObject, "LeftUp/vipPrivilege/vipPrivilegeBtn")
this.vipLevelText = Util.GetGameObject(this.vipPrivilegeBtn, "bg/vip"):GetComponent("Image")
this.vipRedPoint = Util.GetGameObject(self.gameObject, "LeftUp/vipPrivilege/redPoint")
screenAdapte(this.vipPrivilegeBtn)
end
--绑定事件(用于子类重写)
@ -116,20 +100,6 @@ function RoleListPanel:BindEvent()
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(54))
end
end)
-- 点击你的猪头
Util.AddClick(this.headBox, function ()
UIManager.OpenPanel(UIName.SettingPanel)
end)
BindRedPointObject(RedPointType.Setting, this.headRedpot)
Util.AddClick(this.vipPrivilegeBtn, function()
UIManager.OpenPanel(UIName.VipPanelV2)
end)
BindRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
end
--添加事件监听(用于子类重写)
@ -143,7 +113,6 @@ function RoleListPanel:RemoveListener()
end
function this:OnSortingOrderChange()
Util.AddParticleSortLayer(this.vipPrivilegeBtn, self.sortingOrder - orginLayer)
this.ScrollView:ForeachItemGO(function (index, go)
Util.AddParticleSortLayer(go, self.sortingOrder - orginLayer)
end)
@ -151,8 +120,8 @@ function this:OnSortingOrderChange()
this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder })
-- 头像层级
if this.playerHead then
this.playerHead:SetLayer(self.sortingOrder)
if this.playerInfoView then
this.playerInfoView:SetLayer(self.sortingOrder)
end
end
@ -186,32 +155,6 @@ function RoleListPanel:OnShow()
-- if this.ScrollView then
-- this.ScrollView:SetIndex(1)
-- end
this.FreshPlayerInfo()
this.SetPlayerHead()
end
-- 刷新玩家信息显示
function this.FreshPlayerInfo()
this.vipLevelText.sprite = VipManager.SetVipLevelImg()
this.level.text = PlayerManager.level
this.expSliderValue.value = PlayerManager.exp / PlayerManager.userLevelData[PlayerManager.level].Exp
this.playName.text = PlayerManager.nickName
this.teamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
end
-- 设置头像
function this.SetPlayerHead()
if not this.playerHead then
this.playerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, this.headPos.transform)
end
this.playerHead:SetHead(PlayerManager.head)
this.playerHead:SetFrame(HeadManager.GetCurFrameId())
this.playerHead:SetScale(Vector3.one * 0.9)
this.playerHead:SetPosition(Vector3.New(-5, 8, 0))
this.playerHead:SetLayer(this.sortingOrder)
this.playerHead:SetEffectScale(0.85)
end
--组合当前选项数据
@ -420,6 +363,11 @@ function RoleListPanel:OnDestroy()
ClearRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
this.ScrollView = nil
if this.playerInfoView then
SubUIManager.Close(this.playerInfoView)
this.playerInfoView = nil
end
end
return RoleListPanel

View File

@ -52,7 +52,9 @@ end
--添加事件监听(用于子类重写)
function PlayerInfoView:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, self.OnShow, self)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerLvChange, self.OnShow, self)
Game.GlobalEvent:AddEvent(GameEvent.Formation.OnFormationChange, self.RefreshPower, self)
-- 绑定红点
BindRedPointObject(RedPointType.Setting, self.headRedpot)
@ -61,7 +63,9 @@ end
--移除事件监听(用于子类重写)
function PlayerInfoView:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, self.OnShow, self)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerLvChange, self.OnShow, self)
Game.GlobalEvent:RemoveEvent(GameEvent.Formation.OnFormationChange, self.RefreshPower, self)
-- 解除绑定
ClearRedPointObject(RedPointType.Setting, self.headRedpot)
@ -72,6 +76,9 @@ end
function PlayerInfoView:OnOpen(...)
self.orginLayer = 0
self:OnShow()
self:RefreshPower()
-- 默认关闭特权显示
self:SetPrivilegeShow(false)
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
@ -79,7 +86,6 @@ function PlayerInfoView:OnShow()
self.level.text = PlayerManager.level
self.expSliderValue.value = PlayerManager.exp / PlayerManager.userLevelData[PlayerManager.level].Exp
self.playName.text = PlayerManager.nickName
self.heroTeamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
self.vipLevelText.sprite = VipManager.SetVipLevelImg()
@ -95,6 +101,10 @@ function PlayerInfoView:OnShow()
end
function PlayerInfoView:RefreshPower()
self.heroTeamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
end
--界面关闭时调用(用于子类重写)
function PlayerInfoView:OnClose()
-- 头像回收
@ -117,5 +127,8 @@ function PlayerInfoView:SetLayer(sortingOrder)
self.orginLayer = sortingOrder
end
function PlayerInfoView:SetPrivilegeShow(isShow)
self.vipPrivilegeBtn:SetActive(not not isShow)
end
return PlayerInfoView