跑得快第二人同步

master
罗家炜 2025-09-03 22:37:39 +08:00
parent 0057741062
commit 92b0f00b4f
3 changed files with 32 additions and 84 deletions

View File

@ -588,39 +588,20 @@ function M:UpdateFamilyRoom(fgCtr, id)
--list_gamePlay:SetVirtual() --list_gamePlay:SetVirtual()
self._view:GetChild('n364').text = string.format("已开启%s桌游戏", self._group.room_num) self._view:GetChild('n364').text = string.format("已开启%s桌游戏", self._group.room_num)
local playList = self._group.playList local playList = self._group.playList
--初始化玩法列表,用于房间使用
local playGameInfoTable = {}
for i = 1, #playList do
playGameInfoTable[playList[i].id] = {
gameId = playList[i].gameId,
config = playList[i].config,
name = playList[i].name,
gameName = playList[i].game_name,
}
end
local roomList = self._group.rooms local roomList = self._group.rooms
local roomCtr = ControllerManager.GetController(RoomController) local roomCtr = ControllerManager.GetController(RoomController)
--先对房间进行一波分类
local readyRoom = {}
local startRoom = {}
for k, v in pairs(roomList) do
table.insert(v.status == 0 and readyRoom or startRoom, v)
end
local all_num = #playList + #roomList
list_room.itemRenderer = function(index, obj) list_room.itemRenderer = function(index, obj)
if index < #roomList then if index < #readyRoom then
local newIndex = index + 1 local newIndex = index + 1
local playInfo = playGameInfoTable[roomList[newIndex].pid] local playInfo = self._group:getPlay(roomList[newIndex].pid)
local gameId = playInfo.gameId
local config = ExtendManager.GetExtendConfig(gameId)
local mode = config:GetGameInfo()
local gamePlay = mode:LoadConfigToDetail(playInfo.config, playInfo.hpData)
obj:GetChild('Label_gameRule').title = gamePlay
local roomName = playGameInfoTable[roomList[newIndex].pid].name
roomName = Utils.TextOmit(roomName, 6, "")
obj:GetChild('game_type').emojies = EmojiDitc.EmojiesDitc
obj:GetChild('game_type').text = string.format("%s%s", playGameInfoTable[roomList[newIndex].pid].gameName,
roomName,
roomList[newIndex].id)
obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1
obj:GetController('num').selectedIndex = roomList[newIndex].maxPlayers - 2
-- if self._group.isWatch == 1 then
-- 允许观战
obj:GetController('type').selectedIndex = self._group.isWatch or 1
-- end
local plist = roomList[newIndex].plist local plist = roomList[newIndex].plist
local insertName = "" local insertName = ""
for i = 1, #plist do for i = 1, #plist do
@ -682,8 +663,10 @@ function M:UpdateFamilyRoom(fgCtr, id)
-- self._gamectr = ControllerManager.GetController(GameController) -- self._gamectr = ControllerManager.GetController(GameController)
-- self._gamectr:WitnessGame(DataManager.SelfUser.account_id, id, roomList[newIndex].id) -- self._gamectr:WitnessGame(DataManager.SelfUser.account_id, id, roomList[newIndex].id)
end) end)
elseif index >= all_num - #startRoom then
else else
local newIndex = index - #roomList + 1 local newIndex = index - #readyRoom + 1
local config = ExtendManager.GetExtendConfig(playList[newIndex].gameId) local config = ExtendManager.GetExtendConfig(playList[newIndex].gameId)
local mode = config:GetGameInfo() local mode = config:GetGameInfo()
local gamePlay = mode:LoadConfigToDetail(playList[newIndex].config, playList[newIndex].hpData) local gamePlay = mode:LoadConfigToDetail(playList[newIndex].config, playList[newIndex].hpData)
@ -730,59 +713,6 @@ function M:UpdateFamilyRoom(fgCtr, id)
end) end)
end end
end end
--[[
list_gamePlay.itemRenderer = function(index, obj)
if index == 0 then
obj:GetController('type').selectedIndex = 0
obj:GetChild('num').text = string.format("%d/7", #playList)
obj:GetChild('btn_addPlay').onClick:Set(function()
local tem = GroupGameSettingView.new(self.blur_view, id, 0, nil, function(play)
local group = DataManager.groups:get(id)
group:addPlay(play)
-- self:FillView()
self:UpdateFamilyRoom(fgCtr, id)
printlog("刷新玩法===>>>>")
group.update_play = true
end)
tem:Show()
end)
return
end
obj:GetChild('text_title').text = playList[index].game_name
local mode = ExtendManager.GetExtendConfig(playList[index].gameId):GetGameInfo()
local pId = playList[index].id
obj:GetChild('Label_details'):GetChild('title').text = mode:LoadConfigToDetail(playList[index].config)
obj:GetChild('text_playName').text = playList[index].name
obj:GetController('type').selectedIndex = 1
obj:GetChild('btn_del').onClick:Set(function()
ViewUtil.ShowTwoChooose("是否要删除该玩法", function()
fgCtr:FG_DelPlay(id, playList[index].id, function(res)
if res.ReturnCode ~= 0 then
local msg = Table_Error_code_Map[res.ReturnCode] or {}
msg = msg.note or "操作失败"
ViewUtil.ShowBannerOnScreenCenter(msg)
return
end
self:UpdateFamilyRoom(fgCtr, id)
end)
end)
end)
obj:GetChild("btn_edit").onClick:Set(function()
local tem = GroupGameSettingView.new(self.blur_view, id, pId, nil, function(play)
local group = DataManager.groups:get(id)
group:addPlay(play)
-- self:FillView()
self:UpdateFamilyRoom(fgCtr, id)
printlog("刷新玩法===>>>>")
group.update_play = true
end)
tem:Show()
end)
end
list_gamePlay.numItems = #playList + 1
]]
local all_num = #playList + #roomList
-- print("=================================================list_room", list_room, list_room.numItems, all_num) -- print("=================================================list_room", list_room, list_room.numItems, all_num)
print("游戏中的房间") print("游戏中的房间")
pt(roomList) pt(roomList)
@ -795,6 +725,24 @@ function M:UpdateFamilyRoom(fgCtr, id)
end end
end end
function M:FillSameRoomInfo(newIndex, obj, playInfo)
local gameId = playInfo.gameId
local config = ExtendManager.GetExtendConfig(gameId)
local mode = config:GetGameInfo()
local gamePlay = mode:LoadConfigToDetail(playInfo.config, playInfo.hpData)
obj:GetChild('Label_gameRule').title = gamePlay
local roomName = playInfo.name
roomName = Utils.TextOmit(roomName, 6, "")
obj:GetChild('game_type').emojies = EmojiDitc.EmojiesDitc
obj:GetChild('game_type').text = string.format("%s%s", playInfo.game_name, roomName, roomList[newIndex].id)
obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1
obj:GetController('num').selectedIndex = roomList[newIndex].maxPlayers - 2
-- if self._group.isWatch == 1 then
-- 允许观战
obj:GetController('type').selectedIndex = self._group.isWatch or 1
-- end
end
function M:ReflashFamilyList() function M:ReflashFamilyList()
local list_family = self._view:GetChild('list_family') local list_family = self._view:GetChild('list_family')
list_family.numItems = #DataManager.groups.groupList list_family.numItems = #DataManager.groups.groupList

View File

@ -39,7 +39,7 @@
<relation target="" sidePair="width-width,height-height,center-center,middle-middle"/> <relation target="" sidePair="width-width,height-height,center-center,middle-middle"/>
</component> </component>
<group id="n49_ckvb" name="head" xy="0,0" size="144,144"/> <group id="n49_ckvb" name="head" xy="0,0" size="144,144"/>
<text id="n45_kx91" name="text_score" xy="-31,81" size="25,49" font="ui://27vd145bh35o7ik0" fontSize="36" color="#ffffff" align="center" vAlign="middle" bold="true" autoClearText="true" text="0"> <text id="n45_kx91" name="text_jifen" xy="-31,81" size="25,49" font="ui://27vd145bh35o7ik0" fontSize="36" color="#ffffff" align="center" vAlign="middle" bold="true" autoClearText="true" text="0">
<gearColor controller="text_color" pages="1" values="#ff0000,#000000" default="#ffffff,#000000"/> <gearColor controller="text_color" pages="1" values="#ff0000,#000000" default="#ffffff,#000000"/>
<relation target="" sidePair="center-center,right-left,top-bottom"/> <relation target="" sidePair="center-center,right-left,top-bottom"/>
</text> </text>