同步出牌提示

master
罗家炜 2025-05-07 15:38:38 +08:00
parent b502289a2a
commit ff796b86dd
7 changed files with 54 additions and 33 deletions

View File

@ -195,13 +195,13 @@ function M:LoadConfigToDetail(data)
configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2)) configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2))
end end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
end end
if configData.shaozhuang then if configData.shaozhuang then
returnString = string.format("%s%s", returnString, configData.shaozhuang == 0 and "" or ",有烧庄") returnString = string.format("%s%s", returnString, configData.shaozhuang == 0 and "" or ",有烧庄")
end end
if configData.fengding then if configData.fengding then
local matString = "%s,%s" local matString = "%s%s"
if configData.fengding == 0 then if configData.fengding == 0 then
returnString = string.format(matString, returnString, ",封顶20炮") returnString = string.format(matString, returnString, ",封顶20炮")
end end

View File

@ -192,7 +192,7 @@ function M:LoadConfigToDetail(data)
configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2)) configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2))
end end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
end end
if configData.shaozhuang then if configData.shaozhuang then
returnString = string.format("%s%s", returnString, configData.shaozhuang == 0 and "" or ",有烧庄") returnString = string.format("%s%s", returnString, configData.shaozhuang == 0 and "" or ",有烧庄")

View File

@ -79,17 +79,21 @@ function M:initCards(cardList, flag, flag_allCards)
end end
function M:CheckCards() function M:CheckCards()
print("lingmengCheckAloneOrLong")
if self:CheckAloneOrLong() then if self:CheckAloneOrLong() then
return true return true
end end
print("lingmengCheckDuiZi")
if self:CheckDuiZi() then if self:CheckDuiZi() then
return true return true
end end
print("lingmengCheckSanDai")
if self:CheckSanDai() then if self:CheckSanDai() then
return true return true
end end
print("lingmengCheckZha")
if self:CheckZha() then if self:CheckZha() then
return true return true
@ -135,13 +139,16 @@ function M:CheckSanDai()
if self.cardNum == 5 and self.cardSize < 4 then if self.cardNum == 5 and self.cardSize < 4 then
return true return true
end end
if self.threeNoBelt and self.cardNum == 3 and self.cardSize == 1 then
return true
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 true
end end
if self.threeNoBelt and self.cardNum == 3 and self.cardSize == 1 then
return true
end
--飞机 --飞机
local temp_normol_feiji local temp_normol_feiji
if self.cardNum % 5 == 0 then if self.cardNum % 5 == 0 then
@ -173,18 +180,46 @@ function M:CheckSanDai()
end end
end end
print("liengmengCheckSanDai", self.planeNoBelt, self.cardNum) print("liengmengCheckthreelack", self.threelack, self._flag_allCards)
if self.threelack and self._flag_allCards then
local last_k
local num_san = 0
for k, v in pairs(self.cardList) do
if v >= 3 then
num_san = num_san + 1
print("liengmengCheckthreelack2", last_k, k)
if not last_k then
last_k = k
else
if math.abs(last_k - k) ~= 1 then
return
end
last_k = k
end
end
end
print("liengmengCheckthreelack4", num_san, self.cardNum - num_san * 3 < num_san * 2)
if self.cardNum - num_san * 3 < num_san * 2 then
return true
else
return
end
end
print("liengmengCheckplaneNoBelt", self.planeNoBelt, self.cardNum % 3)
if self.planeNoBelt and self.cardNum % 3 == 0 then if self.planeNoBelt and self.cardNum % 3 == 0 then
local last_k local last_k
for i = 1, self.cardSize do for i = 1, self.cardSize do
local k = self.cardListSord[i] local k = self.cardListSord[i]
local v = self.cardList[k] local v = self.cardList[k]
if v == 3 then if v == 3 then
print("liengmengCheckSanDai2")
if not last_k then if not last_k then
last_k = k last_k = k
else else
print("liengmengCheckSanDai3", last_k, k)
if math.abs(last_k - k) ~= 1 then if math.abs(last_k - k) ~= 1 then
return return
end end
@ -196,28 +231,6 @@ function M:CheckSanDai()
end end
return true return true
end end
if self.threelack and self._flag_allCards then
local last_k
local num_san = 0
for k, v in pairs(self.cardList) do
if v >= 3 then
num_san = num_san + 1
if not last_k then
last_k = k
else
if math.abs(last_k - k) ~= 1 then
return
end
end
end
end
if self.cardNum - num_san * 3 < num_san * 2 then
return true
else
return
end
end
end end
function M:CheckZha() function M:CheckZha()

