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
|
|
|
|
|
|
self:init('ui://Lobby/PlayerInfo')
|
|
|
|
|
|
return self
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:init(url)
|
|
|
|
|
|
BaseWindow.init(self, url)
|
|
|
|
|
|
|
|
|
|
|
|
local view = self._view
|
|
|
|
|
|
local user = self.user;
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- print("================phone=====================")
|
2025-04-01 10:48:36 +08:00
|
|
|
|
for k, v in pairs(user) do
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- print(string.format("k:%s|v:%s", k, v))
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--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
|
|
|
|
|
|
view:GetChild('sex').text = user.sex and "男" or "女"
|
|
|
|
|
|
ImageLoad.Load(DataManager.SelfUser.head_url, view:GetChild("btn_PlayerHead")._iconObject)
|
|
|
|
|
|
|
|
|
|
|
|
--change
|
|
|
|
|
|
view:GetChild('choose_id').text = user.account_id
|
|
|
|
|
|
view:GetChild('choose_diamo').text = user.diamo
|
|
|
|
|
|
self.Lable_name = view:GetChild('Lable_name'):GetChild('text')
|
|
|
|
|
|
self.Lable_name.text = user.nick_name
|
|
|
|
|
|
self.group_sex = view:GetController('group_sex')
|
|
|
|
|
|
self.group_sex.selectedIndex = user.sex
|
|
|
|
|
|
self.Lable_phone = view:GetChild('Lable_phone'):GetChild('text')
|
|
|
|
|
|
local bind = view:GetController('bind')
|
|
|
|
|
|
if user.phone then
|
|
|
|
|
|
bind.selectedIndex = 1
|
|
|
|
|
|
self.Lable_phone.text = user.phone
|
|
|
|
|
|
else
|
|
|
|
|
|
bind.selectedIndex = 0
|
|
|
|
|
|
self.Lable_phone.text = ""
|
|
|
|
|
|
end
|
|
|
|
|
|
view:GetChild('btn_headChange').onClick:Add(function()
|
|
|
|
|
|
ViewUtil.ShowOneChooose("暂不支持更换头像", 1)
|
|
|
|
|
|
end)
|
|
|
|
|
|
view:GetChild('btn_changePhone').onClick:Add(function()
|
|
|
|
|
|
ViewUtil.ShowOneChooose("绑定页面正在优化中,请稍后绑定", 1)
|
|
|
|
|
|
end)
|
|
|
|
|
|
view:GetChild('btn_bindPhone').onClick:Add(function()
|
|
|
|
|
|
ViewUtil.ShowOneChooose("绑定页面正在优化中,请稍后绑定", 1, function()
|
|
|
|
|
|
bind.selectedIndex = 1
|
|
|
|
|
|
end)
|
|
|
|
|
|
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
|
|
|
|
|
|
ViewUtil.ShowOneChooose(
|
|
|
|
|
|
string.format("确定要修改%s%s%s吗?", cnt % 2 == 1 and "昵称" or "", cnt == 3 and "、" or "",
|
2025-05-22 18:14:21 +08:00
|
|
|
|
cnt >= 2 and "性别" or ""), 1, function()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
type.selectedIndex = 0
|
|
|
|
|
|
end)
|
|
|
|
|
|
else
|
|
|
|
|
|
type.selectedIndex = 0
|
|
|
|
|
|
end
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return M
|