2020-05-09 13:31:21 +08:00
|
|
|
----- 公会十绝阵奖励弹窗 -----
|
|
|
|
require("Base/BasePanel")
|
|
|
|
local DeathPosRewardPopup = Inherit(BasePanel)
|
|
|
|
local this = DeathPosRewardPopup
|
|
|
|
|
|
|
|
function DeathPosRewardPopup:InitComponent()
|
|
|
|
this.panel=Util.GetGameObject(this.gameObject,"Panel")
|
|
|
|
this.backBtn=Util.GetGameObject(this.panel,"BackBtn")
|
|
|
|
this.scroll=Util.GetGameObject(this.panel,"Scroll")
|
|
|
|
this.pre=Util.GetGameObject(this.scroll,"Pre")
|
|
|
|
this.scrollView=SubUIManager.Open(SubUIConfig.ScrollCycleView,this.scroll.transform,
|
|
|
|
this.pre,nil,Vector2.New(this.scroll.transform.rect.width,this.scroll.transform.rect.height),1,3,Vector2.New(10,5))--生成滚动条,设置属性
|
|
|
|
--设置滚动条
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchoredPosition= Vector2.New(0,0)
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
|
|
|
|
this.scrollView.moveTween.MomentumAmount = 1
|
|
|
|
this.scrollView.moveTween.Strength = 2
|
|
|
|
end
|
|
|
|
|
|
|
|
function DeathPosRewardPopup:BindEvent()
|
|
|
|
Util.AddClick(this.backBtn,function()
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function DeathPosRewardPopup:AddListener()
|
2020-05-11 09:38:52 +08:00
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Guild.RefreshDeathPosStatus, this.RefreshPanel)
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function DeathPosRewardPopup:RemoveListener()
|
2020-05-11 09:38:52 +08:00
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.RefreshDeathPosStatus, this.RefreshPanel)
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
function DeathPosRewardPopup:OnOpen(...)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function DeathPosRewardPopup:OnShow()
|
|
|
|
this.RefreshPanel()
|
|
|
|
end
|
|
|
|
|
|
|
|
function DeathPosRewardPopup:OnClose()
|
|
|
|
end
|
|
|
|
|
|
|
|
function DeathPosRewardPopup:OnDestroy()
|
|
|
|
this.scrollView=nil
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--刷新面板
|
|
|
|
function this.RefreshPanel()
|
2020-05-11 09:38:52 +08:00
|
|
|
if DeathPosManager.status==DeathPosStatus.Close then
|
|
|
|
this:ClosePanel()
|
|
|
|
return
|
|
|
|
end
|
|
|
|
if DeathPosManager.status== DeathPosStatus.Fight then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
NetManager.GetAllDeathPathRewardInfoResponse(function(msg)
|
|
|
|
local data=msg.info
|
|
|
|
this.scrollView:SetData(data,function(index,root)
|
|
|
|
this.SetScrollPre(root,data[index],index)
|
|
|
|
end)
|
|
|
|
this.scrollView:SetIndex(1)
|
2020-05-09 13:31:21 +08:00
|
|
|
end)
|
2020-05-11 09:38:52 +08:00
|
|
|
|
|
|
|
-- local data={1,2,3,4,5}--临时数据
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--设置每个预设
|
2020-05-11 09:38:52 +08:00
|
|
|
function this.SetScrollPre(root,data,index)
|
2020-05-09 13:31:21 +08:00
|
|
|
local itemRoot=Util.GetGameObject(root,"Root")
|
|
|
|
local name=Util.GetGameObject(root,"Name"):GetComponent("Text")
|
2020-05-11 09:38:52 +08:00
|
|
|
local btn=Util.GetGameObject(root,"Button")
|
|
|
|
Log(data.uid.." "..data.itemId.." "..data.itemCount.." "..data.position)
|
|
|
|
|
|
|
|
Util.AddOnceClick(btn,function()
|
|
|
|
NetManager.DoRewardDeathPathRequest(index,function(msg)
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function ()
|
|
|
|
-- this.RefreshPanel()
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
return DeathPosRewardPopup
|