View File

@ -287,6 +287,9 @@ end
function M:LoadConfigToDetail(data) function M:LoadConfigToDetail(data)
local configData = json.decode(data) local configData = json.decode(data)
local returnString = string.format("人数%s人", configData.maxPlayers) local returnString = string.format("人数%s人", configData.maxPlayers)
if configData.leaf then
returnString = string.format("%s,%s", returnString, configData.leaf == 1 and "十五张手牌" or "十六张手牌")
end
if configData.rule then if configData.rule then
returnString = string.format("%s%s", returnString, returnString = string.format("%s%s", returnString,
configData.rule == 1 and ",黑桃三必出" or "") configData.rule == 1 and ",黑桃三必出" or "")

View File

@ -746,6 +746,7 @@ function M:TouchMoveEnd(context)
table.sort(send_card, tableSortNumber) table.sort(send_card, tableSortNumber)
send_card = #xuan_card > 0 and xuan_card or send_card send_card = #xuan_card > 0 and xuan_card or send_card
self._cardCheck:initCards(send_card, #xuan_card > 0, #send_card == self._view_handCard.numItems) self._cardCheck:initCards(send_card, #xuan_card > 0, #send_card == self._view_handCard.numItems)
print("lingmengthis?")
self._ctr_canSendCard.selectedIndex = self._cardCheck:CheckCards() and 1 or 0 self._ctr_canSendCard.selectedIndex = self._cardCheck:CheckCards() and 1 or 0
else else
self._ctr_canSendCard.selectedIndex = 0 self._ctr_canSendCard.selectedIndex = 0
@ -1068,6 +1069,7 @@ function M:BtnEvent()
self:ErrorTip('请选择要出的牌') self:ErrorTip('请选择要出的牌')
else else
self.gameCtr:SendCard(send_card, currentCard) self.gameCtr:SendCard(send_card, currentCard)
self._ctr_canSendCard.selectedIndex = 0
end end
end end
) )
@ -1114,6 +1116,7 @@ function M:BtnEvent()
end end
function M:ShowTipsCard(index) function M:ShowTipsCard(index)
print("lingmengShowTipsCard")
local item = self.tips_card_list[index] local item = self.tips_card_list[index]
for i = 1, #self.card_list do for i = 1, #self.card_list do
local card = self.card_list[i] local card = self.card_list[i]
@ -1126,10 +1129,9 @@ function M:ShowTipsCard(index)
end end
if isExsit == false then if isExsit == false then
self:UpdateCardMove(card.btn_card, false, false) self:UpdateCardMove(card.btn_card, false, false)
else
self._ctr_canSendCard.selectedIndex = 1
end end
end end
self._ctr_canSendCard.selectedIndex = 1
end end
function M:GetHandCardOffset(count) function M:GetHandCardOffset(count)

View File

@ -157,6 +157,9 @@ function M:onTouchMove(context)
else else
local touchPos = self._view_handCardList:GetChildAt(0):GlobalToLocal(Vector2.New(context.inputEvent.x, local touchPos = self._view_handCardList:GetChildAt(0):GlobalToLocal(Vector2.New(context.inputEvent.x,
context.inputEvent.y)) context.inputEvent.y))
if touchPos.x < 0 then
return
end
local cardWidth = button.width; local cardWidth = button.width;
local grap = self._view_handCardList.columnGap local grap = self._view_handCardList.columnGap
local chooseIndex = math.floor(touchPos.x / (cardWidth + grap)) local chooseIndex = math.floor(touchPos.x / (cardWidth + grap))