miduo_client/Assets/ManagedResources/~Lua/Modules/DailyRecharge/GMTianTianXJQ.lua

134 lines
4.4 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

local GMTianTianXJQ = quick_class("GMTianTianXJQ", BasePanel)
local actRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig)
local kMaxReward = 5
local index = 0
local cursortingOrder
local isFirstOpen = false
local missionId=0
local state=0
function GMTianTianXJQ:InitComponent()
self.spLoader = SpriteLoader.New()
cursortingOrder = 0
self.backBtnNew = Util.GetGameObject(self.transform, "BG")
self.backBtn = Util.GetGameObject(self.transform, "frame")
self.title = Util.GetGameObject(self.backBtn, "bg/title"):GetComponent("Text")
self.infoTxt=Util.GetGameObject(self.backBtn, "bg/title/Text"):GetComponent("Text")
self.infoTxt.text="现金点券每日0点清空请各位道友注意使用"
self.rewardContent = {}
self.rewardContentEffect = {}
self.rewardContentbg = {}
self.rewardList = {}
for i = 1, kMaxReward do
self.rewardContent[i] = Util.GetGameObject(self.backBtn, "bg/rewardContent/itemPos_" .. i)
self.rewardContentEffect[i] = Util.GetGameObject(self.rewardContent[i], "Kuang")
self.rewardContentbg[i] = Util.GetGameObject(self.rewardContent[i], "Image")
effectAdapte(self.rewardContentEffect[i])
self.rewardList[i] = SubUIManager.Open(SubUIConfig.ItemView, self.rewardContent[i].transform)
end
self.dealBtn = Util.GetGameObject(self.backBtn,"bg/dealBtn")
self.dealText = Util.GetGameObject(self.dealBtn, "Text"):GetComponent("Text")
self.dealText.text="领取"
self.UI_effect_DailyRechargePanel_particle = Util.GetGameObject(self.transform, "frame/UI_effect_DailyRechargePanel_particle")
end
function GMTianTianXJQ:BindEvent()
Util.AddClick(self.backBtnNew, function()
self:ClosePanel()
end)
Util.AddClick(self.dealBtn, function()
NetManager.GetActivityRewardRequest(missionId,12701,function(_drop)
UIManager.OpenPanel(UIName.RewardItemPopup, _drop, 1)
self:RefreshPanel()
CheckRedPointStatus(RedPointType.tiantianXJQ)
end)
end)
end
local func=nil
function GMTianTianXJQ:OnOpen(_func)
func=_func
--GMEspecially:SetSortingOrder(6300)
self.UI_effect_DailyRechargePanel_particle:SetActive(true)
end
function GMTianTianXJQ:AddListener()
end
function GMTianTianXJQ:RemoveListener()
end
function GMTianTianXJQ:OnSortingOrderChange()
Util.AddParticleSortLayer( self.UI_effect_DailyRechargePanel_particle, self.sortingOrder - cursortingOrder)
for i = 1, #self.rewardContentEffect do
Util.AddParticleSortLayer( self.rewardContentEffect[i], self.sortingOrder - cursortingOrder)
end
cursortingOrder = self.sortingOrder
end
function GMTianTianXJQ:OnShow()
self.title.text = "每日现金点券放送"
self:RefreshPanel()
end
function GMTianTianXJQ:OnClose()
if func then
func()
end
end
function GMTianTianXJQ:OnDestroy()
self.spLoader:Destroy()
end
function GMTianTianXJQ:RefreshPanel()
local info=ActivityGiftManager.GetActivityInfoByType(12701)
if info and info.mission then
for i = 1, #info.mission do
missionId=info.mission[i].missionId
state=info.mission[i].state
end
end
Util.SetGray(self.dealBtn,state==1)
table.walk(self.rewardList, function(rewardPosItem)
rewardPosItem.gameObject:SetActive(false)
end)
table.walk(self.rewardContent, function(rewardPosItem)
rewardPosItem.gameObject:SetActive(false)
end)
table.walk(self.rewardContentbg, function(rewardPosItem)
rewardPosItem.gameObject:SetActive(false)
end)
local config=ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,21001)
for i = 1, #config.Reward do
if self.rewardContent[i] then
self.rewardContent[i].gameObject:SetActive(true)
end
end
self.thread = coroutine.start(function()
coroutine.wait(0.2)
for i, rewardInfo in ipairs(config.Reward) do
if self.rewardList[i] then
self.rewardList[i]:OnOpen(false, rewardInfo, 1.1,true)
self.rewardList[i]:ResetNameColor(Vector4.New(0.298,0.133,0.102,1))
self.rewardList[i]:ResetBtnInteractable(false)
self.rewardList[i].gameObject:SetActive(true)
self.rewardContentbg[i].gameObject:SetActive(true)
end
end
end)
end
function GMTianTianXJQ:OnDealBtnClicked()
end
return GMTianTianXJQ