hengyang_client/lua_probject/base_project/Game/View/Lobby/LobbyAuthenticateView.lua

70 lines
1.8 KiB
Lua

--设置窗口对象
local LobbyAuthenticateView = {}
local M = LobbyAuthenticateView
setmetatable(M, { __index = BaseWindow })
function LobbyAuthenticateView.new()
local self = setmetatable({}, { __index = M })
self.class = 'AuthenticateView'
self._close_destroy = true
--假效果
self.authenticate = 0
self.authenticateName = ""
self.authenticateId = ""
self:init('ui://Lobby/Authentication')
return self
end
function M:init(url)
BaseWindow.init(self, url)
local view = self._view
local input_name = view:GetChild('input_name');
input_name.onChanged:Set(function()
input_name.alpha = 1
end)
input_name.onFocusOut:Set(function()
if #input_name.text > 0 then
input_name.alpha = 1
else
input_name.alpha = 0.5
end
end)
local input_idInfo = view:GetChild('input_idInfo');
input_idInfo.onChanged:Set(function()
input_idInfo.alpha = 1
end)
input_idInfo.onFocusOut:Set(function()
if #input_idInfo.text > 0 then
input_idInfo.alpha = 1
else
input_idInfo.alpha = 0.5
end
end)
local btn_send = view:GetChild('btn_send')
btn_send.onClick:Set(function()
local _data = {}
_data.type = 1
_data.real_info = {}
_data.real_info.name = input_name.text
_data.real_info.ID = input_idInfo.text
local loddyctr = ControllerManager.GetController(LoddyController)
loddyctr:UpdateUserInfo(_data, function(res)
if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "实名认证失败")
else
pt(res)
ViewUtil.ShowOneChooose("实名认证成功")
self:Destroy()
end
end)
end)
end
return M