diff --git a/lua_probject/base_project/Game/Controller/GameController.lua b/lua_probject/base_project/Game/Controller/GameController.lua index bf24a0fd..7f32e760 100644 --- a/lua_probject/base_project/Game/Controller/GameController.lua +++ b/lua_probject/base_project/Game/Controller/GameController.lua @@ -313,7 +313,32 @@ end function M:OnEventDismissRoomFail(evt_data) self._cacheEvent:Enqueue( function() - DispatchEvent(self._dispatcher, GameEvent.DeskBreak, 3) + local room = DataManager.CurrenRoom + local req_aid = evt_data['req_aid'] + evt_data.req_p = room:GetPlayerById(req_aid) + local player_list = room.player_list + local tem_list = {} + local list = evt_data['list'] + + for k = 1, #player_list do + local p = nil + for i = 1, #list do + local tem = list[i] + if tem.aid == player_list[k].self_user.account_id then + tem.player = player_list[k] + p = tem + break + end + end + if not p then + p = {} + p.player = player_list[k] + p.result = 0 + end + tem_list[k] = p + end + evt_data['list'] = tem_list + DispatchEvent(self._dispatcher, GameEvent.DeskBreak, 3, evt_data) end ) end diff --git a/lua_probject/base_project/Game/View/DismissRoomWindow.lua b/lua_probject/base_project/Game/View/DismissRoomWindow.lua index 6437ff10..f03e6023 100644 --- a/lua_probject/base_project/Game/View/DismissRoomWindow.lua +++ b/lua_probject/base_project/Game/View/DismissRoomWindow.lua @@ -12,7 +12,7 @@ function DismissRoomWindow.new(blur_view) self._animation = false self.onCallback = event("onCallback", true) self._close_zone = false - -- self._queue = false + self._queue = false self.time = 180 self:init("ui://Common/dismiss_room") return self @@ -21,7 +21,7 @@ end function M:init(url) BaseWindow.init(self, url) local view = self._view - -- self._root_view.sortingOrder = 100 + self._root_view.sortingOrder = 100 self.tex_time = view:GetChild("tex_time") self.tex_time2 = view:GetChild("tex_time2") local _btn_aggree = view:GetChild("btn_aggree") @@ -41,6 +41,13 @@ function M:init(url) _gamectr:DismissRoomVote(false) end end) + + local btn_ok = view:GetChild('btn_ok') + if btn_ok then + btn_ok.onClick:Set(function() + self:Close() + end) + end end function M:FillData(data) @@ -79,6 +86,9 @@ function M:FillData(data) ctr_item_falg.selectedIndex = tem.result -- end end + if data._flag_faild then + ctr_falg.selectedIndex = 2 + end end function M:OnUpdate(deltaTime) diff --git a/lua_probject/base_project/Game/View/MainView.lua b/lua_probject/base_project/Game/View/MainView.lua index ec159ea2..bc481dfb 100644 --- a/lua_probject/base_project/Game/View/MainView.lua +++ b/lua_probject/base_project/Game/View/MainView.lua @@ -814,12 +814,25 @@ function M:EventInit() local p = arg[2] local result = arg[3] elseif code == 3 then - if self.dismissWin ~= nil then - self.dismissWin:Destroy() - end - self.dismissWin = nil + local info = arg[2] self.dismiss_room_cd_time = 30 - ViewUtil.ShowTips('解散失败!') + for i = 1, #info.list do + local tem = info.list[i] + if tem.player == DataManager.CurrenRoom.self_player then + if tem.result ~= 2 then + info._flag_faild = true + info.time = 0 + self.dismissWin:FillData(info) + break + else + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil + break + end + end + end end end ) diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua index ad194e88..045e616f 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua @@ -516,6 +516,10 @@ function M:EventInit() local total_result = arg[2] local result = arg[1] local over = arg[3] + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil if over == 2 then if _room.curren_round > 0 then self:PlayMJMusic("gameover.mp3") diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua index 36909f9f..3e2f3cc2 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua @@ -518,6 +518,10 @@ function M:EventInit() local total_result = arg[2] local result = arg[1] local over = arg[3] + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil if over == 2 then if _room.curren_round > 0 then self:PlayMJMusic("gameover.mp3") diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua index 785d64a7..861dc81c 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua @@ -517,6 +517,10 @@ function M:EventInit() local total_result = arg[2] local result = arg[1] local over = arg[3] + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil if over == 2 then if _room.curren_round > 0 then self:PlayMJMusic("gameover.mp3") diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index 1b78a671..51d12b6a 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -517,6 +517,10 @@ function M:EventInit() local total_result = arg[2] local result = arg[1] local over = arg[3] + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil if over == 2 then if _room.curren_round > 0 then self:PlayMJMusic("gameover.mp3") diff --git a/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua b/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua index 330b03a8..ded1ac52 100644 --- a/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua +++ b/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua @@ -462,7 +462,7 @@ function M:CheckOutCardSetTipList(tipCardSet, longLength, cardMap, cardType) end end if #tempList > 0 then - if cardType == 3 then + if self.type == 4 or self.type == 5 then local removeSanDaiList = {} for k, v in pairs(cardMap) do if not tempSanDaiCard[k] then @@ -496,7 +496,7 @@ function M:CheckOutCardSetTipList(tipCardSet, longLength, cardMap, cardType) end end if #tempList > 0 then - if cardType == 3 then + if self.type == 4 or self.type == 5 then local removeSanDaiList = {} for k, v in pairs(cardMap) do if not tempSanDaiCard[k] then diff --git a/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua index 851bc5ce..a186cc02 100644 --- a/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua @@ -2,20 +2,21 @@ local PlayerInfoView = require("Game.View.PlayerInfoView2") local M = {} -function M.new(view, mainView) +function M.new(view, mainView, flag_witness) setmetatable(M, { __index = PlayerInfoView }) local self = setmetatable({}, { __index = M }) self._view = view self._main_view = mainView - self:init() + self:init(flag_witness) return self end -function M:init() +function M:init(flag_witness) getmetatable(M).__index.init(self) --互动表情的父类 self._hudon = self._view:GetChild('comp_hudon') + PlayerInfoView.init(self, flag_witness) end function M:FillData(player) diff --git a/lua_probject/extend_project/extend/poker/runfast/EXWitnessView.lua b/lua_probject/extend_project/extend/poker/runfast/EXWitnessView.lua index 3026aed0..780105ed 100644 --- a/lua_probject/extend_project/extend/poker/runfast/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/EXWitnessView.lua @@ -23,6 +23,7 @@ end function M:InitView(url) local _room = DataManager.CurrenRoom + local room = DataManager.CurrenRoom self._full = true UIPackage.AddPackage("extend/poker/runfast/ui/Extend_Poker_RunFastNew") getmetatable(M).__index.InitView(self, @@ -43,7 +44,7 @@ function M:InitView(url) local _player_info = self._player_info for i = 1, self._room.room_config.people_num do local tem = self._view:GetChild("player_info" .. i) - _player_info[i] = PlayerInfoView.new(tem, self) + _player_info[i] = PlayerInfoView.new(tem, self, true) tem.visible = false end local list = self._room.player_list @@ -192,6 +193,29 @@ function M:InitView(url) end self._rightPanelView = RunFast_RightPanelView.new(self, rightpanel) + + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + viewList_witness:SetVirtual() + viewList_witness.itemRenderer = function(index, obj) + obj:GetChild('title').text = room.witness_player_list[index + 1].nick + ImageLoad.Load(room.witness_player_list[index + 1].portrait, obj:GetChild('btn_head')._iconObject) + end + + local btn_witness = self._view:GetChild('btn_pangGuang') + if btn_witness then + btn_witness.onClick:Set(function() + self._view:GetController('witness').selectedIndex = 1 + end) + end + + --直接渲染观战人员 + if room.witness_player_list then + if viewList_witness.numItems == #room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #room.witness_player_list + end + end end function M:ChangeBgmMusic(bgm_index) @@ -297,7 +321,6 @@ function M:EventInit() -- if index == 1 then local card_info = self._player_card_info[index] - card_info:SetOutCardInfo(nil, false) -- if self.MypokerList ~= nil then -- -- body -- card_info:Clear() @@ -306,7 +329,7 @@ function M:EventInit() -- end -- end self._leftClock_continue = coroutine.start(function() - coroutine.wait(1) + card_info:SetOutCardInfo(nil, false) for i = 1, #self._player_card_info do local card_info = self._player_card_info[i] if i == index then @@ -341,7 +364,7 @@ function M:EventInit() _gamectr:AddEventListener(RunFast_GameEvent.OnPlaySucc, function(...) ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/playcard_chup.mp3") - self._popEvent = false + -- self._popEvent = false local arg = { ... } local p = arg[1] local card_number = arg[2] @@ -368,6 +391,7 @@ function M:EventInit() head_info:SetBaoDan(card_number == 1) local card_info = self._player_card_info[index] card_info:SetOutCardInfo(p.out_card_list, false, true) + card_info._ctr_time_clock.selectedIndex = 0 for i = 1, #otherList do local other_seat = otherList[i] @@ -433,6 +457,7 @@ function M:EventInit() end) _gamectr:AddEventListener(RunFast_GameEvent.OnPassSucc, function(...) + self._popEvent = false local arg = { ... } local p = arg[1] @@ -450,6 +475,10 @@ function M:EventInit() card_info._ctr_time_clock.selectedIndex = 0 card_info:SetOutCardInfo(nil, true) self:PlaySound(p.self_user.sex, "pass_" .. math.random(1, 4)) + coroutine.start(function() + coroutine.wait(1) + self._popEvent = true + end) end) _gamectr:AddEventListener(RunFast_GameEvent.OnErrorTip, function(...) @@ -482,7 +511,10 @@ function M:EventInit() -- local energyTab = arg[5] local otherpoker_list = self._view:GetChild("otherpoker_list") local card_info = self._player_card_info[self:GetPos(self._room.self_player.seat)] - + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil if self.MypokerList ~= nil then -- body card_info:Clear() @@ -517,30 +549,38 @@ function M:EventInit() card_info._ctr_time_clock.selectedIndex = 0 self._left_time = 0 end + -- -- print("11111111111111") + -- coroutine.wait(1) + -- if self._room.self_player.seat == win_seat then + -- local sprint_seat_list = self:GetSpringSeats(info) + -- if #sprint_seat_list > 0 then + -- local url = "ui://Extend_Poker_RunFastNew/Spring" + -- self.WinItem_view = UIPackage.CreateObjectFromURL(url) + -- self._view:AddChild(self.WinItem_view) + -- self.WinItem_view:Center() + -- self.WinItem_view:GetTransition("t0"):Play() + -- ViewUtil.PlaySound("RunFastNew_PK", "base/common/sound/win new.mp3") + -- end + -- -- local url = #sprint_seat_list > 0 and "ui://Extend_Poker_RunFastNew/Spring" or "ui://Extend_Poker_RunFastNew/Win_Mine" + -- else + -- local beigang = false + -- if #self:GetSpringSeats(info) > 0 then + -- for i = 1, #self:GetSpringSeats(info) do + -- if self:GetSpringSeats(info)[i] == self._room.self_player.seat then + -- local url = "ui://Extend_Poker_RunFastNew/spring2" + -- self.WinItem_view = UIPackage.CreateObjectFromURL(url) + -- self._view:AddChild(self.WinItem_view) + -- self.WinItem_view:Center() + -- self.WinItem_view:GetTransition("t0"):Play() + -- beigang = true + -- end + -- end + -- end + -- -- if beigang == false then + -- -- self:CreateRankEff() + -- -- end + -- end - for i = 1, #info do - local player = info[i] - local p = self._room:GetPlayerBySeat(player.seat) - local head_info = self._player_info[self:GetPos(player.seat)] - local card_info = self._player_card_info[self:GetPos(player.seat)] - - if player.seat ~= self._room.self_player.seat then - local oneTime = 7 / 60 - - -- card_info:UpdateHandPoker(player.cards, false, true) - - card_info._view_resultOut:RemoveChildrenToPool() - card_info._ctr_resultOut.selectedIndex = 1 - card_info.ctr_outpoker.selectedIndex = 0 - for i = 1, #player.handCards do - local child_card = card_info._view_resultOut:AddItemFromPool() - card_info:FillPoker(child_card, "", nil, player.handCards[i]) - ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/fanCard.mp3") - printlog("lingmeng oneTime", oneTime) - coroutine.wait(oneTime) - end - end - end for i = 1, #info do local player = info[i] local p = self._room:GetPlayerBySeat(player.seat) @@ -551,7 +591,41 @@ function M:EventInit() -- head_info:PlayScore(player.winscore, win_seat == player.seat) head_info:PlayScore(player.card_score, win_seat == player.seat) end + + for i = 1, #info do + local player = info[i] + local p = self._room:GetPlayerBySeat(player.seat) + local head_info = self._player_info[self:GetPos(player.seat)] + local card_info = self._player_card_info[self:GetPos(player.seat)] + + if player.seat ~= win_seat then + card_info.ctr_outpoker.selectedIndex = 0 + end + if player.seat ~= self._room.self_player.seat then + local oneTime = 7 / 60 + + -- card_info:UpdateHandPoker(player.cards, false, true) + + card_info._view_resultOut:RemoveChildrenToPool() + card_info._ctr_resultOut.selectedIndex = 1 + for i = 1, #player.handCards do + local child_card = card_info._view_resultOut:AddItemFromPool() + card_info:FillPoker(child_card, "", nil, player.handCards[i]) + ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/fanCard.mp3") + printlog("lingmeng oneTime", oneTime) + coroutine.wait(oneTime) + end + end + end self:ChangeBgmMusic(1) + -- if over == 0 then + -- if #self:GetSpringSeats(info) > 0 then + -- -- -- print("222222222222222222") + -- coroutine.wait(1) + -- else + -- -- -- print("333333333333333333") + -- -- coroutine.wait(2) + -- end coroutine.wait(2) self.result_view = RunFast_ResultView.new(self, info, self._room.room_id, over, win_seat, 0, @@ -565,10 +639,6 @@ function M:EventInit() end end end) - ------------观战把准备按钮隐藏了----------- - self._ctr_inClear.selectedIndex = 0 - self.result_view._view:GetChild('btn_nextRound').visible = false - ------------------------ self.result_view:Show() if self.WinItem_view ~= nil then self.WinItem_view:Dispose() @@ -584,6 +654,20 @@ function M:EventInit() btn_confirm.onClick:Call() end ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3") + -- local _actionView = UIPackage.CreateObject("Common", "Btn_Yellow") + -- _actionView.icon = "ui://Common/btn_comfirm" + -- _actionView.onClick:Set(function () + -- --local _gamectr = ControllerManager.GetController(GameController) + -- _gamectr:ConformToNextGame() + -- _actionView:Dispose() + -- end) + -- _actionView.xy = Vector2(900, 625) + -- self._view:AddChild(_actionView) + -- else + -- coroutine.wait(4) + -- self.result_view = RunFast_ResultView.new(self._root_view,info,self._room.room_id) + -- self.result_view:Show() + -- end end) if over == 1 then -- body @@ -598,7 +682,13 @@ function M:EventInit() local info = arg[2] local winseat = arg[3] local dissolve = arg[4] - ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3") + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil + if _room.curren_round > 0 then + ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3") + end for i = 1, #self._player_card_info do local card_info = self._player_card_info[i] card_info._ctr_time_clock.selectedIndex = 0 diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua index 321dea04..9ecd631f 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua @@ -482,7 +482,9 @@ function M:EventInit() local round = arg[1] local cardlist = arg[2] - + if self.destory_win ~= nil then + coroutine.stop(self.destory_win) + end if self.result_view ~= nil then self.result_view:Destroy() self.result_view = nil @@ -585,7 +587,6 @@ function M:EventInit() -- end -- end self._leftClock_continue = coroutine.start(function() - coroutine.wait(0.2) card_info:SetOutCardInfo(nil, false) for i = 1, #self._player_card_info do local card_info = self._player_card_info[i] @@ -888,7 +889,10 @@ function M:EventInit() -- local energyTab = arg[5] local otherpoker_list = self._view:GetChild("otherpoker_list") local card_info = self._player_card_info[self:GetPos(self._room.self_player.seat)] - + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil if self.MypokerList ~= nil then -- body card_info:Clear() @@ -1056,6 +1060,10 @@ function M:EventInit() local info = arg[2] local winseat = arg[3] local dissolve = arg[4] + if self.dismissWin ~= nil then + self.dismissWin:Destroy() + end + self.dismissWin = nil if _room.curren_round > 0 then ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3") end diff --git a/lua_probject/main_project/main/majiang/MJSettingViewNew.lua b/lua_probject/main_project/main/majiang/MJSettingViewNew.lua index 651bf927..d76df1b0 100644 --- a/lua_probject/main_project/main/majiang/MJSettingViewNew.lua +++ b/lua_probject/main_project/main/majiang/MJSettingViewNew.lua @@ -163,6 +163,7 @@ function M:init(url) local _gamectr = ControllerManager.GetController(GameController) _gamectr:AskDismissRoom() + self:Destroy() end) self.btn_closeRoom.onClick:Set(function() diff --git a/lua_probject/main_project/main/poker/PKMainView.lua b/lua_probject/main_project/main/poker/PKMainView.lua index 191ab464..af62ffa4 100644 --- a/lua_probject/main_project/main/poker/PKMainView.lua +++ b/lua_probject/main_project/main/poker/PKMainView.lua @@ -49,6 +49,13 @@ function M:InitView(url, isHideIpAdds, settingViewType, ex_defaultbg, ex_bgconfi end self.com_notice = self._view:GetChild("com_notice") + + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + viewList_witness:SetVirtual() + viewList_witness.itemRenderer = function(index, obj) + obj:GetChild('title').text = self._room.witness_player_list[index + 1].nick + ImageLoad.Load(self._room.witness_player_list[index + 1].portrait, obj:GetChild('btn_head')._iconObject) + end end function M:InitXiPai() @@ -139,6 +146,44 @@ function M:DoNoticeAnimation() end end +function M:OnPlayerWitnessEnter(...) + ViewUtil.PlaySound("PK", "base/main_majiang/sound/user_enter.mp3") + local arg = { ... } + local witnessPlayerList = arg[1] + self._room.witness_player_list = witnessPlayerList + + local _room = DataManager.CurrenRoom + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems) + if viewList_witness.numItems == #_room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #_room.witness_player_list + end +end + +function M:OnPlayerWitnessLeave(...) + ---- print("刷新托管数据=====") + local arg = { ... } + local player = arg[1] + local witnessPlayerList = self._room.witness_player_list + for i, _player in ipairs(witnessPlayerList) do + if _player.aid == player then + table.remove(witnessPlayerList, i) + break + end + end + + local _room = DataManager.CurrenRoom + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems) + if viewList_witness.numItems == #_room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #_room.witness_player_list + end +end + -- 设置界面的换牌回调,需要换牌的玩法settingViewType传1,重写这个方法 function M:UpdateCard(index) end diff --git a/lua_probject/main_project/main/poker/PKSettingView.lua b/lua_probject/main_project/main/poker/PKSettingView.lua index e8835706..c5f5d888 100644 --- a/lua_probject/main_project/main/poker/PKSettingView.lua +++ b/lua_probject/main_project/main/poker/PKSettingView.lua @@ -136,6 +136,7 @@ function M:init(url) local _gamectr = ControllerManager.GetController(GameController) _gamectr:AskDismissRoom() + self:Destroy() end) self.btn_closeRoom.onClick:Set(function() diff --git a/wb_new_ui/assets/Common/component/dismiss_room/dismiss_room.xml b/wb_new_ui/assets/Common/component/dismiss_room/dismiss_room.xml index 1a36f309..920ac169 100644 --- a/wb_new_ui/assets/Common/component/dismiss_room/dismiss_room.xml +++ b/wb_new_ui/assets/Common/component/dismiss_room/dismiss_room.xml @@ -1,6 +1,6 @@ - + @@ -22,6 +22,12 @@ + +