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

50 lines
1.4 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

local LobbyService = {}
local M = LobbyService
function M.new()
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
self.class = "LobbyService"
self._close_destroy = true
self:init("ui://Lobby/service")
return self
end
function M:init(url)
BaseWindow.init(self, url)
self._listView_main = self._view:GetChild('list')
self._listView_main.itemRenderer = function(index, obj)
local info = self._data_services[index + 1]
obj.text = info.service_link
obj:GetChild('text_title').text = string.format("%s", info.service_name)
obj:GetChild('btn_copy').onClick:Set(function()
GameApplication.Instance:CopyToClipboard(info.service_link) --湘北
ViewUtil.ErrorTip(-1, "复制成功")
end)
end
self:GetService()
end
function M:GetService()
ViewUtil:ShowModalWait2(0.1)
local lobbyCtr = ControllerManager.GetController(LoddyController)
lobbyCtr:GetServiceInfo({}, function(res)
if res.ReturnCode ~= 0 then
ViewUtil.CloseModalWait2()
ViewUtil.ErrorTip(res.ReturnCode, "客服信息正在更新")
return
else
pt("GetService", res)
self._data_services = res.Data.services
self._listView_main.numItems = #self._data_services
ViewUtil.CloseModalWait2()
self:Show()
end
end)
end
return M