2020-08-06 17:52:32 +08:00
|
|
|
---- 百宝商会活动弹窗 ----
|
2020-05-09 13:31:21 +08:00
|
|
|
require("Base/BasePanel")
|
|
|
|
local TreasureStorePopup = Inherit(BasePanel)
|
|
|
|
local this=TreasureStorePopup
|
|
|
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
|
|
|
function TreasureStorePopup:InitComponent()
|
|
|
|
this.panel=Util.GetGameObject(this.gameObject,"Panel")
|
|
|
|
this.backBtn=Util.GetGameObject(this.panel,"BackBtn")
|
|
|
|
this.time=Util.GetGameObject(this.panel,"Time")
|
|
|
|
|
|
|
|
this.scroll=Util.GetGameObject(this.panel,"Scroll")
|
|
|
|
this.scrollPre=Util.GetGameObject(this.scroll,"Pre")
|
|
|
|
this.scrollView=SubUIManager.Open(SubUIConfig.ScrollCycleView,this.scroll.transform,this.scrollPre, nil,--
|
|
|
|
Vector2.New(this.scroll.transform.rect.width,this.scroll.transform.rect.height),1,1,Vector2.New(0,10))
|
|
|
|
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 TreasureStorePopup:BindEvent()
|
|
|
|
Util.AddClick(this.backBtn,function()
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function TreasureStorePopup:AddListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
function TreasureStorePopup:RemoveListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
function TreasureStorePopup:OnOpen(...)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function TreasureStorePopup:OnShow()
|
|
|
|
this.RefreshPanel()
|
|
|
|
end
|
|
|
|
|
|
|
|
function TreasureStorePopup:OnClose()
|
|
|
|
if this.timer then
|
|
|
|
this.timer:Stop()
|
|
|
|
this.timer = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function TreasureStorePopup:OnDestroy()
|
|
|
|
this.scrollView=nil
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--刷新面板
|
|
|
|
function this.RefreshPanel()
|
|
|
|
-- this.TimeCountDown(timeDown)
|
|
|
|
local data={1,2,3}
|
|
|
|
this.scrollView:SetData(data,function(index,root)
|
|
|
|
this.SetScrollPre(root,data[index])
|
|
|
|
end)
|
|
|
|
this.scrollView:SetIndex(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
--设置每一条
|
|
|
|
function this.SetScrollPre(root,data)
|
|
|
|
local title=Util.GetGameObject(root,"Title"):GetComponent("Text")
|
|
|
|
local iRoot=Util.GetGameObject(root,"ItemRoot")
|
|
|
|
local oldNum=Util.GetGameObject(root,"OldNum"):GetComponent("Text")
|
|
|
|
local buyBtn=Util.GetGameObject(root,"BuyBtn")
|
|
|
|
local buyNum=Util.GetGameObject(root,"BuyBtn/BuyNum"):GetComponent("Text")
|
|
|
|
local tip=Util.GetGameObject(root,"Tip"):GetComponent("Text")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--倒计时
|
|
|
|
function this.TimeCountDown(timeDown)
|
|
|
|
if this.timer then
|
|
|
|
this.timer:Stop()
|
|
|
|
this.timer = nil
|
|
|
|
end
|
2020-06-23 18:36:24 +08:00
|
|
|
this.time.text = Language[10028]..TimeToHMS(timeDown)
|
2020-05-09 13:31:21 +08:00
|
|
|
this.timer = Timer.New(function()
|
|
|
|
if timeDown < 1 then
|
|
|
|
this.timer:Stop()
|
|
|
|
this.timer = nil
|
|
|
|
this.RefreshPanel()
|
|
|
|
return
|
|
|
|
end
|
|
|
|
timeDown = timeDown - 1
|
2020-06-23 18:36:24 +08:00
|
|
|
this.time.text = Language[10028]..TimeToHMS(timeDown)
|
2020-05-09 13:31:21 +08:00
|
|
|
end, 1, -1, true)
|
|
|
|
this.timer:Start()
|
|
|
|
end
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
return TreasureStorePopup
|