Files
tianrunCRM/Assets/trCRM/upgradeRes4Dev/priority/lua/ui/panel/CSPMsg.lua
2020-07-04 14:41:25 +08:00

99 lines
2.9 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.

-- xx界面
local CSPMsg = {}
local csSelf = nil
local transform = nil
CSPMsg.sizeAdjust = 1
CSPMsg.contentRect = Vector4.zero
local objs = {}
local defaulList = {
{icon="news_news_1", bgColor=0xfff1c40f,type=DBMessage.MsgType.Sys, name="公告"},
{icon="news_news_2", bgColor=0xff2990dc,type=DBMessage.MsgType.SysNotice, name="系统消息"},
{icon="news_news_3", bgColor=0xff1abc9c,type=DBMessage.MsgType.Task, name="待办任务"},
}
-- 初始化,只会调用一次
function CSPMsg.init(csObj)
csSelf = csObj
transform = csObj.transform
CSPMsg.contentRect = MyUtl.getUIContent(csSelf, nil, nil, true)
objs.Content = getCC(transform, "PanelContent", "UIPanel")
objs.Content.transform.localPosition = Vector3.zero
objs.Content.clipOffset = Vector2.zero
objs.Content.baseClipRegion = CSPMsg.contentRect
---@type UIScrollView
objs.scrollView = objs.Content:GetComponent("UIScrollView")
---@type UITable
objs.Table = getCC(objs.scrollView.transform, "Table", "UITable")
objs.LoopGrid = getCC(objs.Table.transform, "msgList/Grid", "CLUILoopGrid")
end
-- 设置数据
function CSPMsg.setData(paras)
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function CSPMsg.show()
objs.LoopGrid:setList(defaulList, CSPMsg.initCell)
objs.Table:Reposition()
objs.scrollView:ResetPosition()
end
function CSPMsg.initCell(cell, data)
cell:init(data, CSPMsg.onClickCell)
end
function CSPMsg.onClickCell(cell, data)
getPanelAsy("PanelSysMsgList", onLoadedPanelTT, data)
end
-- 刷新
function CSPMsg.refresh()
end
-- 关闭页面
function CSPMsg.hide()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function CSPMsg.procNetwork(cmd, succ, msg, paras)
--[[
if(succ == 1) then
if(cmd == "xxx") then
-- TODO:
end
end
--]]
end
-- 处理ui上的事件例如点击等
function CSPMsg.uiEventDelegate(go)
local goName = go.name
if (goName == "Button01") then
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
--[[
if isNilOrEmpty(__uid__) then
getPanelAsy("PanelLogin", onLoadedPanelTT, {function (uid)
if uid then
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
end
end}
)
else
-- 密码保护
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
end
--]]
end
end
-- 当按了返回键时关闭自己返值为true时关闭
function CSPMsg.hideSelfOnKeyBack()
return false
end
--------------------------------------------
return CSPMsg