725 lines
26 KiB
Lua
725 lines
26 KiB
Lua
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')
|
|
local WitnessView = require("main.poker.PKWitnessView")
|
|
local RunFast_CardCheck = import(".CardCheck")
|
|
|
|
local M = {}
|
|
|
|
function M.new()
|
|
setmetatable(M, { __index = WitnessView })
|
|
local self = setmetatable({}, { __index = M })
|
|
self.class = "EXMJWitness"
|
|
self:init()
|
|
|
|
self._gamectr = ControllerManager.GetController(GameController)
|
|
return self
|
|
end
|
|
|
|
function M:InitView(url)
|
|
local _room = DataManager.CurrenRoom
|
|
self._full = true
|
|
UIPackage.AddPackage("extend/poker/runfast/ui/Extend_Poker_RunFastNew")
|
|
getmetatable(M).__index.InitView(self,
|
|
"ui://Extend_Poker_RunFastNew/RunFast_Main_New_" .. _room.room_config.people_num)
|
|
local user_id = DataManager.SelfUser.account_id
|
|
|
|
local json_data = Utils.LoadLocalFile(user_id .. _room.game_id .. "pai")
|
|
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
|
|
|
|
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
|
|
|
|
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.ctr_time = self._view:GetController("time")
|
|
self.ctr_card_eff = self._view:GetController("card_eff")
|
|
self._player_card_info = {}
|
|
|
|
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
|
|
|
|
if not _room.self_player.ready then
|
|
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
|
|
else
|
|
self._ctr_action.selectedIndex = 0
|
|
end
|
|
self._left_time = 0
|
|
self.bgm_index = 1
|
|
self._state.selectedIndex = 4
|
|
|
|
self._view:GetChild("btn_back_jiesan").onClick:Set(function()
|
|
if self.dismiss_room_cd_time > 0 then
|
|
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
|
else
|
|
local _gamectr = ControllerManager.GetController(GameController)
|
|
_gamectr:AskDismissRoom()
|
|
end
|
|
end)
|
|
|
|
self:ChangeBgmMusic()
|
|
self:EventInit()
|
|
UpdateBeat:Add(self.OnUpdate, self)
|
|
|
|
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(0)
|
|
|
|
--按钮功能全部未开放
|
|
self._view:GetChild('Btn_Spectator').onClick:Set(function()
|
|
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
|
end)
|
|
self._view:GetChild('Btn_Invite').onClick:Set(function()
|
|
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
|
end)
|
|
|
|
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()
|
|
else
|
|
self.result_view = nil
|
|
local _gamectr = ControllerManager.GetController(GameController)
|
|
_gamectr:ConformToNextGame()
|
|
end
|
|
end)
|
|
----------------------------------------------------
|
|
--闹钟倒计时报时
|
|
self._leftTime_xiangling = 5
|
|
self._leftTime_bianhong = true
|
|
|
|
-----------如果进入观战时,已经开始游戏,则渲染画面------------
|
|
if _room.curren_round > 0 then
|
|
self:UpdateRound(_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)]
|
|
if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then
|
|
-- body
|
|
|
|
if self._room.room_config.showlength == 1 then
|
|
-- body
|
|
head_info._view:GetController("shengyu").selectedIndex = 1
|
|
else
|
|
head_info._view:GetController("shengyu").selectedIndex = 0
|
|
end
|
|
|
|
-- body
|
|
head_info._view:GetChild("shengyu").text = p.hand_count
|
|
end
|
|
p:Clear()
|
|
head_info:MarkBank(p.seat == _room.banker_seat)
|
|
head_info:FillData(p)
|
|
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
|
card_info:Clear()
|
|
head_info:Ready(false)
|
|
end
|
|
end
|
|
-----------
|
|
local rightpanel = self._view:GetChild("right_panel")
|
|
if self._rightPanelView ~= nil then
|
|
self._rightPanelView:Destroy()
|
|
end
|
|
|
|
self._rightPanelView = RunFast_RightPanelView.new(self, rightpanel)
|
|
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
|
|
|
|
function M:EventInit()
|
|
local _gamectr = ControllerManager.GetController(GameController)
|
|
getmetatable(M).__index.EventInit(self)
|
|
local _player_info = self._player_info
|
|
local _player_card_info = self._player_card_info
|
|
local _room = self._room
|
|
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.EventXiPai, function(...)
|
|
printlog("lingmeng pkwitness EventXiPai")
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnMingCard, function(...)
|
|
printlog("lingmeng pkwitness OnMingCard")
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnInitCard, function(...)
|
|
local arg = { ... }
|
|
local round = arg[1]
|
|
local cardlist = arg[2]
|
|
|
|
if self.result_view ~= nil then
|
|
self.result_view:Destroy()
|
|
self.result_view = nil
|
|
end
|
|
|
|
self._player_card_info[1]:HidePiao()
|
|
|
|
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_card_eff.selectedIndex = 0
|
|
if self.rank_view ~= nil then
|
|
self.rank_view:Dispose()
|
|
self.rank_view = nil
|
|
end
|
|
self._ctr_inClear.selectedIndex = 0
|
|
self:UpdateRound(round)
|
|
-- ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/fapai.mp3")
|
|
local list = _room.player_list
|
|
for i = 1, #list do
|
|
local p = list[i]
|
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
|
if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then
|
|
-- body
|
|
|
|
if self._room.room_config.showlength == 1 then
|
|
-- body
|
|
head_info._view:GetController("shengyu").selectedIndex = 1
|
|
else
|
|
head_info._view:GetController("shengyu").selectedIndex = 0
|
|
end
|
|
|
|
-- body
|
|
head_info._view:GetChild("shengyu").text = p.hand_count
|
|
end
|
|
p:Clear()
|
|
head_info:MarkBank(p.seat == _room.banker_seat)
|
|
head_info:FillData(p)
|
|
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
|
card_info:Clear()
|
|
head_info:Ready(false)
|
|
end
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnIndexMove, function(...)
|
|
local arg = { ... }
|
|
local seat = arg[1]
|
|
local isNewBout = arg[2]
|
|
local index = self:GetPos(seat)
|
|
|
|
|
|
self.ctr_time.selectedIndex = index
|
|
-- 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
|
|
-- end
|
|
|
|
-- if index == 1 then
|
|
local card_info = self._player_card_info[index]
|
|
card_info:SetOutCardInfo(nil, false)
|
|
-- if self.MypokerList ~= nil then
|
|
-- -- body
|
|
-- card_info:Clear()
|
|
-- card_info:InitPoker(self.MypokerList, false)
|
|
-- self.MypokerList = nil
|
|
-- end
|
|
-- end
|
|
self._leftClock_continue = coroutine.start(function()
|
|
coroutine.wait(1)
|
|
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)
|
|
|
|
|
|
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)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnBombScore, function(...)
|
|
printlog("lingmeng pkwitness OnBombScore")
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnPlaySucc, function(...)
|
|
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/playcard_chup.mp3")
|
|
self._popEvent = false
|
|
local arg = { ... }
|
|
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]
|
|
local lastCardList = arg[7]
|
|
self.ctr_time.selectedIndex = 0
|
|
local index = self:GetPos(p.seat)
|
|
if index == 1 then
|
|
self.caozuo = 0
|
|
end
|
|
|
|
local head_info = self._player_info[index]
|
|
if head_info._view:GetChild("shengyu") ~= nil then
|
|
-- body
|
|
-- body
|
|
if card_number ~= nil then
|
|
-- body
|
|
head_info._view:GetChild("shengyu").text = card_number
|
|
end
|
|
end
|
|
head_info:SetBaoDan(card_number == 1)
|
|
local card_info = self._player_card_info[index]
|
|
card_info:SetOutCardInfo(p.out_card_list, false, true)
|
|
|
|
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
|
|
-- card_info:SetRemainCardNumber(card_number == 1)
|
|
--card_info:UpdateHandPoker(card_number,false,false) -- todo
|
|
end
|
|
|
|
-- 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)
|
|
|
|
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))
|
|
|
|
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)
|
|
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnPassSuccCheckCard, function(...)
|
|
self._popEvent = false
|
|
local arg = { ... }
|
|
local seat = arg[1]
|
|
local cards = arg[2]
|
|
--self.MypokerList=cards
|
|
self.ctr_time.selectedIndex = 0
|
|
local card_info = self._player_card_info[self:GetPos(seat)]
|
|
if seat == self._room.self_player.seat then
|
|
card_info:ClearCheck()
|
|
card_info:InitPoker(cards, false)
|
|
end
|
|
|
|
self._popEvent = true
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnPassSucc, function(...)
|
|
local arg = { ... }
|
|
local p = arg[1]
|
|
|
|
self.ctr_time.selectedIndex = 0
|
|
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
|
|
|
--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
|
|
coroutine.stop(self._leftClock_continue)
|
|
card_info._ctr_time_clock.selectedIndex = 0
|
|
card_info:SetOutCardInfo(nil, true)
|
|
self:PlaySound(p.self_user.sex, "pass_" .. math.random(1, 4))
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnErrorTip, function(...)
|
|
local arg = { ... }
|
|
local error_str = arg[1]
|
|
self._player_card_info[1]:ErrorTip(error_str)
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnPiaoTips, function(...)
|
|
printlog("lingmeng pkwitness OnPiaoTips")
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnPiaoAction, function(...)
|
|
printlog("lingmeng pkwitness OnPiaoAction")
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnOptions, function(...)
|
|
printlog("lingmeng pkwitness OnOptions")
|
|
end)
|
|
-- 托管
|
|
_gamectr:AddEventListener(RunFast_GameEvent.Game_TuoGuan, function(...)
|
|
printlog("lingmeng pkwitness Game_TuoGuan")
|
|
end)
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnResult, function(...)
|
|
local arg = { ... }
|
|
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")
|
|
local card_info = self._player_card_info[self:GetPos(self._room.self_player.seat)]
|
|
|
|
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()
|
|
otherpoker_list.visible = true
|
|
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
|
|
|
|
self.destory_win = nil
|
|
self.destory_win = coroutine.start(function()
|
|
if win_seat == self._room.self_player.seat then
|
|
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3")
|
|
else
|
|
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/lose_music.mp3")
|
|
end
|
|
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
|
|
|
|
for i = 1, #info do
|
|
local player = info[i]
|
|
local p = self._room:GetPlayerBySeat(player.seat)
|
|
local head_info = self._player_info[self:GetPos(player.seat)]
|
|
local card_info = self._player_card_info[self:GetPos(player.seat)]
|
|
|
|
if player.seat ~= self._room.self_player.seat then
|
|
local oneTime = 7 / 60
|
|
|
|
-- card_info:UpdateHandPoker(player.cards, false, true)
|
|
|
|
card_info._view_resultOut:RemoveChildrenToPool()
|
|
card_info._ctr_resultOut.selectedIndex = 1
|
|
card_info.ctr_outpoker.selectedIndex = 0
|
|
for i = 1, #player.handCards do
|
|
local child_card = card_info._view_resultOut:AddItemFromPool()
|
|
card_info:FillPoker(child_card, "", nil, player.handCards[i])
|
|
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/fanCard.mp3")
|
|
printlog("lingmeng oneTime", oneTime)
|
|
coroutine.wait(oneTime)
|
|
end
|
|
end
|
|
end
|
|
for i = 1, #info do
|
|
local player = info[i]
|
|
local p = self._room:GetPlayerBySeat(player.seat)
|
|
local head_info = self._player_info[self:GetPos(player.seat)]
|
|
head_info:SetBaoDan(false)
|
|
|
|
head_info._view:GetChild('text_jifen').text = player.score
|
|
-- head_info:PlayScore(player.winscore, win_seat == player.seat)
|
|
head_info:PlayScore(player.card_score, win_seat == player.seat)
|
|
end
|
|
self:ChangeBgmMusic(1)
|
|
coroutine.wait(2)
|
|
|
|
self.result_view = RunFast_ResultView.new(self, info, self._room.room_id, over, win_seat, 0,
|
|
remaincards)
|
|
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)
|
|
------------观战把准备按钮隐藏了-----------
|
|
self._ctr_inClear.selectedIndex = 0
|
|
self.result_view._view:GetChild('btn_nextRound').visible = false
|
|
------------------------
|
|
self.result_view:Show()
|
|
if self.WinItem_view ~= nil then
|
|
self.WinItem_view:Dispose()
|
|
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
|
|
local btn_confirm = self.result_view._view:GetChild("btn_confirm")
|
|
btn_confirm.onClick:Call()
|
|
end
|
|
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3")
|
|
end)
|
|
if over == 1 then
|
|
-- body
|
|
self:UnmarkSelfTuoguan()
|
|
ControllerManager.ChangeController(LoddyController)
|
|
end
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnResultByDissolve, function(...)
|
|
local arg = { ... }
|
|
local over = arg[1]
|
|
local info = arg[2]
|
|
local winseat = arg[3]
|
|
local dissolve = arg[4]
|
|
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3")
|
|
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)
|
|
self.result_view:Show()
|
|
ControllerManager.ChangeController(LoddyController)
|
|
self:UnmarkSelfTuoguan()
|
|
end)
|
|
|
|
-- 确定开始下一局 成功
|
|
_gamectr:AddEventListener(RunFast_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()
|
|
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
|
if otherpoker_list ~= nil then
|
|
-- body
|
|
otherpoker_list.visible = false
|
|
otherpoker_list:RemoveChildrenToPool()
|
|
end
|
|
--player_head._view:GetController("Oener").selectedIndex=0
|
|
end
|
|
end
|
|
local player_info = self._player_info[self:GetPos(p.seat)]
|
|
player_info:Ready(true)
|
|
end)
|
|
|
|
_gamectr:AddEventListener(RunFast_GameEvent.OnBompScoreNew, function(...)
|
|
local arg = { ... }
|
|
local scoreList = arg[1]
|
|
for i = 1, #scoreList do
|
|
local score = scoreList[i].pomSore
|
|
local player = self._room:GetPlayerBySeat(scoreList[i].seat)
|
|
local head_info = self._player_info[self:GetPos(scoreList[i].seat)]
|
|
head_info:PlayScore(score, true)
|
|
head_info:UpdateScore(player.total_score)
|
|
end
|
|
end)
|
|
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:GetPos(seat)
|
|
return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num)
|
|
end
|
|
|
|
function M:UpdateRound(round)
|
|
local total_round = self._room.room_config.Times
|
|
-- 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)
|
|
end
|
|
|
|
function M:_Effect(type1, player)
|
|
if type1 == 1 or type1 == 3 or type1 == 7 then
|
|
self._popEvent = true
|
|
return
|
|
end
|
|
local info = self._player_card_info[self:GetPos(player.seat)]
|
|
info:PlayEffect(type1, function()
|
|
self._popEvent = true
|
|
end)
|
|
end
|
|
|
|
function M:GetSoundFileName(type, num, isNewBout)
|
|
local fileName
|
|
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
|
|
fileName = string.format("3_%d", num)
|
|
end
|
|
else
|
|
if not isNewBout and type ~= 6 then
|
|
local r = math.random(1, 3)
|
|
fileName = "dani_" .. r
|
|
else
|
|
if type == 8 or type == 12 then
|
|
fileName = 5
|
|
else
|
|
fileName = type
|
|
end
|
|
end
|
|
end
|
|
|
|
return fileName
|
|
end
|
|
|
|
function M:PlaySound(sex, path)
|
|
local sex_path = ViewUtil.Sex_Chat[sex] -- 1 男 2 女
|
|
local sound_path = string.format("extend/poker/runfast/sound/%s/%s.mp3", sex_path, path)
|
|
ViewUtil.PlaySound("RunFastNew_PK", sound_path)
|
|
end
|
|
|
|
return M
|