This commit is contained in:
2020-08-04 21:58:27 +08:00
parent a7b47a6827
commit f913a2a0aa
91 changed files with 1671 additions and 965 deletions

View File

@@ -1,13 +1,16 @@
-- xx界面
local CSPMsg = {}
---@type Coolape.CLPanelLua
local csSelf = nil
local transform = nil
CSPMsg.sizeAdjust = 1
CSPMsg.contentRect = Vector4.zero
local isShowdDragFrefresh = false
local dragVal = Vector3.zero
local objs = {}
local defaulList = {
{icon="news_news_1", bgColor=0xfff1c40f,type=DBMessage.MsgType.Sys, name="公告"},
{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="待办任务"},
}
@@ -29,6 +32,9 @@ function CSPMsg.init(csObj)
---@type UITable
objs.Table = getCC(objs.scrollView.transform, "Table", "UITable")
objs.LoopGrid = getCC(objs.Table.transform, "msgList/Grid", "CLUILoopGrid")
objs.ButtonEndList = getChild(objs.Table.transform, "ButtonEndList")
objs.ButtonHeadList = getCC(objs.Table.transform, "ButtonHeadList", "UILabel")
end
-- 设置数据
@@ -37,9 +43,49 @@ end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function CSPMsg.show()
CSPMsg.setList()
objs.Content.onClipMove = CSPMsg.onClipMove
objs.scrollView.onDragStarted = CSPMsg.onDragStart
objs.scrollView.onDragFinished = CSPMsg.onDragEnd
end
function CSPMsg.setList()
objs.LoopGrid:setList(defaulList, CSPMsg.initCell)
objs.Table:Reposition()
objs.scrollView:ResetPosition()
csSelf:invoke4Lua(CSPMsg.repositon, 0.1)
end
function CSPMsg.onClipMove(panel)
if (not isShowdDragFrefresh) and objs.ButtonHeadList.isVisible then
isShowdDragFrefresh = true
dragVal = objs.Content.transform.localPosition
end
end
function CSPMsg.onDragStart()
objs.ButtonHeadList.transform.localPosition = Vector3.up * 30
SetActive(objs.ButtonHeadList.gameObject, true)
dragVal = Vector3.zero
isShowdDragFrefresh = false
end
function CSPMsg.onDragEnd()
SetActive(objs.ButtonHeadList.gameObject, false)
local offset = objs.Content.transform.localPosition - dragVal
if offset.y < -50 then
-- 刷数据
NetProto.send.announcement_query()
end
if isShowdDragFrefresh then
CSPMsg.repositon()
end
end
function CSPMsg.repositon()
objs.scrollView:ResetPosition()
end
function CSPMsg.initCell(cell, data)