2020-07-11 17:07:30 +08:00
|
|
|
|
---@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()
|
2020-07-24 22:12:55 +08:00
|
|
|
|
uiobjs.LabelPhone = getCC(uiobjs.scrollview.transform, "Table/ButtonPhone/LabelPhone", "UILabel")
|
2020-07-11 17:07:30 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 设置数据
|
|
|
|
|
|
---@param paras _ParamTRPSetting
|
|
|
|
|
|
function TRPSetting:setData(paras)
|
|
|
|
|
|
self.mdata = paras
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
|
|
|
|
|
function TRPSetting:show()
|
|
|
|
|
|
uiobjs.scrollview:ResetPosition()
|
2020-07-24 22:12:55 +08:00
|
|
|
|
uiobjs.LabelPhone.text = Prefs.getUserName() or "未绑定"
|
2020-07-11 17:07:30 +08:00
|
|
|
|
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 = {
|
2020-07-24 22:12:55 +08:00
|
|
|
|
ButtonPersonInfor = function()
|
2020-07-19 12:52:05 +08:00
|
|
|
|
getPanelAsy("PanelMyInfor", onLoadedPanelTT)
|
|
|
|
|
|
end,
|
2020-07-11 17:07:30 +08:00
|
|
|
|
ButtonPassword = function()
|
|
|
|
|
|
getPanelAsy("PanelResetPasswordStep1", onLoadedPanelTT, {phone = Prefs.getUserName(), isModify = true})
|
|
|
|
|
|
end,
|
2020-07-24 22:12:55 +08:00
|
|
|
|
ButtonPhone = function()
|
|
|
|
|
|
if isNilOrEmpty(Prefs.getUserName()) then
|
|
|
|
|
|
getPanelAsy(
|
|
|
|
|
|
"PanelResetPasswordStep1",
|
|
|
|
|
|
onLoadedPanelTT,
|
|
|
|
|
|
{phone = Prefs.getUserName(), isBindPhone = true}
|
|
|
|
|
|
)
|
|
|
|
|
|
else
|
|
|
|
|
|
getPanelAsy("PanelBindPhone", onLoadedPanelTT, {phoneNo = Prefs.getUserName()})
|
|
|
|
|
|
end
|
|
|
|
|
|
end,
|
2020-07-11 17:07:30 +08:00
|
|
|
|
ButtonLogout = function()
|
|
|
|
|
|
MyUtl.confirm(
|
|
|
|
|
|
"确定要退出当前账号?",
|
2020-07-24 22:12:55 +08:00
|
|
|
|
function()
|
|
|
|
|
|
Prefs.setCurrGroup(Prefs.getUserName(), "")
|
|
|
|
|
|
Prefs.setUserPsd("")
|
|
|
|
|
|
hideTopPanel(self.csSelf)
|
|
|
|
|
|
hideTopPanel()
|
|
|
|
|
|
hideTopPanel()
|
|
|
|
|
|
getPanelAsy("PanelLogin", onLoadedPanel)
|
2020-07-11 17:07:30 +08:00
|
|
|
|
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
|