This commit is contained in:
2020-07-11 17:07:30 +08:00
parent e84465cd64
commit d587401a58
56 changed files with 6913 additions and 5316 deletions

View File

@@ -25,7 +25,11 @@ function DBUser.getPopList()
end
function DBUser.getUserById(loginNo)
return db[loginNo]
local user = db[loginNo]
if user == nil then
printe("get user is nil=", loginNo)
end
return user
end
function DBUser.getIcon(loginNo, callback)

View File

@@ -105,4 +105,7 @@ MyUtl.toastE = function(msg, staySec)
CLToastRoot.toast(msg, CLToastRoot.Type.error, staySec)
end
MyUtl.confirm = function(msg, callback, buttonName)
getPanelAsy("PanelConfirm2", onLoadedPanelTT, {msg = msg, callback = callback, buttonName = buttonName})
end
return MyUtl

View File

@@ -211,7 +211,7 @@ function CLLPStart.doEnterGame()
end
end
if useOldCurrGroup then
getPanelAsy("PanelConnect", onLoadedPanelTT)
getPanelAsy("PanelConnect", onLoadedPanel)
else
---@type _ParamTRPSelectGroup
local d = {}

View File

@@ -6,6 +6,7 @@ local transform = nil
CSPMine.sizeAdjust = 1
CSPMine.contentRect = Vector4.zero
local objs = {}
local headData = {}
-- 初始化,只会调用一次
function CSPMine.init(csObj)
@@ -14,9 +15,12 @@ function CSPMine.init(csObj)
CSPMine.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 = CSPMine.contentRect
MyUtl.setContentView(objs.Content, 147 + 370)
---@type CLUIFormRoot
objs.Top = getCC(transform, "Top", "CLUIFormRoot")
---@type UITexture
objs.HeadIcon = getCC(objs.Top.transform, "SpriteHeadBg/SpriteHeadIcon", "UITexture")
---@type UIScrollView
objs.scrollView = objs.Content:GetComponent("UIScrollView")
@@ -24,14 +28,35 @@ end
-- 设置数据
function CSPMine.setData(paras)
-- 初始化顶部数据
local currGroup = Prefs.getCurrGroup(Prefs.getUserName())
local companyInfro = json.decode(currGroup)
local user = DBUser.getUserById(companyInfro.login_no)
headData.company_id = companyInfro.company_id
headData.company_name = companyInfro.company_name
if user then
headData.loginNo = user.loginNo
headData.loginName = user.loginName
headData.imageUrl = user.imageUrl
else
printe("账号信息未取得!")
end
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function CSPMine.show()
CSPMine.setHeadInfor()
objs.scrollView:ResetPosition()
end
function CSPMine.onClickBottonBtn(cell)
function CSPMine.setHeadInfor()
objs.Top:setValue(headData)
DBUser.getIcon(
headData.loginNo,
function(content)
objs.HeadIcon.mainTexture = content
end
)
end
-- 刷新
@@ -44,37 +69,17 @@ end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function CSPMine.procNetwork(cmd, succ, msg, paras)
--[[
if(succ == 1) then
if(cmd == "xxx") then
-- TODO:
end
end
--]]
end
-- 处理ui上的事件例如点击等
function CSPMine.uiEventDelegate(go)
local goName = go.name
if (goName == "Button01") then
--[[
if isNilOrEmpty(__uid__) then
getPanelAsy("PanelLogin", onLoadedPanelTT, {function (uid)
if uid then
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
end
end}
)
else
-- 密码保护
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
end
--]]
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
elseif goName == "ButtonQR" then
if goName == "ButtonMyCheck" then
showHotWheel()
-- CSPMine.onGetLocation(json.encode({code = 0, latitude = "116.404", longitude = "39.915"}))
MyLocation.self:getMyLocation(CSPMine.onGetLocation)
elseif goName == "ButtonSetting" or goName == "ButtonMySetting" then
getPanelAsy("PanelSetting", onLoadedPanelTT)
end
end

View File

@@ -41,6 +41,7 @@ function CSPTasks.setData(paras)
headData.company_id = companyInfro.company_id
headData.company_name = companyInfro.company_name
if user then
headData.loginNo = user.loginNo
headData.loginName = user.loginName
headData.imageUrl = user.imageUrl
else
@@ -74,25 +75,12 @@ end
function CSPTasks.setHeadInfor()
uiobjs.Top:setValue(headData)
if not isNilOrEmpty(headData.imageurl) then
if uiobjs.HeadIcon.mainTexture == nil or uiobjs.HeadIcon.mainTexture.name ~= headData.imageurl then
WWWEx.get(
headData.imageurl,
nil,
CLAssetType.texture,
function(content, orgs)
content.name = headData.imageurl
uiobjs.HeadIcon.mainTexture = content
end,
function()
printe("取得头像失败")
end,
nil,
true,
2
)
DBUser.getIcon(
headData.loginNo,
function(content)
uiobjs.HeadIcon.mainTexture = content
end
end
)
end
-- 关闭页面

View File

@@ -0,0 +1,73 @@

---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPConfirm2:TRBasePanel 邮件列表
local TRPConfirm2 = class("TRPConfirm2", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPConfirm2:init(csObj)
TRPConfirm2.super.init(self, csObj)
uiobjs.LabelTitle = getCC(self.transform, "Bottom/offset/LabelTitle", "UILabel")
uiobjs.ButtonOkayLb = getCC(self.transform, "Bottom/offset/ButtonOkay/Label", "UILabel")
self:setEventDelegate()
end
-- 设置数据
---@param paras _ParamTRPConfirm2
function TRPConfirm2:setData(paras)
self.mdata = paras
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPConfirm2:show()
uiobjs.LabelTitle.text = self.mdata.msg
uiobjs.ButtonOkayLb.text = self.mdata.buttonName or "确定"
end
-- 刷新
function TRPConfirm2:refresh()
end
-- 关闭页面
function TRPConfirm2:hide()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPConfirm2:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
--[[
if cmd == xx then
end
]]
end
end
function TRPConfirm2:setEventDelegate()
self.EventDelegate = {
SpriteBg = function()
hideTopPanel(self.csSelf)
end,
ButtonClose = function()
hideTopPanel(self.csSelf)
end,
ButtonOkay = function()
hideTopPanel(self.csSelf)
Utl.doCallback(self.mdata.callback)
end
}
end
-- 处理ui上的事件例如点击等
function TRPConfirm2:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPConfirm2:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPConfirm2

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e16aaf885e0a946298c6ec0c66b6af25
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -25,7 +25,11 @@ function TRPResetPasswordStep1:onShowFrame(cs)
if cs.frameObj then
---@type _BGFrame1Param
local d = {}
d.title = cs.titleKeyName
if self.mData.isModify then
d.title = "重置密码"
else
d.title = "寻找密码"
end
d.panel = cs
d.isHideCloseBtn = true
cs.frameObj:init(d)

View File

@@ -26,7 +26,11 @@ function TRPResetPasswordStep2:onShowFrame(cs)
if cs.frameObj then
---@type _BGFrame1Param
local d = {}
d.title = cs.titleKeyName
if self.mData.isModify then
d.title = "重置密码"
else
d.title = "寻找密码"
end
d.panel = cs
d.isHideCloseBtn = true
cs.frameObj:init(d)
@@ -88,7 +92,9 @@ function TRPResetPasswordStep2:setEventDelegate()
if not isNilOrEmpty(uiobjs.formRoot:checkValid()) then
return
end
getPanelAsy("PanelResetPasswordStep3", onLoadedPanelTT, uiobjs.formRoot:getValue(self.mData, true))
local data = uiobjs.formRoot:getValue(self.mData, true)
data.isModify = self.mData.isModify
getPanelAsy("PanelResetPasswordStep3", onLoadedPanelTT, data)
end,
ButtonReGetCode = function()
if self.canReGetcode then

View File

@@ -28,7 +28,11 @@ function TRPResetPasswordStep3:onShowFrame(cs)
if cs.frameObj then
---@type _BGFrame1Param
local d = {}
d.title = cs.titleKeyName
if self.mData.isModify then
d.title = "重置密码"
else
d.title = "寻找密码"
end
d.panel = cs
d.isHideCloseBtn = true
cs.frameObj:init(d)

View File

@@ -0,0 +1,103 @@
---@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为调用refreshshow和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 = {
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

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3c1115850f0ba4a1882fa9495daae161
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: