2025-04-01 10:48:36 +08:00
|
|
|
|
--设置窗口对象
|
2025-11-10 21:01:13 +08:00
|
|
|
|
local PasswordUpdateView = import(".PasswordUpdateView")
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
local LobbyPlayerInfoView = {}
|
|
|
|
|
|
|
|
|
|
|
|
local M = LobbyPlayerInfoView
|
|
|
|
|
|
setmetatable(M, { __index = BaseWindow })
|
|
|
|
|
|
|
|
|
|
|
|
function LobbyPlayerInfoView.new(user, callback)
|
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
|
|
|
|
|
self.class = 'LobbyPlayerInfoView'
|
|
|
|
|
|
self._close_destroy = true
|
|
|
|
|
|
self.user = user
|
|
|
|
|
|
self._callback = callback
|
2025-11-10 21:01:13 +08:00
|
|
|
|
self._loadAll = 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:init('ui://Lobby/PlayerInfo')
|
|
|
|
|
|
return self
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:init(url)
|
|
|
|
|
|
BaseWindow.init(self, url)
|
|
|
|
|
|
|
|
|
|
|
|
local view = self._view
|
|
|
|
|
|
local user = self.user;
|
|
|
|
|
|
|
|
|
|
|
|
--show
|
|
|
|
|
|
view:GetChild('name').text = user.nick_name
|
|
|
|
|
|
view:GetChild('phone').text = user.phone
|
|
|
|
|
|
view:GetChild('id').text = user.account_id
|
|
|
|
|
|
view:GetChild('diamo').text = user.diamo
|
2025-09-19 18:01:12 +08:00
|
|
|
|
view:GetChild('sex').text = user.sex == 1 and "男" or "女"
|
|
|
|
|
|
view:GetController('ctr_sex').selectedIndex = user.sex - 1
|
2025-11-06 17:37:53 +08:00
|
|
|
|
view:GetChild('ip').text = DataManager.SelfUser.currenIp
|
2025-04-01 10:48:36 +08:00
|
|
|
|
ImageLoad.Load(DataManager.SelfUser.head_url, view:GetChild("btn_PlayerHead")._iconObject)
|
2025-11-10 21:01:13 +08:00
|
|
|
|
if DataManager.SelfUser.currenIp then
|
|
|
|
|
|
self._loadAll = self._loadAll + 1
|
|
|
|
|
|
else
|
|
|
|
|
|
GameApplication.Instance:GetPublicIP(function(ip)
|
|
|
|
|
|
DataManager.SelfUser.currenIp = ip
|
|
|
|
|
|
view:GetChild('ip').text = DataManager.SelfUser.currenIp
|
|
|
|
|
|
self:CheckAllload()
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
--change
|
|
|
|
|
|
view:GetChild('choose_id').text = user.account_id
|
|
|
|
|
|
view:GetChild('choose_diamo').text = user.diamo
|
2025-11-10 21:01:13 +08:00
|
|
|
|
-- if user.phone and #user.phone == 11 then
|
|
|
|
|
|
-- self._view:GetChild('btn_changeInfo').visible = false
|
|
|
|
|
|
-- self._view:GetChild('btn_changeInfo').touchable = false
|
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.Lable_name = view:GetChild('Lable_name'):GetChild('text')
|
|
|
|
|
|
self.Lable_name.text = user.nick_name
|
|
|
|
|
|
self.group_sex = view:GetController('group_sex')
|
2025-09-19 18:50:28 +08:00
|
|
|
|
self.group_sex.selectedIndex = user.sex - 1
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.Lable_phone = view:GetChild('Lable_phone'):GetChild('text')
|
|
|
|
|
|
local bind = view:GetController('bind')
|
|
|
|
|
|
if user.phone then
|
|
|
|
|
|
self.Lable_phone.text = user.phone
|
|
|
|
|
|
else
|
|
|
|
|
|
self.Lable_phone.text = ""
|
|
|
|
|
|
end
|
|
|
|
|
|
view:GetChild('btn_headChange').onClick:Add(function()
|
2025-09-05 16:23:34 +08:00
|
|
|
|
local guo_msg = MsgWindow.new(self._root_view, "暂不支持更换头像", MsgWindow.MsgMode.OnlyOk)
|
|
|
|
|
|
guo_msg:Show()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end)
|
|
|
|
|
|
view:GetChild('btn_changePhone').onClick:Add(function()
|
2025-09-05 16:23:34 +08:00
|
|
|
|
local guo_msg = MsgWindow.new(self._root_view, "绑定页面正在优化中,请稍后绑定", MsgWindow.MsgMode.OnlyOk)
|
|
|
|
|
|
guo_msg:Show()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end)
|
|
|
|
|
|
view:GetChild('btn_bindPhone').onClick:Add(function()
|
2025-09-05 16:23:34 +08:00
|
|
|
|
local guo_msg = MsgWindow.new(self._root_view, "绑定页面正在优化中,请稍后绑定", MsgWindow.MsgMode.OnlyOk)
|
|
|
|
|
|
guo_msg.onOk(function()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end)
|
2025-09-05 16:23:34 +08:00
|
|
|
|
guo_msg:Show()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end)
|
|
|
|
|
|
local type = view:GetController('type')
|
|
|
|
|
|
view:GetChild('btn_save').onClick:Add(function()
|
|
|
|
|
|
local cnt = 0
|
|
|
|
|
|
if self.Lable_name.text ~= user.nick_name then
|
|
|
|
|
|
cnt = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.group_sex.selectedIndex ~= tonumber(user.sex) then
|
|
|
|
|
|
cnt = cnt + 2
|
|
|
|
|
|
end
|
|
|
|
|
|
if cnt > 0 then
|
2025-09-05 16:23:34 +08:00
|
|
|
|
local guo_msg = MsgWindow.new(self._root_view,
|
2025-04-01 10:48:36 +08:00
|
|
|
|
string.format("确定要修改%s%s%s吗?", cnt % 2 == 1 and "昵称" or "", cnt == 3 and "、" or "",
|
2025-09-05 16:23:34 +08:00
|
|
|
|
cnt >= 2 and "性别" or ""), MsgWindow.MsgMode.OnlyOk)
|
|
|
|
|
|
guo_msg.onOk(function()
|
|
|
|
|
|
type.selectedIndex = 0
|
|
|
|
|
|
end)
|
|
|
|
|
|
guo_msg:Show()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
else
|
|
|
|
|
|
type.selectedIndex = 0
|
|
|
|
|
|
end
|
|
|
|
|
|
end)
|
2025-09-19 18:01:12 +08:00
|
|
|
|
|
|
|
|
|
|
view:GetController('ctr_sex').onChanged:Set(function(context)
|
|
|
|
|
|
user.sex = context.sender.selectedIndex + 1
|
|
|
|
|
|
ViewUtil.ShowModalWait2(self._root_view)
|
|
|
|
|
|
local loddyctr = ControllerManager.GetController(LoddyController)
|
|
|
|
|
|
local _data = {}
|
|
|
|
|
|
_data.sex = context.sender.selectedIndex + 1
|
|
|
|
|
|
_data.type = 7
|
|
|
|
|
|
|
|
|
|
|
|
loddyctr:UpdateUserInfo(_data, function(res)
|
|
|
|
|
|
ViewUtil.CloseModalWait2()
|
|
|
|
|
|
if (res.ReturnCode == 0) then
|
|
|
|
|
|
else
|
|
|
|
|
|
ViewUtil.ErrorTip(res.ReturnCode, "切换性别失败")
|
|
|
|
|
|
end
|
|
|
|
|
|
end)
|
|
|
|
|
|
end)
|
2025-11-06 17:37:53 +08:00
|
|
|
|
|
2025-11-10 21:01:13 +08:00
|
|
|
|
local pswType = DataManager.SelfUser.havaPsw and 1 or 0
|
2025-11-06 17:37:53 +08:00
|
|
|
|
local btn_changeInfo = self._view:GetChild('btn_changeInfo')
|
2025-11-10 21:01:13 +08:00
|
|
|
|
btn_changeInfo:GetController('type').selectedIndex = pswType
|
2025-11-06 17:37:53 +08:00
|
|
|
|
btn_changeInfo.onClick:Set(function()
|
2025-11-10 21:01:13 +08:00
|
|
|
|
local passwordUpdateView = PasswordUpdateView.new(pswType, function(res)
|
|
|
|
|
|
pswType = DataManager.SelfUser.havaPsw and 1 or 0
|
|
|
|
|
|
btn_changeInfo:GetController('type').selectedIndex = pswType
|
2025-11-06 17:37:53 +08:00
|
|
|
|
end)
|
2025-11-10 21:01:13 +08:00
|
|
|
|
passwordUpdateView:Show()
|
2025-11-06 17:37:53 +08:00
|
|
|
|
end)
|
2025-11-10 21:01:13 +08:00
|
|
|
|
|
|
|
|
|
|
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
|
|
|
|
|
loddyCtr1:GetUserInfo(function(res)
|
|
|
|
|
|
if res.ReturnCode == 0 then
|
|
|
|
|
|
self:CheckAllload()
|
|
|
|
|
|
end
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:CheckAllload()
|
|
|
|
|
|
self._loadAll = self._loadAll + 1
|
|
|
|
|
|
if self._loadAll >= 2 then
|
|
|
|
|
|
self:Show()
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return M
|