展示牌更新

master
罗家炜 2025-05-08 12:41:42 +08:00
parent 4678fa548a
commit 037c03f977
12 changed files with 203 additions and 174 deletions

View File

@ -46,8 +46,6 @@ function M:InitView(url)
end end
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人个旧麻将 ' .. room.score_times .. ''
self.selectLaiziBtn = self._view:GetChild('selectlaizi') self.selectLaiziBtn = self._view:GetChild('selectlaizi')
self.Laizi1Btn = self._view:GetChild('selectgang1') self.Laizi1Btn = self._view:GetChild('selectgang1')
self.Laizi2Btn = self._view:GetChild('selectgang2') self.Laizi2Btn = self._view:GetChild('selectgang2')
@ -154,6 +152,10 @@ function M:InitView(url)
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
---------为了下次复现出牌情况
self._viewText_testName = self._view:GetChild('text_testName')
self._viewText_testName.text = 0
end end
function M:__BuGang(cardInfo, callback) function M:__BuGang(cardInfo, callback)
@ -310,6 +312,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...) _gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
local info = self._player_card_info[self:GetPos(_room.self_player.seat)] local info = self._player_card_info[self:GetPos(_room.self_player.seat)]
self._viewText_testName.text = tonumber(self._viewText_testName.text) + 1
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
@ -972,12 +975,10 @@ function M:PlayerChangeLineState()
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)
local index = seat local index = seat - 1
local people_num = self._room.room_config.people_num local people_num = self._room.room_config.people_num
if people_num == 2 and seat == 2 then if people_num == 2 and seat == 2 then
index = 3 index = 2
elseif people_num == 3 and seat == 3 then
index = 4
end end
self._ctr_cardbox.selectedIndex = index self._ctr_cardbox.selectedIndex = index
end end

View File

@ -36,13 +36,15 @@ function M:init(name)
self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards
self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang
self._eventmap[TX_Protocol.GAME_EVT_RESIDUE_CARD] = self.OnEventResidueCard
end end
local __pre_delete_card = false local __pre_delete_card = false
-- 发送出牌指令到服务器 -- 发送出牌指令到服务器
-------------------------lingmeng--------------------------- -------------------------展示牌---------------------------
function M:SendNextCard(card) function M:SendNextCard(card)
local _data = {} local _data = {}
_data["card"] = tonumber(card) _data["card"] = tonumber(card)
@ -50,6 +52,12 @@ function M:SendNextCard(card)
_client:send(TX_Protocol.GAME_NEXT_CARD, _data) _client:send(TX_Protocol.GAME_NEXT_CARD, _data)
end end
function M:ReqResidueCard()
local _data = {}
local _client = ControllerManager.GameNetClinet
_client:send(TX_Protocol.GAME_RESIDUE_CARD, _data)
end
------------------------------------------------------------ ------------------------------------------------------------
function M:SendOutCard(card, callback) function M:SendOutCard(card, callback)
@ -91,6 +99,12 @@ function M:OnEventBuGang(evt_data)
DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true) DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true)
end end
function M:OnEventResidueCard(evt_data)
printlog("OnEventResidueCard")
pt(evt_data)
DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard)
end
-- 发送放子选择到服务器 -- 发送放子选择到服务器
function M:SendAction(id) function M:SendAction(id)
local _data = {} local _data = {}

View File

@ -68,38 +68,20 @@ function M:InitView(url)
self:UpdatePlayerInfoView() self:UpdatePlayerInfoView()
end) end)
local showNextCtr = self._view:GetController('showNext') self.showNextCtr = self._view:GetController('showNext')
local ShowNextConfrimCtr = self._view:GetController('showNextConfrim')
local showNextList = self._view:GetChild('list_showNext') local showNextList = self._view:GetChild('list_showNext')
local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim')
self._view:GetChild('btn_showNext').onClick:Set(function() self._view:GetChild('btn_showNext').onClick:Set(function()
showNextCtr.selectedIndex = 1 self:reqResidueCard()
end)
self._view:GetChild('btn_sendShow').onClick:Set(function()
self:SendShowNext(ShowNextConfrimCtr)
end) end)
self._view:GetChild('btn_closeShow').onClick:Set(function() self._view:GetChild('btn_closeShow').onClick:Set(function()
ShowNextConfrimCtr.selectedIndex = 0 self.showNextCtr.selectedIndex = 0
showNextCtr.selectedIndex = 0
showNextList.selectedIndex = -1 showNextList.selectedIndex = -1
self._showNextName = nil self._showNextName = nil
end) end)
showNextList.onClickItem:Set(function(context) showNextList.onClickItem:Set(function(context)
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:SendNextCard(string.sub(context.data.name, -3)) _gamectr:SendNextCard(string.sub(context.data.name, -3))
showNextCtr.selectedIndex = 0 self.showNextCtr.selectedIndex = 0
showNextList.selectedIndex = -1
self._showNextName = nil
-- self:ClickShowNext(context, ShowNextConfrimCtr)
end)
ShowNextConfrimCtr.onChanged:Set(function()
pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName
end)
pop_showNextConfrim:GetChild("btn_center").onClick:Set(function()
local _gamectr = ControllerManager.GetController(GameController)
_gamectr:SendNextCard(string.sub(self._showNextName, -3))
ShowNextConfrimCtr.selectedIndex = 0
showNextCtr.selectedIndex = 0
showNextList.selectedIndex = -1 showNextList.selectedIndex = -1
self._showNextName = nil self._showNextName = nil
end) end)
@ -153,6 +135,10 @@ function M:InitView(url)
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
---------为了下次复现出牌情况
self._viewText_testName = self._view:GetChild('text_testName')
self._viewText_testName.text = 0
end end
function M:__BuGang(cardInfo, callback) function M:__BuGang(cardInfo, callback)
@ -309,6 +295,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...) _gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
local info = self._player_card_info[self:GetPos(_room.self_player.seat)] local info = self._player_card_info[self:GetPos(_room.self_player.seat)]
self._viewText_testName.text = tonumber(self._viewText_testName.text) + 1
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
@ -563,6 +550,11 @@ function M:EventInit()
end end
end end
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
local arg = { ... }
self.showNextCtr.selectedIndex = 1
end)
end end
function M:OutCard(card) function M:OutCard(card)
@ -972,17 +964,21 @@ function M:PlayerChangeLineState()
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)
local index = seat local index = seat - 1
local people_num = self._room.room_config.people_num local people_num = self._room.room_config.people_num
if people_num == 2 and seat == 2 then if people_num == 2 and seat == 2 then
index = 3 index = 2
elseif people_num == 3 and seat == 3 then
index = 4
end end
self._ctr_cardbox.selectedIndex = index self._ctr_cardbox.selectedIndex = index
end end
-----------------------lingmeng---------------------------- -----------------------展示牌----------------------------
function M:reqResidueCard()
local _gamectr = ControllerManager.GetController(GameController)
_gamectr:ReqResidueCard()
end
function M:SendShowNext(ShowNextConfrimCtr) function M:SendShowNext(ShowNextConfrimCtr)
if not self._showNextName then if not self._showNextName then
ViewUtil.ErrorTip(nil, "请先选择一个麻将牌") ViewUtil.ErrorTip(nil, "请先选择一个麻将牌")

View File

