miduo_client/Assets/ManagedResources/~Lua/Modules/Operating/QianKunBox.lua

73 lines
2.5 KiB
Lua
Raw Normal View History

2020-07-08 09:40:36 +08:00
local QianKunBox = quick_class("QianKunBox")
2020-07-08 16:23:02 +08:00
local ActivityDetail = require("Modules/Operating/ActivityDetail")--活动详情
2020-07-08 09:40:36 +08:00
function QianKunBox:ctor(mainPanel, gameObject)
self.mainPanel = mainPanel
self.gameObject = gameObject
self:InitComponent(gameObject)
self:BindEvent()
end
function QianKunBox:InitComponent(gameObject)
--leftUp
self.leftUp = Util.GetGameObject(gameObject,"leftUp")
self.leftUpTime = Util.GetGameObject(self.leftUp,"tips/tips2/time"):GetComponent("Text")
2020-07-08 16:23:02 +08:00
self.btnHelp= Util.GetGameObject(gameObject,"btnHelp")
self.helpPosition=self.btnHelp:GetComponent("RectTransform").localPosition
2020-07-08 09:40:36 +08:00
--rightUp
self.rightUp = Util.GetGameObject(gameObject,"rightUp")
self.btnReward = Util.GetGameObject(self.rightUp,"reward")
self.btnStore = Util.GetGameObject(self.rightUp,"store")
--center
self.center = Util.GetGameObject(gameObject,"center")
--bottom
self.bottom = Util.GetGameObject(gameObject,"bottom")
self.btnOne = Util.GetGameObject(self.bottom,"btnOne")
self.btnTime = Util.GetGameObject(self.bottom,"btnOne/di/time"):GetComponent("Text")
2020-07-08 16:23:02 +08:00
self.btnTen1 = Util.GetGameObject(self.bottom,"btnTen1")
self.btnTen2 = Util.GetGameObject(self.bottom,"btnTen2")
self.btnTimes= Util.GetGameObject(self.bottom,"btnTen2/di/times"):GetComponent("Text")
2020-07-08 09:40:36 +08:00
self.limit = Util.GetGameObject(self.bottom,"limit")
2020-07-08 16:23:02 +08:00
--detail
self.detail = Util.GetGameObject(gameObject,"detail")
2020-07-08 09:40:36 +08:00
end
function QianKunBox:BindEvent()
Util.AddClick(self.btnHelp,function()
2020-07-08 16:23:02 +08:00
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.QianKunBox,self.helpPosition.x,self.helpPosition.y)
2020-07-08 09:40:36 +08:00
end)
Util.AddClick(self.btnReward,function()
2020-07-08 16:23:02 +08:00
ActivityDetail.new(self.detail,2)
2020-07-08 09:40:36 +08:00
end)
Util.AddClick(self.btnStore,function()
2020-07-08 16:23:02 +08:00
LogRed("魂印商店")
2020-07-08 09:40:36 +08:00
end)
Util.AddClick(self.btnOne,function()
2020-07-08 16:23:02 +08:00
LogPink("单抽")
2020-07-08 09:40:36 +08:00
end)
2020-07-08 16:23:02 +08:00
Util.AddClick(self.btnTen1,function()
LogYellow("钥匙十连")
end)
Util.AddClick(self.btnTen2,function()
LogPurple("妖晶十连")
2020-07-08 09:40:36 +08:00
end)
end
function QianKunBox:OnShow()
self.gameObject:SetActive(true)
2020-07-08 16:23:02 +08:00
self.btnTen2:SetActive(BagManager.GetItemCountById(16)>=2000)
self.btnTen1:SetActive(BagManager.GetItemCountById(16)<2000)
2020-07-08 09:40:36 +08:00
end
function QianKunBox:OnHide()
self.gameObject:SetActive(false)
2020-07-08 21:09:45 +08:00
self.detail.gameObject:SetActive(false)
-- self.reward.gameObject:SetActive(false)
2020-07-08 09:40:36 +08:00
end
function QianKunBox:OnDestroy()
end
return QianKunBox