Files
tianrunCRM/Assets/trCRM/upgradeRes4Dev/priority/lua/ui/panel/TRPConfirm2.lua
2020-07-11 17:07:30 +08:00

74 lines
2.0 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPConfirm2:TRBasePanel 邮件列表
local TRPConfirm2 = class("TRPConfirm2", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPConfirm2:init(csObj)
TRPConfirm2.super.init(self, csObj)
uiobjs.LabelTitle = getCC(self.transform, "Bottom/offset/LabelTitle", "UILabel")
uiobjs.ButtonOkayLb = getCC(self.transform, "Bottom/offset/ButtonOkay/Label", "UILabel")
self:setEventDelegate()
end
-- 设置数据
---@param paras _ParamTRPConfirm2
function TRPConfirm2:setData(paras)
self.mdata = paras
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPConfirm2:show()
uiobjs.LabelTitle.text = self.mdata.msg
uiobjs.ButtonOkayLb.text = self.mdata.buttonName or "确定"
end
-- 刷新
function TRPConfirm2:refresh()
end
-- 关闭页面
function TRPConfirm2:hide()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPConfirm2:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
--[[
if cmd == xx then
end
]]
end
end
function TRPConfirm2:setEventDelegate()
self.EventDelegate = {
SpriteBg = function()
hideTopPanel(self.csSelf)
end,
ButtonClose = function()
hideTopPanel(self.csSelf)
end,
ButtonOkay = function()
hideTopPanel(self.csSelf)
Utl.doCallback(self.mdata.callback)
end
}
end
-- 处理ui上的事件例如点击等
function TRPConfirm2:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPConfirm2:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPConfirm2