miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_LingMaiJump.lua

96 lines
2.5 KiB
Lua

----灵脉跳转界面 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
function this:InitComponent(gameObject)
self.spLoader = SpriteLoader.New()
self.add1 = Util.GetGameObject(gameObject,"Btns/Add1")
self.add10 = Util.GetGameObject(gameObject,"Btns/Add10")
self.re1 = Util.GetGameObject(gameObject,"Btns/Re1")
self.re10 = Util.GetGameObject(gameObject,"Btns/Re10")
self.inputField = Util.GetGameObject(gameObject, "Btns/InputField"):GetComponent("InputField")
self.btnSure = Util.GetGameObject(gameObject,"BtnSure")
self.btnCancel = Util.GetGameObject(gameObject,"BtnCancel")
end
function this:BindEvent()
Util.AddClick(self.add1,function()
self.curPage = self.curPage + 1
if self.curPage > 100 then
self.curPage = 100
end
self:Refresh()
end)
Util.AddClick(self.add10,function()
self.curPage = self.curPage + 10
if self.curPage > 100 then
self.curPage = 100
end
self:Refresh()
end)
Util.AddClick(self.re1,function()
self.curPage = self.curPage - 1
if self.curPage < 1 then
self.curPage = 1
end
self:Refresh()
end)
Util.AddClick(self.re10,function()
self.curPage = self.curPage - 10
if self.curPage < 1 then
self.curPage = 1
end
self:Refresh()
end)
Util.AddClick(self.btnSure,function()
if self.inputField.text ~= "" then
local num = tonumber(self.inputField.text)
if num > self.pageNum then
num = self.pageNum
elseif num < 1 then
num = 1
end
LingMaiMiJingManager.curPage = num
Game.GlobalEvent:DispatchEvent(GameEvent.LingMaiMiJing.RefreshPanel)
self.parent:ClosePanel()
else
PopupTipPanel.ShowTip("请输入要前往的位置")
return
end
end)
Util.AddClick(self.btnCancel,function()
self.parent:ClosePanel()
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,_pageNum)
self.parent = _parent
self.curPage = LingMaiMiJingManager.curPage
self.pageNum = _pageNum
self:Refresh()
end
function this:Refresh()
self.inputField.text = self.curPage
end
function this:OnClose()
end
function this:OnDestroy()
this.spLoader:Destroy()
end
return this