@ -1,6 +1,5 @@
local TX_GameEvent = { local TX_GameEvent = {
-- 发牌 -- 发牌
SendCards = "SendCards", SendCards = "SendCards",
EventTurn = "EventTurn", EventTurn = "EventTurn",
@ -28,10 +27,12 @@ local TX_GameEvent = {
EvnetPiao = "EvnetPiao", EvnetPiao = "EvnetPiao",
--- ---
SendLaiZi="SendLaiZi", SendLaiZi = "SendLaiZi",
SendGangZi = "SendGangZi", SendGangZi = "SendGangZi",
EventBuGang = "EventBuGang", EventBuGang = "EventBuGang",
---
EventResidueCard = "EventResidueCard"
} }
return TX_GameEvent return TX_GameEvent

View File

@ -1,6 +1,6 @@
local Protocol = { local Protocol = {
-- 发牌协议 -- 发牌协议
GAME_EVT_PLAYER_DEAL = "811", GAME_EVT_PLAYER_DEAL = "811",
-- 出牌 -- 出牌
GAME_DIS_CARD = "611", GAME_DIS_CARD = "611",
@ -29,7 +29,7 @@ local Protocol = {
-- 大结算 -- 大结算
GAME_EVT_RESULT2 = "818", GAME_EVT_RESULT2 = "818",
-- 抓牌 -- 抓牌
GAME_EVT_DRAW = "819", GAME_EVT_DRAW = "819",
-- 转盘指向事件 -- 转盘指向事件
@ -49,7 +49,9 @@ local Protocol = {
GAME_EVT_DOGANG = "839", GAME_EVT_DOGANG = "839",
--送牌 --送牌
GAME_NEXT_CARD = "888" GAME_NEXT_CARD = "888",
GAME_RESIDUE_CARD = "889",
GAME_EVT_RESIDUE_CARD = "613"
} }
return Protocol return Protocol

View File

@ -152,6 +152,10 @@ function M:InitView(url)
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
---------为了下次复现出牌情况
self._viewText_testName = self._view:GetChild('text_testName')
self._viewText_testName.text = 0
end end
function M:__BuGang(cardInfo, callback) function M:__BuGang(cardInfo, callback)
@ -307,6 +311,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...) _gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
local info = self._player_card_info[self:GetPos(_room.self_player.seat)] local info = self._player_card_info[self:GetPos(_room.self_player.seat)]
self._viewText_testName.text = tonumber(self._viewText_testName.text) + 1
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
@ -971,12 +976,10 @@ function M:PlayerChangeLineState()
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)
local index = seat local index = seat - 1
local people_num = self._room.room_config.people_num local people_num = self._room.room_config.people_num
if people_num == 2 and seat == 2 then if people_num == 2 and seat == 2 then
index = 3 index = 2
elseif people_num == 3 and seat == 3 then
index = 4
end end
self._ctr_cardbox.selectedIndex = index self._ctr_cardbox.selectedIndex = index
end end

View File

@ -152,6 +152,10 @@ function M:InitView(url)
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
---------为了下次复现出牌情况
self._viewText_testName = self._view:GetChild('text_testName')
self._viewText_testName.text = 0
end end
function M:__BuGang(cardInfo, callback) function M:__BuGang(cardInfo, callback)
@ -308,6 +312,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...) _gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
local info = self._player_card_info[self:GetPos(_room.self_player.seat)] local info = self._player_card_info[self:GetPos(_room.self_player.seat)]
self._viewText_testName.text = tonumber(self._viewText_testName.text) + 1
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
@ -983,12 +988,10 @@ function M:PlayerChangeLineState()
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)
local index = seat local index = seat - 1
local people_num = self._room.room_config.people_num local people_num = self._room.room_config.people_num
if people_num == 2 and seat == 2 then if people_num == 2 and seat == 2 then
index = 3 index = 2
elseif people_num == 3 and seat == 3 then
index = 4
end end
self._ctr_cardbox.selectedIndex = index self._ctr_cardbox.selectedIndex = index
end end

View File

