展示牌更新

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
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.Laizi1Btn = self._view:GetChild('selectgang1')
self.Laizi2Btn = self._view:GetChild('selectgang2')
@ -154,6 +152,10 @@ function M:InitView(url)
if room.playing or room.curren_round > 0 then
self:ReloadRoom()
end
---------为了下次复现出牌情况
self._viewText_testName = self._view:GetChild('text_testName')
self._viewText_testName.text = 0
end
function M:__BuGang(cardInfo, callback)
@ -310,6 +312,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
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)
end)
@ -972,12 +975,10 @@ function M:PlayerChangeLineState()
end
function M:UpdateCardBox(seat)
local index = seat
local index = seat - 1
local people_num = self._room.room_config.people_num
if people_num == 2 and seat == 2 then
index = 3
elseif people_num == 3 and seat == 3 then
index = 4
index = 2
end
self._ctr_cardbox.selectedIndex = index
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_BUGANG] = self.OnEventBuGang
self._eventmap[TX_Protocol.GAME_EVT_RESIDUE_CARD] = self.OnEventResidueCard
end
local __pre_delete_card = false
-- 发送出牌指令到服务器
-------------------------lingmeng---------------------------
-------------------------展示牌---------------------------
function M:SendNextCard(card)
local _data = {}
_data["card"] = tonumber(card)
@ -50,6 +52,12 @@ function M:SendNextCard(card)
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
end
function M:ReqResidueCard()
local _data = {}
local _client = ControllerManager.GameNetClinet
_client:send(TX_Protocol.GAME_RESIDUE_CARD, _data)
end
------------------------------------------------------------
function M:SendOutCard(card, callback)
@ -91,6 +99,12 @@ function M:OnEventBuGang(evt_data)
DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true)
end
function M:OnEventResidueCard(evt_data)
printlog("OnEventResidueCard")
pt(evt_data)
DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard)
end
-- 发送放子选择到服务器
function M:SendAction(id)
local _data = {}

View File

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

View File

