同步梭哈修改

master
罗家炜 2025-05-15 16:49:18 +08:00
parent 6fe74e62e6
commit 9d72403c7b
5 changed files with 83 additions and 33 deletions

View File

@ -82,6 +82,7 @@ end
--绑定协议为事件 --绑定协议为事件
function M:OnSendCard(evt_data) function M:OnSendCard(evt_data)
print("lingmengsuohaOnSendCard")
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, EXGameEvent.OnSendCard, evt_data) DispatchEvent(self._dispatcher, EXGameEvent.OnSendCard, evt_data)

View File

@ -304,6 +304,24 @@ function M:EventInit()
_gamectr:AddEventListener(EXGameEvent.OnSendCard, function(...) _gamectr:AddEventListener(EXGameEvent.OnSendCard, function(...)
local arg = { ... } local arg = { ... }
local data = arg[1]
local round = data.round
local bank_seat = data.bank_seat
self:UpdateRound(round)
self._state.selectedIndex = 1
local maxPeopleNum = _room.room_config.people_num
for i = 1, maxPeopleNum do
local cardList = data[string.format("seat_%d", i)]
pt(cardList)
local cardInfo = _player_card_info[self:GetPos(i)]
if cardList then
cardInfo:UpdateHandPoker(cardList)
if self:GetPos(bank_seat) == 1 and bank_seat == i then
cardInfo:ShowTips(1)
end
end
end
end) end)
_gamectr:AddEventListener(EXGameEvent.OnTipAction, function(...) _gamectr:AddEventListener(EXGameEvent.OnTipAction, function(...)
@ -371,30 +389,33 @@ function M:ReConnectForStart()
-- body -- body
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "" .. player.hand_count .. "" head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "" .. player.hand_count .. ""
end end
if player.seat == self._room.self_player.seat then print("lingmengReConnectForStart")
if player.open ~= nil and player.open == 0 and self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then pt(player)
-- body -- if player.seat == self._room.self_player.seat then
self.MypokerList = player.hand_list -- if player.open ~= nil and player.open == 0 and self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
player_card_info:InitPoker(player.hand_list, false, 1) -- -- body
else -- self.MypokerList = player.hand_list
player_card_info:InitPoker(player.hand_list, false) -- player_card_info:InitPoker(player.hand_list, false, 1)
end -- else
else -- player_card_info:InitPoker(player.hand_list, false)
player_card_info:SetRemainCardNumber(player.hand_count == 1) -- end
if player.hand_count == 1 then -- else
self.bgm_index = 2 -- player_card_info:SetRemainCardNumber(player.hand_count == 1)
end -- if player.hand_count == 1 then
end -- self.bgm_index = 2
if self._room.curren_turn_seat ~= player.seat then -- end
-- head_info:MarkBank(false) -- end
if player.out_card_list[1] == 0 then player_card_info:UpdateHandPoker(player.hand_list)
player_card_info:SetOutCardInfo(nil, false) -- if self._room.curren_turn_seat ~= player.seat then
else -- -- head_info:MarkBank(false)
player_card_info:SetOutCardInfo(player.out_card_list, false) -- if player.out_card_list[1] == 0 then
end -- player_card_info:SetOutCardInfo(nil, false)
else -- else
-- head_info:MarkBank(true) -- player_card_info:SetOutCardInfo(player.out_card_list, false)
end -- end
-- else
-- -- head_info:MarkBank(true)
-- end
end end
end end

View File

@ -27,18 +27,21 @@ function M:init()
end end
function M:UpdateHandPoker(cardList) function M:UpdateHandPoker(cardList)
print("lingmengUpdateHandPoker", #cardList)
self._view_handCardList:RemoveChildren()
for i = 1, #cardList do
local obj = self._view_handCardList:AddItemFromPool()
print("lingmengUpdateHandPoker2", obj, cardList[i], string.format("ui://Main_Poker/%s", cardList[i]))
self:FillPoker(obj, cardList[i])
end
end end
function M:FillPoker(poker2, prefix, num, code) function M:FillPoker(poker2, code)
if num ~= nil then code = code == 0 and "00" or code
code = self:ChangeCodeByTo(num)
end
code = code == 1 and "00" or code
if not poker2.icon then if not poker2.icon then
poker2:GetChild('icon').url = string.format("ui://Extend_Poker_SuoHa/%s%s", prefix, code) poker2:GetChild('icon').url = string.format("ui://Main_Poker/%s", code)
else else
poker2.icon = string.format("ui://Extend_Poker_SuoHa/%s%s", prefix, code) poker2.icon = string.format("ui://Main_Poker/%s", code)
end end
end end

View File

@ -2,6 +2,13 @@
--- Created by 谌建军. --- Created by 谌建军.
--- DateTime: 2017/12/13 17:04 --- DateTime: 2017/12/13 17:04
--- ---
local TipType = {
guo = 0,
qi = 1,
xia = 4
}
local EXPlayerPokerInfoView = import('.EXPlayerPokerInfoView') local EXPlayerPokerInfoView = import('.EXPlayerPokerInfoView')
local EXCardType = import('.EXCardType') local EXCardType = import('.EXCardType')
local EXCardCheck = import(".CardCheck") local EXCardCheck = import(".CardCheck")
@ -25,11 +32,29 @@ function M.new(view, mainView)
end end
function M:init() function M:init()
local view = self._view
EXPlayerPokerInfoView.init(self) EXPlayerPokerInfoView.init(self)
self._view_tipsList = view:GetChild('list_tips')
self._ctr_out = view:GetController('out')
end end
function M:InitPoker(pokerList, isPlayAni, open) function M:ShowTips(type)
self._ctr_out.selectedIndex = 1
if type == 1 then
self._view_tipsList:RemoveChildren()
local obj = self._view_tipsList:AddItemFromPool()
self.SetTipData(obj, TipType.qi)
local obj = self._view_tipsList:AddItemFromPool()
self.SetTipData(obj, TipType.xia)
end
end
function M.SetTipData(obj, type)
obj.data = {}
obj.data.type = type
obj:GetController('type').selectedIndex = type
end end
function M:Clear() function M:Clear()