--- --- Created by 谌建军. --- DateTime: 2017/12/18 9:41 --- local MSMainView = import("main.poker.MSMainView") local MuShi_PlayerPokerInfoView = import(".MuShi_PlayerPokerInfoView") local MuShi_PlayerSelfPokerInfoView = import(".MuShi_PlayerSelfPokerInfoView") local MuShi_GameEvent = import(".MuShi_GameEvent") local MuShi_ResultView = import(".MuShi_ResultView") local MuShi_RightPanelView = import(".MuShi_RightPanelView") local PlayerInfoView = import(".EXPlayerInfoView") local TableBG = import('Game.Data.TableBG') local MuShi_CardType = import(".MuShi_CardType") local FlyCoin = import(".FlyCoin") local M = {} function M.new() setmetatable(M, {__index = MSMainView}) local self = setmetatable({}, {__index = M}) self.class = "MuShi_MainView" self:init() self._gamectr = ControllerManager.GetController(GameController) return self end local default_bg = 1 local bg_config = { {id = 1, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'}, {id = 2, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'}, {id = 3, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'} } local gameState = { None = 0, ROOM_STATUS_INIT = 1,--初始化 ROOM_STATUS_START = 2,--开始 ROOM_STATUS_QIANGZHUANG = 3,--抢庄 ROOM_STATUS_XIAZHU = 4,--下注 ROOM_STATUS_BUPAI = 5,--补牌 ROOM_STATUS_FINISH = 6,--完成 } function M:InitView(url) --printlog("进入木虱=============================>>>") --printlog(debug.traceback()) local room = self._room UIPackage.AddPackage("extend/poker/mushi/ui/Extend_Poker_MuShi") --pt(room) self._curren_msg = nil --room.room_config.people_num = 5 self.currenBank = -1 MSMainView.InitView(self, "ui://Extend_Poker_MuShi/MuShi_Main_"..room.room_config.people_num,nil,1,default_bg,bg_config,nil,"ui://Extend_Poker_MuShi/SettingWindow1") local _room = DataManager.CurrenRoom local user_id = DataManager.SelfUser.account_id self._player_info = {} 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) tem.visible = false end local list = self._room.player_list for i=1,#list do local p = list[i] local info = _player_info[self:GetPos(p.seat)] info._view.visible = true info:FillData(p) end local rightpanel = self._view:GetChild("right_panel") if self._rightPanelView ~= nil then self._rightPanelView:Destroy() end self._rightPanelView = MuShi_RightPanelView.new(self, rightpanel) for i=1,#self._room.player_list do if self._room.self_player.seat==self._room.player_list[i].seat and self._room.self_player.self_user.account_id ~= self._room.player_list[i].self_user.account_id then -- body local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip") local _action = self._view:AddChild(ErrorMsgTip) _action.xy = Vector2((self._view.width - _action.width) / 4, self._view.height / 4) local text = _action:GetChild("tex_message") local btn1 = _action:GetChild("btn_connect") local btn2 = _action:GetChild("btn_back") text.text = "您来晚了,座位有人,请重新进牌桌" btn1.visible=false btn2:Center() btn2.y=btn2.y+50 btn2.onClick:Set(function() -- body ErrorMsgTip:Destroy() ErrorMsgTip = nil self._gamectr:LevelRoom(function(res) ViewUtil.CloseModalWait() NetResetConnectWindow.CloseNetReset() ControllerManager.ChangeController(LoddyController) ViewManager.ChangeView(ViewManager.View_Lobby) end) end) end end self.ctr_state = self._view:GetController("state") self._ctr_action = self._view:GetController("action") self._tex_leftTime = self._view:GetChild("time"):GetChild("title") self.ctr_time = self._view:GetController("time") self._text_round = self._view:GetChild("round") self.ctr_card_eff = self._view:GetController("card_eff") self._player_card_info = {} self.btn_ready1 = self._view:GetChild("btn_ready1") self.btn_ready1.visible = false local _player_card_info = self._player_card_info for i = 1, room.room_config.people_num do local tem = self._view:GetChild("player_card_info_" .. i) _player_card_info[i] = self:NewPlayerCardInfoView(tem, i) end local list = room.player_list printlog("#list#list ",#list) if not room.self_player.ready and room.room_config.people_num ==#list then self._ctr_action.selectedIndex = 1 else self._ctr_action.selectedIndex = 0 end self._left_time = 0 self.bgm_index = 1 local state = self._room.CurnrenState -- printlog("aaaaaaaaaaaaaaaaawwwwwwwwwwwwwwww ",state) self.btnstar = self._view:GetChild("btnstar") self.btnstar.onClick:Set(function() --printlog("提前开始=================================") local _gamectr = ControllerManager.GetController(GameController) _gamectr:SendStar() end) --print("11111111111111111111111122222222222222222222222222222222 ",room.CurnrenState) if room.CurnrenState ~= StateType.PalyingWait then self._state.selectedIndex = state -- if room.CurnrenState == StateType.Palying then -- self:ReConnectForStart() -- end self:ReConnectForStart() else self._state.selectedIndex = StateType.Palying self:ReConnectForStart() --self:ReconnectForClearing() end if room.CurnrenState ~= StateType.Ready then --print("cccccccccccccccccc111111111111111111111111") self._ctr_action.selectedIndex = 1 self.btnstar.visible = fasle else --print("cccccccccccccccccc222222222222222222222222") self.btnstar.visible = true end print("cccccccccccccccccc222222222222222222222222") local jsBtn=self._view:GetChild("btn_back_jiesan") printlog(jsBtn.visible) printlog(jsBtn.touchable) jsBtn.onClick:Set(function () printlog("进入解散按钮=====》》》") if self.dismiss_room_cd_time > 0 then ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!") else local _gamectr = ControllerManager.GetController(GameController) _gamectr:AskDismissRoom() end end) self.InitCardList = {} self:ChangeBgmMusic() self:EventInit() local btn_rule = self._view:GetChild("right_panel"):GetChild("btn_log") self._view:GetChild('info_text'):GetChild('text').text = room.room_config:GetDes() self._view:GetChild('wanfa_text').text = '木虱' self:CuoPai() self:ResetCuoPai() self.isUpcuo = false self.coin = ResourcesManager.LoadObjectByGroup("extend/poker/mushi/effect/flycoin/flyCoinEffect.prefab",typeof(UnityEngine.GameObject),"extend/poker/mushi/effect/flycoin/flyCoinEffect") printlog("创建金币示例===》》》》") printlog(self.coin) printlog("self.ctr_state.selectedIndex ",self.ctr_state.selectedIndex," ") -- self.testcard = self._view:GetChild("testcard") -- self.test = self._view:GetChild("test") -- self.endCard = self._view:GetChild("n119") -- self.test.onClick:Set(function() -- self:Test() -- end) -- printlog("11111111111111111 ",self.endCard.displayObject.gameObject.transform:InverseTransformPoint(self._view.displayObject.gameObject.transform.position)) -- pt(self.endCard.displayObject.gameObject.transform:InverseTransformPoint(self._view.displayObject.gameObject.transform.position)) end -- function M:OnMuShiUpdate() -- -- for i = 1, #self._room.player_list do -- -- local player = self._room.player_list[i] -- -- local head_info = self._player_info[self:GetPos(player.seat)] -- -- head_info:UpdateKuang() -- -- end -- end function M:Test() --local endCard = self._player_card_info[1].endcard.displayObject.gameObject.transform.position --local temp = self._view.displayObject.gameObject.transform:InverseTransformPoint(endCard) -- self.testcard:TweenMove(Vector2(temp.x,temp.y * -1), 0.10) -- printlog("是否存在==》》》》》",self.testcard:TweenMove(self.endCard.xy,1).OnComplete) -- self.testcard:TweenMove(self.endCard.xy,1):OnComplete(function () -- printlog("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr") -- end) -- printlog("2222222222222222222222 ",self.endCard.xy.x," ",self.endCard.xy.y) end function M:PlayFaPai(seat,cardlist,cardtype) local card_info = self._player_card_info[self:GetPos(seat)] local endPos = Vector3(0,0,0) coroutine.start(function() --coroutine.wait(0.2) for i=1,#cardlist do --printlog("ttttttttttttttt1111111111111111111111111111111") endPos = card_info.cards_view:GetChildAt(i-1).displayObject.gameObject.transform.position local obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_MuShi/00") self._view:AddChild(obj) obj:Center() obj:SetScale(0.8,0.8) endPos = self._view.displayObject.gameObject.transform:InverseTransformPoint(endPos) obj:TweenMove(Vector2(endPos.x,-1*endPos.y),0.2):OnComplete(function () obj:Dispose() -- card_info.cards_view:GetChildAt(i-1).visible = true card_info:ShowCard(i-1) end) ViewUtil.PlaySound("MuShi_PK", "extend/poker/mushi/sound/ms_sound_fapai.mp3") coroutine.wait(0.1) end end) end function M:CuoPai() self.cuoCorout = nil self.cuopai = self._view:GetChild("cuopai") self.n4 = self.cuopai:GetChild("n4") self.iconCuo = self.cuopai:GetChild("n7") self.btnCuoPai = self.n4:GetChild("n3") self.btnCuoPai.onTouchMove:Set(handler(self, self.onTouchMove)) self.btnCuoPai.onTouchBegin:Set(handler(self, self.onTouchBegin)) self.btnCuoPai.onTouchEnd:Set(handler(self, self.__OnDragEnd)) self.beginX = self.n4.x self.beginY = self.n4.y self.btnX=self.n4.x self.btnY = self.n4.y self.lastX = self.n4.x self.lastY = self.n4.y self.initBtnX = self.n4.x self.initBtnY = self.n4.y self.cuopai.visible = false -- print("self.btnY ",self.btnY) end function M:ResetCuoPai() self.n4.x = self.beginX self.n4.y = self.beginY self.btnX=self.beginX self.btnY = self.beginY self.cuopai.visible = false if self.cuoCorout ~= nil then coroutine.stop(self.cuoCorout) self.cuoCorout = nil end end function M:SetCuoPai(poker) self.iconCuo.icon = "ui://Extend_Poker_MuShi/ms_poker_cuo_"..poker self:ResetCuoPai() self.cuopai.visible = true end function M:onTouchBegin(context) self.lastX = self.cuopai:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y)).x self.lastY = self.cuopai:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y)).y end function M:onTouchMove(context) local xy = self.cuopai:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y)) local tempx = xy.x-self.lastX local tempy = xy.y-self.lastY if self.n4.y == self.initBtnY then if tempx >= 0 then local tempCardX = self.btnX+(xy.x-self.lastX) --print("cccccccccccc1111111111111111 ;",tempCardX," ",self.btnX) if tempCardX <= 510 then self.n4.x = tempCardX self.btnX = self.n4.x else if (not self.isUpcuo) then self.isUpcuo = true local _gamectr = ControllerManager.GetController(GameController) print("===========================上报搓牌=====================") _gamectr:SendCuo() self:ResetCuoPai() end self.n4.x = 510 self.btnX = self.n4.x end else local tempCardX = self.btnX+(xy.x-self.lastX) if tempCardX > self.initBtnX then self.n4.x = tempCardX self.btnX = self.n4.x else self.n4.x = self.initBtnX self.btnX = self.n4.x end end end if self.n4.x == self.initBtnX then if tempy >=0 then local tempCardY =self.btnY+(xy.y-self.lastY) --print("11111111111111111111 ;",tempCardY," ",self.btnY) if tempCardY < 276 then self.n4.y = tempCardY self.btnY = self.n4.y else self.n4.y = 276 self.btnY = self.n4.y end else local tempCardY =self.btnY+(xy.y-self.lastY) --print("22222222222222222222 ;",tempCardY," ",self.btnY) if tempCardY > self.initBtnY then self.n4.y = tempCardY self.btnY = self.n4.y else self.n4.y = self.initBtnY self.btnY = self.n4.y end end end self.lastX = xy.x self.lastY = xy.y end function M:__OnDragEnd(context) local xy = self.cuopai:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y)) if ((xy.x-self.lastX) < 150 and self.n4.y == self.initBtnY) then self.n4.x = self.beginX self.n4.y = self.beginY self.btnX=self.beginX self.btnY = self.beginY end -- printlog("ttttttttt222222222222222222 ",xy.x- self.beginX," ",xy.y-self.beginY) end function M:NewPlayerCardInfoView(tem, index) if index == 1 then return MuShi_PlayerSelfPokerInfoView.new(tem, self) end return MuShi_PlayerPokerInfoView.new(tem, self) end function M:PlayCardEff(card) if self.cor_card_eff ~= nil then coroutine.stop(self.cor_card_eff) end self.cor_card_eff = nil local cor_time = 0.1 self.cor_card_eff = coroutine.start(function() self._popEvent = false local eff = self._view:GetChild("poker_eff") local poker_obj = eff:GetChild("poker") local poker_back = eff:GetChild("di") poker_back.visible = false -- selfcard_code_obj if DataManager.CurrenRoom.room_config.config.laizi == 1 then local card = 500+card%100 --printlog("鬼牌=++++++++++++++++++++++++++++",card," ",math.floor(card / 100)," ",card%15) self.guiCard = UIPackage.CreateObjectFromURL("ui://Extend_Poker_MuShi/"..card) else end if self.guiCard then self.ctr_card_eff.selectedIndex = 1 self.guiCard:SetScale(1, 1) poker_obj:AddChild(self.guiCard) self.guiCard.visible = true self.tween = TweenUtils.TweenFloat(0, 2340, cor_time, function(x) poker_back.rotationY = x poker_obj.rotationY = -180 + x local x_1 = x % 360 if (x_1 > 90 and x_1 < 270) then poker_obj.visible = true poker_back.visible = false else poker_obj.visible = false poker_back.visible = true end end) end coroutine.wait(1) self._popEvent = true end) end function M:OnPlayerReady(...) --printlog("玩家准备6++++++++++++++++++++") local arg = {...} local p = arg[1] local _room = self._room local _player_info = self._player_info if p.seat == _room.self_player.seat then self._ctr_action.selectedIndex = 0 self.btnstar.visible = false end local info = _player_info[self:GetPos(p.seat)] info:Ready(true) end function M:OnPlayerLeave(...) MainView.OnPlayerLeave(self, ...) local _room = self._room if not _room.self_player.ready then --self._ctr_action.selectedIndex = 1 else self._ctr_action.selectedIndex = 0 end end function M:Clear() if self.result_view ~= nil then self.result_view:Destroy() self.result_view = nil end self.btnstar.visible = false local list = self._room.player_list for i = 1, #list do local p = list[i] local head_info = self._player_info[self:GetPos(p.seat)] p:Clear() head_info:FillData(p) local card_info = self._player_card_info[self:GetPos(p.seat)] card_info:Clear() head_info:Ready(false) end end function M:PlayZhuangEffect() if self.currenBank == -1 then return end self.zhuangEffect = nil local playerList = {} for _, player in ipairs(self._room.player_list) do local player_head = self._player_info[self:GetPos(player.seat)] table.insert(playerList,player_head) end local kIndex = 0 local round = 4 if #playerList > 4 then round = 2 end local bCurren = #playerList*round + self.currenBank self.zhuangEffect = coroutine.start(function() while true do coroutine.wait(0.14) ViewUtil.PlaySound("MuShi_PK", "extend/poker/mushi/sound/ms_sound_randbanker.mp3") kIndex = kIndex + 1 local k = kIndex % #playerList if k == 0 then k =#playerList end for i=1,#playerList do playerList[i]:SetKuang(false) end playerList[k]:SetKuang(true) if kIndex >= bCurren then for i=1,#playerList do playerList[i]:SetKuang(false) end local player_head = self._player_info[self:GetPos(self.currenBank)] -- player_head:SetKuang(true) -- local head_info = self._player_info[self:GetPos(self.currenBank)] -- head_info:MarkBank(true) if self.zhuangEffect then coroutine.stop(self.zhuangEffect) self.zhuangEffect = nil player_head:MarkBank(true) return end end end end) end function M:EventInit() local _gamectr = ControllerManager.GetController(GameController) MainView.EventInit(self) local _player_info = self._player_info local _player_card_info = self._player_card_info local _room = self._room _gamectr:AddEventListener(MuShi_GameEvent.OnMingCard, function(...) local arg = {...} local card = arg[1] self.ctr_state.selectedIndex = 1 self.ctr_card_eff.selectedIndex = 1 self:PlayCardEff(card) self.btn_ready1.visible = false end) _gamectr:AddEventListener(MuShi_GameEvent.OnGuiPai,function (...) local arg = {...} local card = arg[1] self.ctr_state.selectedIndex = 1 self.ctr_card_eff.selectedIndex = 1 self:PlayCardEff(card) self.btn_ready1.visible = false end) _gamectr:AddEventListener(MuShi_GameEvent.OnAgree,function (...) local arg = {...} local seat = arg[1] local agree = arg[2] end) _gamectr:AddEventListener(MuShi_GameEvent.OnReady,function (...) local arg = {...} local seat = arg[1] if seat == self._room.self_player.seat then printlog("aaaaaaaaaaaaaaaaaaaaaaaa1111111111111") self.btn_ready1.visible = false end end) _gamectr:AddEventListener(MuShi_GameEvent.OnTiQian,function (...) --printlog("发起提前开始返回2222====================================") local arg = {...} local seat = arg[1] local agree = arg[2] local _gamectr = ControllerManager.GetController(GameController) if (seat ~= self._room.self_player.seat and self._curren_msg ==nil) then self._curren_msg = UIPackage.CreateObjectFromURL('ui://Common/MessageBox') self._view:AddChild(self._curren_msg) self._curren_msg:Center() self._curren_msg:GetChild('tex_message').text = '确定要提前开始吗?' self._curren_msg:GetChild('btn_ok').onClick:Set( function() _gamectr:AgreeStar(1) self._curren_msg:Dispose() self._curren_msg = nil end ) self._curren_msg:GetChild('btn_close').onClick:Set( function() _gamectr:AgreeStar(0) self._curren_msg:Dispose() self._curren_msg = nil end ) end end) _gamectr:AddEventListener(MuShi_GameEvent.OnInitCard, function(...) self.btn_ready1.visible = false local arg = {...} local round = arg[1] -- local cardlist = arg[2] -- local cardtype = arg[3] -- local seat = arg[4] -- local cardopen = arg[5] local info = arg[2] --self.currenBank = -1 if self.result_view ~= nil then self.result_view:Destroy() self.result_view = nil end --self._player_card_info[1]:HidePiao() self.btnstar.visible = false -- if self._room.room_config.people_num==3 and self._room.room_config.fangzuobi==1 then -- -- body -- self.MypokerList = cardlist -- end local otherpoker_list = self._view:GetChild("otherpoker_list") if otherpoker_list ~= nil then -- body otherpoker_list.visible=false otherpoker_list:RemoveChildrenToPool() end self.ctr_state.selectedIndex = 1 --self.ctr_card_eff.selectedIndex = 0 if self.rank_view ~= nil then self.rank_view:Dispose() self.rank_view = nil end self:UpdateRound(round) ViewUtil.PlaySound("MuShi_PK", "extend/poker/mushi/sound/fapai.mp3") for i=1,#info do local seat = info[i]["seat"] local cardlist = info[i]["cards"] local cardtype = info[i]["cardtype"] local cardopen = info[i]["cardopen"] local head_info = self._player_info[self:GetPos(seat)] head_info:Ready(false) local card_info = self._player_card_info[self:GetPos(seat)] card_info:Clear() card_info:InitPoker(cardlist,cardtype,cardopen) -- if seat == self._room.self_player.seat then -- self:PlayFaPai(seat,cardlist,cardtype) -- end end coroutine.start(function() coroutine.wait(0.2) for i=1,#info do local seat = info[i]["seat"] local cardlist = info[i]["cards"] local cardtype = info[i]["cardtype"] local cardopen = info[i]["cardopen"] local head_info = self._player_info[self:GetPos(seat)] self:PlayFaPai(seat,cardlist,cardtype) coroutine.wait(0.2) end end) -- local list = _room.player_list -- local head_info = self._player_info[self:GetPos(seat)] -- --head_info:FillData(seat) -- head_info:Ready(false) -- local card_info = self._player_card_info[self:GetPos(seat)] -- card_info:Clear() -- card_info:InitPoker(cardlist,cardtype,cardopen) -- if seat == self._room.self_player.seat then -- self:PlayFaPai(seat,cardlist,cardtype) -- end end) _gamectr:AddEventListener(MuShi_GameEvent.OnErrorTip, function(...) local arg = {...} local error_str = arg[1] self._player_card_info[1]:ErrorTip(error_str) -- self._player_card_info[1]:ResetPoker() end) _gamectr:AddEventListener(MuShi_GameEvent.OnPiaoTips, function(...) self.btn_ready1.visible = false local player_card_info = self._player_card_info[1] if (self.currenBank == self._room.self_player.seat) then player_card_info:ChangeCtrBuPai(2) else player_card_info:ChangeCtrBuPai(1) end end) _gamectr:AddEventListener(MuShi_GameEvent.OnPiaoAction, function(...) self.btn_ready1.visible = false local arg = {...} local seat = arg[1] local piao = arg[3] self.isUpcuo = false --printlog("广播补牌============================") --pt(arg) if (arg[2] == 1) then local card_info = self._player_card_info[self:GetPos(seat)] card_info:AddPoker(piao) end if (arg[2] == 3) and self._room.self_player.seat == seat then self:SetCuoPai(piao) -- self.cuoCorout = coroutine.start(function() -- coroutine.wait(5) -- local _gamectr = ControllerManager.GetController(GameController) -- _gamectr:SendCuo() -- end) end if self._room.self_player.seat == seat then local player_card_info = self._player_card_info[1] player_card_info:ChangeCtrBuPai(0) end local player1 = self._room:GetPlayerBySeat(seat) if (arg[2] == 1) and seat == self._room.self_player.seat then self:PlaySound(player1.self_user.sex,"ms_sound_bupai") elseif (arg[2] == 2) and seat == self._room.self_player.seat then self:PlaySound(player1.self_user.sex,"ms_sound_kaipai") end end) _gamectr:AddEventListener(MuShi_GameEvent.OnFinishCuoPai, function(...) local arg = {...} local seat = arg[1] local card = arg[2] local card_info = self._player_card_info[self:GetPos(seat)] card_info:AddPoker(card) self:ResetCuoPai() end) -- 托管 _gamectr:AddEventListener(MuShi_GameEvent.Game_TuoGuan, function(...) local arg = {...} local tuoguan = arg[1] local seat = arg[2] local tuoguanzhong = self._view:GetChild("tuoguanzhong") local zhezhao = self._view:GetChild("n109") local head_info = self._player_info[self:GetPos(seat)] if (tuoguan == 1) then if (seat == self._room.self_player.seat ) then tuoguanzhong.visible = true zhezhao.visible = true zhezhao.onClick:Set(function() _gamectr:TuoGuan(0) end) else head_info._view:GetController("tuoguan").selectedIndex = 1 end else if (seat == self._room.self_player.seat) then tuoguanzhong.visible = false zhezhao.visible = false else head_info._view:GetController("tuoguan").selectedIndex = 0 end end end) _gamectr:AddEventListener(MuShi_GameEvent.OnResult, function(...) local arg = {...} local over = arg[1] local info = arg[2] local win_seat = arg[3] local remaincards = arg[4] local player_card_info = self._player_card_info[1] player_card_info:ChangeCtrBuPai(0) if remaincards then -- body end if self._cor_sound ~= nil then coroutine.stop(self._cor_sound) self._cor_sound = nil end if self.destory_win ~= nil then coroutine.stop(self.destory_win) end if self.WinItem_view1 ~= nil then self.WinItem_view1:Dispose() self.WinItem_view1 = nil end self.destory_win = nil self.destory_win = coroutine.start(function() -- 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_MuShiNew/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("MuShi_PK", "base/common/sound/win new.mp3") end -- local url = #sprint_seat_list > 0 and "ui://Extend_Poker_MuShiNew/Spring" or "ui://Extend_Poker_MuShiNew/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_MuShiNew/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 end for i = 1, #info do -- coroutine.wait(0.3) --print("player.cardMul===============",player.cardMul) 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)] card_info:SetCarType(player.cardType,player.cardPoint,player.cardMul) local player1 = self._room:GetPlayerBySeat(player.seat) if self._room.self_player.seat == player.seat then self:PlayCardTypeVoice(player1.self_user.sex,player.cardType,player.cardPoint) end end self:FlyCoinByInfo(info) coroutine.wait(0.1*#info) 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.hp_info ~= nil and player.hp_info.cur_hp ~= nil then p.hp_info = player.hp_info head_info:UpdateScore(d2ad(player.hp_info.cur_hp)) head_info._view:GetChild('zhanji').visible = true local num = player.hp_info.total_hp if num > 0 then head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetChild('text_jifen').text = "+" .. d2ad(player.hp_info.total_hp) else head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetChild('text_jifen').text = d2ad(player.hp_info.total_hp) end card_info:PlayScore(d2ad(player.hp_info.round_actual_hp), false, win_seat == player.seat) else local rt = 1 if self._room.hpOnOff == 1 then rt = self._room.score_times end if over == 1 and self._room.hpOnOff == 1 then head_info:UpdateScore(player.score / 10) --不可负分 else head_info:UpdateScore(player.score * rt) end card_info:PlayScore(player.winscore * rt, false, win_seat == player.seat) end if player.seat ~= self._room.self_player.seat then card_info:UpdateHandPoker(player.cards, false, true) card_info:SetRemainCardNumber(false) else end end coroutine.wait(0.5) 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 if (player.winscore>0) then printlog("cccccccccccc22222222222222222222222") local url = "ui://Extend_Poker_MuShi/FzEffect" self.WinItem_view1 = UIPackage.CreateObjectFromURL(url) self._view:AddChild(self.WinItem_view1) self.WinItem_view1:Center() self.WinItem_view1:GetTransition("t2"):Play() ViewUtil.PlaySound("MuShi_PK", "extend/poker/mushi/sound/ms_sound_win.mp3") 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(1) if (over == 0) then-- -- if self._room.self_player.entrust and self._room.self_player.entrust == false then -- self.btn_ready1.visible = true -- end self.btn_ready1.visible = true if self.WinItem_view1 ~= nil then self.WinItem_view1:Dispose() self.WinItem_view1 = nil end self.btn_ready1.onClick:Set(function() self.btn_ready1.visible = false local _gamectr = ControllerManager.GetController(GameController) _gamectr:ConformToNextGame() end) else self.result_view = MuShi_ResultView.new(self._root_view, info, self._room.room_id, over, win_seat, 1,nil) self.result_view:Show() end --self.result_view = MuShi_ResultView.new(self._root_view, info, self._room.room_id, over, win_seat, 0, remaincards) --self.result_view:Show() if self.WinItem_view ~= nil then self.WinItem_view:Dispose() self.WinItem_view = nil end if self.rank_view ~= nil then self.rank_view:Dispose() self.rank_view = nil end if self._room.self_player.entrust == true and self.result_view then local btn_confirm = self.result_view._view:GetChild("btn_confirm") btn_confirm.onClick:Call() end end) if over==1 then -- body self:UnmarkSelfTuoguan() ControllerManager.ChangeController(LoddyController) end if self.guiCard ~=nil then self.guiCard:Dispose() end end) _gamectr:AddEventListener(MuShi_GameEvent.OnResultByDissolve, function(...) local arg = {...} local over = arg[1] local info = arg[2] local winseat = arg[3] local dissolve = arg[4] self.result_view = MuShi_ResultView.new(self._root_view, info, self._room.room_id, over, winseat, dissolve,nil) self.result_view:Show() ControllerManager.ChangeController(LoddyController) self:UnmarkSelfTuoguan() end) -- 确定开始下一局 成功 _gamectr:AddEventListener(MuShi_GameEvent.OnConfrimToNextGameSucc, function(...) local arg = {...} local aid = arg[1] local p = self._room:GetPlayerById(aid) if p.seat == self._room.self_player.seat then if self.rank_view ~= nil then self.rank_view:Dispose() self.rank_view = nil end if self.destory_win ~= nil then coroutine.stop(self.destory_win) self.destory_win = nil end for _, player in ipairs(self._room.player_list) do local player_card_info = self._player_card_info[self:GetPos(player.seat)] local player_head = self._player_info[self:GetPos(player.seat)] player_card_info:Clear() end end local player_info = self._player_info[self:GetPos(p.seat)] player_info:Ready(true) end) _gamectr:AddEventListener(MuShi_GameEvent.OnQiangZhuang, function(...) self:Clear() self.ctr_state.selectedIndex = 1 for _, player in ipairs(self._room.player_list) do local player_head = self._player_info[self:GetPos(player.seat)] player_head:MarkBank(false) player_head:UpdateFen(-1,0) end self._player_card_info[1]:StarQiangZhuang(1) self.btnstar.visible = fasle self.btn_ready1.visible = false end) _gamectr:AddEventListener(MuShi_GameEvent.OnOtherQiangZhuang, function(...) local arg = {...} local seat = arg[1] local index = arg[2] if (seat == self._room.self_player.seat) then self._player_card_info[1]:StarQiangZhuang(0) end --printlog("iiiiiiiiiiiiiiiiiiii ",seat," ",self:GetPos(seat)) local head_info = self._player_info[self:GetPos(seat)] head_info:UpdateFen(0,index) if seat == self._room.self_player.seat then local player1 = self._room:GetPlayerBySeat(seat) self:PlaySound(player1.self_user.sex,"jiaofen_"..index) end printlog("iiiiiiiiiiiiiiiiiiiiii ",index) self.btn_ready1.visible = false end) _gamectr:AddEventListener(MuShi_GameEvent.OnZhuang, function(...) local arg = {...} local seat = arg[1] local index = arg[2] local score = arg[3] local head_info = self._player_info[self:GetPos(seat)] self.currenBank = -1 self.currenBank = seat self.btn_ready1.visible = false printlog("庄家 客户端相对座位号================",seat," ",self._room.self_player.seat) for _, player in ipairs(self._room.player_list) do local player_head = self._player_info[self:GetPos(player.seat)] player_head:MarkBank(false) end head_info:UpdateFen(1,score) -- head_info:MarkBank(true) self:PlayZhuangEffect() end) _gamectr:AddEventListener(MuShi_GameEvent.OnStarBet, function(...) local arg = {...} local seat = arg[1] -- printlog("自己座位号===============",self._room.self_player.seat) if (seat == self._room.self_player.seat) then self._player_card_info[1]:StarBet(1) local head_info = self._player_info[self:GetPos(seat)] head_info.colKuang = true self.btn_ready1.visible = false end end) _gamectr:AddEventListener(MuShi_GameEvent.OnBet, function(...) local arg = {...} local seat = arg[1] local index = arg[2] local score = arg[3] local head_info = self._player_info[self:GetPos(seat)] head_info:UpdateFen(2,index) if (seat == self._room.self_player.seat) then self._player_card_info[1]:StarBet(0) local head_info = self._player_info[self:GetPos(seat)] head_info.colKuang = false self.btn_ready1.visible = false end end) end function M:PlayCardTypeVoice(sex,card_type,point) if card_type == MuShi_CardType.TYPE_SHUANGGUI then self:PlaySound(sex,"ms_sound_type_10") elseif card_type == MuShi_CardType.TYPE_SANGUI then self:PlaySound(sex,"ms_sound_type_20") elseif card_type == MuShi_CardType.TYPE_TIANGONG then self:PlaySound(sex,"ms_sound_tian_8") elseif card_type == MuShi_CardType.TYPE_DOUBLE_TIANGONG then self:PlaySound(sex,"ms_sound_tian_9") elseif card_type == MuShi_CardType.TYPE_NORMAL then self:PlaySound(sex,"ms_sound_point_"..point) elseif card_type == MuShi_CardType.TYPE_MUSHI then self:PlaySound(sex,"ms_sound_point_03") elseif card_type == MuShi_CardType.TYPE_TONGHUASHUN then self:PlaySound(sex,"ms_sound_type_8") elseif card_type == MuShi_CardType.TYPE_SANTIAO then self:PlaySound(sex,"ms_sound_man_type_5") elseif card_type == MuShi_CardType.TYPE_SHUNZI then self:PlaySound(sex,"ms_sound_man_type_4") end end function M:FlyCoinByInfo(info) self.coinNum = 8 printlog("庄家信息=======================",self.currenBank," ",self._room.self_player.seat) if (self.currenBank ~= -1) then local bankHeadInfo = self._player_info[self:GetPos(self.currenBank)] coroutine.start(function () for i=1,#info do local player = info[i] local head_info = self._player_info[self:GetPos(player.seat)] if (player.winscore > 0) and player.seat ~=self.currenBank then -- for i=1,self.coinNum do -- FlyCoin.new(bankHeadInfo._btn_head.displayObject.gameObject.transform.position,head_info._btn_head.displayObject.gameObject.transform.position,self._view) -- coroutine.wait(0.2) -- end FlyCoin.new(bankHeadInfo.point.displayObject.gameObject.transform.position,head_info.point.displayObject.gameObject.transform.position,self._view,self.coin) printlog("playerseatplayerseatplayerseatplayerseatplayerseat111 ",player.seat," ",self._room.self_player.seat) if self.currenBank == self._room.self_player.seat then ViewUtil.PlaySound("MuShi_PK","extend/poker/mushi/sound/ms_sound_flychips.mp3") end coroutine.wait(0.2) elseif(player.winscore < 0 and player.seat ~=self.currenBank) then -- for i=1,self.coinNum do -- FlyCoin.new(head_info._btn_head.displayObject.gameObject.transform.position,bankHeadInfo._btn_head.displayObject.gameObject.transform.position,self._view) -- coroutine.wait(0.2) -- end printlog("playerseatplayerseatplayerseatplayerseatplayerseat22222 ",player.seat," ",self._room.self_player.seat) FlyCoin.new(head_info.point.displayObject.gameObject.transform.position,bankHeadInfo.point.displayObject.gameObject.transform.position,self._view,self.coin) if self.currenBank == self._room.self_player.seat then ViewUtil.PlaySound("MuShi_PK","extend/poker/mushi/sound/ms_sound_flychips.mp3") end coroutine.wait(0.2) end end end) else for i=1,#info do local player = info[i] local head_info = self._player_info[self:GetPos(player.seat)] coroutine.start(function () if (player.winscore > 0) then -- for i=1,self.coinNum do -- FlyCoin.new(self.btn_ready1.displayObject.gameObject.transform.position,head_info._btn_head.displayObject.gameObject.transform.position,self._view) -- coroutine.wait(0.02) -- end printlog("playerseatplayerseatplayerseatplayerseatplayerseat333333333333333333333333") FlyCoin.new(self.btn_ready1.displayObject.gameObject.transform.position,head_info.point.displayObject.gameObject.transform.position,self._view,self.coin) if player.seat == self._room.self_player.seat then --printlog("aaaaaaaaaaaaaa33333333333333333333333") ViewUtil.PlaySound("MuShi_PK", "extend/poker/mushi/sound/ms_sound_flychips.mp3") end coroutine.wait(0.1) elseif (player.winscore < 0) then -- for i=1,self.coinNum do -- FlyCoin.new(head_info._btn_head.displayObject.gameObject.transform.position,self.btn_ready1.displayObject.gameObject.transform.position,self._view) -- coroutine.wait(0.02) -- end printlog("playerseatplayerseatplayerseatplayerseatplayerseat4444444444444444444444444444") FlyCoin.new(head_info.point.displayObject.gameObject.transform.position,self.btn_ready1.displayObject.gameObject.transform.position,self._view,self.coin) if player.seat == self._room.self_player.seat then --printlog("aaaaaaaaaaaaaa444444444444444444444444444444444") ViewUtil.PlaySound("MuShi_PK", "extend/poker/mushi/sound/ms_sound_flychips.mp3") end coroutine.wait(0.1) end end) end end end function M:ReConnectForStart() if self.cor_card_eff ~= nil then coroutine.stop(self.cor_card_eff) end local _gamectr = ControllerManager.GetController(GameController) --self._room.is_new_bout = _gamectr:GetIsNewBout(self._room.curren_turn_seat) --self._state.selectedIndex = 1 --self._view:GetController("time").selectedIndex = self:GetPos(self._room.curren_turn_seat) self:UpdateRound(self._room.curren_round) for _, player in ipairs(self._room.player_list) do local player_card_info = self._player_card_info[self:GetPos(player.seat)] local head_info = self._player_info[self:GetPos(player.seat)] head_info:Ready(false) --如果是体力值不可负分模式 则显示当前的hp值 -- if player.hp_info ~= nil and player.hp_info.cur_hp ~= nil then -- head_info:UpdateScore(d2ad(player.hp_info.cur_hp)) -- head_info._view:GetChild('zhanji').visible = true -- local num = player.hp_info.total_hp -- if num > 0 then -- head_info._view:GetController('text_color').selectedIndex = 0 -- head_info._view:GetChild('text_jifen').text = '+' .. d2ad(player.hp_info.total_hp) -- else -- head_info._view:GetController('text_color').selectedIndex = 1 -- head_info._view:GetChild('text_jifen').text = d2ad(player.hp_info.total_hp) -- end -- else -- local rt = 1 -- if self._room.hpOnOff == 1 then -- rt = self._room.score_times -- end -- head_info:UpdateScore(player.total_score * rt) -- end -- head_info:UpdateLineState(player.line_state) -- head_info:UpdatePiao(player.piao) -- if player.seat == self._room.self_player.seat then -- player_card_info:InitPoker(player.hand_list) -- else -- end end -- gameState = { -- None = 0, -- ROOM_STATUS_INIT = 1,--初始化 -- ROOM_STATUS_START = 2,--开始 -- ROOM_STATUS_QIANGZHUANG = 3,--抢庄 -- ROOM_STATUS_XIAZHU = 4,--下注 -- ROOM_STATUS_BUPAI = 5,--补牌 -- ROOM_STATUS_FINISH = 6,--完成 -- } if (self._room.roomStatus == gameState.ROOM_STATUS_INIT) then elseif (self._room.roomStatus == gameState.ROOM_STATUS_START) then elseif (self._room.roomStatus == gameState.ROOM_STATUS_QIANGZHUANG) then for _, player in ipairs(self._room.player_list) do local player_card_info = self._player_card_info[self:GetPos(player.seat)] local head_info = self._player_info[self:GetPos(player.seat)] if(player.seat == self._room.self_player.seat) and player.isPlaying==true then if(not player.isQiangZhuang)then player_card_info:StarQiangZhuang(1) else head_info:UpdateFen(0,player.qiangZhuangIndex) end else if(player.isQiangZhuang)then head_info:UpdateFen(0,player.qiangZhuangIndex) end end end elseif (self._room.roomStatus == gameState.ROOM_STATUS_XIAZHU) then for _, player in ipairs(self._room.player_list) do local player_card_info = self._player_card_info[self:GetPos(player.seat)] local head_info = self._player_info[self:GetPos(player.seat)] if(player.seat == self._room.self_player.seat) and player.isPlaying==true then if(player.isZhuang) then head_info:MarkBank(true) else if (not player.isXiaZhu) then player_card_info:StarBet(1) else head_info:UpdateFen(2,player.xiaZhuIndex) end end else if(player.isZhuang) then head_info:MarkBank(true) else if (player.isXiaZhu) then head_info:UpdateFen(2,player.xiaZhuIndex) end end end end elseif (self._room.roomStatus == gameState.ROOM_STATUS_BUPAI) then for _, player in ipairs(self._room.player_list) do local player_card_info = self._player_card_info[self:GetPos(player.seat)] local head_info = self._player_info[self:GetPos(player.seat)] if(player.seat == self._room.self_player.seat) and player.isPlaying==true then if (not player.isBuPai) then player_card_info:ChangeCtrBuPai(1) end player_card_info:InitPoker2(player.hand_list) elseif(player.seat == self._room.self_player.seat) and player.isPlaying==false then end if (player.seat ~= self._room.self_player.seat and player.isPlaying==true) then player_card_info:InitPoker2({0,0}) end end elseif (self._room.roomStatus == gameState.ROOM_STATUS_FINISH) then for _, player in ipairs(self._room.player_list) do local player_card_info = self._player_card_info[self:GetPos(player.seat)] local head_info = self._player_info[self:GetPos(player.seat)] player_card_info:InitPoker2(player.hand_list) local num = player.hp_info.total_hp if num > 0 then head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetChild('text_jifen').text = '+' .. d2ad(player.hp_info.total_hp) else head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetChild('text_jifen').text = d2ad(player.hp_info.total_hp) end player_card_info:SetCarType(player.cardType,player.cardPoint) end self.btn_ready1.visible = true self.btn_ready1.onClick:Set(function() self.btn_ready1.visible = fasle local _gamectr = ControllerManager.GetController(GameController) _gamectr:ConformToNextGame() end) end if self._room.zhuangSeat ~= -1 then self.currenBank = self._room.zhuangSeat -- local player_head = self._player_info[self:GetPos(self.currenBank)] -- player_head:MarkBank(true) end if self._room.guiCard then self:PlayCardEff(self._room.guiCard) end end function M:ReconnectForClearing() self:UpdateRound(self._room.curren_round) local win_seat = 0 --self.rank_view = self:CreateRankEff(self._room.winseat) for _, player in ipairs(self._room.player_list) do local head_info = self._player_info[self:GetPos(player.seat)] local player_card_info = self._player_card_info[self:GetPos(player.seat)] --如果是体力值不可负分模式 则显示当前的hp值 if player.hp_info ~= nil and player.hp_info.cur_hp ~= nil then head_info:UpdateScore(d2ad(player.hp_info.cur_hp)) head_info._view:GetChild('zhanji').visible = true local num = player.hp_info.total_hp if num > 0 then head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetChild('text_jifen').text = '+' .. d2ad(player.hp_info.total_hp) else head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetChild('text_jifen').text = d2ad(player.hp_info.total_hp) end -- player_card_info:PlayScore(d2ad(player.hp_info.round_actual_hp)) else local rt = 1 if self._room.hpOnOff == 1 then rt = self._room.score_times end head_info:UpdateScore(player.total_score * rt) -- player_card_info:PlayScore(player.winscore * rt, false, self._room.winseat) end head_info:UpdateLineState(player.line_state) --head_info._view:GetController("Oener").selectedIndex=0 head_info:UpdatePiao(player.piao) if head_info._view:GetChild("shengyu")~=nil and head_info._view:GetController("shengyu")~=nil then end if player.seat == self._room.self_player.seat then player_card_info:InitPoker(player.hand_list, false) else player_card_info:UpdateHandPoker(player.hand_list, false, true) end if player.out_card_list[1] == 0 then --player_card_info:SetOutCardInfo(nil, false) else --player_card_info:SetOutCardInfo(player.out_card_list, false) end end win_seat=self._room.winseat self._room.winseat = nil local remaincards = self._room.remaincards if self._room.game_status==1 then -- body coroutine.start(function() coroutine.wait(0.3) --self.result_view = MuShi_ResultView.new(self._root_view, self._room.player_list, self._room.room_id, 0, win_seat,0,nil) --self.result_view:Show() local card_info = self._player_card_info[1] card_info._view:GetChild("out_card_list").visible=true end) if remaincards then local newremaincards = self._gamectr:ChangeCodeByFrom(remaincards,true) -- body local otherpoker_list = self._view:GetChild("otherpoker_list") if otherpoker_list ~= nil then -- body otherpoker_list:RemoveChildrenToPool() otherpoker_list.visible=true end for i = #newremaincards, 1, -1 do coroutine.start(function() coroutine.wait(0.1 * (15 - i)) local flow = newremaincards[i] % 10 local num = (newremaincards[i] - (newremaincards[i] % 10)) / 10 local card_n = flow * 100 + num local poker_item = UIPackage.CreateObject("Extend_Poker_MuShi", "poker6") --local code = self:ChangeCodeByTo(card_n) -- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_MuShi/" .. card_n) -- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2") local card_code_obj if DataManager.CurrenRoom.pai==0 then card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_MuShi/"..card_n) else card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2") end if card_n==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then -- body card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_MuShi/"..card_n.."_1") end card_code_obj:SetScale(0.6, 0.6) poker_item:AddChild(card_code_obj) -- otherpoker_list:AddChild(poker_item) end) end end end end function M:CreateRankEff() self.rank_view = UIPackage.CreateObjectFromURL("ui://Extend_Poker_MuShi/rank_eff") self._view:AddChild(self.rank_view) self.rank_view:Center() self.rank_view:GetTransition("t0"):Play() end function M:UpdateRound(round) local total_round = self._room.room_config.Times self._text_round.text = string.format("%d / %d 局", round, total_round) end function M:GetSoundFileName(type, num, isNewBout) local fileName if isNewBout then if type > 6 or type == 4 then if type == 8 or type == 9 then type = 7 end fileName = tostring(type) elseif type > 2 then fileName = string.format("3_%d", num) else fileName = string.format("%d_%d", type, num) end else math.randomseed(os.time()) if type > 2 and type ~= 11 then local r = math.random(1, 3) fileName = "dani_" .. r elseif type == 11 then fileName = tostring(type) else fileName = string.format("%d_%d", type, num) end end return fileName end function M:GetSpringSeats(player_info) local seat_list = {} local card_max_length = self._room.room_config.Leaf + 14 for i = 1, #player_info do local player = player_info[i] if #player.cards == card_max_length then seat_list[#seat_list + 1] = player.seat end end return seat_list end function M:PlaySound(sex, path) local sex_path = ViewUtil.Sex_Chat[sex]-- 1 男 2 女 local sound_path = string.format("extend/poker/mushi/sound/%s/%s.mp3", sex_path, path) ViewUtil.PlaySound("MuShi_PK", sound_path) end function M:ChangeBgmMusic(bgm_index) if bgm_index == nil then bgm_index = self.bgm_index else self.bgm_index = bgm_index end ViewUtil.PlayMuisc("MuShi_PK", string.format("extend/poker/mushi/sound/bgm%d.mp3", 1)) end function M:OnPlayerEnter( ... ) --DataManager.CurrenRoom.RoomConfig.people_num --pt(DataManager.CurrenRoom.room_config) --printlog("玩家进入游戏11111111111111111111111111111111111 ") local arg = {...} local p = arg[1] for i=1,#self._room.player_list do if self._room.self_player.seat==self._room.player_list[i].seat and self._room.self_player.self_user.account_id ~= self._room.player_list[i].self_user.account_id then -- body local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip") local _action = self._view:AddChild(ErrorMsgTip) _action.xy = Vector2((self._view.width - _action.width) / 4, self._view.height / 4) local text = _action:GetChild("tex_message") local btn1 = _action:GetChild("btn_connect") local btn2 = _action:GetChild("btn_back") text.text = "您来晚了,座位有人,请重新进牌桌" btn1.visible=false btn2:Center() btn2.y=btn2.y+50 btn2.onClick:Set(function() -- body ErrorMsgTip:Destroy() ErrorMsgTip = nil self._gamectr:LevelRoom(function(res) ViewUtil.CloseModalWait() NetResetConnectWindow.CloseNetReset() ControllerManager.ChangeController(LoddyController) ViewManager.ChangeView(ViewManager.View_Lobby) end) end) end end if not self._room.self_player.ready and self._room.room_config.people_num ==#self._room.player_list then self._ctr_action.selectedIndex = 1 else self._ctr_action.selectedIndex = 0 end MainView.OnPlayerEnter(self, ...) end function M:Destroy() UpdateBeat:Remove(self.OnUpdate,self) for i = 1, #self._room.player_list do local player = self._room.player_list[i] local card_info_i = self._player_card_info[self:GetPos(player.seat)] --player:Destroy() card_info_i:Destroy() if card_info_i ~= nil and card_info_i.cor_init_poker ~= nil then coroutine.stop(card_info_i.cor_init_poker) end local head_info = self._player_info[self:GetPos(player.seat)] head_info:Destroy1() head_info:Destroy() end MSMainView.Destroy(self) UIPackage.RemovePackage("extend/poker/mushi/ui/Extend_Poker_MuShi") self.InitCardList = {} --self.OnMuShiUpdate = nil end return M