@ -1,4 +1,3 @@
local TX_GameEvent = {
-- 发牌
SendCards = "SendCards",
@ -33,5 +32,7 @@ local TX_GameEvent = {
SendGangZi = "SendGangZi",
EventBuGang = "EventBuGang",
---
EventResidueCard = "EventResidueCard"
}
return TX_GameEvent

View File

@ -49,7 +49,9 @@ local Protocol = {
GAME_EVT_DOGANG = "839",
--送牌
GAME_NEXT_CARD = "888"
GAME_NEXT_CARD = "888",
GAME_RESIDUE_CARD = "889",
GAME_EVT_RESIDUE_CARD = "613"
}
return Protocol

View File

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

View File

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

View File

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

View File

@ -52,8 +52,8 @@ function M:RegisterEvt()
self._eventmap[RunFast_Protocol.GAME_EVENT_NOTIFY_XIPAI] = self.OnEventXiPaiAnim
self._eventmap[RunFast_Protocol.GAME_EVT_CARDINHAND] = self.OnPlaySuccCheckHandCard
end
-- function M:Oener(evt_data)
-- local seat = evt_data["owner"]
-- self._cacheEvent:Enqueue(function()
@ -100,11 +100,8 @@ function M:OnEventXiPai(evt_data)
else
ViewUtil.ErrorTip(1000000, "申请洗牌失败")
end
end
function M:OnEventXiPaiAnim(evt_data)
printlog("洗牌动画===》》》》")
pt(evt_data)
@ -127,7 +124,6 @@ function M:OnEventXiPaiAnim(evt_data)
end)
end
function M:SendCard(cards, currentCard)
local _data = {}
_data["card"] = cards
@ -231,7 +227,8 @@ function M:OnPlaySuccCheck(evt_data)
player.hand_count = remain
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)
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
@ -244,12 +241,8 @@ function M:OnPlaySuccCheckHandCard(evt_data)
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPassSuccCheckCard, seat, cards)
end
)
end
function M:OnPassSucc(evt_data)
local seat = evt_data["seat"]
self._cacheEvent:Enqueue(
@ -270,6 +263,7 @@ function M:OnPutError(evt_data)
end
)
end
function M:TuoGuan(isTuo)
local _data = {}
_data["tuoguan"] = isTuo
@ -284,6 +278,7 @@ function M:Game_TuoGuan(evt_data)
DispatchEvent(self._dispatcher, RunFast_GameEvent.Game_TuoGuan, tuoguan, seat)
end)
end
function M:OnIndexMove(evt_data)
local seat = evt_data["index"]
self._cacheEvent:Enqueue(
@ -303,8 +298,8 @@ function M:OnOptions(evt_data)
function()
local lastCardList = self:GetLastCardList(self._room.self_player.seat)
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
@ -319,7 +314,6 @@ function M:OnPiaoTip(evt_data)
local reload = evt_data["reload"]
self._cacheEvent:Enqueue(
function()
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPiaoTips, piao, reload)
end
)
@ -331,7 +325,6 @@ function M:OnPiaoAction(evt_data)
self._cacheEvent:Enqueue(
function()
DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPiaoAction, seat, piao)
end
)
@ -393,6 +386,7 @@ function M:OnConfrimToNextGameSucc(evt_data)
end
)
end
function M:Game_TuoGuan(evt_data)
local tuoguan = evt_data["tuoguan"]
local seat = evt_data["seat"]
@ -400,6 +394,7 @@ function M:Game_TuoGuan(evt_data)
DispatchEvent(self._dispatcher, RunFast_GameEvent.Game_TuoGuan, tuoguan, seat)
end)
end
function M:ChangeCodeByFrom(cardList, isSort)
isSort = isSort or false
local new_card_list = {}
@ -520,7 +515,6 @@ end
--Bomb = 11
-- 牌型,大小, 长度
function M:GetCardListInfo(cardlist)
if #cardlist == 0 then
return 0, 0, 0, 0
end
@ -541,9 +535,7 @@ function M:GetCardListInfo(cardlist)
card_type = RunFast_CardType.Bomb
else
card_type = RunFast_CardType.Three
end
elseif #cardlist == 4 then
local max_key = 0
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
for k, v in pairs(card_map) do
if #v == 2 then
if k > max_two_key then
max_two_key = k
end
@ -612,7 +602,6 @@ function M:GetCardListInfo(cardlist)
card_num = max_two_key
end
elseif #v == 1 then
if k > max_one_key then
max_one_key = k
end
@ -622,7 +611,6 @@ function M:GetCardListInfo(cardlist)
card_num = max_one_key
end
elseif #v == 3 then
if max_three_key == 0 then
max_three_key = k
three_count = three_count + 1
@ -655,21 +643,13 @@ function M:GetCardListInfo(cardlist)
if three_count * 3 == #cardlist then
card_type = RunFast_CardType.Plane
card_num = max_three_key
elseif three_count * 4 >= #cardlist and #cardlist % 4 == 0 then
card_type = RunFast_CardType.PlaneAndOne
card_num = max_three_key
elseif three_count * 5 >= #cardlist and #cardlist % 5 == 0 then
card_type = RunFast_CardType.PlaneAndTwo
card_num = max_three_key
end
end
return card_type, card_num, card_length, plan_three_count

View File

@ -769,6 +769,7 @@ function M:EventInit()
local card_type = arg[2]
local card_number = arg[3]
local card_length = arg[4]
local lastCardList = arg[6]
local ctr_number = pass == nil and 2 or 1
self.caozuo = 1 --记录是否是自己出牌的阶段
self.pass = pass
@ -790,6 +791,7 @@ function M:EventInit()
end
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]._cardCheck:initLastCard(lastCardList)
end)
-- 托管
_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")
self._zhuanpanCtr = _cardbox:GetController("zuozi")
self._ctr_cardbox = _cardbox:GetController("c1")
self._tex_leftTime = _cardbox:GetChild("tex_leftnum")
-- self._ctr_cardbox = _cardbox:GetController("c1")
-- 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
self:Change3d(true)