2020-07-28 21:02:59 +08:00
|
|
|
|
---@type IDBasePanel
|
|
|
|
|
|
local TRBasePanel = require("ui.panel.TRBasePanel")
|
|
|
|
|
|
---@class TRPSelectServer:TRBasePanel 邮件列表
|
|
|
|
|
|
local TRPSelectServer = class("TRPSelectServer", TRBasePanel)
|
|
|
|
|
|
|
|
|
|
|
|
local uiobjs = {}
|
|
|
|
|
|
-- 初始化,只会调用一次
|
|
|
|
|
|
function TRPSelectServer:init(csObj)
|
|
|
|
|
|
TRPSelectServer.super.init(self, csObj)
|
|
|
|
|
|
|
|
|
|
|
|
self:setEventDelegate()
|
2020-08-01 17:55:18 +08:00
|
|
|
|
uiobjs.grid = getCC(self.transform, "Grid", "UIGrid")
|
2020-08-03 23:05:29 +08:00
|
|
|
|
uiobjs.gridPrefab = getChild(uiobjs.grid.transform, "00000").gameObject
|
2020-07-28 21:02:59 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 设置数据
|
|
|
|
|
|
---@param paras _ParamTRPSelectServer
|
|
|
|
|
|
function TRPSelectServer:setData(paras)
|
|
|
|
|
|
self.mdata = paras
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
|
|
|
|
|
function TRPSelectServer:show()
|
2020-08-03 23:05:29 +08:00
|
|
|
|
CLUIUtl.resetList4Lua(uiobjs.grid, uiobjs.gridPrefab, self.mdata.servers, self:wrapFunc(self.initCell))
|
2020-08-01 17:55:18 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function TRPSelectServer:initCell(cell, data)
|
|
|
|
|
|
cell:init(data, self:wrapFunc(self.onClickCell))
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function TRPSelectServer:onClickCell(cell, data)
|
|
|
|
|
|
hideTopPanel(self.csSelf)
|
|
|
|
|
|
Utl.doCallback(self.mdata.callback, data)
|
2020-07-28 21:02:59 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 刷新
|
|
|
|
|
|
function TRPSelectServer:refresh()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 关闭页面
|
|
|
|
|
|
function TRPSelectServer:hide()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
|
|
|
|
|
function TRPSelectServer:procNetwork(cmd, succ, msg, paras)
|
|
|
|
|
|
if (succ == NetSuccess) then
|
|
|
|
|
|
--[[
|
|
|
|
|
|
if cmd == xx then
|
|
|
|
|
|
end
|
|
|
|
|
|
]]
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function TRPSelectServer:setEventDelegate()
|
|
|
|
|
|
self.EventDelegate = {
|
2020-08-01 17:55:18 +08:00
|
|
|
|
-- ButtonServer = function()
|
|
|
|
|
|
-- hideTopPanel(self.csSelf)
|
|
|
|
|
|
-- -- NetProto.setSeverPublish()
|
|
|
|
|
|
-- local server = {version = "11212222121"}
|
|
|
|
|
|
-- Utl.doCallback(self.mdata.callback, server)
|
|
|
|
|
|
-- end,
|
|
|
|
|
|
-- ButtonServerDev = function()
|
|
|
|
|
|
-- hideTopPanel(self.csSelf)
|
|
|
|
|
|
-- -- NetProto.setSeverDev()
|
|
|
|
|
|
-- Utl.doCallback(self.mdata.callback)
|
|
|
|
|
|
-- end,
|
|
|
|
|
|
-- ButtonServerLoc = function()
|
|
|
|
|
|
-- hideTopPanel(self.csSelf)
|
|
|
|
|
|
-- -- NetProto.setSeverLocal()
|
|
|
|
|
|
-- Utl.doCallback(self.mdata.callback)
|
|
|
|
|
|
-- end
|
2020-07-28 21:02:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
end
|
|
|
|
|
|
-- 处理ui上的事件,例如点击等
|
|
|
|
|
|
function TRPSelectServer:uiEventDelegate(go)
|
|
|
|
|
|
local func = self.EventDelegate[go.name]
|
|
|
|
|
|
if func then
|
|
|
|
|
|
func()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 当顶层页面发生变化时回调
|
|
|
|
|
|
function TRPSelectServer:onTopPanelChange(topPanel)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-08-01 17:55:18 +08:00
|
|
|
|
-- 当按了返回键时,关闭自己(返值为true时关闭)
|
|
|
|
|
|
function TRPSelectServer:hideSelfOnKeyBack()
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
2020-07-28 21:02:59 +08:00
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
return TRPSelectServer
|