同步四人左面展示
parent
b3283b922c
commit
552d248de1
|
|
@ -50,17 +50,61 @@ function M:initLastCard(cardList)
|
|||
self.lastCardNum = #cardList
|
||||
table.sort(cardList)
|
||||
pt(cardList)
|
||||
local temp_long = 0
|
||||
self:Clear()
|
||||
self._flag_allCards = false
|
||||
for i = 1, #cardList do
|
||||
local number = math.floor(cardList[i] / 10)
|
||||
if self.cardList[number] then
|
||||
self.cardList[number] = self.cardList[number] + 1
|
||||
else
|
||||
self.cardList[number] = 1
|
||||
self.cardSize = self.cardSize + 1
|
||||
table.insert(self.cardListSord, number)
|
||||
end
|
||||
self.cardNum = self.cardNum + 1
|
||||
if i == 1 then
|
||||
temp_long = 1
|
||||
elseif temp_long == i - 1 then
|
||||
if math.abs(math.floor(cardList[i - 1].card_code_number / 10) - number) == 1 then
|
||||
temp_long = i
|
||||
end
|
||||
end
|
||||
end
|
||||
self.type = -1
|
||||
print("lingmengCheckAloneOrLong2")
|
||||
if self:CheckAloneOrLong() then
|
||||
self.type = self:CheckAloneOrLong()
|
||||
return
|
||||
end
|
||||
print("lingmengCheckDuiZi2")
|
||||
if self:CheckDuiZi() then
|
||||
self.type = self:CheckDuiZi()
|
||||
return
|
||||
end
|
||||
print("lingmengCheckSanDai2")
|
||||
|
||||
if self:CheckSanDai() then
|
||||
self.type = self:CheckSanDai()
|
||||
return
|
||||
end
|
||||
print("lingmengCheckZha2")
|
||||
|
||||
if self:CheckZha() then
|
||||
self.type = self:CheckZha()
|
||||
return
|
||||
end
|
||||
if self.type == -1 then
|
||||
ViewUtil.ErrorTip(-1, "上一份牌型判断错误")
|
||||
end
|
||||
end
|
||||
|
||||
function M:initCards(cardList, flag, flag_allCards, lastCards)
|
||||
function M:initCards(cardList, flag, flag_allCards)
|
||||
print("lingmenginitCards")
|
||||
pt(cardList)
|
||||
local temp_long = 0
|
||||
self:Clear()
|
||||
self._flag_allCards = flag_allCards or false
|
||||
self.cardType = lastCards.type or -1
|
||||
self.cardMaxNum = lastCards.maxNum or 0
|
||||
self.length = lastCards.length or 0
|
||||
if flag then
|
||||
for i = 1, #cardList do
|
||||
local number = math.floor(cardList[i][1].card_code_number / 10)
|
||||
|
|
@ -130,7 +174,8 @@ function M:CheckCards()
|
|||
return false
|
||||
end
|
||||
|
||||
function M:CheckAloneOrLong()
|
||||
function M:CheckAloneOrLong(falg_check)
|
||||
falg_check = falg_check or false
|
||||
if self.cardNum == 1 then
|
||||
return cardType.one
|
||||
end
|
||||
|
|
@ -139,7 +184,8 @@ function M:CheckAloneOrLong()
|
|||
end
|
||||
end
|
||||
|
||||
function M:CheckDuiZi()
|
||||
function M:CheckDuiZi(falg_check)
|
||||
falg_check = falg_check or false
|
||||
if self.cardNum == 2 and self.cardSize == 1 then
|
||||
return cardType.dui
|
||||
end
|
||||
|
|
@ -165,7 +211,8 @@ function M:CheckDuiZi()
|
|||
end
|
||||
end
|
||||
|
||||
function M:CheckSanDai()
|
||||
function M:CheckSanDai(falg_check)
|
||||
falg_check = falg_check or false
|
||||
--三张
|
||||
if self.cardNum == 5 and self.cardSize < 4 then
|
||||
return cardType.threeAndTwo
|
||||
|
|
@ -264,7 +311,8 @@ function M:CheckSanDai()
|
|||
end
|
||||
end
|
||||
|
||||
function M:CheckZha()
|
||||
function M:CheckZha(falg_check)
|
||||
falg_check = falg_check or false
|
||||
if self.cardNum == 4 and self.cardSize == 1 then
|
||||
return cardType.zha
|
||||
end
|
||||
|
|
|
|||
|
|
@ -745,7 +745,7 @@ function M:TouchMoveEnd(context)
|
|||
if #send_card > 0 then
|
||||
table.sort(send_card, tableSortNumber)
|
||||
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.lastCard)
|
||||
self._cardCheck:initCards(send_card, #xuan_card > 0, #send_card == self._view_handCard.numItems)
|
||||
self._ctr_canSendCard.selectedIndex = self._cardCheck:CheckCards() and 1 or 0
|
||||
else
|
||||
self._ctr_canSendCard.selectedIndex = 0
|
||||
|
|
@ -796,7 +796,6 @@ function M:ShowOutCardOption(ctr_select, type, number, length, mustPutMaxCard, p
|
|||
self.send_card = {}
|
||||
self.tips_card_list = self:GetCardTips(type, number, length, mustPutMaxCard)
|
||||
self._ctr_canSendCard.selectedIndex = 0
|
||||
self.lastCard = self.newLastCardTable(type, number, length)
|
||||
|
||||
if #self.tips_card_list >= 1 then
|
||||
-- body --在这个方法里添加判断抬起牌是否符合出牌类型(少跑一次手牌循环)
|
||||
|
|
@ -827,14 +826,6 @@ function M:ShowOutCardOption(ctr_select, type, number, length, mustPutMaxCard, p
|
|||
self.ctr_put_card_option.selectedIndex = ctr_select
|
||||
end
|
||||
|
||||
function M.newLastCardTable(type, number, length)
|
||||
local newtable = {}
|
||||
newtable.type = type
|
||||
newtable.maxNum = number
|
||||
newtable.length = length
|
||||
return newtable
|
||||
end
|
||||
|
||||
-- function M:SetOutCardInfo(cardlist, isPass, isAnim)
|
||||
-- self.ctr_put_card_option.selectedIndex = 0
|
||||
-- for i = 1, #self.out_card_list do
|
||||
|
|
@ -1052,7 +1043,7 @@ function M:UpdateHandCardsColor()
|
|||
end
|
||||
if #send_card > 0 then
|
||||
table.sort(send_card, tableSortNumber)
|
||||
self._cardCheck:initCards(send_card, false, #send_card == self._view_handCard.numItems, self.lastCard)
|
||||
self._cardCheck:initCards(send_card, false, #send_card == self._view_handCard.numItems)
|
||||
self._ctr_canSendCard.selectedIndex = self._cardCheck:CheckCards() and 1 or 0
|
||||
else
|
||||
self._ctr_canSendCard.selectedIndex = 0
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue