【特权优化】 vip 公会 vip 升级战力提升

dev_chengFeng
zhangqiang 2021-03-30 19:49:49 +08:00
parent 365a694eca
commit cfaeff6759
4 changed files with 5949 additions and 19232 deletions

File diff suppressed because it is too large Load Diff

View File

@ -111,21 +111,10 @@ function GuildMainCityPanel:InitComponent()
this.btnResult = Util.GetGameObject(this.rightBox, "result")
this.btnRedPacket=Util.GetGameObject(this.rightBox,"redPacket")
this.btnRedPacketRedPoint=Util.GetGameObject(this.btnRedPacket,"redPoint")
-- 嚣张的头像
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)
if not this.playerInfoView then
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
end
-- 聊天
this.ChatTipView = SubUIManager.Open(SubUIConfig.ChatTipView, self.transform, 2)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
@ -222,19 +211,8 @@ function GuildMainCityPanel:BindEvent()
UIManager.OpenPanel(UIName.RedPacketPanel)
end)
-- 点击你的猪头
Util.AddClick(this.headBox, function ()
UIManager.OpenPanel(UIName.SettingPanel)
end)
Util.AddClick(this.vipPrivilegeBtn, function()
UIManager.OpenPanel(UIName.VipPanelV2)
end)
-- 绑定红点
BindRedPointObject(RedPointType.Guild_RedPacket, this.btnRedPacketRedPoint)
BindRedPointObject(RedPointType.Setting, this.headRedpot)
BindRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
end
--添加事件监听(用于子类重写)
@ -249,7 +227,6 @@ function GuildMainCityPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.GuildFight.AttackStageDefendDataUpdate, this.RefreshGetStar)
Game.GlobalEvent:AddEvent(GameEvent.GuildRedPacket.OnCloseRedPointClick, this.CloseRedPointClick)
Game.GlobalEvent:AddEvent(GameEvent.Guild.RefreshDeathPosStatus, this.RefreshDeathPos)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnChangeName, this.FreshPlayerInfo)
end
--移除事件监听(用于子类重写)
@ -264,7 +241,6 @@ function GuildMainCityPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.GuildFight.AttackStageDefendDataUpdate, this.RefreshGetStar)
Game.GlobalEvent:RemoveEvent(GameEvent.GuildRedPacket.OnCloseRedPointClick, this.CloseRedPointClick)
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.RefreshDeathPosStatus, this.RefreshDeathPos)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnChangeName, this.FreshPlayerInfo)
end
--界面打开时调用(用于子类重写)
@ -301,8 +277,6 @@ function GuildMainCityPanel:OnShow()
this._TimeCounter = Timer.New(this._TimeUpdate, 1, -1, true)
this._TimeCounter:Start()
end
this.FreshPlayerInfo()
this.SetPlayerHead()
if not RECHARGEABLE then--(是否开启充值)
this.btnRedPacket:SetActive(false)
@ -315,34 +289,13 @@ function GuildMainCityPanel:OnShow()
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
function this:OnSortingOrderChange()
if this.playerHead then
this.playerHead:SetLayer(self.sortingOrder)
end
if this.playerInfoView then
this.playerInfoView:SetLayer(self.sortingOrder)
end
end
function this.RefreshStageShow()
-- 关闭按钮显示
@ -594,8 +547,6 @@ function GuildMainCityPanel:OnDestroy()
-- 清除红点
ClearRedPointObject(RedPointType.Guild_RedPacket, this.btnRedPacketRedPoint)
ClearRedPointObject(RedPointType.Setting, this.headRedpot)
ClearRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
this.playerHead = nil
@ -604,6 +555,10 @@ function GuildMainCityPanel:OnDestroy()
this.LiveName = nil
this.LiveGO = nil
end
if this.playerInfoView then
SubUIManager.Close(this.playerInfoView)
this.playerInfoView = nil
end
end
return GuildMainCityPanel

View File

@ -25,19 +25,11 @@ function VipPanelV2:InitComponent()
screenAdapte(self.bg)
end
if not this.playerInfoView then
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
end
this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.transform)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
-- 嚣张的头像
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")
-- self.BtnBack = Util.GetGameObject(self.transform, "btnBack")
-- this.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
-- this.helpPosition=this.helpBtn:GetComponent("RectTransform").localPosition
@ -90,28 +82,6 @@ function VipPanelV2:InitComponent()
end
end
-- 刷新玩家信息显示
function this.FreshPlayerInfo()
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
function VipPanelV2:BindEvent()
--帮助按钮
@ -171,16 +141,17 @@ function VipPanelV2:OnSortingOrderChange()
Util.AddParticleSortLayer(self.effect, self.sortingOrder - orginLayer)
orginLayer = self.sortingOrder
-- 头像层级
if this.playerHead then
this.playerHead:SetLayer(self.sortingOrder)
-- if this.playerHead then
-- this.playerHead:SetLayer(self.sortingOrder)
-- end
if this.playerInfoView then
this.playerInfoView:SetLayer(self.sortingOrder)
end
end
function VipPanelV2:OnShow()
self:InitVipContext()
self:SetPanelStatus()
this.FreshPlayerInfo()
this.SetPlayerHead()
end
function VipPanelV2:OnClose()
@ -199,9 +170,13 @@ function VipPanelV2:OnDestroy()
SubUIManager.Close(this.UpView)
SubUIManager.Close(this.BtView)
SubUIManager.Close(this.playerHead)
this.playerHead = nil
-- this.playerHead = nil
this.UpView = nil
this.BtView = nil
if this.playerInfoView then
SubUIManager.Close(this.playerInfoView)
this.playerInfoView = nil
end
end
function VipPanelV2:InitVipContext()
@ -490,9 +465,14 @@ function VipPanelV2:OnTurnRightBtnClicked()
end
function VipPanelV2:OnBtnLvUpClicked()
local oldPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
NetManager.RequestVipLevelUp(function(respond)
self:OnShow()
SoundManager.PlaySound(SoundConfig.Sound_VipUpLevel)
local newPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
if oldPowerNum ~= newPowerNum then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPowerNum,newValue = newPowerNum})
end
end)
end