展示牌更新
parent
4678fa548a
commit
037c03f977
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 = {}
|
||||||
|
|
|
||||||
|
|
@ -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, "请先选择一个麻将牌")
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
local TX_GameEvent = {
|
local TX_GameEvent = {
|
||||||
-- 发牌
|
-- 发牌
|
||||||
SendCards = "SendCards",
|
SendCards = "SendCards",
|
||||||
|
|
@ -33,5 +32,7 @@ local TX_GameEvent = {
|
||||||
SendGangZi = "SendGangZi",
|
SendGangZi = "SendGangZi",
|
||||||
EventBuGang = "EventBuGang",
|
EventBuGang = "EventBuGang",
|
||||||
|
|
||||||
|
---
|
||||||
|
EventResidueCard = "EventResidueCard"
|
||||||
}
|
}
|
||||||
return TX_GameEvent
|
return TX_GameEvent
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ function M:RegisterEvt()
|
||||||
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()
|
||||||
|
|
@ -100,11 +100,8 @@ function M:OnEventXiPai(evt_data)
|
||||||
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)
|
||||||
|
|
@ -127,7 +124,6 @@ function M:OnEventXiPaiAnim(evt_data)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:SendCard(cards, currentCard)
|
function M:SendCard(cards, currentCard)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["card"] = cards
|
_data["card"] = cards
|
||||||
|
|
@ -231,7 +227,8 @@ 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
|
||||||
|
|
@ -244,12 +241,8 @@ function M:OnPlaySuccCheckHandCard(evt_data)
|
||||||
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(
|
||||||
|
|
@ -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,7 +314,6 @@ 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
|
||||||
)
|
)
|
||||||
|
|
@ -331,7 +325,6 @@ 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
|
||||||
)
|
)
|
||||||
|
|
@ -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
|
||||||
|
|
@ -541,9 +535,7 @@ function M:GetCardListInfo(cardlist)
|
||||||
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
|
||||||
|
|
@ -655,21 +643,13 @@ function M:GetCardListInfo(cardlist)
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -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(...)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue