diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index dc57d9c7..e5872659 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -598,36 +598,22 @@ function M:UpdateFamilyRoom(fgCtr, id) end local all_num = #playList + #roomList list_room.itemRenderer = function(index, obj) - if index < #roomList then + if index < #readyRoom then local newIndex = index + 1 local playInfo = self._group:getPlay(roomList[newIndex].pid) - -- self:FillSameRoomInfo(newIndex, obj, 1, 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) - 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 + self:FillSameRoomInfo(obj, 1, playInfo) + local plist = readyRoom[newIndex].plist local insertName = "" for i = 1, #plist do ImageLoad.Load(plist[i].portrait, obj:GetChild(string.format("player%d", i))._iconObject) insertName = string.format("%s、%s", plist[i].nick, insertName) end obj:GetChild('Label_joinPlayers').text = insertName + obj:GetChild('text_playerNum').text = string.format("%s/%s", #plist, playInfo.maxPlayers) obj:GetChild('btn_joinGame').onClick:Set(function() roomCtr:PublicJoinRoom( Protocol.WEB_FG_JOIN_ROOM, - roomList[newIndex].id, + readyRoom[newIndex].id, id, function(response) if (response.ReturnCode == -1) then @@ -643,11 +629,11 @@ function M:UpdateFamilyRoom(fgCtr, id) else UpdateBeat:Remove(self.OnUpdate, self) FamilyView.lastId = self._group.id - ViewManager.ChangeView(ViewManager.View_Main, gameId, { _flag_showTip = true }) + ViewManager.ChangeView(ViewManager.View_Main, playInfo.gameId, { _flag_showTip = true }) end end, id, - roomList[newIndex].pid + readyRoom[newIndex].pid ) end) obj:GetChild('btn_watch').onClick:Set(function() @@ -669,29 +655,88 @@ function M:UpdateFamilyRoom(fgCtr, id) else UpdateBeat:Remove(self.OnUpdate, self) FamilyView.lastId = self._group.id - ViewManager.ChangeView(ViewManager.View_Witness, gameId) + ViewManager.ChangeView(ViewManager.View_Witness, playInfo.gameId) end end, - gameId, + playInfo.gameId, + roomList[newIndex].pid + ) + end) + obj:GetChild('btn_jiesan').onClick:Set(function() + local _curren_msg = + MsgWindow.new( + self._root_view, + '确定要解散该房间吗?', + MsgWindow.MsgMode.OkAndCancel + ) + _curren_msg.onOk:Add( + function() + ViewUtil.ShowModalWait(self._root_view) + local fgCtr = ControllerManager.GetController(NewGroupController) + + fgCtr:FG_RemoveRoom( + id, + readyRoom[newIndex].id, + function(res) + if self._is_destroy then + return + end + ViewUtil.CloseModalWait() + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, '删除房间失败!') + return + end + end + ) + end + ) + _curren_msg:Show() + end) + elseif index >= all_num - #startRoom then + local newIndex = index - #readyRoom - #playList + 1 + local playInfo = self._group:getPlay(startRoom[newIndex].pid) + self:FillSameRoomInfo(obj, 2, playInfo) + local plist = startRoom[newIndex].plist + local insertName = "" + for i = 1, #plist do + ImageLoad.Load(plist[i].portrait, obj:GetChild(string.format("player%d", i))._iconObject) + insertName = string.format("%s、%s", plist[i].nick, insertName) + end + obj:GetChild('Label_joinPlayers').text = insertName + obj:GetChild('text_playerNum').text = string.format("%s/%s", playInfo.maxPlayers, playInfo.maxPlayers) + obj:GetChild('text_roundNum').text = string.format("%s/%s", startRoom[newIndex].round, + startRoom[newIndex].times) + obj:GetChild('btn_joinGame').onClick:Clear() + obj:GetChild('btn_watch').onClick:Set(function() + roomCtr:PublicWitnessRoom( + Protocol.WEB_FG_Witness_ROOM, + roomList[newIndex].id, + id, + function(response) + if (response.ReturnCode == -1) then + ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, 'response.ReturnCode == -1') + -- RestartGame() + return + end + + if response.ReturnCode ~= 0 then + ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间失败') + -- ViewManager.ChangeView(ViewManager.View_Lobby) + return + else + UpdateBeat:Remove(self.OnUpdate, self) + FamilyView.lastId = self._group.id + ViewManager.ChangeView(ViewManager.View_Witness, playInfo.gameId) + end + end, + playInfo.gameId, roomList[newIndex].pid ) - -- self._gamectr = ControllerManager.GetController(GameController) - -- self._gamectr:WitnessGame(DataManager.SelfUser.account_id, id, roomList[newIndex].id) end) - -- elseif index >= all_num - #startRoom then else local newIndex = index - #readyRoom + 1 - local config = ExtendManager.GetExtendConfig(playList[newIndex].gameId) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(playList[newIndex].config, playList[newIndex].hpData) - obj:GetChild('Label_gameRule').title = gamePlay - local roomName = Utils.TextOmit(playList[newIndex].name, 6, "") - roomName = string.format("(%s)%s", playList[newIndex].game_name, roomName) - obj:GetChild('game_type').emojies = EmojiDitc.EmojiesDitc - obj:GetChild('game_type').text = roomName - obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 0 - obj:GetController('type').selectedIndex = 0 - obj:GetController('num').selectedIndex = playList[newIndex].maxPlayers - 2 + local playInfo = playList[newIndex] + self:FillSameRoomInfo(obj, 0, playInfo) obj:GetChild('Label_joinPlayers').text = "" for i = 1, 4 do local btn = obj:GetChild(string.format("player%d", i)) @@ -725,6 +770,7 @@ function M:UpdateFamilyRoom(fgCtr, id) playList[newIndex].id ) end) + obj:GetChild('btn_watch').onClick:Clear() end end -- print("=================================================list_room", list_room, list_room.numItems, all_num) @@ -739,22 +785,22 @@ function M:UpdateFamilyRoom(fgCtr, id) end end -function M:FillSameRoomInfo(newIndex, obj, type, playInfo) +--房间渲染 +function M:FillSameRoomInfo(obj, type, 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) - 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 + obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = type + obj:GetController('type').selectedIndex = type + obj:GetController('isWatch').selectedIndex = (self._group.isWatch and self._group.isWatch == 1) and type or 0 + obj:GetController('num').selectedIndex = playInfo.maxPlayers - 2 end function M:ReflashFamilyList() diff --git a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua index 4da97ba5..49b2a50b 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua @@ -164,6 +164,11 @@ function M:UpdateHandCard(getcard, mp) getcard = getcard or false mp = mp or false + --存在back_columnGap字段则调控列表间距 + if self._viewText_cardInfo['back_columnGap'] and self._view_handCardList.columnGap ~= tonumber(self._viewText_cardInfo['back_columnGap']) then + self._view_handCardList.columnGap = tonumber(self._viewText_cardInfo['back_columnGap']) + end + self._view_handCardList:RemoveChildren() self._view_getCard:RemoveChildren() local btn_card @@ -489,7 +494,10 @@ function M:ShowHand(cards) list = self._view:GetChild('List_HandCard2') cardType = self._viewText_cardInfo["Hand_Card"] end - + --存在show_columnGap字段则调控列表间距 + if self._viewText_cardInfo['show_columnGap'] and list.columnGap ~= tonumber(self._viewText_cardInfo['show_columnGap']) then + list.columnGap = tonumber(self._viewText_cardInfo['show_columnGap']) + end list:RemoveChildren() --list:RemoveChildren() local passcard = false diff --git a/wb_new_ui/assets/Family/Main/Component/btn_joinGame.xml b/wb_new_ui/assets/Family/Main/Component/btn_joinGame.xml index 0c6ffae1..86ec5573 100644 --- a/wb_new_ui/assets/Family/Main/Component/btn_joinGame.xml +++ b/wb_new_ui/assets/Family/Main/Component/btn_joinGame.xml @@ -1,7 +1,7 @@ - + diff --git a/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml b/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml index 287b5ce2..c0354845 100644 --- a/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml +++ b/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml @@ -2,6 +2,7 @@ + @@ -10,9 +11,13 @@ - + + + +