jx_client_neibu/lua_probject/base_project/Game/View/RoomInfoView.lua

43 lines
1.1 KiB
Lua

RoomInfoView = {}
local M = RoomInfoView
function RoomInfoView.new(_room, auto_close)
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
self.class = "RoomInfoView"
self._close_destroy = true
self._close_zone = true
self:init("ui://Common/GameRule", _room)
return self
end
function M:init(url, _room)
BaseWindow.init(self, url)
self._close_time = 3
local _mainView = self._view
self:FillRoomConfig(self._view:GetChild("rule"), _room)
end
function M:FillRoomConfig(roominfo_panel, _room)
local config = ExtendManager.GetExtendConfig(_room.game_id)
local mode = config:GetGameInfo()
local gamePlay = mode:LoadConfigToDetail(json.encode(_room.room_config.config))
local tex_gametype = roominfo_panel:GetChild("tex_gametype")
tex_gametype.text = _room.room_config:GetGameName()
local tex_roomconfig = roominfo_panel:GetChild("tex_roomconfig")
tex_roomconfig.text = gamePlay
end
function M:Show()
BaseWindow.Show(self)
if self._run_close then
coroutine.stop(self._run_close)
end
end
return M