2021-09-28 10:34:05 +08:00
|
|
|
require("Base/BasePanel")
|
2021-09-29 18:34:54 +08:00
|
|
|
-- local riceCtrl = require("Modules/YuJianXing/RiceCtrlView")
|
2021-09-28 10:34:05 +08:00
|
|
|
local YuJianXingPanel = Inherit(BasePanel)
|
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
function YuJianXingPanel:InitComponent()
|
|
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
--Btns
|
|
|
|
self.backBtn = Util.GetGameObject(self.gameObject, "backBtn")
|
|
|
|
self.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
|
|
|
|
self.helpPosition = self.helpBtn:GetComponent("RectTransform").localPosition
|
|
|
|
self.btnBet = Util.GetGameObject(self.gameObject, "Bgs/Down/btns/btnBet")
|
|
|
|
self.btnRecord = Util.GetGameObject(self.gameObject, "Bgs/Down/btns/btnRecord")
|
|
|
|
self.btnRank = Util.GetGameObject(self.gameObject, "Bgs/Down/btns/btnRank")
|
|
|
|
self.btnStore = Util.GetGameObject(self.gameObject, "Bgs/Down/btns/btnStore")
|
|
|
|
--Text
|
|
|
|
self.curActTime = Util.GetGameObject(self.gameObject, "Bgs/Up/Board/time1"):GetComponent("Text")
|
|
|
|
self.nextRoundTime = Util.GetGameObject(self.gameObject, "Bgs/Up/Board/time2"):GetComponent("Text")
|
|
|
|
self.canBetTime = Util.GetGameObject(self.gameObject, "Bgs/Up/Board/time3"):GetComponent("Text")
|
|
|
|
--Bg
|
|
|
|
self.bg = Util.GetGameObject(self.gameObject, "Bgs/Bg")
|
2021-09-28 17:48:28 +08:00
|
|
|
|
|
|
|
--testBtn
|
|
|
|
self.start = Util.GetGameObject(self.gameObject, "Button (4)")
|
2021-10-08 15:45:28 +08:00
|
|
|
self.speedUp = Util.GetGameObject(self.gameObject, "Button (3)")
|
|
|
|
self.speedDown = Util.GetGameObject(self.gameObject, "Button (2)")
|
|
|
|
self.speedDown:SetActive(false)
|
2021-09-28 17:48:28 +08:00
|
|
|
self.reset = Util.GetGameObject(self.gameObject, "Button (1)")
|
2021-09-28 10:34:05 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
function YuJianXingPanel:BindEvent()
|
|
|
|
Util.AddOnceClick(self.backBtn,function ()
|
2021-09-28 17:48:28 +08:00
|
|
|
self:ClosePanel()
|
2021-09-28 10:34:05 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
Util.AddOnceClick(self.helpBtn,function ()
|
|
|
|
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.QiJieShiLian,self.helpPosition.x,self.helpPosition.y)
|
|
|
|
end)
|
|
|
|
|
|
|
|
Util.AddOnceClick(self.btnBet,function ()
|
2021-10-08 20:49:25 +08:00
|
|
|
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.YuJianBet)
|
2021-09-28 10:34:05 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
Util.AddOnceClick(self.btnRecord,function ()
|
2021-09-28 17:48:28 +08:00
|
|
|
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.YuJianXingRecord)
|
2021-09-28 10:34:05 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
Util.AddOnceClick(self.btnRank,function ()
|
2021-10-08 20:49:25 +08:00
|
|
|
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.YuJianLastResult)
|
2021-09-28 10:34:05 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
Util.AddOnceClick(self.btnStore,function ()
|
2021-09-28 17:48:28 +08:00
|
|
|
JumpManager.GoJump(20003)
|
|
|
|
end)
|
|
|
|
|
|
|
|
-----test
|
|
|
|
Util.AddOnceClick(self.start,function ()
|
2021-09-29 18:34:54 +08:00
|
|
|
YuJianXingManager.SetGameState(true)
|
2021-09-28 17:48:28 +08:00
|
|
|
end)
|
|
|
|
Util.AddOnceClick(self.reset,function ()
|
2021-09-29 18:34:54 +08:00
|
|
|
YuJianXingManager.SetGameState(false)
|
2021-09-28 17:48:28 +08:00
|
|
|
end)
|
2021-10-08 15:45:28 +08:00
|
|
|
Util.AddOnceClick(self.speedUp,function ()
|
|
|
|
YuJianXingManager.ResetGame()
|
|
|
|
end)
|
2021-09-28 10:34:05 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
function YuJianXingPanel:AddListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
function YuJianXingPanel:RemoveListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
function YuJianXingPanel:OnSortingOrderChange()
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
function YuJianXingPanel:OnOpen()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- 打开,重新打开时回调
|
|
|
|
function YuJianXingPanel:OnShow()
|
2021-10-08 15:45:28 +08:00
|
|
|
YuJianXingManager.OpenMap()
|
2021-10-09 16:24:34 +08:00
|
|
|
self.count = 0
|
|
|
|
if self.timer then
|
|
|
|
self.timer:Stop()
|
|
|
|
self.timer = nil
|
|
|
|
end
|
|
|
|
self.timer = Timer.New(function ()
|
|
|
|
if self.count % 2 == 0 then
|
|
|
|
YuJianXingManager.ResetPlayerPosVertical()
|
|
|
|
end
|
|
|
|
self.count = self.count + 1
|
|
|
|
end,1,-1):Start()
|
2021-09-28 10:34:05 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
function YuJianXingPanel:OnClose()
|
2021-10-08 15:45:28 +08:00
|
|
|
YuJianXingManager.CloseMap()
|
2021-10-09 16:24:34 +08:00
|
|
|
self.count = 0
|
|
|
|
if self.timer then
|
|
|
|
self.timer:Stop()
|
|
|
|
self.timer = nil
|
|
|
|
end
|
2021-09-28 10:34:05 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
function YuJianXingPanel:OnDestroy()
|
2021-10-08 20:49:25 +08:00
|
|
|
-- YuJianXingManager.DestroyMap()
|
2021-09-28 10:34:05 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
return YuJianXingPanel
|