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

43 lines
1.1 KiB
Lua
Raw Permalink Normal View History

2025-04-01 10:48:36 +08:00
RoomInfoView = {}
local M = RoomInfoView
function RoomInfoView.new(_room, auto_close)
2025-06-09 16:30:22 +08:00
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
2025-04-01 10:48:36 +08:00
self.class = "RoomInfoView"
self._close_destroy = true
self._close_zone = true
2025-06-09 16:30:22 +08:00
self:init("ui://Common/GameRule", _room)
2025-04-01 10:48:36 +08:00
return self
end
2025-06-09 16:30:22 +08:00
function M:init(url, _room)
BaseWindow.init(self, url)
2025-04-01 10:48:36 +08:00
self._close_time = 3
local _mainView = self._view
2025-06-09 16:30:22 +08:00
self:FillRoomConfig(self._view:GetChild("rule"), _room)
2025-04-01 10:48:36 +08:00
end
2025-06-09 16:30:22 +08:00
function M:FillRoomConfig(roominfo_panel, _room)
local config = ExtendManager.GetExtendConfig(_room.game_id)
local mode = config:GetGameInfo()
2025-08-23 22:23:17 +08:00
local gamePlay = mode:LoadConfigToDetail(json.encode(_room.room_config.config), json.encode(_room.room_config.hpData))
2025-04-01 10:48:36 +08:00
local tex_gametype = roominfo_panel:GetChild("tex_gametype")
tex_gametype.text = _room.room_config:GetGameName()
local tex_roomconfig = roominfo_panel:GetChild("tex_roomconfig")
2025-06-09 16:30:22 +08:00
tex_roomconfig.text = gamePlay
2025-04-01 10:48:36 +08:00
end
function M:Show()
BaseWindow.Show(self)
if self._run_close then
coroutine.stop(self._run_close)
end
end
return M