107 lines
3.2 KiB
Lua
107 lines
3.2 KiB
Lua
---@type IDBasePanel
|
||
local TRBasePanel = require("ui.panel.TRBasePanel")
|
||
---@class TRPSetting:TRBasePanel 邮件列表
|
||
local TRPSetting = class("TRPSetting", TRBasePanel)
|
||
|
||
local uiobjs = {}
|
||
-- 初始化,只会调用一次
|
||
function TRPSetting:init(csObj)
|
||
TRPSetting.super.init(self, csObj)
|
||
uiobjs.content = getChild(self.transform, "PanelContent")
|
||
MyUtl.setContentView(uiobjs.content)
|
||
---@type UIScrollView
|
||
uiobjs.scrollview = getCC(self.transform, "PanelContent", "UIScrollView")
|
||
|
||
self:setEventDelegate()
|
||
end
|
||
|
||
-- 设置数据
|
||
---@param paras _ParamTRPSetting
|
||
function TRPSetting:setData(paras)
|
||
self.mdata = paras
|
||
end
|
||
|
||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||
function TRPSetting:show()
|
||
uiobjs.scrollview:ResetPosition()
|
||
end
|
||
|
||
-- 刷新
|
||
function TRPSetting:refresh()
|
||
end
|
||
|
||
-- 关闭页面
|
||
function TRPSetting:hide()
|
||
end
|
||
|
||
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
||
function TRPSetting:procNetwork(cmd, succ, msg, paras)
|
||
if (succ == NetSuccess) then
|
||
--[[
|
||
if cmd == xx then
|
||
end
|
||
]]
|
||
end
|
||
end
|
||
|
||
function TRPSetting:setEventDelegate()
|
||
self.EventDelegate = {
|
||
ButtonPersonInfor=function()
|
||
getPanelAsy("PanelMyInfor", onLoadedPanelTT)
|
||
end,
|
||
ButtonPassword = function()
|
||
getPanelAsy("PanelResetPasswordStep1", onLoadedPanelTT, {phone = Prefs.getUserName(), isModify = true})
|
||
end,
|
||
ButtonLogout = function()
|
||
MyUtl.confirm(
|
||
"确定要退出当前账号?",
|
||
function()
|
||
Prefs.setCurrGroup(Prefs.getUserName(), "")
|
||
Prefs.setUserPsd("")
|
||
hideTopPanel(self.csSelf)
|
||
hideTopPanel()
|
||
hideTopPanel()
|
||
getPanelAsy("PanelLogin", onLoadedPanel)
|
||
end,
|
||
"退出账号"
|
||
)
|
||
end,
|
||
ButtonClearCache = function()
|
||
MyUtl.confirm(
|
||
"确定要清空缓存?",
|
||
function()
|
||
PlayerPrefs.DeleteAll()
|
||
|
||
--- 释放资源开始-------------------------------
|
||
local cleanRes = function()
|
||
pcall(doSomethingBeforeRestart)
|
||
pcall(releaseRes4GC, true)
|
||
end
|
||
--- 释放资源结束-------------------------------
|
||
pcall(cleanRes)
|
||
local panel = CLPanelManager.getPanel(CLMainBase.self.firstPanel)
|
||
if panel then
|
||
CLPanelManager.showPanel(panel)
|
||
end
|
||
CLMainBase.self:reStart()
|
||
end,
|
||
"确定清空"
|
||
)
|
||
end
|
||
}
|
||
end
|
||
-- 处理ui上的事件,例如点击等
|
||
function TRPSetting:uiEventDelegate(go)
|
||
local func = self.EventDelegate[go.name]
|
||
if func then
|
||
func()
|
||
end
|
||
end
|
||
|
||
-- 当顶层页面发生变化时回调
|
||
function TRPSetting:onTopPanelChange(topPanel)
|
||
end
|
||
|
||
--------------------------------------------
|
||
return TRPSetting
|