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._auto_close = auto_close 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._view:GetChild("btn_close2").onClick:Add(function() self:Destroy() end) self:FillRoomConfig(self._view:GetChild("rule"),_room) self:FillGameConfig(self._view:GetChild("point"),_room) --self:FillGameConfig(_room) end function M:FillRoomConfig(roominfo_panel,_room) if _room.room_id and _room.room_id ~= "" then local tex_roomid = roominfo_panel:GetChild("tex_roomid") tex_roomid.text = _room.room_id else roominfo_panel:GetController("hide_id").selectedIndex = 1 end 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 = _room.room_config:GetDes() end function M:FillGameConfig(parentP,_room) --local tex_roomconfig = roominfo_panel:GetChild("tex_roomconfig") --tex_roomconfig.text = _room.room_config:GetGameJS() --local tempX,tempY=_room.room_config:GetGameSMSize() --if tempX and tempY then -- tex_roomconfig:SetSize(tempX,tempY) --end --[[local gameR=_room.room_config:GetGameJS() if gameR then parentP:AddChild(gameR) end--]] end function M:Show() BaseWindow.Show(self) if self._run_close then coroutine.stop(self._run_close) end if self._auto_close then self._view:GetController("auto_close").selectedIndex = 1 self._run_close = coroutine.start(function() while self._close_time > 0 do local tex_time = self._view:GetChild("tex_time") tex_time.text = "自动关闭剩余" .. self._close_time .. "s" coroutine.wait(1) self._close_time = self._close_time - 1 end self:Destroy() end) end end return M