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

66 lines
1.9 KiB
Lua

local LobbyGiftDiamond = {
sendPage = 1
}
local M = LobbyGiftDiamond
function M.new(data, callback)
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
self.class = "LobbyGiftDiamond"
self._full = true
self._close_destroy = true
self._close_zone = false
self._data = data
self._callback = callback
self:init("ui://Lobby/GiftDiamond")
return self
end
function M:init(url)
BaseWindow.init(self, url)
local input_id = self._view:GetChild('input_id')
input_id.onFocusOut:Set(function()
--发送查找用户的协议
printlog("lingmeng send find", input_id.text)
end)
self._view:GetChild('btn_center').onClick:Set(function()
local text_id = input_id.text
local text_num = self._view:GetChild('input_num').text
local lobbyCtr = ControllerManager.GetController(LoddyController)
lobbyCtr:GiftDiamond({ tagId = tonumber(text_id), diamo = tonumber(text_num) }, function(res)
if res.ReturnCode == 0 then
DataManager.SelfUser.diamo = DataManager.SelfUser.diamo - text_num
self._callback()
self:Destroy()
ViewUtil.ErrorTip(-1, "赠送房卡成功")
else
ViewUtil.ErrorTip(res.ReturnCode, "赠送房卡失败")
end
end)
end)
local ctr_page = self._view:GetController('page')
ctr_page.onChanged:Set(function()
if ctr_page.selectedIndex == 0 then
input_id.text = ""
self._view:GetChild('input_num').text = ""
self._view:GetChild('text_name').text = ""
self._view:GetChild('btn_head').url = ""
elseif ctr_page.selectedIndex == 1 then
end
end)
self._list_list = self._view:GetChild('list')
self._list_list.itemRenderer = function(index, obj)
end
end
return M