yunque9/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua

1389 lines
49 KiB
Lua
Raw Normal View History

2025-05-25 11:35:02 +08:00
local SettingView = import('.main.ZPSettingView')
local PlayerSelfCardInfoView = import('.PlayerSelfCardInfoView')
local PlayerCardInfoView = import('.PlayerCardInfoView')
local ZPMainView = import('.main.ZPMainView')
local GameEvent = import('.FanPaoFa_GameEvent')
local FanPaoFa_ResultView = import('.FanPaoFa_ResultView')
2025-05-26 23:26:09 +08:00
local PlayerInfoView = import(".EXPlayerInfoView")
2025-05-25 11:35:02 +08:00
local M = {}
local Fix_Msg_Chat = {
'在搞么的,出牌撒',
'又掉线哒!',
'和你打牌太有味了',
'人呢?还搞不搞滴',
'哈哈,对不住了',
'稍等哈哈,马上就来',
'不要走,决战到天亮',
'牌打得不错嘛!',
'今朝这个方位硬是不好',
'不好意思临时有事,申请解散!'
}
--- Create a new ZZ_MainView
function M.new()
2025-06-20 14:55:27 +08:00
setmetatable(M, { __index = ZPMainView })
local self = setmetatable({}, { __index = M })
2025-05-25 11:35:02 +08:00
self.class = 'FanPaoFa_MainView'
self._full = true
self:init()
return self
end
function M:getCardItem(card_1, card_2)
if self._room.change_card_display ~= nil then
return card_1 .. self._room.change_card_display .. card_2
else
2025-06-05 13:39:22 +08:00
return card_1 .. '6_' .. card_2
2025-05-25 11:35:02 +08:00
end
end
2025-06-20 14:55:27 +08:00
2025-05-25 11:35:02 +08:00
function M:InitView(url)
local _room = self._room
self.Fix_Msg_Chat = Fix_Msg_Chat
2025-06-29 22:21:50 +08:00
self._flag_fanpaofa = true
2025-06-20 11:52:54 +08:00
2025-05-25 11:35:02 +08:00
ViewUtil.PlayMuisc('FanPaoFa_ZP', 'extend/zipai/fanpaofa/sound/bg.mp3')
UIPackage.AddPackage('extend/zipai/fanpaofa/ui/Extend_Poker_FanPaoFa')
local hx = 0
if _room.room_config.config.hunum == 2 then
hx = 6
end
if _room.room_config.config.hunum == 1 then
hx = 10
end
if _room.room_config.config.hunum == 0 then
hx = 15
end
ZPMainView.InitView(self, 'ui://Main_RunBeard/Main_' .. _room.room_config.people_num, false, false, 1.2, hx)
self:PlayerChangeLineState()
SettingView.onEXMainCallback = handler(self, self.UpdateCardDisplay)
SettingView.onUpdataCardSizeCallback = handler(self, self.UpdateCardSize)
for i = 1, #_room.player_list do
local p = _room.player_list[i]
local head = self._player_info[self:GetPos(p.seat)]
if head._tex_score then
head._tex_score.visible = true
end
head:UpdateScore()
end
if _room.playing or _room.curren_round > 0 then
self:ReloadRoom()
end
2025-06-20 14:55:27 +08:00
2025-05-25 11:35:02 +08:00
self._view:GetController('jushu').selectedIndex = 1
self:setBtn()
end
2025-05-26 23:26:09 +08:00
function M:InitPlayerInfoView()
2025-06-20 14:55:27 +08:00
self._player_info = {}
2025-05-26 23:26:09 +08:00
local _player_info = self._player_info
for i = 1, self._room.room_config.people_num do
local tem = self._view:GetChild("player_info" .. i)
2025-06-20 14:55:27 +08:00
_player_info[i] = PlayerInfoView.new(tem, self)
2025-05-26 23:26:09 +08:00
tem.visible = false
end
end
2025-05-25 11:35:02 +08:00
function M:setBtn()
local rightpanel = self._view:GetChild('right_panel')
local btn_rule = rightpanel:GetChild('btn_log')
local gcm_chat = self._view:GetChild('gcm_chat')
local _btn_chat = gcm_chat:GetChild('n1')
_btn_chat:GetChild('icon').icon = 'ui://Main_RunBeard/chat_img'
local btn_record = gcm_chat:GetChild('btn_record')
btn_record:GetChild('icon').icon = 'ui://Main_RunBeard/yuyin_img'
if btn_rule ~= nil then
btn_rule.onClick:Set(
function()
if self.RuleView == nil or self.RuleView._is_destroy then
self.RuleView = RoomInfoView.new(self._room)
end
self.RuleView:Show()
end
)
end
local btn_setting = self._view:GetChild('btn_setting')
btn_setting.onClick:Set(
function()
local _settingView = self:NewSettingView()
_settingView.stateIndex = (self._room.curren_round >= 1 and self._allow_dissmiss) and 2 or 1
_settingView.cd_time = self.dismiss_room_cd_time
_settingView:Show()
local room = DataManager.CurrenRoom
_settingView.onCallback:Add(
function(context)
local _gamectr = ControllerManager.GetController(GameController)
if (room.CurnrenState == StateType.Ready) then
_gamectr:LevelRoom(
function(response)
if (response.ReturnCode == 0) then
ViewManager.ChangeView(ViewManager.View_Lobby)
GameApplication.Instance:ShowTips('房间已解散!')
end
end
)
else
_gamectr:AskDismissRoom(
function(res)
ViewUtil.ErrorTip(res.ReturnCode, '')
end
)
end
end
)
end
)
local tex_roomid = rightpanel:GetChild('tex_roomid')
tex_roomid.text = self._room.room_id
if self._room.room_config.isHidden and self._room.room_config.isHidden == 1 then
tex_roomid.text = "000000"
end
end
function M:NewPlayerCardInfoView(view, index)
if index == 1 then
return PlayerSelfCardInfoView.new(view, self)
end
return PlayerCardInfoView.new(view, self)
end
2025-06-20 14:55:27 +08:00
2025-05-25 11:35:02 +08:00
function M:closeTipOnTuoguan()
if self._clearingView ~= nil then
self._clearingView:Close()
end
self:__CloseTip()
end
2025-06-20 14:55:27 +08:00
2025-05-25 11:35:02 +08:00
function M:EventInit()
MainView.EventInit(self)
local _room = self._room
local _view = self._view
local _player_info = self._player_info
local _gamectr = self._gamectr
2025-06-20 14:55:27 +08:00
_gamectr:AddEventListener(GameEvent.EventXiPai, function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-06-20 14:55:27 +08:00
local arg = { ... }
local currentPlayer1 = arg[1]
local currentPlayer2 = arg[2]
2025-06-12 21:08:17 +08:00
self._player_card_info[1]:HideDaNiao(0)
2025-06-20 14:55:27 +08:00
if (currentPlayer1) then
local xipaiCB = function()
end
self:PlayXiPai(xipaiCB)
end
if (currentPlayer2) then
local xipaiCB2 = function()
2025-06-29 22:21:50 +08:00
2025-06-20 14:55:27 +08:00
end
self:PlayXiPai1(xipaiCB2)
end
end)
_gamectr:AddEventListener(GameEvent.OnDaNiaoTips, function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local niao = arg[1]
2025-05-25 20:45:04 +08:00
local reload = arg[2]
2025-06-29 22:21:50 +08:00
2025-06-20 14:55:27 +08:00
if reload == 0 then
self._leftcard = 1
self._leftcard = 1
local rightpanel = self._view:GetChild('right_panel')
local tex_round = rightpanel:GetChild('tex_round')
if tex_round ~= nil then
tex_round.text = '' .. _room.curren_round .. ''
end
2025-06-27 03:16:36 +08:00
self._view:GetChild('tex_round').text = '' .. _room.curren_round .. ''
2025-06-20 14:55:27 +08:00
self._state.selectedIndex = 1
self:closeTipOnTuoguan()
local list = _room.player_list
for i = 1, #list do
local p = list[i]
p.hu_xi = 0
local _info = self._player_card_info[self:GetPos(p.seat)]
_info:SetPlayer(p)
local info = self._player_info[self:GetPos(p.seat)]
info:FillData(p)
info:MarkBank(p.seat == _room.banker_seat)
info:Ready(false)
--info:UpdatePiao(-1)
end
end
2025-05-25 11:35:02 +08:00
self._player_card_info[1]:ShwoDaNiao(niao)
end)
2025-05-25 20:45:04 +08:00
_gamectr:AddEventListener(GameEvent.OnEventDaNiao, function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 20:45:04 +08:00
local seat = arg[1]
local niao = arg[2]
2025-06-29 22:21:50 +08:00
2025-06-20 14:55:27 +08:00
if self.seat == seat then
2025-06-12 21:08:17 +08:00
self._player_card_info[seat]:HideDaNiao(niao)
end
2025-05-26 23:26:09 +08:00
local head_info = self._player_info[self:GetPos(seat)]
head_info:UpdateNiao(niao)
2025-05-25 20:45:04 +08:00
end)
2025-05-25 11:35:02 +08:00
_gamectr:AddEventListener(
GameEvent.SendCards,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-05-25 11:35:02 +08:00
self._leftcard = 1
self._leftcard = 1
local rightpanel = self._view:GetChild('right_panel')
local tex_round = rightpanel:GetChild('tex_round')
if tex_round ~= nil then
tex_round.text = '' .. _room.curren_round .. ''
end
2025-06-27 03:16:36 +08:00
self._view:GetChild('tex_round').text = '' .. _room.curren_round .. ''
2025-05-25 11:35:02 +08:00
self._state.selectedIndex = 1
self:closeTipOnTuoguan()
local list = _room.player_list
for i = 1, #list do
local p = list[i]
p.hu_xi = 0
local _info = self._player_card_info[self:GetPos(p.seat)]
_info:SetPlayer(p)
2025-06-20 14:55:27 +08:00
2025-05-25 11:35:02 +08:00
local info = self._player_info[self:GetPos(p.seat)]
2025-06-20 14:55:27 +08:00
2025-05-25 11:35:02 +08:00
info:FillData(p)
2025-06-12 21:08:17 +08:00
2025-05-25 11:35:02 +08:00
info:MarkBank(p.seat == _room.banker_seat)
info:Ready(false)
2025-06-19 14:10:26 +08:00
--info._view:GetController('huxi').selectedIndex = 1
2025-05-25 11:35:02 +08:00
info._view:GetChild('huxi').text = p.hu_xi
2025-06-05 13:39:22 +08:00
info._view:GetController('zhanji').selectedIndex = 1
2025-06-20 14:55:27 +08:00
info._view:GetChild('tex_jifen').text = p.total_score --d2ad(p.total_hp)
2025-06-05 13:39:22 +08:00
info._view:GetChild('tex_jifen_text').text = "总胡息"
--[[if _room.hpOnOff == 1 or _room:checkHpNonnegative() then
2025-05-25 11:35:02 +08:00
if p.total_hp == nil then
p.total_hp = 0
end
info._view:GetController('zhanji').selectedIndex = 1
info._view:GetChild('tex_jifen').text = d2ad(p.total_hp)
2025-05-26 23:26:09 +08:00
info._view:GetChild('tex_jifen_text').text = "总胡息"
2025-06-05 13:39:22 +08:00
end]]
2025-05-25 11:35:02 +08:00
end
local card_info = self._player_card_info[1]
card_info:UpdateIsOnClick(false)
card_info:InitHandCard(true)
2025-06-12 21:08:17 +08:00
card_info:HideDaNiao(0)
2025-05-25 11:35:02 +08:00
end
)
_gamectr:AddEventListener(
GameEvent.GetCard,
function(...)
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local seat = arg[1]
local card = arg[2]
local _leftcard = arg[3]
self._left_time = 15
self._tex_LeftCard.text = '剩余 ' .. _leftcard .. ' 张牌'
local info = self._player_card_info[self:GetPos(seat)]
2025-06-29 22:21:50 +08:00
print("lingmeng GetCard1")
2025-05-25 11:35:02 +08:00
info:UpdateOutCardList(card, true, true, self:GetPos(seat))
if card ~= 0 then
local p = _room:GetPlayerBySeat(seat)
2025-06-29 22:21:50 +08:00
print("lingmeng baopai")
-- self:PlaySound(p.self_user.sex, 'F_SaoChuan')
2025-05-25 11:35:02 +08:00
self:PlaySound(p.self_user.sex, 'F_' .. card)
2025-06-29 22:21:50 +08:00
print("lingmeng GetCard2", os.time())
coroutine.start(
function()
coroutine.wait(0.5)
print("lingmeng GetCard2-1", os.time())
self._popEvent = true
end
)
2025-05-25 11:35:02 +08:00
else
2025-06-29 22:21:50 +08:00
print("lingmeng GetCard3", os.time())
2025-05-25 11:35:02 +08:00
coroutine.start(
function()
coroutine.wait(0.5)
2025-06-29 22:21:50 +08:00
print("lingmeng GetCard3-1", os.time())
2025-05-25 11:35:02 +08:00
self._popEvent = true
info:ClearOutCard()
end
)
end
end
)
_gamectr:AddEventListener(
GameEvent.AddCard,
function(...)
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local seat = arg[1]
local card = arg[2]
2025-06-29 22:21:50 +08:00
2025-05-25 11:35:02 +08:00
local info = self._player_card_info[self:GetPos(seat)]
2025-06-29 22:21:50 +08:00
coroutine.start(
function()
coroutine.wait(0.2)
if info._area_outcard_list.numChildren > 0 then
local outCard = info._area_outcard_list:GetChildAt(0)
outCard:TweenMove(outCard:GlobalToLocal(info:GetFzMove()), 0.35)
outCard:TweenScale(Vector2.New(0, 0), 0.35)
end
end
)
2025-05-25 11:35:02 +08:00
coroutine.start(
function()
coroutine.wait(0.5)
if seat == self._room.self_player.seat then
info:InitHandCard(false)
end
info:ClearOutCard()
self._popEvent = true
end
)
end
)
_gamectr:AddEventListener(
GameEvent.EventTurn,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local seat = arg[1]
local list = _room.player_list
2025-06-29 22:21:50 +08:00
2025-05-25 11:35:02 +08:00
local readyNum = 0
for i = 1, #list do
local p = list[i]
local info = self._player_info[self:GetPos(p.seat)]
info._view:GetController('time').selectedIndex = 0
end
local info = self._player_info[self:GetPos(seat)]
info._view:GetController('time').selectedIndex = 1
end
)
_gamectr:AddEventListener(
GameEvent.OutHint,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-05-25 11:35:02 +08:00
_room.curren_outcard_seat = _room.self_player.seat
2025-06-20 11:52:54 +08:00
--printlog("jefe OutHint view>>>>",card)
2025-06-29 22:21:50 +08:00
2025-05-25 11:35:02 +08:00
coroutine.start(
function()
coroutine.wait(0.5)
local info = self._player_card_info[self:GetPos(_room.self_player.seat)]
info:ChuPaiTiShi()
end
)
end
)
_gamectr:AddEventListener(
GameEvent.FangWei,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local seat = arg[1]
local card = arg[2]
2025-06-29 22:21:50 +08:00
2025-05-25 11:35:02 +08:00
--self:__CloseTip()
_room.curren_outcard_seat = _room.self_player.seat
local _player_card_info = self._player_card_info
2025-06-20 11:52:54 +08:00
--printlog("jefe FangWei view>>>>")
2025-05-25 11:35:02 +08:00
local p = self._room:GetPlayerBySeat(seat)
local info = self._player_card_info[self:GetPos(seat)]
local fangwei_msg = MsgWindow.new(self._root_view, '放偎之后这局将不能再吃碰,是否确定', MsgWindow.MsgMode.OkAndCancel)
local removeOutcard = self._player_card_info[1]
fangwei_msg.onOk:Add(
2025-06-20 14:55:27 +08:00
function()
2025-05-25 11:35:02 +08:00
local _gamectr = ControllerManager.GetController(GameController)
if _gamectr then
_gamectr:SendFangPao(card)
2025-06-20 14:55:27 +08:00
end
2025-05-25 11:35:02 +08:00
end
)
fangwei_msg.onCancel:Add(
function(...)
--
self:__CloseTip()
2025-05-26 23:26:09 +08:00
--把牌弄回原位
2025-06-20 14:55:27 +08:00
-- info:ResetCards(card)
2025-05-25 11:35:02 +08:00
if seat == self._room.self_player.seat then
2025-06-20 14:55:27 +08:00
if seat == self._room.self_player.seat then
local buttonData = info.outcard_button
local context = {}
context.sender = buttonData.btn_card
context.sender.data = buttonData
context.sender.y = -300
context.sender.touchable = true
info:__OnDragEnd(context)
info:UpdateIsOnClick(true)
end
2025-05-25 11:35:02 +08:00
end
end
2025-06-20 14:55:27 +08:00
)
2025-05-25 11:35:02 +08:00
fangwei_msg:Show()
end
)
_gamectr:AddEventListener(
GameEvent.OutCard,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-05-25 11:35:02 +08:00
self:__CloseTip()
self._left_time = 0
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local p = arg[1]
local card = arg[2]
2025-06-29 22:21:50 +08:00
2025-05-25 11:35:02 +08:00
local seat = p.seat
local info = self._player_card_info[self:GetPos(seat)]
2025-06-20 14:55:27 +08:00
2025-05-25 11:35:02 +08:00
self:PlaySound(p.self_user.sex, 'F_' .. card)
if seat == self._room.self_player.seat then
_room.curren_outcard_seat = -1
info:DeleteHandCard(card)
info:UpdateIsOnClick(true)
info:SendChangeCard()
info:ChuPaiTiShi()
end
local list = _room.player_list
for i = 1, #list do
local p = list[i]
local info = self._player_info[self:GetPos(p.seat)]
info._view:GetController('time').selectedIndex = 0
2025-06-19 14:10:26 +08:00
self._player_info[self:GetPos(p.seat)]._view:GetController("huxi").selectedIndex = 1
2025-05-25 11:35:02 +08:00
end
2025-06-29 22:21:50 +08:00
self._view_showPalyerOutCardView = info._area_outcard_list
2025-05-25 11:35:02 +08:00
info:UpdateOutCardList(card, true, false, self:GetPos(seat))
if self._leftcard == 1 then
self._leftcard = 0
for i = 1, #_room.player_list do
local p = _room.player_list[i]
local card_info = self._player_card_info[self:GetPos(p.seat)]
card_info:UpdateFzList(p.fz_list, false, p.seat)
end
end
end
)
_gamectr:AddEventListener(
GameEvent.QiCard,
function(...)
self:__CloseTip()
2025-06-29 22:21:50 +08:00
2025-05-25 11:35:02 +08:00
self._left_time = 0
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local seat = arg[1]
local card = arg[2]
local p = _room:GetPlayerBySeat(seat)
local info = self._player_card_info[self:GetPos(seat)]
2025-06-29 22:21:50 +08:00
info:PlayingOutCardAnima(card, self:GetPos(seat))
coroutine.start(
function()
coroutine.wait(0.2)
self._popEvent = true
info:ClearOutCard()
p.DiceCard = 0
info:UpdateQiPai(p.outcard_list, false, seat)
end
)
2025-05-25 11:35:02 +08:00
end
)
_gamectr:AddEventListener(
GameEvent.FZTips,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local _tip = arg[1]
local _uid = arg[2]
local _fptype = arg[3]
2025-06-29 22:21:50 +08:00
2025-06-20 14:55:27 +08:00
self:__FangziTip(_tip, _uid, _fptype)
2025-05-25 11:35:02 +08:00
end
)
_gamectr:AddEventListener(GameEvent.FangziAction, handler(self, self.OnFangziAction))
_gamectr:AddEventListener(
GameEvent.ZPHuCard,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-05-25 11:35:02 +08:00
self._left_time = 0
self:__CloseTip()
2025-06-29 22:21:50 +08:00
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local w = arg[1]
local l = arg[2]
local cards = arg[3]
local info = self._player_card_info[self:GetPos(w)]
-- info:UpdateHandCard()
local url = 'ui://Extend_Poker_FanPaoFa/别人胡'
local pNode = info._mask_liangpai
local player = _room:GetPlayerBySeat(w)
if w == _room.self_player.seat then
url = 'ui://Extend_Poker_FanPaoFa/自己胡牌'
pNode = self._view
end
self:PlaySound(player.self_user.sex, 'F_Hu')
local he = UIPackage.CreateObjectFromURL(url)
he:GetTransition('t2'):Play()
if w == _room.self_player.seat then
he:Center()
end
pNode:AddChild(he)
coroutine.start(
function()
coroutine.wait(0.7)
he:Dispose()
end
)
end
)
_gamectr:AddEventListener(
GameEvent.ZPResult1,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-06-20 14:55:27 +08:00
--printlog("ZPResult111ssssssttteessssssttt")
2025-06-29 22:21:50 +08:00
2025-05-25 11:35:02 +08:00
self._left_time = 0
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local result = arg[1]
local liuju = result.liuju
local data = result.info_list
local x = {}
2025-06-20 11:52:54 +08:00
--printlog("ZPResult111sssssstttee")
2025-05-25 11:35:02 +08:00
self._hu_tip:FillData(x)
2025-06-20 11:52:54 +08:00
--printlog("ZPResult111ssss6666")
2025-05-25 11:35:02 +08:00
self:__CloseTip()
2025-06-20 11:52:54 +08:00
--printlog("ZPResult111")
2025-05-25 11:35:02 +08:00
if self._clearingView == nil then
2025-06-20 11:52:54 +08:00
--printlog("ZPResult11122222")
2025-05-25 11:35:02 +08:00
if liuju == true then
self._clearingView = FanPaoFa_ResultView.new(self._view, 1)
else
self._clearingView = FanPaoFa_ResultView.new(self._view)
end
end
coroutine.start(
function()
coroutine.wait(0.5)
-- if self._clearingView._is_destroy then return end
2025-06-20 14:55:27 +08:00
--printlog("ZPResult111qqqqqq")
2025-05-25 11:35:02 +08:00
self._clearingView:Show()
if _room.curren_round ~= _room.room_config.round then
for i = 1, #data do
local p = _room:GetPlayerBySeat(data[i].seat)
local card_info = self._player_card_info[self:GetPos(p.seat)]
local info = self._player_info[self:GetPos(p.seat)]
p.total_score = data[i].total_score
2025-06-20 14:55:27 +08:00
2025-06-05 13:39:22 +08:00
info._view:GetController('zhanji').selectedIndex = 1
2025-06-20 14:55:27 +08:00
info._view:GetChild('tex_jifen').text = p.total_score
2025-06-05 13:39:22 +08:00
info._view:GetChild('tex_jifen_text').text = "总胡息"
2025-05-25 11:35:02 +08:00
card_info:Clear()
info:UpdateScore()
end
2025-06-20 11:52:54 +08:00
--printlog("ZPResult111sdddddd")
2025-05-25 11:35:02 +08:00
local list = _room.player_list
for i = 1, #list do
local p = list[i]
local info = self._player_info[self:GetPos(p.seat)]
info._view:GetController('time').selectedIndex = 0
end
for i = 1, #_room.player_list do
_room.self_player.handcard_list = {}
_room.player_list[i].DiceCard = nil
_room.player_list[i].hand_left_count = 20
_room.player_list[i].fz_list = {}
_room.player_list[i].card_list = {}
_room.player_list[i].outcard_list = {}
_room.player_list[i].hu_xi = 0
end
end
end
)
if _room.curren_round ~= _room.room_config.round then
self._clearingView:InitData(
0,
_room,
result,
nil,
function(...)
self._state.selectedIndex = 2
self._clearingView = nil
end
)
end
end
)
_gamectr:AddEventListener(
GameEvent.ZPResult2,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-05-25 11:35:02 +08:00
self._left_time = 0
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local total_result = arg[2]
local result = arg[1]
local over = arg[3]
2025-06-29 22:21:50 +08:00
2025-06-05 13:39:22 +08:00
local data = result.info_list
2025-05-25 11:35:02 +08:00
local x = {}
self._hu_tip:FillData(x)
self:__CloseTip()
self:UnmarkSelfTuoguan()
self._clearingView = FanPaoFa_ResultView.new()
coroutine.start(
function()
coroutine.wait(0.5)
self._clearingView:Show()
end
)
self._clearingView:InitData(over, _room, result, total_result)
ControllerManager.ChangeController(LoddyController)
end
)
2025-05-26 23:26:09 +08:00
2025-06-20 14:55:27 +08:00
_gamectr:AddEventListener(
2025-05-26 23:26:09 +08:00
GameEvent.FangPaoOk,
function(...)
2025-06-29 22:21:50 +08:00
self._popEvent = true
2025-05-26 23:26:09 +08:00
self._left_time = 0
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-26 23:26:09 +08:00
local seat = arg[1]
local card = arg[2]
2025-06-29 22:21:50 +08:00
2025-05-26 23:26:09 +08:00
--禁牌 把手上的牌都禁掉
2025-06-20 14:55:27 +08:00
-- local card_info = self._player_card_info[self:GetPos(seat)]
-- card_info:banHandCards(self._room.self_player.card_list)
2025-05-26 23:26:09 +08:00
end
)
2025-05-25 11:35:02 +08:00
end
function M:OutCard(card_item)
local _gamectr = ControllerManager.GetController(GameController)
self._room.curren_outcard_seat = -1
_gamectr:SendOutCard(card_item)
end
--改变牌队形
function M:ChangeCards(list)
local _gamectr = ControllerManager.GetController(GameController)
if _gamectr then
2025-06-20 14:55:27 +08:00
_gamectr:SendChangeCards(list)
end
2025-05-25 11:35:02 +08:00
end
2025-06-20 14:55:27 +08:00
function M:__FangziTip(tip, _uid, fptype)
2025-05-25 11:35:02 +08:00
local _gamectr = self._gamectr
local _chipeng_tip = UIPackage.CreateObject('Main_RunBeard', 'Gcm_action_tips')
self._chipeng_tip = _chipeng_tip
local p = self._room.self_player
2025-06-20 11:52:54 +08:00
--printlog("jefe __FangziTip>>>>",_uid)
2025-05-25 11:35:02 +08:00
local _lit_fanzi = _chipeng_tip:GetChild('lit_fanzi')
_lit_fanzi:RemoveChildrenToPool()
local _tlist = table.keys(tip.tip_map_type)
local tip_hu = false
2025-06-03 21:34:18 +08:00
local tip_fanpao = false
local tip_id = 0;
2025-05-25 11:35:02 +08:00
local count = #_tlist
2025-06-05 20:43:57 +08:00
local zdhu = false
local fpao = true
2025-05-25 11:35:02 +08:00
for k = 1, #_tlist do
local td = tip.tip_map_type[_tlist[k]][1]
if td.type == 8 then
tip_hu = true
2025-06-03 21:34:18 +08:00
tip_id = td.id
2025-06-05 13:39:22 +08:00
--自动放炮
2025-06-20 14:55:27 +08:00
if td.weight == 7 then
2025-06-05 20:43:57 +08:00
zdhu = true
2025-06-20 14:55:27 +08:00
end
2025-06-05 20:43:57 +08:00
end
2025-06-05 13:39:22 +08:00
2025-06-05 20:43:57 +08:00
if td.type == 6 and td.weight == 8 then
fpao = false
2025-05-25 11:35:02 +08:00
end
2025-06-05 20:43:57 +08:00
end
if fpao and zdhu then
_gamectr:SendAction(tip_id)
_chipeng_tip:Dispose()
self._chipeng_tip = nil
return
2025-05-25 11:35:02 +08:00
end
2025-06-03 21:34:18 +08:00
for k = 1, #_tlist do
local td = tip.tip_map_type[_tlist[k]][1]
local url = 'ui://Main_RunBeard/Btn_fztip'
local btn_t = _lit_fanzi:AddItemFromPool(url)
btn_t.icon = 'ui://Main_RunBeard/newop_' .. td.type
2025-06-20 14:55:27 +08:00
btn_t.data = { tip, td, tip_hu }
2025-06-03 21:34:18 +08:00
btn_t.onClick:Set(self.__TipAction, self)
end
2025-05-25 11:35:02 +08:00
if p.hand_left_count ~= 0 then
local _btn_pass = _lit_fanzi:AddItemFromPool('ui://Main_RunBeard/Btn_pass_new')
_btn_pass.onClick:Set(
function()
if tip_hu then
local guo_msg = MsgWindow.new(self._root_view, '确定取消胡吗?', MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(
function()
_gamectr:SendAction(_uid)
_chipeng_tip:Dispose()
self._chipeng_tip = nil
guo_msg:Close()
end
)
guo_msg:Show()
else
_gamectr:SendAction(_uid)
_chipeng_tip:Dispose()
self._chipeng_tip = nil
end
end
)
end
--禁止放跑
2025-06-20 14:55:27 +08:00
if fptype == 1 and tip_hu == false then
2025-05-25 11:35:02 +08:00
_gamectr:SendAction(_uid)
_chipeng_tip:Dispose()
self._chipeng_tip = nil
else
self._view:AddChild(_chipeng_tip)
_chipeng_tip:Center()
_chipeng_tip.x = _chipeng_tip.x + 200
_chipeng_tip.y = _chipeng_tip.y - 50
end
end
2025-06-20 14:55:27 +08:00
2025-05-25 11:35:02 +08:00
function M:__TipAction(context)
local data = context.sender.data
local _gamectr = self._gamectr
local tip = data[1]
local td = data[2]
local tip_hu = data[3]
local list = tip.tip_map_type[td.weight]
2025-05-25 11:35:02 +08:00
if (#list > 1) or td.type == 1 then
2025-06-06 01:08:50 +08:00
local chiflag = true
for key, value in pairs(list) do
2025-06-20 14:55:27 +08:00
if value['bi_list'] ~= nil then
2025-06-06 01:08:50 +08:00
chiflag = false
end
end
2025-06-20 14:55:27 +08:00
if #list > 1 then
2025-06-06 01:08:50 +08:00
chiflag = false
end
if tip_hu == false and chiflag then
2025-05-29 15:23:52 +08:00
_gamectr:SendAction(list[1]["id"])
self:__CloseTip()
local info = self._player_card_info[1]
info:UpdateIsOnClick(false)
return
end
2025-06-06 01:08:50 +08:00
2025-05-25 11:35:02 +08:00
self:_ChiView(
list,
tip_hu,
function(id)
if tip_hu and td.type ~= 8 then
local guo_msg = MsgWindow.new(self._root_view, '确定取消胡吗?', MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(
function()
_gamectr:SendAction(id)
guo_msg:Close()
self:__CloseTip()
local info = self._player_card_info[1]
info:UpdateIsOnClick(false)
end
)
guo_msg:Show()
else
_gamectr:SendAction(id)
self:__CloseTip()
local info = self._player_card_info[1]
info:UpdateIsOnClick(false)
end
end
)
2025-06-24 22:13:50 +08:00
2025-06-20 14:55:27 +08:00
-- self._chipeng_tip.visible = false
2025-05-25 11:35:02 +08:00
return
end
if tip_hu and td.type ~= 8 then
local guo_msg = MsgWindow.new(self._root_view, '确定取消胡吗?', MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(
function()
_gamectr:SendAction(td.id)
guo_msg:Close()
local info = self._player_card_info[1]
info:UpdateIsOnClick(false)
if (self._chipeng_tip == nil) then
return
end
self._chipeng_tip:Dispose()
self._chipeng_tip = nil
end
)
guo_msg:Show()
else
_gamectr:SendAction(td.id)
local info = self._player_card_info[1]
info:UpdateIsOnClick(false)
if (self._chipeng_tip == nil) then
return
end
self._chipeng_tip:Dispose()
self._chipeng_tip = nil
end
end
function M:_ChiView(tip_list, tip_hu, callback)
local _pop_tip_choice = UIPackage.CreateObject('Main_RunBeard', 'Pop_tip_choice')
local list_choose = _pop_tip_choice:GetChild('Lst_choose')
_pop_tip_choice:GetChild('dibtn').onClick:Add(
function()
_pop_tip_choice:Dispose()
end
)
list_choose:RemoveChildrenToPool()
for i = 1, #tip_list do
if tip_list[i].weight ~= 4 then
local item_choose = list_choose:AddItemFromPool()
item_choose:GetChild('card' .. 2).icon =
UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', tip_list[i].OpCard[1]))
item_choose:GetChild('card' .. 3).icon =
UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', tip_list[i].OpCard[2]))
item_choose:GetChild('card' .. 1).icon =
UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', tip_list[i].card))
item_choose.onClick:Add(
function()
for k = 1, list_choose.numChildren do
list_choose:GetChildAt(k - 1):GetController('zhong').selectedIndex = 0
end
item_choose:GetController('zhong').selectedIndex = 1
if tip_list[i].bi_list == nil then
callback(tip_list[i].id)
else
self.bilist = {}
self._chiid = tip_list[i].id
self:CheckRatioCard(tip_list[i].bi_list, 1, tip_list[i].card)
end
end
)
end
end
list_choose:ResizeToFit(#tip_list)
_pop_tip_choice:GetChild('di1').width = list_choose.width + 110
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2, -100)
self._view:AddChild(_pop_tip_choice)
self._pop_tip_choice = _pop_tip_choice
end
function M:CheckRatioCard(_tiplist, index, chicard, _biid, list)
if _biid ~= nil then
self.bilist = {}
self.bilist[#self.bilist + 1] = _biid
end
if self._pop_tip_choice == nil then
-- statements
return
end
self._pop_tip_choice:GetController('bipai').selectedIndex = index
local Bilist_choose = self._pop_tip_choice:GetChild('Bi_Lst_choose' .. index)
Bilist_choose:RemoveChildrenToPool()
for i = 1, #_tiplist do
local item = UIPackage.CreateObjectFromURL('ui://Main_RunBeard/Comp_choose')
local item_choose = Bilist_choose:AddChild(item)
item_choose:GetChild('card' .. 2).icon =
UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', _tiplist[i].opcard[1]))
item_choose:GetChild('card' .. 3).icon =
UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', _tiplist[i].opcard[2]))
item_choose:GetChild('card' .. 1).icon =
UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', chicard))
item_choose:GetController('zhong').selectedIndex = 0
item_choose.onClick:Add(
function()
for k = 1, Bilist_choose.numChildren do
Bilist_choose:GetChildAt(k - 1):GetController('zhong').selectedIndex = 0
end
item_choose:GetController('zhong').selectedIndex = 1
if _tiplist[i].bi_list == nil then
if index == 1 then
self.bilist = {}
end
self.bilist[#self.bilist + 1] = i - 1
if tip_hu then
local guo_msg = MsgWindow.new(self._root_view, '确定取消胡吗?', MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(
function()
self._gamectr:SendAction(self._chiid, self.bilist)
guo_msg:Close()
self:__CloseTip()
local info = self._player_card_info[1]
info:UpdateIsOnClick(false)
end
)
guo_msg:Show()
else
self._gamectr:SendAction(self._chiid, self.bilist)
self:__CloseTip()
local info = self._player_card_info[1]
info:UpdateIsOnClick(false)
end
else
self:CheckRatioCard(_tiplist[i].bi_list, 2, chicard, i - 1, #_tiplist)
end
end
)
end
Bilist_choose:ResizeToFit(#_tiplist)
self._pop_tip_choice:GetChild('di' .. index + 1).width = Bilist_choose.width + 110
end
-- lua table 深拷贝
function M:deepcopy(object)
local lookup_table = {}
local function _copy(object)
if type(object) ~= 'table' then
return object
elseif lookup_table[object] then
return lookup_table[object]
end
local new_table = {}
lookup_table[object] = new_table
for index, value in pairs(object) do
new_table[_copy(index)] = _copy(value)
end
return setmetatable(new_table, getmetatable(object))
end
return _copy(object)
end
function M:OnFangziAction(...)
2025-06-20 14:55:27 +08:00
local arg = { ... }
2025-05-25 11:35:02 +08:00
local _player_card_info = self._player_card_info
2025-05-25 11:35:02 +08:00
local fz = arg[1]
local player = arg[2]
local num = arg[3]
2025-06-29 22:21:50 +08:00
local flag_pengPao = arg[4]
2025-05-25 11:35:02 +08:00
if fz.type == RB_FZType.Peng or fz.type == RB_FZType.Chi or fz.type == RB_FZType.Bi then
self:__CloseTip()
end
if (player == self._room.self_player) then
local info = _player_card_info[self:GetPos(player.seat)]
info:UpdateIsOnClick(false)
end
local info = _player_card_info[self:GetPos(player.seat)]
2025-06-29 22:21:50 +08:00
-- if fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei then
-- coroutine.start(
-- function()
-- coroutine.wait(1.2)
-- info:UpdateFzList(player.fz_list, true, player.seat)
-- end)
-- else
-- info:UpdateFzList(player.fz_list, true, player.seat) --更新放子数组
-- end
2025-06-26 02:19:44 +08:00
2025-05-25 11:35:02 +08:00
if (player == self._room.self_player) then
if fz.type == RB_FZType.Chi then
for i = 1, #fz.opcard do
info:DeleteHandCard(fz.opcard[i])
end
elseif fz.type == RB_FZType.Bi then
for i = 1, #fz.opcard do
info:DeleteHandCard(fz.opcard[i])
end
info:DeleteHandCard(fz.card)
elseif fz.type == RB_FZType.Peng then
for i = 1, #fz.opcard do
info:DeleteHandCard(fz.opcard[i])
end
elseif fz.type == RB_FZType.Kan then
if #fz.opcard == 2 then
info:InitHandCard(false)
end
info:UpdateKan(fz.card)
elseif fz.type == RB_FZType.Wei then
2025-06-26 02:19:44 +08:00
--显示wei 的牌
coroutine.start(
function()
2025-06-27 03:16:36 +08:00
coroutine.wait(1.2)
for i = 1, #fz.opcard do
info:DeleteHandCard(fz.opcard[i])
end
end)
2025-05-25 11:35:02 +08:00
elseif fz.type == RB_FZType.ChouWei then
--[[ for i = 1, #fz.opcard do
2025-05-25 11:35:02 +08:00
info:DeleteHandCard(fz.opcard[i])
2025-06-26 02:19:44 +08:00
end]]
coroutine.start(
function()
2025-06-27 03:16:36 +08:00
coroutine.wait(1.2)
for i = 1, #fz.opcard do
info:DeleteHandCard(fz.opcard[i])
end
end)
2025-05-25 11:35:02 +08:00
elseif fz.type == RB_FZType.Pao then
if num > 0 then
for i = 1, #fz.opcard do
info:DeleteHandCard(fz.opcard[i])
end
end
elseif fz.type == RB_FZType.Ti then
if num > 0 then
for i = 1, #fz.opcard do
info:DeleteHandCard(fz.opcard[i])
end
end
end
coroutine.start(
function()
2025-06-26 02:19:44 +08:00
coroutine.wait(0.3)
2025-05-25 11:35:02 +08:00
if fz.type ~= RB_FZType.Kan then
info:SendChangeCard()
2025-05-25 11:35:02 +08:00
end
end
)
end
2025-06-20 14:55:27 +08:00
-- if false then
if fz.type ~= RB_FZType.Kan and fz.type ~= RB_FZType.Bi then
2025-06-20 11:52:54 +08:00
--printlog("jefe self RB_FZType 2=======")
2025-05-25 11:35:02 +08:00
local info = _player_card_info[self:GetPos(player.seat)]
local pNode = info._mask_liangpai
2025-06-26 02:19:44 +08:00
local effect = UIPackage.CreateObject('Main_RunBeard', 'FzEffect')
2025-05-25 11:35:02 +08:00
if fz.type == RB_FZType.Peng then
-- effect:GetChild("icon2").icon = UIPackage.GetItemURL("Main_RunBeard", "peng")
self:PlaySound(player.self_user.sex, 'F_Peng')
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'peng')
elseif fz.type == RB_FZType.Chi then
-- effect:GetChild("icon2").icon = UIPackage.GetItemURL("Main_RunBeard", "chi")
2025-06-20 11:52:54 +08:00
--printlog("jefe self RB_FZType 3=======")
2025-05-25 11:35:02 +08:00
self:PlaySound(player.self_user.sex, 'F_Chi')
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'chi')
2025-06-20 11:52:54 +08:00
--printlog("jefe self RB_FZType 4=======")
2025-05-25 11:35:02 +08:00
elseif fz.type == RB_FZType.Wei then
-- effect:GetChild("icon2").icon = UIPackage.GetItemURL("Main_RunBeard", "wei")
2025-06-29 22:21:50 +08:00
-- self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
2025-06-29 22:21:50 +08:00
-- info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
2025-06-29 22:21:50 +08:00
-- coroutine.start(
-- function()
-- coroutine.wait(1.0)
-- info:PlayingOutCardAnima()
self:PlaySound(player.self_user.sex, 'F_GuoSao')
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'wei')
effect.touchable = false
effect.x, effect.y = -250, -200
effect:GetTransition('t0'):Play()
pNode:AddChild(effect)
-- end)
2025-06-26 02:19:44 +08:00
coroutine.start(
function()
2025-06-29 22:21:50 +08:00
coroutine.wait(0.7)
2025-06-26 02:19:44 +08:00
effect:Dispose()
end
)
2025-05-25 11:35:02 +08:00
elseif fz.type == RB_FZType.ChouWei then
2025-06-29 22:21:50 +08:00
-- self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
-- info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
-- coroutine.start(
-- function()
-- coroutine.wait(1.2)
-- info:PlayingOutCardAnima()
self:PlaySound(player.self_user.sex, 'F_GuoSao')
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'wei')
effect.touchable = false
effect.x, effect.y = -250, -200
effect:GetTransition('t0'):Play()
pNode:AddChild(effect)
-- end)
2025-06-26 02:19:44 +08:00
coroutine.start(
function()
2025-06-29 22:21:50 +08:00
coroutine.wait(0.7)
2025-06-26 02:19:44 +08:00
effect:Dispose()
end
)
2025-05-25 11:35:02 +08:00
elseif fz.type == RB_FZType.Pao then
-- effect:GetChild("icon2").icon = UIPackage.GetItemURL("Main_RunBeard", "pao")
self:PlaySound(player.self_user.sex, 'F_KaiDuo')
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'pao')
elseif fz.type == RB_FZType.Ti then
2025-06-29 22:21:50 +08:00
-- self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
-- info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
2025-05-25 11:35:02 +08:00
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'ti')
2025-06-26 02:19:44 +08:00
effect.touchable = false
effect.x, effect.y = -250, -200
effect:GetTransition('t0'):Play()
pNode:AddChild(effect)
2025-06-29 22:21:50 +08:00
-- coroutine.start(
-- function()
-- coroutine.wait(1.2)
print("lingmeng tiqi")
self:PlaySound(player.self_user.sex, 'F_SaoChuan')
-- info:PlayingOutCardAnima()
-- end)
2025-06-26 02:19:44 +08:00
coroutine.start(
function()
2025-06-29 22:06:20 +08:00
coroutine.wait(2)
2025-06-26 02:19:44 +08:00
effect:Dispose()
end
)
2025-06-20 14:55:27 +08:00
-- effect:GetChild("icon2").icon = UIPackage.GetItemURL("Main_RunBeard", "ti")
2025-05-25 11:35:02 +08:00
end
if fz.type ~= RB_FZType.Wei and fz.type ~= RB_FZType.ChouWei then
2025-06-26 02:19:44 +08:00
effect.touchable = false
effect.x, effect.y = -250, -200
effect:GetTransition('t0'):Play()
pNode:AddChild(effect)
coroutine.start(
function()
coroutine.wait(0.4)
effect:Dispose()
end
)
end
2025-05-25 11:35:02 +08:00
end
if (player == self._room.self_player) then
coroutine.start(
function()
coroutine.wait(0.5)
local info = _player_card_info[self:GetPos(player.seat)]
info:ShowHuTip()
end
)
end
2025-06-26 02:19:44 +08:00
2025-06-29 22:21:50 +08:00
if fz.type ~= RB_FZType.Kan then
local time = 0.01
if fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei then
time = 0.3
2025-06-26 02:19:44 +08:00
end
2025-06-29 22:21:50 +08:00
local removeOutcard = _player_card_info[self:GetPos(fz.from_seat)]
coroutine.start(
function()
coroutine.wait(time)
local p = self._room:GetPlayerBySeat(fz.from_seat)
if p.DiceCard ~= nil and fz.active_card == p.DiceCard then
local outCard
if removeOutcard._area_outcard_list.numChildren == 0 then
for i = 1, self._room.maxPlayers do
if _player_card_info[i]._area_outcard_list.numChildren > 0 then
outCard = _player_card_info[i]._area_outcard_list:GetChildAt(0)
end
end
else
outCard = removeOutcard._area_outcard_list:GetChildAt(0)
end
if flag_pengPao then
outCard:TweenMove(outCard:GlobalToLocal(info:GetFzMove()) - Vector2.New(outCard.width, 0), 0.25)
outCard:TweenScale(Vector2.New(0, 0), 0.25)
else
outCard:TweenMove(outCard:GlobalToLocal(info:GetFzMove()) - Vector2.New(outCard.width, 0), 0.25)
outCard:TweenScale(Vector2.New(0, 0), 0.25)
end
p.DiceCard = nil
end
end
)
coroutine.start(
function()
coroutine.wait(0.2 + time)
removeOutcard:ClearOutCard()
info:UpdateFzList(player.fz_list, true, player.seat, flag_pengPao) --更新放子数组
end
)
2025-05-25 11:35:02 +08:00
end
2025-06-26 02:19:44 +08:00
2025-05-25 11:35:02 +08:00
local list = self._room.player_list
for i = 1, #list do
local p = list[i]
local info = self._player_info[self:GetPos(p.seat)]
info._view:GetChild('huxi').text = p.hu_xi
end
2025-06-26 02:19:44 +08:00
2025-06-29 22:21:50 +08:00
local time = 0.01
if fz.type ~= RB_FZType.Kan then
time = flag_pengPao and 0.3 or 0.7
if fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei then
time = time + 0.3
end
end
2025-05-25 11:35:02 +08:00
coroutine.start(
function()
2025-06-29 22:21:50 +08:00
print("lingmeng OnFangziAction", time, os.time())
coroutine.wait(time)
self._popEvent = true
2025-05-25 11:35:02 +08:00
local info = _player_card_info[1]
info:UpdateIsOnClick(true)
end
)
2025-06-20 11:52:54 +08:00
--printlog("seft rbtpe4")
2025-05-25 11:35:02 +08:00
end
function M:ReloadRoom()
local _gamectr = self._gamectr
local room = self._room
if not room.playing then
self._state.selectedIndex = 2
else
self._state.selectedIndex = 1
end
if room.discard == 0 then
self._leftcard = 1
else
self._leftcard = 0
end
for i = 1, #room.player_list do
local p = room.player_list[i]
if p.seat == room.banker_seat then
local head = self._player_info[self:GetPos(p.seat)]
head:MarkBank(true)
end
if p.ready then
self._player_info[self:GetPos(p.seat)]:Ready(true)
else
self._player_info[self:GetPos(p.seat)]:Ready(false)
end
if self._state.selectedIndex == 1 then
local info = self._player_info[self:GetPos(p.seat)]
info._view:GetController('huxi').selectedIndex = 1
info._view:GetChild('huxi').text = p.hu_xi
2025-06-20 14:55:27 +08:00
info._view:GetController('zhanji').selectedIndex = 1
info._view:GetChild('tex_jifen').text = p.total_score -- d2ad(p.total_hp)
info._view:GetChild('tex_jifen_text').text = "总胡息"
2025-05-25 11:35:02 +08:00
end
local card_info = self._player_card_info[self:GetPos(p.seat)]
card_info:UpdateQiPai(p.outcard_list)
card_info:UpdateFzList(p.fz_list, false, p.seat)
if p.DiceCard ~= nil and p.DiceCard ~= 0 then
card_info:UpdateOutCardList(p.DiceCard)
end
if DataManager.CurrenRoom.curren_outcard_seat == p.seat then
local info = self._player_info[self:GetPos(p.seat)]
info._view:GetController('time').selectedIndex = 1
end
if p.seat == self._room.self_player.seat then
card_info:ChuPaiTiShi()
if
self._room.self_player.card_list ~= nil and
2025-06-20 14:55:27 +08:00
#self._room.self_player.handcard_list == #self._room.self_player.card_list
then
2025-05-25 11:35:02 +08:00
local _list = self:deepcopy(self._room.self_player.card_list)
local cards = {}
for i = 1, #_list do
cards[#cards + 1] = _list[i].card_item
end
table.sort(cards, ViewUtil.HandCardSort)
table.sort(self._room.self_player.handcard_list, ViewUtil.HandCardSort)
local isNot = false
for i = 1, #cards do
if cards[i] ~= self._room.self_player.handcard_list[i] then
isNot = true
end
end
if isNot == true then
card_info:InitHandCard(false)
else
card_info:UpdateHandCards(self._room.self_player.card_list)
end
else
card_info:InitHandCard(false)
end
-- card_info:ChuPaiTiShi()
card_info:ShowHuTip()
for i = 1, #p.fz_list do
if p.fz_list[i].type == RB_FZType.Kan then
card_info:UpdateKan(3, p.fz_list[i].card)
end
end
end
end
self._tex_LeftCard.text = '剩余 ' .. room.left_count .. ' 张牌'
local rightpanel = self._view:GetChild('right_panel')
local tex_round = rightpanel:GetChild('tex_round')
if tex_round ~= nil then
tex_round.text = '' .. room.curren_round .. ''
end
2025-06-27 03:16:36 +08:00
self._view:GetChild('tex_round').text = '' .. room.curren_round .. ''
2025-05-25 11:35:02 +08:00
end
function M:PlayChatSound(sex, chat_index)
local sex_path = ViewUtil.Sex_Chat[sex]
local path1 = string.format('extend/zipai/fanpaofa/sound/%s/chat_%s.mp3', sex_path, tostring(chat_index))
ViewUtil.PlaySound('ChangDe_ZP', path1)
end
function M:PlaySound(sex, path)
local sex_path = ViewUtil.Sex_Chat[sex] -- 1 男 2 女
local sound_path = string.format('extend/zipai/fanpaofa/sound/%s/%s.mp3', sex_path, path)
ViewUtil.PlaySound('ChangDe_ZP', sound_path)
end
function M:__CloseTip()
if (self._chipeng_tip) then
self._chipeng_tip:Dispose()
self._chipeng_tip = nil
end
if (self._pop_tip_choice) then
self._pop_tip_choice:Dispose()
self._pop_tip_choice = nil
end
end
function M:Destroy()
ZPMainView.Destroy(self)
UIPackage.RemovePackage('extend/zipai/fanpaofa/ui/Extend_Poker_FanPaoFa')
end
return M