百宝商会活动添加
parent
def3e829ff
commit
c3cce0b06e
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9325e6dfe13e9ce4fb2fc3f7afacce09
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -139,6 +139,7 @@ function this:InitComponent()
|
|||
|
||||
--百宝商会
|
||||
this.treasureStoreBtn=Util.GetGameObject(self.transform,"RightUp/treasureStoreBtn")
|
||||
this.treasureStoreTime=Util.GetGameObject(this.treasureStoreBtn,"time"):GetComponent("Text")
|
||||
this.treasureStoreRedPoint=Util.GetGameObject(this.treasureStoreBtn,"redPoint")
|
||||
---- 招财猫
|
||||
--this.luckyCatBtn = Util.GetGameObject(self.gameObject, "RightUp/luckyCat")
|
||||
|
@ -1443,6 +1444,20 @@ function this.TimeFormat()
|
|||
end
|
||||
end
|
||||
|
||||
--云梦祈福
|
||||
local treasureStore = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureStore)
|
||||
if treasureStore and treasureStore > 0 then
|
||||
local info = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.TreasureStore)
|
||||
local tempTime = info.endTime - PlayerManager.serverTime
|
||||
if tempTime>= 86400 then
|
||||
this.treasureStoreTime.text = TimeToDH(tempTime)
|
||||
else
|
||||
this.treasureStoreTime.text = TimeToHMS(tempTime)
|
||||
end
|
||||
else
|
||||
this.treasureStoreBtn.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
-- 巅峰赛
|
||||
local function SetTopMatchActive(isActive)
|
||||
if isActive ~= this.isTopMatchShow then
|
||||
|
@ -1667,6 +1682,10 @@ function this.RefreshActivityBtn(context)
|
|||
elseif context.type==ActivityTypeDef.DynamicAct then
|
||||
isRefeshIcon = true
|
||||
this.btnDynamicActivity:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct))
|
||||
|
||||
elseif context.type==ActivityTypeDef.TreasureStore then
|
||||
isRefeshIcon = true
|
||||
this.treasureStoreBtn:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureStore))
|
||||
end
|
||||
if ActTimeCtrlManager.IsQualifiled(42) then
|
||||
this.expert:SetActive(ActivityGiftManager.GetExpertActiveisOpen() > 0)
|
||||
|
@ -1729,8 +1748,7 @@ function this.RefreshActivityShow()
|
|||
|
||||
this.rechargeBtn:SetActive(ActTimeCtrlManager.IsQualifiled(36)) --ActTimeCtrlManager.IsQualifiled(36))
|
||||
this.packageGiftBtn:SetActive(ActTimeCtrlManager.IsQualifiled(40))
|
||||
|
||||
|
||||
this.treasureStoreBtn:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureStore))
|
||||
this.questionnaireBtn:SetActive(QuestionnaireManager.GetQuestionState() == 0)
|
||||
--轮转活动 限时召唤 乾坤宝盒
|
||||
this.btnDynamicActivity:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct))
|
||||
|
@ -1842,6 +1860,7 @@ end
|
|||
this.sgName.text=ConfigManager.GetConfigData(ConfigName.ItemConfig,itemId).Name
|
||||
end
|
||||
function this.RefreshBattleUpLvTip()
|
||||
this.battleUpLvTip:GetComponent("Canvas").sortingOrder = orginLayer + 10
|
||||
this.battleUpLvTip:SetActive(true)
|
||||
end
|
||||
-- 刷新公会战图标显示
|
||||
|
|
|
@ -3,15 +3,17 @@ require("Base/BasePanel")
|
|||
local TreasureStorePopup = Inherit(BasePanel)
|
||||
local this=TreasureStorePopup
|
||||
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
|
||||
local GlobalActivity = ConfigManager.GetConfig(ConfigName.GlobalActivity)
|
||||
local itemsGrid = {}
|
||||
local isPlayAnim = true
|
||||
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.time=Util.GetGameObject(this.panel,"Time"):GetComponent("Text")
|
||||
|
||||
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,--
|
||||
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)
|
||||
|
@ -38,7 +40,9 @@ function TreasureStorePopup:OnOpen(...)
|
|||
end
|
||||
|
||||
function TreasureStorePopup:OnShow()
|
||||
this.RefreshPanel()
|
||||
this:RefreshPanel()
|
||||
this:TimeCountDown()
|
||||
isPlayAnim = true
|
||||
end
|
||||
|
||||
function TreasureStorePopup:OnClose()
|
||||
|
@ -49,44 +53,135 @@ function TreasureStorePopup:OnClose()
|
|||
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
|
||||
this.scrollView=nil
|
||||
itemsGrid = nil
|
||||
end
|
||||
|
||||
--刷新面板
|
||||
function TreasureStorePopup:RefreshPanel()
|
||||
local allData = {}
|
||||
local curActId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureStore)
|
||||
if not curActId then
|
||||
return
|
||||
end
|
||||
local data = GlobalActivity[curActId].CanBuyRechargeId
|
||||
for i = 1, #data do
|
||||
local data = ConfigManager.GetConfigDataByKey(ConfigName.RechargeCommodityConfig, "Id", data[i])
|
||||
table.insert(allData,data)
|
||||
end
|
||||
if allData then
|
||||
allData = this.SortData(allData)
|
||||
this.scrollView:SetData(allData, function (index, go)
|
||||
this:SetScrollPre(go, allData[index])
|
||||
end)
|
||||
end
|
||||
if isPlayAnim then
|
||||
SecTorPlayAnimByScroll(this.scrollView)
|
||||
isPlayAnim = false
|
||||
end
|
||||
this.scrollView:SetIndex(1)
|
||||
|
||||
end
|
||||
function this.SortData(allData)
|
||||
if allData==nil then
|
||||
return
|
||||
end
|
||||
table.sort(allData, function(a,b)
|
||||
local aboughtNum = a.Limit - OperatingManager.GetGoodsBuyTime(GoodsTypeDef.DirectPurchaseGift, a.Id) > 0 and 2 or 1
|
||||
local bboughtNum = b.Limit - OperatingManager.GetGoodsBuyTime(GoodsTypeDef.DirectPurchaseGift, b.Id) > 0 and 2 or 1
|
||||
if aboughtNum == bboughtNum then
|
||||
return a.Id < b.Id
|
||||
else
|
||||
return aboughtNum > bboughtNum
|
||||
end
|
||||
end)
|
||||
return allData
|
||||
end
|
||||
--设置每一条
|
||||
function this:SetScrollPre(root,data)
|
||||
if isPlayAnim then
|
||||
root.gameObject:SetActive(false)
|
||||
else
|
||||
root.gameObject:SetActive(true)
|
||||
end
|
||||
local title=Util.GetGameObject(root,"Title"):GetComponent("Text")
|
||||
local iRoot=Util.GetGameObject(root,"ItemRoot")
|
||||
local buyBtn=Util.GetGameObject(root,"BuyBtn")
|
||||
local buyNum=Util.GetGameObject(root,"BuyBtn/BuyNum"):GetComponent("Text")
|
||||
local tip=Util.GetGameObject(root,"Tip"):GetComponent("Text")
|
||||
|
||||
title.text = data.Name
|
||||
local rewardArray = data.RewardShow
|
||||
if not itemsGrid then
|
||||
itemsGrid = {}
|
||||
end
|
||||
--滚动条复用重设itemview
|
||||
if not itemsGrid[root] then
|
||||
itemsGrid[root] = {}
|
||||
end
|
||||
for i = 1, #itemsGrid[root] do
|
||||
itemsGrid[root][i].gameObject:SetActive(false)
|
||||
end
|
||||
for i = 1, #rewardArray do
|
||||
if not itemsGrid[root][i] then
|
||||
itemsGrid[root][i] = SubUIManager.Open(SubUIConfig.ItemView, iRoot.transform)
|
||||
end
|
||||
itemsGrid[root][i]:OnOpen(false, {rewardArray[i][1],rewardArray[i][2]}, 0.7)
|
||||
itemsGrid[root][i].gameObject:SetActive(true)
|
||||
end
|
||||
|
||||
local boughtNum = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.DirectPurchaseGift, data.Id) or 0
|
||||
|
||||
tip.text =Language[11454].. (data.Limit-boughtNum) .."/".. data.Limit..")"
|
||||
if data.Limit - boughtNum > 0 then
|
||||
buyNum.text = string.format(MoneyUtil.GetMoneyUnitName(), MoneyUtil.GetMoney(data.Price))--shopItemData.Price..MoneyUtil.GetMoneyUnitName()
|
||||
buyBtn:GetComponent("Button").enabled = true
|
||||
Util.SetGray(buyBtn, false)
|
||||
else
|
||||
buyNum.text = Language[10526]
|
||||
buyBtn:GetComponent("Button").enabled = false
|
||||
Util.SetGray(buyBtn, true)
|
||||
end
|
||||
|
||||
--local costId, finalNum, oriCostNum = ShopManager.calculateBuyCost(SHOP_TYPE.FINDTREASURE_GIFT, data.id, 1)
|
||||
Util.AddOnceClick(buyBtn, function()
|
||||
if data.Limit <= boughtNum then
|
||||
PopupTipPanel.ShowTip(Language[10540])
|
||||
else
|
||||
--直购商品
|
||||
PayManager.Pay(data.Id, function(id)
|
||||
this.RechargeSuccessFunc(id)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function this.RechargeSuccessFunc(id)
|
||||
FirstRechargeManager.RefreshAccumRechargeValue(id)
|
||||
this:RefreshPanel()
|
||||
end
|
||||
|
||||
--倒计时
|
||||
function this.TimeCountDown()
|
||||
if this.timer then
|
||||
this.timer:Stop()
|
||||
this.timer = nil
|
||||
end
|
||||
local endtime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.TreasureStore)
|
||||
local timeDown = endtime - GetTimeStamp()
|
||||
this.time.text = Language[10028]..TimeToHMS(timeDown)
|
||||
this.timer = Timer.New(function()
|
||||
if timeDown < 1 then
|
||||
if timeDown <= 0 then
|
||||
this.timer:Stop()
|
||||
this.timer = nil
|
||||
this.RefreshPanel()
|
||||
this.timer = Timer.New(function()
|
||||
this:RefreshPanel()
|
||||
this:TimeCountDown()
|
||||
end,1):Start()
|
||||
return
|
||||
end
|
||||
timeDown = timeDown - 1
|
||||
|
@ -94,5 +189,4 @@ function this.TimeCountDown(timeDown)
|
|||
end, 1, -1, true)
|
||||
this.timer:Start()
|
||||
end
|
||||
|
||||
return TreasureStorePopup
|
Loading…
Reference in New Issue