@ -1,5 +1,3 @@
local RunFast_CardType = import('.RunFast_CardType')
local CardCheck = { local CardCheck = {
cardList = {}, cardList = {},
@ -11,7 +9,20 @@ local CardCheck = {
threeNoBelt = false, threeNoBelt = false,
planelack = false, planelack = false,
threelack = false, threelack = false,
fourDaiThree = false fourDaiThree = false,
fristCard = true
}
local cardType = {
one = 1,
long = 2,
dui = 3,
threeAndTwo = 4,
normolPlant = 5,
zha = 6,
onlyThree = 7,
onlyPlant = 8,
zhaAndThreee = 9
} }
local M = CardCheck local M = CardCheck
@ -23,12 +34,24 @@ function M:initFlag()
self.planelack = config.planelack == 1 self.planelack = config.planelack == 1
self.threelack = config.threelack == 1 self.threelack = config.threelack == 1
self.fourDaiThree = config.fourDaiThree self.fourDaiThree = config.fourDaiThree
self.fristCard = true
print("==============================lingmengcheckinitFlag") print("==============================lingmengcheckinitFlag")
pt(config) pt(config)
pt(self) pt(self)
return self return self
end end
function M:initLastCard(cardList)
self.fristCard = false
if #cardList == 0 then
self.fristCard = true
return
end
self.lastCardNum = #cardList
table.sort(cardList)
pt(cardList)
end
function M:initCards(cardList, flag, flag_allCards, lastCards) function M:initCards(cardList, flag, flag_allCards, lastCards)
print("lingmenginitCards") print("lingmenginitCards")
pt(cardList) pt(cardList)
@ -84,8 +107,6 @@ function M:initCards(cardList, flag, flag_allCards, lastCards)
end end
function M:CheckCards() function M:CheckCards()
-- local zha
print("lingmengCheckAloneOrLong") print("lingmengCheckAloneOrLong")
if self:CheckAloneOrLong() then if self:CheckAloneOrLong() then
return true return true
@ -110,14 +131,17 @@ function M:CheckCards()
end end
function M:CheckAloneOrLong() function M:CheckAloneOrLong()
if self.cardNum == 1 or self.long then if self.cardNum == 1 then
return true return cardType.one
end
if self.long then
return cardType.long
end end
end end
function M:CheckDuiZi() function M:CheckDuiZi()
if self.cardNum == 2 and self.cardSize == 1 then if self.cardNum == 2 and self.cardSize == 1 then
return true return cardType.dui
end end
if self.cardNum % 2 == 0 then if self.cardNum % 2 == 0 then
local last_k local last_k
@ -137,22 +161,22 @@ function M:CheckDuiZi()
return return
end end
end end
return true return cardType.dui
end end
end end
function M:CheckSanDai() function M:CheckSanDai()
--三张 --三张
if self.cardNum == 5 and self.cardSize < 4 then if self.cardNum == 5 and self.cardSize < 4 then
return true return cardType.threeAndTwo
end end
if self.threelack and self.cardNum == 4 and self.cardSize == 2 and self._flag_allCards then if self.threelack and self.cardNum == 4 and self.cardSize == 2 and self._flag_allCards then
return true return cardType.threeAndTwo
end end
if self.threeNoBelt and self.cardNum == 3 and self.cardSize == 1 then if self.threeNoBelt and self.cardNum == 3 and self.cardSize == 1 then
return true return cardType.onlyThree
end end
@ -181,7 +205,7 @@ function M:CheckSanDai()
end end
end end
if num_san >= temp_normol_feiji then if num_san >= temp_normol_feiji then
return true return cardType.normolPlant
else else
return return
end end
@ -210,7 +234,7 @@ function M:CheckSanDai()
print("liengmengCheckthreelack4", num_san, self.cardNum - num_san * 3 < num_san * 2) print("liengmengCheckthreelack4", num_san, self.cardNum - num_san * 3 < num_san * 2)
if self.cardNum - num_san * 3 < num_san * 2 then if self.cardNum - num_san * 3 < num_san * 2 then
return true return cardType.normolPlant
else else
return return
end end
@ -236,13 +260,13 @@ function M:CheckSanDai()
return return
end end
end end
return true return cardType.onlyPlant
end end
end end
function M:CheckZha() function M:CheckZha()
if self.cardNum == 4 and self.cardSize == 1 then if self.cardNum == 4 and self.cardSize == 1 then
return true return cardType.zha
end end
if self.fourDaiThree and self.cardNum == 7 then if self.fourDaiThree and self.cardNum == 7 then
@ -254,7 +278,7 @@ function M:CheckZha()
return true return true
end end
end end
return false return cardType.zhaAndThreee
end end
end end

View File

@ -18,8 +18,8 @@ local RunFast_GameController = {}
local M = RunFast_GameController local M = RunFast_GameController
function M.new() function M.new()
setmetatable(M, {__index = GameController}) setmetatable(M, { __index = GameController })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self:init("跑得快") self:init("跑得快")
self.class = "RunFast_GameController" self.class = "RunFast_GameController"
return self return self
@ -48,12 +48,12 @@ function M:RegisterEvt()
-- self._eventmap[Protocol.GAME_EVT_PLAYER_JOIN] = self.OnEventPlayerEnter -- self._eventmap[Protocol.GAME_EVT_PLAYER_JOIN] = self.OnEventPlayerEnter
self._eventmap[RunFast_Protocol.PT_GAMETUOGUAN] = self.Game_TuoGuan self._eventmap[RunFast_Protocol.PT_GAMETUOGUAN] = self.Game_TuoGuan
self._eventmap[RunFast_Protocol.GAME_EVENT_XIPAI] = self.OnEventXiPai self._eventmap[RunFast_Protocol.GAME_EVENT_XIPAI] = self.OnEventXiPai
self._eventmap[RunFast_Protocol.GAME_EVENT_NOTIFY_XIPAI] = self.OnEventXiPaiAnim self._eventmap[RunFast_Protocol.GAME_EVENT_NOTIFY_XIPAI] = self.OnEventXiPaiAnim
self._eventmap[RunFast_Protocol.GAME_EVT_CARDINHAND] = self.OnPlaySuccCheckHandCard
self._eventmap[RunFast_Protocol.GAME_EVT_CARDINHAND] = self.OnPlaySuccCheckHandCard
end end
-- function M:Oener(evt_data) -- function M:Oener(evt_data)
-- local seat = evt_data["owner"] -- local seat = evt_data["owner"]
-- self._cacheEvent:Enqueue(function() -- self._cacheEvent:Enqueue(function()
@ -89,49 +89,45 @@ function M:SendXiPaiAction(callBack)
local _data = {} local _data = {}
local _client = ControllerManager.GameNetClinet local _client = ControllerManager.GameNetClinet
_client:send(RunFast_Protocol.GAME_XIPAI, _data) _client:send(RunFast_Protocol.GAME_XIPAI, _data)
self.XiPaiCallBack=callBack self.XiPaiCallBack = callBack
end end
function M:OnEventXiPai(evt_data) function M:OnEventXiPai(evt_data)
if evt_data["result"]==0 then if evt_data["result"] == 0 then
if self.XiPaiCallBack then if self.XiPaiCallBack then
self.XiPaiCallBack() self.XiPaiCallBack()
end end
else else
ViewUtil.ErrorTip(1000000,"申请洗牌失败") ViewUtil.ErrorTip(1000000, "申请洗牌失败")
end end
end end
function M:OnEventXiPaiAnim(evt_data) function M:OnEventXiPaiAnim(evt_data)
printlog("洗牌动画===》》》》") printlog("洗牌动画===》》》》")
pt(evt_data) pt(evt_data)
local playeridList = evt_data["list"] local playeridList = evt_data["list"]
local my_isXiPai=false local my_isXiPai = false
local other_isXiPai=false local other_isXiPai = false
if playeridList and #playeridList>0 then if playeridList and #playeridList > 0 then
for i=1,#playeridList do for i = 1, #playeridList do
local p = self._room:GetPlayerById(playeridList[i]) local p = self._room:GetPlayerById(playeridList[i])
if p== self._room.self_player then if p == self._room.self_player then
my_isXiPai=true my_isXiPai = true
else else
other_isXiPai=true other_isXiPai = true
end end
end end
end end
self._cacheEvent:Enqueue(function() self._cacheEvent:Enqueue(function()
DispatchEvent(self._dispatcher,RunFast_GameEvent.EventXiPai,my_isXiPai,other_isXiPai) DispatchEvent(self._dispatcher, RunFast_GameEvent.EventXiPai, my_isXiPai, other_isXiPai)
end) end)
end end
function M:SendCard(cards, currentCard)
function M:SendCard(cards,currentCard)
local _data = {} local _data = {}
_data["card"] = cards _data["card"] = cards
_data["all_card"] = currentCard _data["all_card"] = currentCard
local _client = ControllerManager.GameNetClinet local _client = ControllerManager.GameNetClinet
_client:send(RunFast_Protocol.RunFast_Send_Card, _data) _client:send(RunFast_Protocol.RunFast_Send_Card, _data)
end end
@ -210,16 +206,16 @@ end
function M:OnPlaySucc(evt_data) function M:OnPlaySucc(evt_data)
if pcall( if pcall(
self.OnPlaySuccCheck,self,evt_data self.OnPlaySuccCheck, self, evt_data
) then ) then
else else
printlog("数据异常OnPlaySucc==>>>") printlog("数据异常OnPlaySucc==>>>")
end end
end end
function M:OnPlaySuccCheck(evt_data) function M:OnPlaySuccCheck(evt_data)
local seat = evt_data["player"] local seat = evt_data["player"]
local card_obj = evt_data["card_obj"] local card_obj = evt_data["card_obj"]
local cards = card_obj["card_list"] local cards = card_obj["card_list"]
local remain = evt_data["remain"] -- 报单 local remain = evt_data["remain"] -- 报单
@ -231,31 +227,28 @@ function M:OnPlaySuccCheck(evt_data)
player.hand_count = remain player.hand_count = remain
local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list) local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list)
player.out_card_list = self:GetSortOutCardList(out_card_list, card_type, number, plan_three_count) player.out_card_list = self:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList,length) DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList,
length)
end end
) )
end end
function M:OnPlaySuccCheckHandCard(evt_data) function M:OnPlaySuccCheckHandCard(evt_data)
local seat = evt_data["player"] local seat = evt_data["player"]
local cards = evt_data["handCards"] local cards = evt_data["handCards"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPassSuccCheckCard,seat,cards) DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPassSuccCheckCard, seat, cards)
end end
) )
end end
function M:OnPassSucc(evt_data) function M:OnPassSucc(evt_data)
local seat = evt_data["seat"] local seat = evt_data["seat"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
local p = self._room:GetPlayerBySeat(seat) local p = self._room:GetPlayerBySeat(seat)
p.out_card_list = {0} p.out_card_list = { 0 }
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPassSucc, p) DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPassSucc, p)
end end
) )
@ -270,6 +263,7 @@ function M:OnPutError(evt_data)
end end
) )
end end
function M:TuoGuan(isTuo) function M:TuoGuan(isTuo)
local _data = {} local _data = {}
_data["tuoguan"] = isTuo _data["tuoguan"] = isTuo
@ -284,6 +278,7 @@ function M:Game_TuoGuan(evt_data)
DispatchEvent(self._dispatcher, RunFast_GameEvent.Game_TuoGuan, tuoguan, seat) DispatchEvent(self._dispatcher, RunFast_GameEvent.Game_TuoGuan, tuoguan, seat)
end) end)
end end
function M:OnIndexMove(evt_data) function M:OnIndexMove(evt_data)
local seat = evt_data["index"] local seat = evt_data["index"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
@ -303,8 +298,8 @@ function M:OnOptions(evt_data)
function() function()
local lastCardList = self:GetLastCardList(self._room.self_player.seat) local lastCardList = self:GetLastCardList(self._room.self_player.seat)
local cardType, cardNum, cardLength = self:GetCardListInfo(lastCardList) local cardType, cardNum, cardLength = self:GetCardListInfo(lastCardList)
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnOptions, play, cardType, cardNum, cardLength, pass,
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnOptions, play, cardType, cardNum, cardLength, pass) lastCardList)
end end
) )
end end
@ -319,8 +314,7 @@ function M:OnPiaoTip(evt_data)
local reload = evt_data["reload"] local reload = evt_data["reload"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPiaoTips, piao, reload)
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPiaoTips, piao,reload)
end end
) )
end end
@ -331,8 +325,7 @@ function M:OnPiaoAction(evt_data)
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPiaoAction, seat, piao)
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPiaoAction, seat,piao)
end end
) )
end end
@ -343,7 +336,7 @@ function M:OnResult(evt_data)
local info = evt_data["info"] local info = evt_data["info"]
local winseat = evt_data["winseat"] local winseat = evt_data["winseat"]
local remaincards = evt_data["remaincards"] local remaincards = evt_data["remaincards"]
DataManager.CurrenRoom.xipaiScore=evt_data["xipai_score"] DataManager.CurrenRoom.xipaiScore = evt_data["xipai_score"]
--printlog("wwwwwwwwwwwwwwwwwwwww1111111 ",result_type) --printlog("wwwwwwwwwwwwwwwwwwwww1111111 ",result_type)
--pt(evt_data) --pt(evt_data)
if result_type == 1 then if result_type == 1 then
@ -393,6 +386,7 @@ function M:OnConfrimToNextGameSucc(evt_data)
end end
) )
end end
function M:Game_TuoGuan(evt_data) function M:Game_TuoGuan(evt_data)
local tuoguan = evt_data["tuoguan"] local tuoguan = evt_data["tuoguan"]
local seat = evt_data["seat"] local seat = evt_data["seat"]
@ -400,6 +394,7 @@ function M:Game_TuoGuan(evt_data)
DispatchEvent(self._dispatcher, RunFast_GameEvent.Game_TuoGuan, tuoguan, seat) DispatchEvent(self._dispatcher, RunFast_GameEvent.Game_TuoGuan, tuoguan, seat)
end) end)
end end
function M:ChangeCodeByFrom(cardList, isSort) function M:ChangeCodeByFrom(cardList, isSort)
isSort = isSort or false isSort = isSort or false
local new_card_list = {} local new_card_list = {}
@ -520,7 +515,6 @@ end
--Bomb = 11 --Bomb = 11
-- 牌型,大小, 长度 -- 牌型,大小, 长度
function M:GetCardListInfo(cardlist) function M:GetCardListInfo(cardlist)
if #cardlist == 0 then if #cardlist == 0 then
return 0, 0, 0, 0 return 0, 0, 0, 0
end end
@ -536,14 +530,12 @@ function M:GetCardListInfo(cardlist)
card_num = math.floor(cardlist[1] / 10) card_num = math.floor(cardlist[1] / 10)
elseif #cardlist == 3 then elseif #cardlist == 3 then
card_num = math.floor(cardlist[1] / 10) card_num = math.floor(cardlist[1] / 10)
if card_num==14 and DataManager.CurrenRoom.room_config.threeA==1 then if card_num == 14 and DataManager.CurrenRoom.room_config.threeA == 1 then
-- body -- body
card_type = RunFast_CardType.Bomb card_type = RunFast_CardType.Bomb
else else
card_type = RunFast_CardType.Three card_type = RunFast_CardType.Three
end end
elseif #cardlist == 4 then elseif #cardlist == 4 then
local max_key = 0 local max_key = 0
for k, v in pairs(card_map) do for k, v in pairs(card_map) do
@ -600,9 +592,7 @@ function M:GetCardListInfo(cardlist)
local max_one_key, max_two_key, max_three_key = 0, 0, 0 local max_one_key, max_two_key, max_three_key = 0, 0, 0
for k, v in pairs(card_map) do for k, v in pairs(card_map) do
if #v == 2 then if #v == 2 then
if k > max_two_key then if k > max_two_key then
max_two_key = k max_two_key = k
end end
@ -612,7 +602,6 @@ function M:GetCardListInfo(cardlist)
card_num = max_two_key card_num = max_two_key
end end
elseif #v == 1 then elseif #v == 1 then
if k > max_one_key then if k > max_one_key then
max_one_key = k max_one_key = k
end end
@ -622,7 +611,6 @@ function M:GetCardListInfo(cardlist)
card_num = max_one_key card_num = max_one_key
end end
elseif #v == 3 then elseif #v == 3 then
if max_three_key == 0 then if max_three_key == 0 then
max_three_key = k max_three_key = k
three_count = three_count + 1 three_count = three_count + 1
@ -632,8 +620,8 @@ function M:GetCardListInfo(cardlist)
elseif k < max_three_key and k == max_three_key - 1 then elseif k < max_three_key and k == max_three_key - 1 then
max_three_key = k max_three_key = k
three_count = three_count + 1 three_count = three_count + 1
-- else -- else
-- max_three_key = k -- max_three_key = k
end end
--three_count = three_count + 1 --three_count = three_count + 1
@ -652,24 +640,16 @@ function M:GetCardListInfo(cardlist)
-- end -- end
plan_three_count = three_count plan_three_count = three_count
if three_count * 3 == #cardlist then if three_count * 3 == #cardlist then
card_type = RunFast_CardType.Plane card_type = RunFast_CardType.Plane
card_num = max_three_key card_num = max_three_key
elseif three_count * 4 >= #cardlist and #cardlist % 4 == 0 then
elseif three_count * 4 >= #cardlist and #cardlist%4==0 then
card_type = RunFast_CardType.PlaneAndOne card_type = RunFast_CardType.PlaneAndOne
card_num = max_three_key card_num = max_three_key
elseif three_count * 5 >= #cardlist and #cardlist % 5 == 0 then
elseif three_count * 5 >= #cardlist and #cardlist%5==0 then
card_type = RunFast_CardType.PlaneAndTwo card_type = RunFast_CardType.PlaneAndTwo
card_num = max_three_key card_num = max_three_key
end end
end end
return card_type, card_num, card_length, plan_three_count return card_type, card_num, card_length, plan_three_count
@ -681,7 +661,7 @@ function M:GetCardMapByList(cardlist)
local card = cardlist[i] local card = cardlist[i]
local card_num = math.floor(cardlist[i] / 10) local card_num = math.floor(cardlist[i] / 10)
if card_map[card_num] == nil then if card_map[card_num] == nil then
card_map[card_num] = {card} card_map[card_num] = { card }
else else
card_map[card_num][#card_map[card_num] + 1] = card card_map[card_num][#card_map[card_num] + 1] = card
end end

View File

@ -769,6 +769,7 @@ function M:EventInit()
local card_type = arg[2] local card_type = arg[2]
local card_number = arg[3] local card_number = arg[3]
local card_length = arg[4] local card_length = arg[4]
local lastCardList = arg[6]
local ctr_number = pass == nil and 2 or 1 local ctr_number = pass == nil and 2 or 1
self.caozuo = 1 --记录是否是自己出牌的阶段 self.caozuo = 1 --记录是否是自己出牌的阶段
self.pass = pass self.pass = pass
@ -790,6 +791,7 @@ function M:EventInit()
end end
local zdts = self._view:GetController("zidongtishi").selectedIndex local zdts = self._view:GetController("zidongtishi").selectedIndex
self._player_card_info[1]:ShowOutCardOption(ctr_number, card_type, card_number, card_length, m, play, zdts) self._player_card_info[1]:ShowOutCardOption(ctr_number, card_type, card_number, card_length, m, play, zdts)
self._player_card_info[1]._cardCheck:initLastCard(lastCardList)
end) end)
-- 托管 -- 托管
_gamectr:AddEventListener(RunFast_GameEvent.Game_TuoGuan, function(...) _gamectr:AddEventListener(RunFast_GameEvent.Game_TuoGuan, function(...)

View File

@ -40,9 +40,12 @@ function M:InitView(url, use_custom_bg)
local _cardbox = _view:GetChild("cardbox") local _cardbox = _view:GetChild("cardbox")
self._zhuanpanCtr = _cardbox:GetController("zuozi") self._zhuanpanCtr = _cardbox:GetController("zuozi")
self._ctr_cardbox = _cardbox:GetController("c1") -- self._ctr_cardbox = _cardbox:GetController("c1")
self._tex_leftTime = _cardbox:GetChild("tex_leftnum") -- self._tex_leftTime = _cardbox:GetChild("tex_leftnum")
local centerBox = _view:GetChild("Comp_ConterBox")
self._ctr_cardbox = centerBox:GetController("seat")
self._tex_leftTime = centerBox:GetChild("Text_Time")
if self._room.card_type == 2 then if self._room.card_type == 2 then
self:Change3d(true) self:Change3d(true)