2025-09-17 19:51:05 +08:00
|
|
|
local GamePlayDetail = {}
|
|
|
|
|
|
|
|
|
|
local M = GamePlayDetail
|
|
|
|
|
|
|
|
|
|
--玩法详情
|
|
|
|
|
local gamePlayDetail = {
|
|
|
|
|
--麻将
|
|
|
|
|
{
|
|
|
|
|
{
|
2025-09-19 16:34:16 +08:00
|
|
|
icon0 = "fuzhou0",
|
|
|
|
|
icon1 = "fuzhou1",
|
|
|
|
|
detail = "fuzhouDetail"
|
2025-09-17 19:51:05 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon0 = "jinxi0",
|
|
|
|
|
icon1 = "jinxi1",
|
2025-09-18 13:32:05 +08:00
|
|
|
detail = "jinxiDetail"
|
2025-09-17 19:51:05 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon0 = "nancheng0",
|
|
|
|
|
icon1 = "nancheng1",
|
2025-09-18 13:32:05 +08:00
|
|
|
detail = "nanchengDetail"
|
2025-09-17 19:51:05 +08:00
|
|
|
},
|
2025-09-19 16:34:16 +08:00
|
|
|
{
|
|
|
|
|
icon0 = "lichuan0",
|
|
|
|
|
icon1 = "lichuan1",
|
|
|
|
|
detail = "lichuanDetail"
|
|
|
|
|
},
|
2025-09-17 19:51:05 +08:00
|
|
|
},
|
|
|
|
|
--扑克
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
icon0 = "paodekuai0",
|
|
|
|
|
icon1 = "paodekuai1",
|
2025-09-18 13:32:05 +08:00
|
|
|
detail = "paodekuaiDetail"
|
2025-09-17 19:51:05 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
--字牌
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function M.New(data, callback)
|
|
|
|
|
setmetatable(M, { __index = BaseWindow })
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
|
|
|
|
self._full = true
|
|
|
|
|
self._full_offset = false
|
|
|
|
|
self.class = "com_GamePlayDetail"
|
|
|
|
|
BaseWindow.init(self, 'ui://Lobby/GamePlay')
|
|
|
|
|
self.data = data
|
|
|
|
|
self:Init()
|
|
|
|
|
self.closeCallback = callback
|
|
|
|
|
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:Init()
|
|
|
|
|
local list_gamePlay = self._view:GetChild('list_gameName')
|
|
|
|
|
list_gamePlay.itemRenderer = function(index, obj)
|
|
|
|
|
obj:GetChild('icon0').url = string.format("ui://Lobby/%s",
|
|
|
|
|
gamePlayDetail[self._ctr_gameType.selectedIndex + 1][index + 1].icon0)
|
|
|
|
|
obj:GetChild('icon1').url = string.format("ui://Lobby/%s",
|
|
|
|
|
gamePlayDetail[self._ctr_gameType.selectedIndex + 1][index + 1].icon1)
|
|
|
|
|
end
|
|
|
|
|
list_gamePlay.onClickItem:Set(function(context)
|
|
|
|
|
self._view:GetChild("gamePlayDetail").url = string.format("ui://Lobby/%s",
|
|
|
|
|
gamePlayDetail[self._ctr_gameType.selectedIndex + 1][context.sender.selectedIndex + 1].detail)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
self._ctr_gameType = self._view:GetController('gameType')
|
|
|
|
|
self._ctr_gameType.onChanged:Set(function(context)
|
|
|
|
|
list_gamePlay.numItems = #gamePlayDetail[context.sender.selectedIndex + 1]
|
|
|
|
|
if list_gamePlay.numItems > 0 then
|
|
|
|
|
self._view:GetChild("gamePlayDetail").url = string.format("ui://Lobby/%s",
|
|
|
|
|
gamePlayDetail[context.sender.selectedIndex + 1][1].detail)
|
|
|
|
|
list_gamePlay.selectedIndex = 0
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
self._ctr_gameType.selectedIndex = 0
|
|
|
|
|
list_gamePlay.numItems = #gamePlayDetail[1]
|
|
|
|
|
self._view:GetChild("gamePlayDetail").url = string.format("ui://Lobby/%s", gamePlayDetail[1][1].detail)
|
|
|
|
|
list_gamePlay.selectedIndex = 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:Show()
|
|
|
|
|
getmetatable(M).__index.Show(self)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:Close()
|
|
|
|
|
if self.closeCallback then
|
|
|
|
|
self.closeCallback()
|
|
|
|
|
end
|
|
|
|
|
getmetatable(M).__index.Close(self)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|