112 lines
3.2 KiB
Lua
112 lines
3.2 KiB
Lua
-- xx界面
|
||
local TRPGuid = {}
|
||
|
||
---@type Coolape.CLPanelLua
|
||
local csSelf = nil
|
||
---@type UnityEngine.Transform
|
||
local transform = nil
|
||
local uiobjs = {}
|
||
local callback
|
||
|
||
-- 初始化,只会调用一次
|
||
function TRPGuid.init(csObj)
|
||
csSelf = csObj
|
||
transform = csObj.transform
|
||
--[[
|
||
上的组件:getChild(transform, "offset", "Progress BarHong"):GetComponent("UISlider");
|
||
--]]
|
||
---@type UIGridPage
|
||
uiobjs.GridPage = getCC(transform, "PanelContent/Grid", "UIGridPage")
|
||
---@type UIGrid
|
||
uiobjs.GridIndex = getCC(transform, "GridIndex", "UIGrid")
|
||
uiobjs.GridIndexPrefab = getChild(uiobjs.GridIndex.transform, "00000").gameObject
|
||
uiobjs.ButtonEnter = getChild(transform, "ButtonEnter").gameObject
|
||
end
|
||
|
||
-- 设置数据
|
||
function TRPGuid.setData(paras)
|
||
callback = paras
|
||
end
|
||
|
||
--当有通用背板显示时的回调
|
||
function TRPGuid.onShowFrame()
|
||
end
|
||
|
||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||
function TRPGuid.show()
|
||
SetActive(uiobjs.ButtonEnter, false)
|
||
uiobjs.GridPage.cellWidth = NumEx.getIntPart(MyUtl.getSizeAdjust() * Screen.width)
|
||
local pages = ArrayList()
|
||
pages:Add({index = 1, label = "业务轻松查看", label2 = "随时查看实时业绩情况"})
|
||
pages:Add({index = 2, label = "客户随时跟进", label2 = "第一时间跟进客户记录消息内容"})
|
||
pages:Add({index = 3, label = "订单高效处理", label2 = "随时随地及时处理各类客户订单"})
|
||
uiobjs.GridPage:init(pages, TRPGuid.onShowPage, 0)
|
||
end
|
||
|
||
function TRPGuid.onShowPage(index, data)
|
||
SetActive(uiobjs.ButtonEnter, index == 2)
|
||
local list = {}
|
||
for i = 0, 2 do
|
||
if i == index then
|
||
table.insert(list, true)
|
||
else
|
||
table.insert(list, false)
|
||
end
|
||
end
|
||
|
||
CLUIUtl.resetList4Lua(
|
||
uiobjs.GridIndex,
|
||
uiobjs.GridIndexPrefab,
|
||
list,
|
||
function(cell, data)
|
||
local sp = cell:GetComponent("UISprite")
|
||
if data then
|
||
sp.color = ColorEx.getColor(0xff363636)
|
||
else
|
||
sp.color = ColorEx.getColor(0xff999999)
|
||
end
|
||
end
|
||
)
|
||
end
|
||
|
||
-- 刷新
|
||
function TRPGuid.refresh()
|
||
end
|
||
|
||
-- 关闭页面
|
||
function TRPGuid.hide()
|
||
end
|
||
|
||
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
||
function TRPGuid.procNetwork(cmd, succ, msg, paras)
|
||
--[[
|
||
if(succ == NetSuccess) then
|
||
if(cmd == "xxx") then
|
||
-- TODO:
|
||
end
|
||
end
|
||
--]]
|
||
end
|
||
|
||
-- 处理ui上的事件,例如点击等
|
||
function TRPGuid.uiEventDelegate(go)
|
||
local goName = go.name
|
||
if(goName == "ButtonEnter") then
|
||
Prefs.setShowGuid(false)
|
||
hideTopPanel(csSelf)
|
||
Utl.doCallback(callback)
|
||
end
|
||
end
|
||
|
||
-- 当顶层页面发生变化时回调
|
||
function TRPGuid.onTopPanelChange(topPanel)
|
||
end
|
||
|
||
-- 当按了返回键时,关闭自己(返值为true时关闭)
|
||
function TRPGuid.hideSelfOnKeyBack()
|
||
return true
|
||
end
|
||
|
||
--------------------------------------------
|
||
return TRPGuid
|