2025-05-24 14:29:14 +08:00
---
--- Created by 谌建军.
--- DateTime: 2017/12/18 9:41
---
local PKMainView = import ( " main.poker.PKMainView " )
local RunFast_PlayerPokerInfoView = import ( " .RunFast_PlayerPokerInfoView " )
local RunFast_PlayerSelfPokerInfoView = import ( " .RunFast_PlayerSelfPokerInfoView " )
local RunFast_GameEvent = import ( " .RunFast_GameEvent " )
local RunFast_ResultView = import ( " .RunFast_ResultView " )
local RunFast_RightPanelView = import ( " .RunFast_RightPanelView " )
local PlayerInfoView = import ( " .EXPlayerInfoView " )
local TableBG = import ( ' Game.Data.TableBG ' )
2026-02-04 15:07:37 +08:00
local RunFast_CardCheck = import ( " .CardCheck " )
2025-05-24 14:29:14 +08:00
local M = { }
function M . new ( )
2025-05-27 02:05:27 +08:00
setmetatable ( M , { __index = PKMainView } )
local self = setmetatable ( { } , { __index = M } )
2025-05-24 14:29:14 +08:00
self.class = " RunFast_MainView "
self : init ( )
self._gamectr = ControllerManager.GetController ( GameController )
return self
end
local default_bg = 1
local bg_config = {
2025-05-27 02:05:27 +08:00
{ id = 1 , url = ' extend/poker/runfast/bg/bg1 ' , thumb = ' ui://Extend_Poker_RunFastNew/table_bg1 ' } ,
{ id = 2 , url = ' extend/poker/runfast/bg/bg2 ' , thumb = ' ui://Extend_Poker_RunFastNew/table_bg2 ' } ,
{ id = 3 , url = ' extend/poker/runfast/bg/bg3 ' , thumb = ' ui://Extend_Poker_RunFastNew/table_bg3 ' }
2025-05-24 14:29:14 +08:00
}
function M : InitView ( url )
local room = self._room
2026-02-04 15:07:37 +08:00
self._full = true
2025-05-24 14:29:14 +08:00
UIPackage.AddPackage ( " extend/poker/runfast/ui/Extend_Poker_RunFastNew " )
2026-02-04 15:07:37 +08:00
PKMainView.InitView ( self , " ui://Extend_Poker_RunFastNew/RunFast_Main_New_ " .. room.room_config . people_num , nil , 1 ,
default_bg , bg_config , nil )
2025-05-24 14:29:14 +08:00
local _room = DataManager.CurrenRoom
local user_id = DataManager.SelfUser . account_id
2025-05-27 02:05:27 +08:00
local json_data = Utils.LoadLocalFile ( user_id .. _room.game_id .. " pai " )
2025-05-24 14:29:14 +08:00
if json_data == nil then
local _gamectr = self._gamectr
self._room . pai = 0
else
local _data = json.decode ( json_data )
local pai = _data [ " pai " ]
self._room . pai = pai
end
2025-05-27 02:05:27 +08:00
json_data = Utils.LoadLocalFile ( user_id .. _room.game_id .. " cardsize " )
2025-05-24 14:29:14 +08:00
if json_data == nil then
local _gamectr = self._gamectr
self._room . cardsize = 1
else
local _data = json.decode ( json_data )
local cardsize = _data [ " cardsize " ]
self._room . cardsize = cardsize
end
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
2025-05-27 02:05:27 +08:00
for i = 1 , # list do
2025-05-24 14:29:14 +08:00
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
2025-05-27 02:05:27 +08:00
self._rightPanelView = RunFast_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
2025-05-24 14:29:14 +08:00
-- 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 = " 您来晚了,座位有人,请重新进牌桌 "
2025-05-27 02:05:27 +08:00
btn1.visible = false
2025-05-24 14:29:14 +08:00
btn2 : Center ( )
2025-05-27 02:05:27 +08:00
btn2.y = btn2.y + 50
2025-05-24 14:29:14 +08:00
btn2.onClick : Set ( function ( )
2025-05-27 02:05:27 +08:00
-- body
ErrorMsgTip : Destroy ( )
ErrorMsgTip = nil
self._gamectr : LevelRoom ( function ( res )
2026-02-04 15:07:37 +08:00
ViewUtil.CloseModalWait2 ( )
2025-05-27 02:05:27 +08:00
NetResetConnectWindow.CloseNetReset ( )
ControllerManager.ChangeController ( LoddyController )
ViewManager.ChangeView ( ViewManager.View_Lobby )
end )
2025-05-24 14:29:14 +08:00
end )
end
end
2025-05-27 02:05:27 +08:00
if self._room . hpOnOff == 1 and self._room . score_times ~= 1 then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
self._view : GetChild ( " roominfo_panel1 " ) : GetChild ( " tex_beishu " ) . text = self._room . score_times .. " 倍 "
2025-05-24 14:29:14 +08:00
else
2025-05-27 02:05:27 +08:00
self._view : GetChild ( " roominfo_panel1 " ) : GetChild ( " tex_beishu " ) . text = " "
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
self.ctr_state = self._view : GetController ( " state " )
self._ctr_action = self._view : GetController ( " action " )
2026-02-04 15:07:37 +08:00
-- self._tex_leftTime = self._view:GetChild("time"):GetChild("title")
2025-05-24 14:29:14 +08:00
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 = { }
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
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
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
local list = room.player_list
if not room.self_player . ready then
2025-05-27 02:05:27 +08:00
local round = DataManager.CurrenRoom . room_config.config . times or 1
local xpconfig = DataManager.CurrenRoom . room_config.config . xi_pai
if xpconfig then
if round > 1 then
self._ctr_action . selectedIndex = 1
else
self._ctr_action . selectedIndex = 2
end
else
self._ctr_action . selectedIndex = 1
end
2025-05-24 14:29:14 +08:00
else
self._ctr_action . selectedIndex = 0
end
self._left_time = 0
self.bgm_index = 1
local state = self._room . CurnrenState
if room.CurnrenState ~= StateType.PalyingWait then
self._state . selectedIndex = state
if room.CurnrenState == StateType.Palying then
self : ReConnectForStart ( )
end
else
self._state . selectedIndex = StateType.Palying
self : ReconnectForClearing ( )
end
2025-05-27 02:05:27 +08:00
self._view : GetChild ( " btn_back_jiesan " ) . onClick : Set ( function ( )
2025-05-24 14:29:14 +08:00
if self.dismiss_room_cd_time > 0 then
ViewUtil.ErrorTip ( nil , " 您还处于解散冷却时间当中,请稍后重试! " )
else
local _gamectr = ControllerManager.GetController ( GameController )
_gamectr : AskDismissRoom ( )
end
end )
2025-05-27 02:05:27 +08:00
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
2025-05-24 14:29:14 +08:00
self : ChangeBgmMusic ( )
self : EventInit ( )
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
self._view : GetChild ( " bg_mask " ) . onClick : Set ( function ( )
-- self:ResetPoker()
2025-05-24 14:29:14 +08:00
end )
local btn_rule = self._view : GetChild ( " right_panel " ) : GetChild ( " btn_log " )
self._view : GetChild ( ' info_text ' ) : GetChild ( ' text ' ) . text = room.room_config : GetDes ( )
if room.room_config . Leaf == 1 then
2025-05-27 02:05:27 +08:00
if room.room_config . people_num == 2 then
2025-05-24 14:29:14 +08:00
self._view : GetChild ( ' wanfa_text ' ) . text = ' 十五张 ' .. ' 二人跑得快 ' .. room.score_times .. ' 倍 '
else
self._view : GetChild ( ' wanfa_text ' ) . text = ' 十五张 ' .. ' 三人跑得快 ' .. room.score_times .. ' 倍 '
end
else
if room.room_config . people_num == 2 then
2025-05-27 02:05:27 +08:00
self._view : GetChild ( ' wanfa_text ' ) . text = ' 十六张 ' .. ' 二人跑得快 ' .. room.score_times .. ' 倍 '
2025-05-24 14:29:14 +08:00
else
self._view : GetChild ( ' wanfa_text ' ) . text = ' 十六张 ' .. ' 三人跑得快 ' .. room.score_times .. ' 倍 '
end
end
2026-02-04 15:07:37 +08:00
--剩余弄在头像上,三人就会有两个剩余
-- if self._view:GetChild("shengyu") ~= nil then
-- -- body
2025-05-24 14:29:14 +08:00
2026-02-04 15:07:37 +08:00
-- if room.room_config.Leaf == 1 then
-- -- body
-- self._view:GetChild("shengyu"):GetChild("shengyu").text = "剩余15张"
-- else
-- self._view:GetChild("shengyu"):GetChild("shengyu").text = "剩余16张"
-- end
-- end
------------------lingmeng--------------------------
-- self._tex_leftTime = self._view:GetChild('Comp_Clock'):GetChild('time') -- 重写
self._text_currenRound = self._view : GetChild ( ' Text_CurrenRound ' )
self._text_maxRound = self._view : GetChild ( ' Text_MaxMaxRound ' )
self._cardCheck = RunFast_CardCheck : InitFlag ( )
self._gamectr . _cardCheck = self._cardCheck
self : UpdateRound ( self._room . curren_round or 0 )
self._view : GetChild ( ' text_roomId ' ) . text = self._room . room_id
self._ctr_inClear = self._view : GetController ( ' Inclear ' )
self._view : GetChild ( ' btn_ready_inClear ' ) . onClick : Set ( function ( )
if self.result_view and self.result_view . _view then
self._ctr_inClear . selectedIndex = 0
self.result_view : ClearReady ( )
2025-05-24 14:29:14 +08:00
else
2026-02-04 15:07:37 +08:00
self.result_view = nil
local _gamectr = ControllerManager.GetController ( GameController )
_gamectr : ConformToNextGame ( )
self : ClearOk ( )
2025-05-24 14:29:14 +08:00
end
2026-02-04 15:07:37 +08:00
end )
----------------------------------------------------
--闹钟倒计时报时
self._leftTime_xiangling = 5
self._leftTime_bianhong = true
local btn_witness = self._view : GetChild ( ' btn_pangGuang ' )
if btn_witness then
btn_witness.onClick : Set ( function ( )
self._view : GetController ( ' witness ' ) . selectedIndex = 1
end )
2025-05-24 14:29:14 +08:00
end
2026-02-04 15:07:37 +08:00
----------屏幕大小发生变化
GRoot.inst . onSizeChanged : Set ( function ( )
for _ , player in ipairs ( self._room . player_list ) do
local player_card_info = self._player_card_info [ self : GetPos ( player.seat ) ]
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
if player.seat == self._room . self_player.seat then
player_card_info : InitPoker ( player.hand_list , false )
else
end
end
end )
--打鸟
2025-05-27 02:05:27 +08:00
if self._view : GetChild ( ' btn_daNiao ' ) then
self._view : GetChild ( ' btn_daNiao ' ) . onClick : Set ( function ( )
self._gamectr : SendDaNiaoAction ( 1 )
self._ctr_action . selectedIndex = 0
end )
end
if self._view : GetChild ( ' btn_buDaNiao ' ) then
self._view : GetChild ( ' btn_buDaNiao ' ) . onClick : Set ( function ( )
self._gamectr : SendDaNiaoAction ( 0 )
self._ctr_action . selectedIndex = 0
end )
end
2025-06-04 19:59:58 +08:00
2026-01-13 18:35:26 +08:00
-- self._view:GetChild('btn_leave_lobby').onClick:Set(function()
-- ViewManager.ChangeView(ViewManager.View_Lobby)
-- end)
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
function M : UpdateCard ( index )
self._room . pai = index
2025-05-24 14:29:14 +08:00
local card_info = self._player_card_info [ 1 ]
-- for i=1,#self._room.player_list do
2026-02-04 15:07:37 +08:00
-- -- print(i)
2025-05-24 14:29:14 +08:00
-- end
card_info : updatePoker ( )
for _ , player in ipairs ( self._room . player_list ) do
local player_card_info = self._player_card_info [ self : GetPos ( player.seat ) ]
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
if self._room . curren_turn_seat ~= player.seat then
if player.out_card_list [ 1 ] == 0 then
player_card_info : SetOutCardInfo ( nil , true )
else
player_card_info : SetOutCardInfo ( player.out_card_list , false )
end
end
end
2025-05-27 02:05:27 +08:00
if self.caozuo == 1 then
2025-05-24 14:29:14 +08:00
local ctr_number = self.pass == nil and 2 or 1
local lastCardList = self._gamectr : GetLastCardList ( self._room . self_player.seat )
local cardType , cardNum , cardLength = self._gamectr : GetCardListInfo ( lastCardList )
local m = false
local next_seat = self._room . self_player.seat + 1
if next_seat > self._room . room_config.people_num then
next_seat = next_seat - self._room . room_config.people_num
end
if self._room : GetPlayerBySeat ( next_seat ) . hand_count == 1 and self._room . room_config.WillBeOut == 1 then
m = true
end
local zdts = self._view : GetController ( " zidongtishi " ) . selectedIndex
2025-05-27 02:05:27 +08:00
self._player_card_info [ 1 ] : ShowOutCardOption ( ctr_number , cardType , cardNum , cardLength , m )
2025-05-24 14:29:14 +08:00
end
end
function M : UpdateCardSize ( index )
2025-05-27 02:05:27 +08:00
self._room . cardsize = index
2025-05-24 14:29:14 +08:00
local card_info = self._player_card_info [ 1 ]
card_info : updatePoker ( )
end
function M : NewPlayerCardInfoView ( tem , index )
if index == 1 then
return RunFast_PlayerSelfPokerInfoView.new ( tem , self )
end
return RunFast_PlayerPokerInfoView.new ( tem , self )
end
function M : OnPlayerEnter ( ... )
2026-02-04 15:07:37 +08:00
ViewUtil.PlaySound ( " RunFastNew_PK " , " base/main_majiang/sound/user_enter.mp3 " )
2025-05-24 14:29:14 +08:00
MainView.OnPlayerEnter ( self , ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local p = arg [ 1 ]
local index = self : GetPos ( p.seat )
local info = self._player_info [ index ]
local selecet_seat = self._view : GetChild ( " seat_ " .. index )
if selecet_seat ~= nil then
selecet_seat.visible = true
end
info : FillData ( p )
if self._room . banker_seat == self._room . self_player.seat and self._room . self_player.ready then
self._ctr_action . selectedIndex = 0
end
end
function M : OnPlayerReady ( ... )
2026-02-04 15:07:37 +08:00
ViewUtil.PlaySound ( " RunFastNew_PK " , " base/main_majiang/sound/user_ready.mp3 " )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
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
end
local info = _player_info [ self : GetPos ( p.seat ) ]
info : Ready ( true )
2025-05-27 02:05:27 +08:00
--local readyNum = 0
--for i = 1, #_room.player_list do
-- local player = _room.player_list[i]
-- if player.ready then readyNum = readyNum + 1 end
--end
--if _room.banker_seat == _room.self_player.seat and readyNum > 1 and readyNum == _room.room_config.people_num then
-- if self._state.selectedIndex == 2 then
-- local _gamectr = ControllerManager.GetController(GameController)
-- _gamectr:StartGame()
-- end
-- --self._ctr_action.selectedIndex = 2
--end
2025-05-24 14:29:14 +08:00
end
function M : OnPlayerLeave ( ... )
2026-02-04 15:07:37 +08:00
ViewUtil.PlaySound ( " RunFastNew_PK " , " base/main_majiang/sound/user_leave.mp3 " )
2025-05-24 14:29:14 +08:00
MainView.OnPlayerLeave ( self , ... )
local _room = self._room
if not _room.self_player . ready then
--self._ctr_action.selectedIndex = 1
2025-05-27 02:05:27 +08:00
local round = DataManager.CurrenRoom . room_config.config . times or 1
local xpconfig = DataManager.CurrenRoom . room_config.config . xi_pai
if xpconfig then
if round > 1 then
self._ctr_action . selectedIndex = 1
else
self._ctr_action . selectedIndex = 2
end
else
self._ctr_action . selectedIndex = 1
end
2025-05-24 14:29:14 +08:00
else
self._ctr_action . selectedIndex = 0
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
2025-05-27 02:05:27 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.EventXiPai , function ( ... )
if self.result_view ~= nil then
2025-05-24 14:29:14 +08:00
self.result_view : Destroy ( )
self.result_view = nil
end
2025-05-27 02:05:27 +08:00
self._player_card_info [ 1 ] : HidePiao ( )
if self._room . room_config.people_num == 3 and self._room . room_config.fangzuobi == 1 then
2025-05-24 14:29:14 +08:00
-- body
self.MypokerList = cardlist
end
local otherpoker_list = self._view : GetChild ( " otherpoker_list " )
2025-05-27 02:05:27 +08:00
if otherpoker_list ~= nil then
-- body
otherpoker_list.visible = false
otherpoker_list : RemoveChildrenToPool ( )
end
2025-05-24 14:29:14 +08:00
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
2025-05-27 02:05:27 +08:00
local list = _room.player_list
2025-05-24 14:29:14 +08:00
for i = 1 , # list do
local p = list [ i ]
local head_info = self._player_info [ self : GetPos ( p.seat ) ]
2025-05-27 02:05:27 +08:00
if head_info._view : GetChild ( " shengyu " ) ~= nil and head_info._view : GetController ( " shengyu " ) ~= nil then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
if self._room . room_config.showlength == 1 then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
head_info._view : GetController ( " shengyu " ) . selectedIndex = 1
2025-05-24 14:29:14 +08:00
else
2025-05-27 02:05:27 +08:00
head_info._view : GetController ( " shengyu " ) . selectedIndex = 0
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
-- body
2026-02-04 15:07:37 +08:00
head_info._view : GetChild ( " shengyu " ) . text = p.hand_count
2025-05-24 14:29:14 +08:00
end
p : Clear ( )
head_info : FillData ( p )
local card_info = self._player_card_info [ self : GetPos ( p.seat ) ]
card_info : Clear ( )
head_info : Ready ( false )
2025-05-27 02:05:27 +08:00
end
--[[if ( currentPlayer ) then
2025-05-24 14:29:14 +08:00
self._popEvent = false
local xipaiCB = function ( )
self._popEvent = true
end
self : PlayXiPai ( xipaiCB )
else
ViewUtil.ShowModalWait ( self._root_view , " 等待其它玩家洗牌... " )
coroutine.start ( function ( )
coroutine.wait ( 3 )
2026-02-04 15:07:37 +08:00
ViewUtil.CloseModalWait2 ( )
2025-05-24 14:29:14 +08:00
end )
end --]]
2025-05-27 02:05:27 +08:00
local arg = { ... }
local currentPlayer1 = arg [ 1 ]
local currentPlayer2 = arg [ 2 ]
self._popEvent = false
if ( currentPlayer1 ) then
local xipaiCB = function ( )
self._popEvent = true
end
self : PlayXiPai ( xipaiCB )
end
if ( currentPlayer2 ) then
--self._popEvent = false
local xipaiCB2 = function ( )
self._popEvent = true
end
self : PlayXiPai1 ( xipaiCB2 )
end
end )
2025-05-24 14:29:14 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnMingCard , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local card = arg [ 1 ]
self.ctr_state . selectedIndex = 1
2026-02-04 15:07:37 +08:00
-- self.ctr_card_eff.selectedIndex = 1
-- if self._room.room_config.people_num == 3 then
-- self:PlayCardEff(403)
-- end
2025-05-24 14:29:14 +08:00
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnInitCard , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local round = arg [ 1 ]
local cardlist = arg [ 2 ]
2026-02-04 15:07:37 +08:00
self._popEvent = false
2025-05-24 14:29:14 +08:00
2026-02-04 15:07:37 +08:00
if self.destory_win ~= nil then
coroutine.stop ( self.destory_win )
end
2025-05-24 14:29:14 +08:00
if self.result_view ~= nil then
self.result_view : Destroy ( )
self.result_view = nil
end
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
self._player_card_info [ 1 ] : HidePiao ( )
2025-05-27 02:05:27 +08:00
if self._room . room_config.people_num == 3 and self._room . room_config.fangzuobi == 1 then
2025-05-24 14:29:14 +08:00
-- body
self.MypokerList = cardlist
end
local otherpoker_list = self._view : GetChild ( " otherpoker_list " )
2025-05-27 02:05:27 +08:00
if otherpoker_list ~= nil then
-- body
otherpoker_list.visible = false
otherpoker_list : RemoveChildrenToPool ( )
end
2025-05-24 14:29:14 +08:00
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
2026-02-04 15:07:37 +08:00
self._ctr_inClear . selectedIndex = 0
2025-05-24 14:29:14 +08:00
self : UpdateRound ( round )
2026-02-04 15:07:37 +08:00
-- ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/fapai.mp3")
2025-05-24 14:29:14 +08:00
local list = _room.player_list
for i = 1 , # list do
local p = list [ i ]
local head_info = self._player_info [ self : GetPos ( p.seat ) ]
2025-05-27 02:05:27 +08:00
if head_info._view : GetChild ( " shengyu " ) ~= nil and head_info._view : GetController ( " shengyu " ) ~= nil then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
if self._room . room_config.showlength == 1 then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
head_info._view : GetController ( " shengyu " ) . selectedIndex = 1
2025-05-24 14:29:14 +08:00
else
2025-05-27 02:05:27 +08:00
head_info._view : GetController ( " shengyu " ) . selectedIndex = 0
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
-- body
2026-02-04 15:07:37 +08:00
head_info._view : GetChild ( " shengyu " ) . text = p.hand_count
2025-05-24 14:29:14 +08:00
end
2026-02-04 15:07:37 +08:00
-- p:Clear()
head_info : MarkBank ( p.seat == _room.banker_seat )
2025-05-24 14:29:14 +08:00
head_info : FillData ( p )
local card_info = self._player_card_info [ self : GetPos ( p.seat ) ]
card_info : Clear ( )
head_info : Ready ( false )
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
2025-05-24 14:29:14 +08:00
if p.seat == self._room . self_player.seat then
2025-05-27 02:05:27 +08:00
if self._room . room_config.people_num == 3 and self._room . room_config.fangzuobi == 1 then
2025-05-24 14:29:14 +08:00
-- body
2026-02-04 15:07:37 +08:00
card_info : InitPoker ( cardlist , false , 1 )
2025-05-24 14:29:14 +08:00
else
2026-02-04 15:07:37 +08:00
card_info : InitPoker ( cardlist , false )
2025-05-24 14:29:14 +08:00
end
else
--card_info:UpdateHandPoker(#cardlist,true,false) --todo
--card_info:UpdateRemainCard(#cardlist,true)
end
end
2026-02-04 15:07:37 +08:00
if self._room . room_config.people_num == 3 and round == 1 then
local effect = self._view : GetTransition ( string.format ( ' to_%s ' , self : GetPos ( self._room . banker_seat ) ) )
effect : Play ( 1 , 0 , function ( )
self._popEvent = true
end )
else
self._popEvent = true
end
2025-05-24 14:29:14 +08:00
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
-- _gamectr:AddEventListener(RunFast_GameEvent.Oener,function ( ... )
-- local arg = {...}
-- local seat = arg[1]
-- local head_info = self._player_info[self:GetPos(seat)]
-- head_info._view:GetController("Oener").selectedIndex=1
-- end)
_gamectr : AddEventListener ( RunFast_GameEvent.OnIndexMove , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local seat = arg [ 1 ]
local isNewBout = arg [ 2 ]
local index = self : GetPos ( seat )
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
2025-05-24 14:29:14 +08:00
self.ctr_time . selectedIndex = index
2026-02-04 15:07:37 +08:00
-- for i = 1, #self._player_info do
-- if index == i then
-- -- body
-- local head_info = self._player_info[index]
-- head_info:MarkBank(true)
-- else
-- local head_info = self._player_info[i]
-- head_info:MarkBank(false)
-- end
2025-05-24 14:29:14 +08:00
-- end
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
-- if index == 1 then
local card_info = self._player_card_info [ index ]
-- if self.MypokerList ~= nil then
-- -- body
-- card_info:Clear()
-- card_info:InitPoker(self.MypokerList, false)
-- self.MypokerList = nil
-- end
-- end
self._leftClock_continue = coroutine.start ( function ( )
coroutine.wait ( 0.02 )
2025-05-24 14:29:14 +08:00
card_info : SetOutCardInfo ( nil , false )
2026-02-04 15:07:37 +08:00
for i = 1 , # self._player_card_info do
local card_info = self._player_card_info [ i ]
if i == index then
card_info._ctr_time_clock . selectedIndex = 1
self._tex_leftTime = card_info._view_comp_clock
else
card_info._ctr_time_clock . selectedIndex = 0
end
-- if self._room.is_new_bout then
-- card_info.ctr_outpoker.selectedIndex = 0
-- end
end
if self._left_time and self._left_time < 15 then
self._left_time = 15
end
end )
2025-05-24 14:29:14 +08:00
if self._room . ming_card ~= nil then
self._view : GetTransition ( " t " .. index ) : Play ( )
self._room . ming_card = nil
if self.tween ~= nil then
TweenUtils.Kill ( self.tween )
self.tween = nil
end
end
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnBombScore , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local scoreList = arg [ 1 ]
2026-02-04 15:07:37 +08:00
for i = 1 , # scoreList do
local player = self._room : GetPlayerBySeat ( i )
local card_info = self._player_card_info [ self : GetPos ( i ) ]
local head_info = self._player_info [ self : GetPos ( i ) ]
card_info : PlayScore ( scoreList [ i ] , true )
head_info : UpdateScore ( player.total_score )
end
2025-05-24 14:29:14 +08:00
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnPlaySucc , function ( ... )
2026-02-04 15:07:37 +08:00
ViewUtil.PlaySound ( " RunFastNew_PK " , " extend/poker/runfast/sound/playcard_chup.mp3 " )
-- self._popEvent = false
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local p = arg [ 1 ]
local card_number = arg [ 2 ]
local cardstype = arg [ 3 ]
local num = arg [ 4 ]
local otherList = arg [ 5 ]
local length = arg [ 6 ]
2026-02-04 15:07:37 +08:00
local lastCardList = arg [ 7 ]
2025-05-24 14:29:14 +08:00
self.ctr_time . selectedIndex = 0
local index = self : GetPos ( p.seat )
2025-05-27 02:05:27 +08:00
if index == 1 then
self.caozuo = 0
2025-05-24 14:29:14 +08:00
end
2026-02-04 15:07:37 +08:00
coroutine.stop ( self._leftClock_continue )
2025-05-24 14:29:14 +08:00
local head_info = self._player_info [ index ]
2025-05-27 02:05:27 +08:00
if head_info._view : GetChild ( " shengyu " ) ~= nil then
2025-05-24 14:29:14 +08:00
-- body
-- body
2025-05-27 02:05:27 +08:00
if card_number ~= nil then
2025-05-24 14:29:14 +08:00
-- body
2026-02-04 15:07:37 +08:00
head_info._view : GetChild ( " shengyu " ) . text = card_number
2025-05-24 14:29:14 +08:00
end
end
local card_info = self._player_card_info [ index ]
card_info : SetOutCardInfo ( p.out_card_list , false , true )
2026-02-04 15:07:37 +08:00
card_info._ctr_time_clock . selectedIndex = 0
2025-05-24 14:29:14 +08:00
for i = 1 , # otherList do
local other_seat = otherList [ i ]
local other_card_info = self._player_card_info [ self : GetPos ( other_seat ) ]
other_card_info : SetOutCardBlack ( )
end
if index == 1 then
card_info : DeleteHandCards ( p.out_card_list )
else
2026-02-04 15:07:37 +08:00
-- card_info:SetRemainCardNumber(card_number == 1)
2025-05-27 02:05:27 +08:00
--card_info:UpdateHandPoker(card_number,false,false) -- todo
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
-- if self._room.is_new_bout == true then
-- 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)]
-- if p.seat ~= player.seat then
-- card_info_i:SetOutCardInfo(nil, false)
-- end
-- end
-- self:_Effect(cardstype, p)
-- else
-- if cardstype == 11 and cardstype ~= 12 then
-- self:_Effect(cardstype, p)
-- end
-- end
self : _Effect ( self._cardCheck . type , p )
print ( " lingmeng end _Effect " , self._cardCheck . type )
self : PlaySound ( p.self_user . sex ,
self : GetSoundFileName ( self._cardCheck . type , num , self._room . is_new_bout ) )
-- self:PlaySound(p.self_user.sex, self:GetSoundFileName(cardstype, num, self._room.is_new_bout))
2025-05-24 14:29:14 +08:00
if card_number == 1 then
--self:ChangeBgmMusic(2)
self : ChangeBgmMusic ( 1 )
if self._cor_sound ~= nil then
coroutine.stop ( self._cor_sound )
end
self._cor_sound = nil
self._cor_sound = coroutine.start ( function ( )
self : PlaySound ( p.self_user . sex , " card_1 " )
end )
end
end )
2025-05-27 02:05:27 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnPassSuccCheckCard , function ( ... )
self._popEvent = false
local arg = { ... }
local seat = arg [ 1 ]
2025-05-24 14:29:14 +08:00
local cards = arg [ 2 ]
--self.MypokerList=cards
self.ctr_time . selectedIndex = 0
local card_info = self._player_card_info [ self : GetPos ( seat ) ]
2025-05-27 02:05:27 +08:00
if seat == self._room . self_player.seat then
card_info : ClearCheck ( )
card_info : InitPoker ( cards , false )
--local player=self._room:GetPlayerBySeat(seat)
--if player.out_card_list[1] == 0 then
2025-05-24 14:29:14 +08:00
-- player_card_info:SetOutCardInfo(nil, true)
--else
2025-05-27 02:05:27 +08:00
--player:SetOutCardInfo({207}, false)
-- end
end
2025-05-24 14:29:14 +08:00
self._popEvent = true
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnPassSucc , function ( ... )
2026-02-04 15:07:37 +08:00
self._popEvent = false
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local p = arg [ 1 ]
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
self.ctr_time . selectedIndex = 0
local card_info = self._player_card_info [ self : GetPos ( p.seat ) ]
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
--card_info:SetOutCardInfo(nil, false)
if p.seat == self._room . self_player.seat and self.MypokerList ~= nil then
-- body
card_info : Clear ( )
card_info : InitPoker ( self.MypokerList , false )
self.MypokerList = nil
end
2026-02-04 15:07:37 +08:00
coroutine.stop ( self._leftClock_continue )
card_info._ctr_time_clock . selectedIndex = 0
2025-05-24 14:29:14 +08:00
card_info : SetOutCardInfo ( nil , true )
self : PlaySound ( p.self_user . sex , " pass_ " .. math.random ( 1 , 4 ) )
2026-02-04 15:07:37 +08:00
coroutine.start ( function ( )
coroutine.wait ( 1 )
self._popEvent = true
end )
2025-05-24 14:29:14 +08:00
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnErrorTip , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local error_str = arg [ 1 ]
self._player_card_info [ 1 ] : ErrorTip ( error_str )
-- self._player_card_info[1]:ResetPoker()
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnPiaoTips , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local piao = arg [ 1 ]
local reload = arg [ 2 ]
if reload == 0 then
2025-05-27 02:05:27 +08:00
if self._room . room_config.people_num == 3 and self._room . room_config.fangzuobi == 1 then
2025-05-24 14:29:14 +08:00
-- body
self.MypokerList = cardlist
end
local otherpoker_list = self._view : GetChild ( " otherpoker_list " )
2025-05-27 02:05:27 +08:00
if otherpoker_list ~= nil then
-- body
otherpoker_list.visible = false
otherpoker_list : RemoveChildrenToPool ( )
end
2025-05-24 14:29:14 +08:00
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 ( self._room . curren_round )
local list = _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 )
head_info : UpdatePiao ( - 1 )
end
end
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
self._player_card_info [ 1 ] : ShowPiao ( piao )
end )
_gamectr : AddEventListener ( RunFast_GameEvent.OnPiaoAction , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local seat = arg [ 1 ]
local piao = arg [ 2 ]
local head_info = self._player_info [ self : GetPos ( seat ) ]
head_info : UpdatePiao ( piao )
end )
_gamectr : AddEventListener ( RunFast_GameEvent.OnOptions , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local play = arg [ 1 ]
local pass = arg [ 5 ]
local card_type = arg [ 2 ]
local card_number = arg [ 3 ]
local card_length = arg [ 4 ]
2026-02-04 15:07:37 +08:00
local lastCardList = arg [ 6 ]
2025-05-24 14:29:14 +08:00
local ctr_number = pass == nil and 2 or 1
2025-05-27 02:05:27 +08:00
self.caozuo = 1 --记录是否是自己出牌的阶段
self.pass = pass
2025-05-24 14:29:14 +08:00
local m = false
local next_seat = self._room . self_player.seat + 1
local card_info = self._player_card_info [ 1 ]
2026-02-04 15:07:37 +08:00
card_info : SetOutCardInfo ( nil , false )
2025-05-24 14:29:14 +08:00
if self.MypokerList ~= nil then
-- body
card_info : Clear ( )
card_info : InitPoker ( self.MypokerList , false )
self.MypokerList = nil
end
if next_seat > self._room . room_config.people_num then
next_seat = next_seat - self._room . room_config.people_num
end
if self._room : GetPlayerBySeat ( next_seat ) . hand_count == 1 and self._room . room_config.WillBeOut == 1 then
m = true
end
local zdts = self._view : GetController ( " zidongtishi " ) . selectedIndex
2026-02-04 15:07:37 +08:00
-- self._player_card_info[1]._cardCheck:InitLastCard(lastCardList)
-- self._player_card_info[1]:ShowOutCardOption(ctr_number, card_type, card_number, card_length, m, play, zdts)
card_info : ShowOutCardOption2 ( lastCardList , ctr_number , m )
2025-05-24 14:29:14 +08:00
end )
2025-05-27 02:05:27 +08:00
-- 托管
_gamectr : AddEventListener ( RunFast_GameEvent.Game_TuoGuan , function ( ... )
local arg = { ... }
2025-05-24 14:29:14 +08:00
local tuoguan = arg [ 1 ]
local seat = arg [ 2 ]
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
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
2025-05-27 02:05:27 +08:00
if ( seat == self._room . self_player.seat ) then
2025-05-24 14:29:14 +08:00
tuoguanzhong.visible = true
-- tuoguanzhong.sortingOrder = 2
zhezhao.visible = true
zhezhao.onClick : Set ( function ( )
_gamectr : TuoGuan ( 0 )
end )
else
head_info._view : GetController ( " tuoguan " ) . selectedIndex = 1
end
2025-05-27 02:05:27 +08:00
-- if self.ispanguangzhe == true then
-- -- body
-- zhezhao.visible = false
-- end
2025-05-24 14:29:14 +08:00
else
if ( seat == self._room . self_player.seat ) then
tuoguanzhong.visible = false
zhezhao.visible = false
-- local btn_tuoguan = self._view:GetChild("n107")
-- btn_tuoguan.onClick:Set(function()
-- _gamectr:TuoGuan(1)
-- -- self:ZhiNengtuoguan()
-- end)
else
head_info._view : GetController ( " tuoguan " ) . selectedIndex = 0
end
end
end )
_gamectr : AddEventListener ( RunFast_GameEvent.OnResult , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local over = arg [ 1 ]
local info = arg [ 2 ]
local win_seat = arg [ 3 ]
local remaincards = arg [ 4 ]
-- local energyTab = arg[5]
local otherpoker_list = self._view : GetChild ( " otherpoker_list " )
2026-02-04 15:07:37 +08:00
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
2025-05-24 14:29:14 +08:00
if self.MypokerList ~= nil then
-- body
card_info : Clear ( )
card_info : InitPoker ( self.MypokerList , false )
self.MypokerList = nil
end
if otherpoker_list ~= nil then
-- body
otherpoker_list : RemoveChildrenToPool ( )
2025-05-27 02:05:27 +08:00
otherpoker_list.visible = true
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
if self._cor_sound ~= nil then
coroutine.stop ( self._cor_sound )
self._cor_sound = nil
end
2025-05-27 02:05:27 +08:00
if self.destory_win ~= nil then
coroutine.stop ( self.destory_win )
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
self.destory_win = nil
self.destory_win = coroutine.start ( function ( )
2026-02-04 15:07:37 +08:00
if win_seat == self._room . self_player.seat then
ViewUtil.PlaySound ( " RunFastNew_PK " , " extend/poker/runfast/sound/end_music.mp3 " )
2025-05-24 14:29:14 +08:00
else
2026-02-04 15:07:37 +08:00
ViewUtil.PlaySound ( " RunFastNew_PK " , " extend/poker/runfast/sound/lose_music.mp3 " )
2025-05-24 14:29:14 +08:00
end
2026-02-04 15:07:37 +08:00
coroutine.stop ( self._leftClock_continue )
for i = 1 , # self._player_card_info do
local card_info = self._player_card_info [ i ]
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
2025-05-24 14:29:14 +08:00
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 ) ]
2026-02-04 15:07:37 +08:00
end
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
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 ) ]
2025-05-24 14:29:14 +08:00
2026-02-04 15:07:37 +08:00
if player.seat ~= win_seat then
card_info.ctr_outpoker . selectedIndex = 0
end
2025-05-24 14:29:14 +08:00
if player.seat ~= self._room . self_player.seat then
2026-02-04 15:07:37 +08:00
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
2025-05-24 14:29:14 +08:00
end
end
self : ChangeBgmMusic ( 1 )
-- if over == 0 then
2026-02-04 15:07:37 +08:00
-- if #self:GetSpringSeats(info) > 0 then
-- -- -- print("222222222222222222")
-- coroutine.wait(1)
-- else
-- -- -- print("333333333333333333")
-- -- coroutine.wait(2)
-- end
coroutine.wait ( 2 )
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
self.result_view = RunFast_ResultView.new ( self , info , self._room . room_id , over , win_seat , 0 ,
2025-05-27 02:05:27 +08:00
remaincards )
2026-02-04 15:07:37 +08:00
self.result_view : SetDestroryCallback ( function ( )
for i = 1 , # self._player_card_info do
local card_info = self._player_card_info [ i ]
card_info.ctr_outpoker . selectedIndex = 0
if card_info._ctr_resultOut then
card_info._ctr_resultOut . selectedIndex = 0
end
end
end )
2025-05-24 14:29:14 +08:00
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 then
2025-05-27 02:05:27 +08:00
local btn_confirm = self.result_view . _view : GetChild ( " btn_confirm " )
2025-05-24 14:29:14 +08:00
btn_confirm.onClick : Call ( )
end
2026-02-04 15:07:37 +08:00
ViewUtil.PlaySound ( " RunFastNew_PK " , " extend/poker/runfast/sound/end_music.mp3 " )
2025-05-24 14:29:14 +08:00
end )
2025-05-27 02:05:27 +08:00
if over == 1 then
2025-05-24 14:29:14 +08:00
-- body
self : UnmarkSelfTuoguan ( )
ControllerManager.ChangeController ( LoddyController )
end
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnResultByDissolve , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
local over = arg [ 1 ]
local info = arg [ 2 ]
local winseat = arg [ 3 ]
local dissolve = arg [ 4 ]
2026-02-04 15:07:37 +08:00
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
end
self.result_view = RunFast_ResultView.new ( self , info , self._room . room_id , over , winseat , dissolve , nil )
2025-05-27 02:05:27 +08:00
self.result_view : Show ( )
ControllerManager.ChangeController ( LoddyController )
self : UnmarkSelfTuoguan ( )
2025-05-24 14:29:14 +08:00
end )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
-- 确定开始下一局 成功
_gamectr : AddEventListener ( RunFast_GameEvent.OnConfrimToNextGameSucc , function ( ... )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
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 ( )
local otherpoker_list = self._view : GetChild ( " otherpoker_list " )
if otherpoker_list ~= nil then
-- body
2025-05-27 02:05:27 +08:00
otherpoker_list.visible = false
2025-05-24 14:29:14 +08:00
otherpoker_list : RemoveChildrenToPool ( )
end
2025-05-27 02:05:27 +08:00
--player_head._view:GetController("Oener").selectedIndex=0
2025-05-24 14:29:14 +08:00
end
end
local player_info = self._player_info [ self : GetPos ( p.seat ) ]
player_info : Ready ( true )
end )
2025-05-27 02:05:27 +08:00
_gamectr : AddEventListener ( RunFast_GameEvent.OnDaNiao , function ( ... )
local arg = { ... }
-- local seat = arg[1]
-- local piao = arg[2]
-- local head_info = self._player_info[self:GetPos(1)]
self._ctr_action . selectedIndex = 3
2025-06-12 21:08:17 +08:00
self.ctr_state . selectedIndex = 1
2025-06-04 22:42:49 +08:00
end )
_gamectr : AddEventListener ( RunFast_GameEvent.OnDaNiaoShow , function ( ... )
local arg = { ... }
local seat = arg [ 1 ]
local piao = arg [ 2 ]
local isDa = arg [ 3 ]
local head_info = self._player_info [ self : GetPos ( seat ) ]
head_info : ShowPiao ( isDa == 0 and 0 or piao )
2025-05-27 02:05:27 +08:00
end )
2026-02-04 15:07:37 +08:00
_gamectr : AddEventListener (
GameEvent.PlayerState ,
function ( ... )
printlog ( " lingmeng OnEventOnlineState " )
local arg = { ... }
local p = arg [ 1 ]
local info = self._player_info [ self : GetPos ( p.seat ) ]
info._ctr_offline . selectedIndex = p.line_state == 0 and 1 or 0
end
)
2025-05-24 14:29:14 +08:00
end
function M : ReConnectForStart ( )
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 )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
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 )
2026-02-04 15:07:37 +08:00
head_info : UpdateScore ( player.total_score )
2025-05-24 14:29:14 +08:00
head_info : UpdateLineState ( player.line_state )
head_info : UpdatePiao ( player.piao )
2026-02-04 15:07:37 +08:00
head_info : MarkBank ( player.seat == self._room . banker_seat )
2025-05-27 02:05:27 +08:00
if head_info._view : GetChild ( " shengyu " ) ~= nil and head_info._view : GetController ( " shengyu " ) ~= nil then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
if self._room . room_config.showlength == 1 then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
head_info._view : GetController ( " shengyu " ) . selectedIndex = 1
2025-05-24 14:29:14 +08:00
else
2025-05-27 02:05:27 +08:00
head_info._view : GetController ( " shengyu " ) . selectedIndex = 0
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
-- body
2026-02-04 15:07:37 +08:00
head_info._view : GetChild ( " shengyu " ) . text = player.hand_count
2025-05-24 14:29:14 +08:00
end
if player.seat == self._room . self_player.seat then
2025-05-27 02:05:27 +08:00
if player.open ~= nil and player.open == 0 and self._room . room_config.people_num == 3 and self._room . room_config.fangzuobi == 1 then
2025-05-24 14:29:14 +08:00
-- body
self.MypokerList = player.hand_list
player_card_info : InitPoker ( player.hand_list , false , 1 )
else
player_card_info : InitPoker ( player.hand_list , false )
end
else
2026-02-04 15:07:37 +08:00
-- player_card_info:SetRemainCardNumber(player.hand_count == 1)
2025-05-24 14:29:14 +08:00
if player.hand_count == 1 then
2026-02-04 15:07:37 +08:00
-- self.bgm_index = 2
2025-05-24 14:29:14 +08:00
end
end
2026-02-04 15:07:37 +08:00
if self._room . curren_turn_seat == player.seat then
2025-05-24 14:29:14 +08:00
-- head_info:MarkBank(false)
2026-02-04 15:07:37 +08:00
player_card_info._ctr_time_clock . selectedIndex = 1
self._tex_leftTime = player_card_info._view_comp_clock
self._left_time = 15
-- 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
2025-05-24 14:29:14 +08:00
else
-- head_info:MarkBank(true)
end
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 ) ]
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
--如果是体力值不可负分模式 则显示当前的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
2026-02-04 15:07:37 +08:00
player_card_info : PlayScore ( d2ad ( player.hp_info . round_actual_hp ) )
2025-05-24 14:29:14 +08:00
else
local rt = 1
if self._room . hpOnOff == 1 then
rt = self._room . score_times
end
head_info : UpdateScore ( player.total_score * rt )
2026-02-04 15:07:37 +08:00
player_card_info : PlayScore ( player.winscore * rt , false , self._room . winseat )
2025-05-24 14:29:14 +08:00
end
head_info : UpdateLineState ( player.line_state )
--head_info._view:GetController("Oener").selectedIndex=0
head_info : UpdatePiao ( player.piao )
2026-02-04 15:07:37 +08:00
head_info : MarkBank ( player.seat == self._room . banker_seat )
2025-05-27 02:05:27 +08:00
if head_info._view : GetChild ( " shengyu " ) ~= nil and head_info._view : GetController ( " shengyu " ) ~= nil then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
if self._room . room_config.showlength == 1 then
2025-05-24 14:29:14 +08:00
-- body
2025-05-27 02:05:27 +08:00
head_info._view : GetController ( " shengyu " ) . selectedIndex = 1
2025-05-24 14:29:14 +08:00
else
2025-05-27 02:05:27 +08:00
head_info._view : GetController ( " shengyu " ) . selectedIndex = 0
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
-- body
2026-02-04 15:07:37 +08:00
head_info._view : GetChild ( " shengyu " ) . text = player.hand_count
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
if player.seat == self._room . self_player.seat then
2025-05-24 14:29:14 +08:00
player_card_info : InitPoker ( player.hand_list , false )
else
2026-02-04 15:07:37 +08:00
-- player_card_info:UpdateHandPoker(player.hand_list, false, true)
2025-05-24 14:29:14 +08:00
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
2025-05-27 02:05:27 +08:00
win_seat = self._room . winseat
2025-05-24 14:29:14 +08:00
self._room . winseat = nil
2025-05-27 02:05:27 +08:00
local remaincards = self._room . remaincards
if self._room . game_status == 1 then
2025-05-24 14:29:14 +08:00
-- body
coroutine.start ( function ( )
coroutine.wait ( 0.3 )
2025-05-27 02:05:27 +08:00
2026-02-04 15:07:37 +08:00
self.result_view = RunFast_ResultView.new ( self , self._room . player_list , self._room . room_id , 0 ,
2025-05-27 02:05:27 +08:00
win_seat , 0 , remaincards )
2026-02-04 15:07:37 +08:00
self.result_view : SetDestroryCallback ( function ( )
for i = 1 , # self._player_card_info do
local card_info = self._player_card_info [ i ]
card_info.ctr_outpoker . selectedIndex = 0
if card_info._ctr_resultOut then
card_info._ctr_resultOut . selectedIndex = 0
end
end
end )
2025-05-27 02:05:27 +08:00
self.result_view : Show ( )
local card_info = self._player_card_info [ 1 ]
card_info._view : GetChild ( " out_card_list " ) . visible = true
2025-05-24 14:29:14 +08:00
end )
2025-05-27 02:05:27 +08:00
if remaincards then
local newremaincards = self._gamectr : ChangeCodeByFrom ( remaincards , true )
2025-05-24 14:29:14 +08:00
-- body
local otherpoker_list = self._view : GetChild ( " otherpoker_list " )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
if otherpoker_list ~= nil then
-- body
otherpoker_list : RemoveChildrenToPool ( )
2025-05-27 02:05:27 +08:00
otherpoker_list.visible = true
2025-05-24 14:29:14 +08:00
end
for i = # newremaincards , 1 , - 1 do
coroutine.start ( function ( )
coroutine.wait ( 0.1 * ( 15 - i ) )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
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_RunFastNew " , " poker6 " )
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
--local code = self:ChangeCodeByTo(card_n)
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/" .. card_n)
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
local card_code_obj
2025-05-27 02:05:27 +08:00
if DataManager.CurrenRoom . pai == 0 then
card_code_obj = UIPackage.CreateObjectFromURL ( " ui://Extend_Poker_RunFastNew/ " .. card_n )
2025-05-24 14:29:14 +08:00
else
2025-05-27 02:05:27 +08:00
card_code_obj = UIPackage.CreateObjectFromURL ( " ui://Main_Poker/ " .. card_n .. " _2 " )
2025-05-24 14:29:14 +08:00
end
2026-02-04 15:07:37 +08:00
if card_n == 310 and DataManager.CurrenRoom . room_config.Heart10 == 2 then
2025-05-24 14:29:14 +08:00
-- body
2026-02-04 15:07:37 +08:00
card_code_obj = UIPackage.CreateObjectFromURL ( " ui://Extend_Poker_RunFastNew/ " .. card_n .. " _1 " )
end
2025-05-24 14:29:14 +08:00
card_code_obj : SetScale ( 0.6 , 0.6 )
poker_item : AddChild ( card_code_obj )
otherpoker_list : AddChild ( poker_item )
end )
end
2025-05-27 02:05:27 +08:00
end
2025-05-24 14:29:14 +08:00
end
end
function M : CreateRankEff ( )
self.rank_view = UIPackage.CreateObjectFromURL ( " ui://Extend_Poker_RunFastNew/rank_eff " )
self._view : AddChild ( self.rank_view )
self.rank_view : Center ( )
self.rank_view : GetTransition ( " t0 " ) : Play ( )
end
2025-05-27 02:05:27 +08:00
function M : _Effect ( type1 , player )
2026-02-04 15:07:37 +08:00
if type1 == 1 or type1 == 3 or type1 == 7 then
self._popEvent = true
2025-05-24 14:29:14 +08:00
return
end
local info = self._player_card_info [ self : GetPos ( player.seat ) ]
2026-02-04 15:07:37 +08:00
info : PlayEffect ( type1 , function ( )
self._popEvent = true
2025-05-24 14:29:14 +08:00
end )
end
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
-- function M:_Effect(type1, player)
2026-02-04 15:07:37 +08:00
-- -- body
-- if type1 < 7 and type1 ~= 4 and type1 ~= 5 then
-- return
-- end
-- local eff_code = 0
-- if type1 == 10 then
-- eff_code = 2
-- elseif type1 == 11 then
-- eff_code = 3
-- elseif type1 == 4 then
-- eff_code = 4
-- elseif type1 == 12 then
-- return
-- elseif type1 == 5 then
-- eff_code = 5
2025-05-27 02:05:27 +08:00
-- else
2026-02-04 15:07:37 +08:00
-- eff_code = 1
-- end
-- local info = self._player_card_info[self:GetPos(player.seat)]
-- local pNode = info._mask_liangpai
-- local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/eff_" .. eff_code)
-- -- local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/eff2_1")
-- effect.touchable = false
-- effect:GetTransition("t0"):Play()
-- -- effect:SetXY((self._view.width - effect.width) / 2,(self._view.hight - effect.hight) / 2)
-- if eff_code == 3 then
-- self._view:AddChild(effect)
-- else
-- pNode:AddChild(effect)
2025-05-27 02:05:27 +08:00
-- end
2026-02-04 15:07:37 +08:00
-- if eff_code == 1 then
-- self.eff_feiji = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/eff_feiji")
-- self._view:AddChild(self.eff_feiji)
-- self.eff_feiji:Center()
-- self.eff_feiji:GetTransition("t0"):Play()
-- end
-- if eff_code == 3 then
-- effect:Center()
-- else
-- if self:GetPos(player.seat) == 1 then
-- effect.x, effect.y = 0, 24
-- else
-- effect.x, effect.y = 24, 67
-- end
-- end
-- -- effect:Center()
-- -- if eff_code ==3 then
-- -- coroutine.start(function()
-- -- coroutine.wait(1)
-- -- effect:Dispose()
-- -- end)
-- -- else
2025-05-24 14:29:14 +08:00
-- coroutine.start(function()
2026-02-04 15:07:37 +08:00
-- coroutine.wait(1)
-- if self.eff_feiji ~= nil then
-- self.eff_feiji:Dispose()
-- end
2025-05-24 14:29:14 +08:00
-- effect:Dispose()
-- end)
2026-02-04 15:07:37 +08:00
-- -- end
2025-05-24 14:29:14 +08:00
-- end
2026-02-04 15:07:37 +08:00
function M : OnTupGuanOpen ( ... )
---- print("刷新托管数据=====")
local arg = { ... }
local p = arg [ 1 ]
local player_card_info = self._player_card_info [ self : GetPos ( p.seat ) ]
self._tex_leftTime = player_card_info._view_comp_clock
self._left_time = tonumber ( arg [ 3 ] ) or 0
end
2025-05-24 14:29:14 +08:00
function M : UpdateRound ( round )
local total_round = self._room . room_config.Times
2026-02-04 15:07:37 +08:00
-- self._text_round.text = string.format("%d / %d 局", round, total_round)
if not self._text_currenRound then
self._text_currenRound = self._view : GetChild ( ' Text_CurrenRound ' )
end
if not self._text_maxRound then
self._text_maxRound = self._view : GetChild ( ' Text_MaxMaxRound ' )
end
self._text_currenRound . text = round
self._text_maxRound . text = string.format ( " /%s局 " , total_round )
2025-05-24 14:29:14 +08:00
end
2026-02-04 15:07:37 +08:00
-- function M:InitPlayerInfoView()
-- self._player_info = {}
-- local _player_info = self._player_info
-- for i = 1, self._room.room_config.people_num do
-- local tem = self._view:GetChild(string.format("player_info%d_%d", i, (self._state.selectedIndex % 2) + 1))
-- _player_info[i] = PlayerInfoView.new(tem, self)
-- tem.visible = false
-- end
-- 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
2025-05-24 14:29:14 +08:00
function M : GetSoundFileName ( type , num , isNewBout )
local fileName
2026-02-04 15:07:37 +08:00
if type == 1 or type == 3 or type == 7 then
local num = self._cardCheck . lastMinCard
if type == 1 then
fileName = string.format ( " 1_%d " , num )
elseif type == 3 then
fileName = string.format ( " 2_%d " , num )
elseif type == 7 then
2025-05-24 14:29:14 +08:00
fileName = string.format ( " 3_%d " , num )
end
else
2026-02-04 15:07:37 +08:00
if not isNewBout and type ~= 6 then
2025-05-24 14:29:14 +08:00
local r = math.random ( 1 , 3 )
fileName = " dani_ " .. r
else
2026-02-04 15:07:37 +08:00
if type == 8 or type == 12 then
fileName = 5
else
fileName = type
end
2025-05-24 14:29:14 +08:00
end
end
2026-02-04 15:07:37 +08:00
2025-05-24 14:29:14 +08:00
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 : 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
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/" .. card)
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
local card_code_obj
2025-05-27 02:05:27 +08:00
if DataManager.CurrenRoom . pai == 0 then
card_code_obj = UIPackage.CreateObjectFromURL ( " ui://Extend_Poker_RunFastNew/ " .. card )
2025-05-24 14:29:14 +08:00
else
2025-05-27 02:05:27 +08:00
card_code_obj = UIPackage.CreateObjectFromURL ( " ui://Main_Poker/ " .. card .. " _2 " )
end
if card_code_obj then
card_code_obj : SetScale ( 1 , 1 )
poker_obj : AddChild ( card_code_obj )
card_code_obj.visible = true
2025-05-24 14:29:14 +08:00
end
2025-05-27 02:05:27 +08:00
2025-05-24 14:29:14 +08:00
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 )
coroutine.wait ( 1 )
self._popEvent = true
end )
end
function M : ResetPoker ( )
-- if self._room.curren_turn_seat == self._room.self_player.seat then
-- self._player_card_info[1]:ResetPoker()
-- end
self._player_card_info [ 1 ] : ResetPoker ( )
end
2026-02-04 15:07:37 +08:00
----结算准备时清理桌面
function M : ClearOk ( )
for i = 1 , # self._player_card_info do
self._player_card_info [ i ] : Clear ( )
end
end
2025-05-24 14:29:14 +08:00
function M : PlaySound ( sex , path )
2025-05-27 02:05:27 +08:00
local sex_path = ViewUtil.Sex_Chat [ sex ] -- 1 男 2 女
2025-05-24 14:29:14 +08:00
local sound_path = string.format ( " extend/poker/runfast/sound/%s/%s.mp3 " , sex_path , path )
ViewUtil.PlaySound ( " RunFastNew_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 ( " RunFastNew_PK " , string.format ( " extend/poker/runfast/sound/bgm%d.mp3 " , 1 ) )
end
2025-05-27 02:05:27 +08:00
function M : OnPlayerEnter ( ... )
2026-02-04 15:07:37 +08:00
ViewUtil.PlaySound ( " RunFastNew_PK " , " base/main_majiang/sound/user_enter.mp3 " )
2025-05-27 02:05:27 +08:00
local arg = { ... }
2025-05-24 14:29:14 +08:00
local p = arg [ 1 ]
2025-05-27 02:05:27 +08:00
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
2025-05-24 14:29:14 +08:00
-- 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 = " 您来晚了,座位有人,请重新进牌桌 "
2025-05-27 02:05:27 +08:00
btn1.visible = false
2025-05-24 14:29:14 +08:00
btn2 : Center ( )
2025-05-27 02:05:27 +08:00
btn2.y = btn2.y + 50
2025-05-24 14:29:14 +08:00
btn2.onClick : Set ( function ( )
2025-05-27 02:05:27 +08:00
-- body
ErrorMsgTip : Destroy ( )
ErrorMsgTip = nil
self._gamectr : LevelRoom ( function ( res )
2026-02-04 15:07:37 +08:00
ViewUtil.CloseModalWait2 ( )
2025-05-27 02:05:27 +08:00
NetResetConnectWindow.CloseNetReset ( )
ControllerManager.ChangeController ( LoddyController )
ViewManager.ChangeView ( ViewManager.View_Lobby )
end )
2025-05-24 14:29:14 +08:00
end )
end
end
-- if p ~= self._room.self_player and self._room.room_config.people_num <= 4 and self._room.room_config.people_num >= 3 and self._gamectr:CheckGPS() then
-- if self.distance_view then
-- self.distance_view:Destroy()
2025-05-27 02:05:27 +08:00
-- end
2025-05-24 14:29:14 +08:00
-- self.distance_view = PlayerDistanceView.new(true)
-- self.distance_view:Show()
-- end
-- local info = self._player_info[self:GetPos(p.seat)]
-- info:FillData(p)
-- info._view.visible = true
MainView.OnPlayerEnter ( self , ... )
end
function M : Destroy ( )
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 ) ]
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
end
2026-02-04 15:07:37 +08:00
GRoot.inst . onSizeChanged : Set ( function ( )
end )
2025-05-24 14:29:14 +08:00
PKMainView.Destroy ( self )
UIPackage.RemovePackage ( " extend/poker/runfast/ui/Extend_Poker_RunFastNew " )
end
return M