77 lines
2.0 KiB
Lua
77 lines
2.0 KiB
Lua
|
|
local RoomItem = {}
|
||
|
|
|
||
|
|
local M = RoomItem
|
||
|
|
|
||
|
|
function RoomItem.new(item,max,ishow)
|
||
|
|
local self = setmetatable({}, {__index = M})
|
||
|
|
self.class = "RoomItem"
|
||
|
|
self.item = item
|
||
|
|
self.ishow = ishow
|
||
|
|
self.play = nil
|
||
|
|
self:init(max)
|
||
|
|
return self
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:init(max)
|
||
|
|
local item = self.item
|
||
|
|
self.ctr_state = item:GetController("state")
|
||
|
|
self.tex_round = item:GetChild("tex_round")
|
||
|
|
self.tex_gamename = item:GetChild("tex_gamename")
|
||
|
|
self.tex_roomid = item:GetChild("tex_roomid")
|
||
|
|
self.btn_set = item:GetChild("btn_set")
|
||
|
|
self.desk = item:GetChild("desk")
|
||
|
|
self.ctr_color = self.desk:GetController("color")
|
||
|
|
self.tex_limit = item:GetChild("tex_limit")
|
||
|
|
self.btn_detail = item:GetChild("btn_detail")
|
||
|
|
--self.btn_detail.visible = false
|
||
|
|
if self.btn_detail then
|
||
|
|
self.btn_detail.onClick:Set(function ()
|
||
|
|
local str = self:ShowDetails(self.play)
|
||
|
|
local _curren_msg = MsgWindow.new(self._root_view, str, MsgWindow.MsgMode.OnlyOk)
|
||
|
|
|
||
|
|
_curren_msg:Show()
|
||
|
|
end)
|
||
|
|
end
|
||
|
|
|
||
|
|
self.heads = {}
|
||
|
|
|
||
|
|
for i=1,max do
|
||
|
|
--printlog("==================================",i)
|
||
|
|
local p_item = self.desk:GetChild("head"..i)
|
||
|
|
local btn_head = p_item:GetChild("btn_head")
|
||
|
|
self.def_icon = btn_head._iconObject.texture
|
||
|
|
local tex_name = p_item:GetChild("tex_name")
|
||
|
|
local tex_id = p_item:GetChild("tex_id")
|
||
|
|
--tex_id.visible = self.ishow
|
||
|
|
local text_score=p_item:GetChild("tex_score")
|
||
|
|
text_score.visible = false
|
||
|
|
self.heads[i] = {p_item = p_item,btn_head = btn_head,tex_name = tex_name,tex_id = tex_id,text_score=text_score}
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:SetPlay(play)
|
||
|
|
self.play = play
|
||
|
|
-- if play.gameId == 203 then
|
||
|
|
-- self.desk.touchable = false
|
||
|
|
-- end
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:ShowDetails(play)
|
||
|
|
if not play then return "" end
|
||
|
|
local gameStr
|
||
|
|
local data
|
||
|
|
local exconfig = ExtendManager.GetExtendConfig(play.gameId)
|
||
|
|
|
||
|
|
data = json.decode(play.config)
|
||
|
|
local r = {}
|
||
|
|
exconfig:FillRoomConfig(r, data)
|
||
|
|
gameStr = string.gsub(r.room_config:GetDes(), "\r", "")
|
||
|
|
|
||
|
|
gameStr = "[color=#f22d3c]玩法说明:[/color]".."[color=#776a5e]"..gameStr.."[/color]"
|
||
|
|
|
||
|
|
return gameStr
|
||
|
|
end
|
||
|
|
|
||
|
|
return M
|