2025-05-24 14:29:14 +08:00
|
|
|
---
|
|
|
|
|
--- Created by 谌建军.
|
|
|
|
|
--- DateTime: 2017/12/13 17:04
|
|
|
|
|
---
|
|
|
|
|
local RunFast_PlayerPokerInfoView = import('.RunFast_PlayerPokerInfoView')
|
|
|
|
|
local RunFast_CardType = import('.RunFast_CardType')
|
|
|
|
|
|
|
|
|
|
local CardView = {
|
|
|
|
|
btn_card = nil,
|
|
|
|
|
-- 牌号码 (大小)
|
|
|
|
|
card_code_number = 0,
|
|
|
|
|
-- 牌号码 (花色)
|
|
|
|
|
card_code_flower = 0,
|
|
|
|
|
-- 索引
|
|
|
|
|
index = 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local function NewCardView(card, cardcodenum, cardcodeflower)
|
|
|
|
|
local self = {}
|
2025-05-26 01:39:48 +08:00
|
|
|
setmetatable(self, { __index = CardView })
|
2025-05-24 14:29:14 +08:00
|
|
|
self.btn_card = card
|
|
|
|
|
self.card_code_number = cardcodenum
|
|
|
|
|
self.card_code_flower = cardcodeflower
|
|
|
|
|
self.card_isTouchable = 0
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function tableSortNumber(a, b)
|
|
|
|
|
return a.card_code_number > b.card_code_number
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local RunFast_PlayerSelfPokerInfoView = {
|
|
|
|
|
_view = nil,
|
|
|
|
|
_mainView = nil,
|
|
|
|
|
_mask_liangpai = nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local M = RunFast_PlayerSelfPokerInfoView
|
|
|
|
|
|
|
|
|
|
function M.new(view, mainView)
|
2025-05-26 01:39:48 +08:00
|
|
|
setmetatable(M, { __index = RunFast_PlayerPokerInfoView })
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
2025-05-24 14:29:14 +08:00
|
|
|
self._view = view
|
|
|
|
|
self._mainView = mainView
|
|
|
|
|
self.gameCtr = ControllerManager.GetController(GameController)
|
|
|
|
|
self:init()
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:init()
|
|
|
|
|
self.Reset = false
|
|
|
|
|
self.ctr_outpoker = self._view:GetController('output')
|
|
|
|
|
self.outpoker_list = self._view:GetChild('out_card_list')
|
|
|
|
|
self.item_data = json.decode(self._view:GetChild('area_mask').text)
|
|
|
|
|
self.out_card_data = self.item_data['outcard_list']
|
|
|
|
|
self.hand_card_list = self._view:GetChild('hand_card_list')
|
|
|
|
|
self.ctr_hand_card_pos = self._view:GetChild('hand_card_list')
|
|
|
|
|
self._mask_liangpai = self._view:GetChild('mask_liangpai')
|
|
|
|
|
self.card_width = 129
|
|
|
|
|
self.cards_view = self._view:GetChild('hand_poker_c')
|
|
|
|
|
self.card_list = {}
|
|
|
|
|
self.out_card_list = {}
|
|
|
|
|
self.touchMoveFun = handler(self, self.TouchMoving)
|
|
|
|
|
self.ctr_put_card_option = self._view:GetController('out_card_option')
|
|
|
|
|
self.ctr_piao = self._view:GetController('piao')
|
|
|
|
|
self.ctr_piao_value = self._view:GetController('piao_value')
|
|
|
|
|
self.ctr_put_error = self._view:GetController('put_error')
|
|
|
|
|
self.put_error_text = self._view:GetChild('put_error')
|
|
|
|
|
|
|
|
|
|
self.ctr_select_card_type = self._view:GetController('select_card_type')
|
|
|
|
|
self.select_card_type_view = self._view:GetChild('choose_type')
|
|
|
|
|
|
|
|
|
|
self.text_bomb_score = self._view:GetChild('Score')
|
|
|
|
|
self.ani_bomb_score = self._view:GetTransition('score')
|
|
|
|
|
self.ani_result_score = self._view:GetTransition('score_1')
|
|
|
|
|
|
|
|
|
|
self.send_card = {}
|
|
|
|
|
self.tips_click_count = 0
|
|
|
|
|
self:BtnEvent()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:InitPoker(pokerList, isPlayAni, open)
|
|
|
|
|
-- self.zhizhanctr_select=0
|
|
|
|
|
-- self.zhizhantype=0
|
|
|
|
|
-- self.zhizhannumber=0
|
|
|
|
|
-- self.zhizhanlength=0
|
|
|
|
|
-- self.zhizhanmustPutMaxCard=0
|
|
|
|
|
-- self.zhizhanplay=0
|
|
|
|
|
-- self.zhizhanzdts=0
|
2025-05-28 03:10:00 +08:00
|
|
|
local cs = 1.35
|
2025-05-26 01:39:48 +08:00
|
|
|
if DataManager.CurrenRoom.cardsize == 0 then
|
2025-05-28 03:10:00 +08:00
|
|
|
cs = 1.45
|
2025-05-24 14:29:14 +08:00
|
|
|
elseif DataManager.CurrenRoom.cardsize == 1 then
|
2025-05-28 03:10:00 +08:00
|
|
|
cs = 1.35
|
2025-05-24 14:29:14 +08:00
|
|
|
elseif DataManager.CurrenRoom.cardsize == 2 then
|
2025-05-28 03:10:00 +08:00
|
|
|
cs = 1.25
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if self.cor_init_poker ~= nil then
|
|
|
|
|
coroutine.stop(self.cor_init_poker)
|
|
|
|
|
end
|
|
|
|
|
-- print(vardump(self.card_list))
|
|
|
|
|
self.cor_init_poker = nil
|
|
|
|
|
self.card_list = {}
|
|
|
|
|
|
|
|
|
|
self.cards_view:RemoveChildren(0, -1, true)
|
|
|
|
|
if isPlayAni == true then
|
|
|
|
|
self.cor_init_poker =
|
|
|
|
|
coroutine.start(
|
2025-05-26 01:39:48 +08:00
|
|
|
function()
|
|
|
|
|
self._mainView._popEvent = false
|
|
|
|
|
if self._mainView._rightPanelView._settingView ~= nil then
|
|
|
|
|
self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(false)
|
|
|
|
|
end
|
|
|
|
|
table.sort(pokerList)
|
|
|
|
|
|
|
|
|
|
for i = 1, #pokerList do
|
|
|
|
|
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
|
|
|
|
local card_flower_code = pokerList[i]
|
|
|
|
|
local btn_card = self:CreatPoker(card_number_code, cs, open)
|
|
|
|
|
local x, y = self._view.width / 2 + 100, -200
|
|
|
|
|
btn_card:SetXY(x, y)
|
|
|
|
|
btn_card.alpha = 0
|
|
|
|
|
btn_card.touchable = false
|
|
|
|
|
-- coroutine.wait(0.05)
|
|
|
|
|
self.cards_view:AddChild(btn_card)
|
|
|
|
|
local card_view = NewCardView(btn_card, card_number_code, card_flower_code)
|
|
|
|
|
self.card_list[#self.card_list + 1] = card_view
|
|
|
|
|
|
|
|
|
|
table.sort(self.card_list, tableSortNumber)
|
|
|
|
|
|
|
|
|
|
if i == #pokerList then
|
|
|
|
|
for j = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[j]
|
|
|
|
|
card.btn_card.touchable = true
|
|
|
|
|
if open ~= 1 then
|
|
|
|
|
-- body
|
|
|
|
|
self:AddCardMoveEvent(card)
|
|
|
|
|
end
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-05-26 01:39:48 +08:00
|
|
|
for j = #self.card_list, 1, -1 do
|
|
|
|
|
-- ViewUtil.PlaySound('RunFastNew_PK', 'extend/poker/runfast/sound/mopai.mp3')
|
|
|
|
|
local card_view = self.card_list[j]
|
|
|
|
|
card_view.index = j
|
|
|
|
|
self.cards_view:SetChildIndex(card_view.btn_card, card_view.index - 1)
|
|
|
|
|
|
|
|
|
|
card_view.btn_card:TweenMove(self:GetHandCardPos(j, #self.card_list), 0.10)
|
|
|
|
|
DSTween.To(
|
|
|
|
|
0.7,
|
|
|
|
|
1,
|
|
|
|
|
0.1,
|
|
|
|
|
function(value)
|
|
|
|
|
card_view.btn_card:SetScale(value, value)
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
DSTween.To(
|
|
|
|
|
0.7,
|
|
|
|
|
1,
|
|
|
|
|
0.1,
|
|
|
|
|
function(value)
|
|
|
|
|
card_view.btn_card.alpha = value
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
card_view.btn_card.alpha = 1
|
|
|
|
|
end
|
2025-05-24 14:29:14 +08:00
|
|
|
|
2025-05-26 01:39:48 +08:00
|
|
|
self._mainView._popEvent = true
|
|
|
|
|
if self._mainView._rightPanelView._settingView ~= nil then
|
|
|
|
|
self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(true)
|
|
|
|
|
end
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
2025-05-26 01:39:48 +08:00
|
|
|
)
|
2025-05-24 14:29:14 +08:00
|
|
|
else
|
|
|
|
|
for i = 1, #pokerList do
|
|
|
|
|
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
|
|
|
|
local card_flower_code = pokerList[i]
|
|
|
|
|
local btn_card = self:CreatPoker(card_number_code, cs, open)
|
|
|
|
|
self.cards_view:AddChild(btn_card)
|
|
|
|
|
local card_view = NewCardView(btn_card, card_number_code, card_flower_code)
|
|
|
|
|
self.card_list[#self.card_list + 1] = card_view
|
|
|
|
|
end
|
|
|
|
|
table.sort(self.card_list, tableSortNumber)
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[i]
|
|
|
|
|
card.index = i
|
|
|
|
|
self.cards_view:SetChildIndex(card.btn_card, card.index - 1)
|
|
|
|
|
card.btn_card.xy = self:GetHandCardPos(i, #self.card_list)
|
|
|
|
|
if open ~= 1 then
|
|
|
|
|
-- body
|
|
|
|
|
self:AddCardMoveEvent(card)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:updatePoker()
|
|
|
|
|
local templist = {}
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
templist[#templist + 1] = self.card_list[i].card_code_flower
|
|
|
|
|
end
|
|
|
|
|
self:InitPoker(templist, false, 0)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:AddCardMoveEvent(card)
|
|
|
|
|
local send_card = {}
|
|
|
|
|
|
|
|
|
|
card.btn_card.onTouchBegin:Set(
|
|
|
|
|
function(context)
|
|
|
|
|
self.send_card = {}
|
|
|
|
|
if card.btn_card.touchable == false then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local xy = self.cards_view:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
|
|
|
|
if xy.y > -21 and xy.y < 221 then
|
|
|
|
|
self.touchBegin = xy
|
|
|
|
|
Stage.inst.onTouchMove:Add(self.touchMoveFun)
|
|
|
|
|
--Stage.inst.onClick:Add(self.touchMoveFun)
|
|
|
|
|
card.btn_card.onTouchEnd:Set(
|
|
|
|
|
function(context)
|
|
|
|
|
local xy =
|
|
|
|
|
self.cards_view:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
|
|
|
|
Stage.inst.onTouchMove:Remove(self.touchMoveFun)
|
|
|
|
|
--Stage.inst.onClick:onTouchMove(self.touchMoveFun)
|
|
|
|
|
if xy.y > -21 and xy.y < 221 then
|
|
|
|
|
if xy.x - self.touchBegin.x > 0 then
|
|
|
|
|
local max_x = xy.x
|
|
|
|
|
local min_x = self.touchBegin.x
|
|
|
|
|
for k = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[k]
|
|
|
|
|
|
|
|
|
|
-- for i = 1, #self.card_list do
|
|
|
|
|
-- local card = self.card_list[i]
|
|
|
|
|
-- if card.btn_card.selected then
|
|
|
|
|
-- send_card[#send_card + 1] = card.card_code_flower
|
|
|
|
|
-- self.send_card[#self.send_card + 1] = card
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
if card.btn_card.touchable == true then
|
|
|
|
|
send_card[#send_card + 1] = card
|
|
|
|
|
|
|
|
|
|
self:SetBtnCardColor(card, 1)
|
|
|
|
|
if k == #self.card_list then
|
|
|
|
|
if
|
|
|
|
|
card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and
|
2025-05-26 01:39:48 +08:00
|
|
|
card.card_isTouchable == 0
|
|
|
|
|
then
|
2025-05-24 14:29:14 +08:00
|
|
|
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
2025-05-26 01:39:48 +08:00
|
|
|
--ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if
|
|
|
|
|
card.btn_card.x +
|
2025-05-26 01:39:48 +08:00
|
|
|
(self.card_width + self:GetHandCardOffset(#self.card_list)) >
|
|
|
|
|
min_x and
|
|
|
|
|
card.btn_card.x < max_x and
|
|
|
|
|
card.card_isTouchable == 0
|
|
|
|
|
then
|
2025-05-24 14:29:14 +08:00
|
|
|
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
2025-05-26 01:39:48 +08:00
|
|
|
--ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
local max_x = self.touchBegin.x
|
|
|
|
|
local min_x = xy.x
|
|
|
|
|
-- self.send_card = {}
|
|
|
|
|
for k = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[k]
|
|
|
|
|
|
|
|
|
|
-- for i = 1, #self.card_list do
|
|
|
|
|
-- local card = self.card_list[i]
|
|
|
|
|
-- if card.btn_card.selected then
|
|
|
|
|
-- send_card[#send_card + 1] = card.card_code_flower
|
|
|
|
|
-- self.send_card[#self.send_card + 1] = card
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
if card.btn_card.touchable == true then
|
|
|
|
|
send_card[#send_card + 1] = card
|
|
|
|
|
self:SetBtnCardColor(card, 1)
|
|
|
|
|
--print(vardump(card))
|
|
|
|
|
if k == #self.card_list then
|
|
|
|
|
if
|
|
|
|
|
card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and
|
2025-05-26 01:39:48 +08:00
|
|
|
card.card_isTouchable == 0
|
|
|
|
|
then
|
2025-05-24 14:29:14 +08:00
|
|
|
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
2025-05-26 01:39:48 +08:00
|
|
|
--ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if
|
|
|
|
|
card.btn_card.x +
|
2025-05-26 01:39:48 +08:00
|
|
|
(self.card_width + self:GetHandCardOffset(#self.card_list)) >
|
|
|
|
|
min_x and
|
|
|
|
|
card.btn_card.x < max_x and
|
|
|
|
|
card.card_isTouchable == 0
|
|
|
|
|
then
|
2025-05-24 14:29:14 +08:00
|
|
|
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
2025-05-26 01:39:48 +08:00
|
|
|
--ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
ViewUtil.PlaySound('RunFastNew_PK', 'extend/poker/runfast/sound/click.mp3')
|
|
|
|
|
else
|
|
|
|
|
self.touchBegin = Vector2.New(0, 0)
|
|
|
|
|
for k = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[k]
|
|
|
|
|
if card.btn_card.touchable == true then
|
|
|
|
|
self:SetBtnCardColor(card, 1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Stage.inst:ResetInputState()
|
|
|
|
|
card.btn_card.onTouchEnd:Set(nil)
|
|
|
|
|
|
|
|
|
|
self:zhizhanxuanpai()
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
local button = card.btn_card
|
|
|
|
|
button.onChanged:Add(
|
|
|
|
|
function()
|
|
|
|
|
-- body
|
|
|
|
|
if card.btn_card.selected == true then
|
|
|
|
|
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
|
|
|
|
else
|
|
|
|
|
self:UpdateCardMove(card.btn_card, card.btn_card.selected, false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
end
|
2025-05-26 01:39:48 +08:00
|
|
|
|
2025-05-24 14:29:14 +08:00
|
|
|
function M:zhizhanxuanpai() --智障选牌
|
|
|
|
|
-- body
|
|
|
|
|
local temp_send_card = {}
|
|
|
|
|
for i = 1, #self.send_card do
|
|
|
|
|
if self.send_card[i] ~= self.send_card[i - 1] then
|
|
|
|
|
-- body
|
|
|
|
|
temp_send_card[#temp_send_card + 1] = self.send_card[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local card_map, max_key = self:GetCardMapAndMaxKey(temp_send_card)
|
|
|
|
|
|
|
|
|
|
list_type1, touch_type1 = self:CheckPairs(card_map, 0, 8)
|
|
|
|
|
|
|
|
|
|
list_type2, touch_type2 = self:CheckPlane(card_map, 0, 6, 0)
|
|
|
|
|
list_bomb, touch_bomb = self:CheckBomb(card_map, 0, 4)
|
|
|
|
|
|
|
|
|
|
local list_type, touch_type = self:CheckOnes(card_map, 0, 11)
|
|
|
|
|
for i = 5, 11 do
|
|
|
|
|
local list_temp, touch_temp = self:CheckOnes(card_map, 0, i)
|
|
|
|
|
if list_temp[1] ~= nil then
|
|
|
|
|
-- body
|
|
|
|
|
list_type = list_temp
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local temp_list = list_type[1]
|
|
|
|
|
local temp_list1 = list_type1[1]
|
|
|
|
|
local temp_list2 = list_type2[1]
|
|
|
|
|
local temp_bomb = list_bomb[1]
|
|
|
|
|
if self.xunpai == nil then
|
|
|
|
|
-- body
|
|
|
|
|
self.xunpai = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if temp_list ~= nil and temp_list1 == nil and temp_list2 == nil and temp_bomb == nil and #temp_list > #self.xunpai then
|
|
|
|
|
for i = 1, #self.send_card do
|
|
|
|
|
self:UpdateCardMove(self.send_card[i].btn_card, false, false)
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #self.send_card do
|
|
|
|
|
for j = 1, #temp_list do
|
|
|
|
|
if self.send_card[i] == temp_list[j] then
|
|
|
|
|
-- body
|
|
|
|
|
self:UpdateCardMove(self.send_card[i].btn_card, true, false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
self.xunpai = temp_list
|
|
|
|
|
else
|
|
|
|
|
self.xunpai = {}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:TouchMoving(context)
|
|
|
|
|
if self.cards_view == nil then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local send_card1 = {}
|
|
|
|
|
local xy = self.cards_view:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
|
|
|
|
self.isTouching = true
|
|
|
|
|
if xy.x - self.touchBegin.x > 0 then -- 往右边滑
|
|
|
|
|
--printlog("cccccccccccccc1111111111111111111111111")
|
|
|
|
|
local max_x = xy.x
|
|
|
|
|
local min_x = self.touchBegin.x
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[i]
|
|
|
|
|
if card.btn_card.touchable == false or card.card_isTouchable == 1 then
|
|
|
|
|
else
|
|
|
|
|
if
|
|
|
|
|
card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and
|
2025-05-26 01:39:48 +08:00
|
|
|
card.btn_card.x < max_x
|
|
|
|
|
then
|
2025-05-24 14:29:14 +08:00
|
|
|
printlog("cccccccccccccc22222222222222")
|
|
|
|
|
self:SetBtnCardColor(card, 0.8)
|
|
|
|
|
if #send_card1 == 0 then
|
|
|
|
|
-- body
|
|
|
|
|
send_card1[1] = card
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #send_card1 do
|
|
|
|
|
if send_card1[i] ~= card then
|
|
|
|
|
-- body
|
|
|
|
|
send_card1[#send_card1 + 1] = card
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
|
|
|
|
-- card.card_isTouchable = 1
|
|
|
|
|
-- ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
|
|
|
|
self:SetBtnCardColor(card, 1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif xy.x - self.touchBegin.x < 0 then -- 左边滑
|
|
|
|
|
local max_x = self.touchBegin.x
|
|
|
|
|
local min_x = xy.x
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[i]
|
|
|
|
|
if card.btn_card.touchable == false or card.card_isTouchable == 1 then
|
|
|
|
|
else
|
|
|
|
|
if
|
|
|
|
|
card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and
|
2025-05-26 01:39:48 +08:00
|
|
|
card.btn_card.x < max_x
|
|
|
|
|
then
|
2025-05-24 14:29:14 +08:00
|
|
|
-- self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
|
|
|
|
-- card.card_isTouchable = 1
|
|
|
|
|
-- ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
|
|
|
|
self:SetBtnCardColor(card, 0.8)
|
|
|
|
|
if #send_card1 == 0 then
|
|
|
|
|
-- body
|
|
|
|
|
send_card1[1] = card
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #send_card1 do
|
|
|
|
|
if send_card1[i] ~= card then
|
|
|
|
|
-- body
|
|
|
|
|
send_card1[#send_card1 + 1] = card
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
self:SetBtnCardColor(card, 1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--print(vardump(send_card1))
|
|
|
|
|
-- local send_card = {}
|
|
|
|
|
-- self.send_card = {}
|
|
|
|
|
-- for i = 1, #self.card_list do
|
|
|
|
|
-- local card = self.card_list[i]
|
|
|
|
|
-- if card.btn_card.selected then
|
|
|
|
|
-- send_card[#send_card + 1] = card.card_code_flower
|
|
|
|
|
-- self.send_card[#self.send_card + 1] = card
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
self.send_card = send_card1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:SetBtnCardColor(card, num)
|
|
|
|
|
if
|
|
|
|
|
card.btn_card:GetChildAt(0) ~= nil and card.btn_card:GetChildAt(0):GetChildAt(0) ~= nil and
|
2025-05-26 01:39:48 +08:00
|
|
|
card.btn_card:GetChildAt(0):GetChildAt(0):GetChildAt(0) ~= nil
|
|
|
|
|
then
|
2025-05-24 14:29:14 +08:00
|
|
|
-- body
|
|
|
|
|
card.btn_card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(num, num, num)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--if card.card_code_flower < 500 then
|
|
|
|
|
-- card.btn_card:GetChildAt(0):GetChildAt(2).color = Color(num,num,num)
|
|
|
|
|
-- card.btn_card:GetChildAt(0):GetChildAt(3).color = Color(num,num,num)
|
|
|
|
|
--end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ShowPiao(piao)
|
|
|
|
|
self.ctr_piao.selectedIndex = piao
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:HidePiao()
|
|
|
|
|
self.ctr_piao.selectedIndex = 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ShowOutCardOption(ctr_select, type, number, length, mustPutMaxCard, play, zdts)
|
|
|
|
|
--for i = 1, #self.out_card_list do
|
|
|
|
|
-- local card = self.out_card_list[i]
|
|
|
|
|
-- self.cards_view:RemoveChild(card.btn_card,true)
|
|
|
|
|
--end
|
|
|
|
|
--self.out_card_list = {}
|
|
|
|
|
|
|
|
|
|
-- self.zhizhanctr_select=ctr_select
|
|
|
|
|
-- self.zhizhantype=type
|
|
|
|
|
-- self.zhizhannumber=number
|
|
|
|
|
-- self.zhizhanlength=length
|
|
|
|
|
-- self.zhizhanmustPutMaxCard=mustPutMaxCard
|
|
|
|
|
-- self.zhizhanplay=play
|
|
|
|
|
-- self.zhizhanzdts=zdts
|
|
|
|
|
self.tips_click_count = 0
|
|
|
|
|
self.send_card = {}
|
|
|
|
|
self.tips_card_list = self:GetCardTips(type, number, length, mustPutMaxCard)
|
|
|
|
|
|
|
|
|
|
if #self.tips_card_list >= 1 then
|
|
|
|
|
-- body
|
|
|
|
|
self:UpdateHandCardsColor()
|
|
|
|
|
end
|
|
|
|
|
--
|
|
|
|
|
-- 自动提示
|
|
|
|
|
-- if #self.tips_card_list ~= 0 and play~=0 and mustPutMaxCard==false and zdts==1 then
|
|
|
|
|
-- local index = self.tips_click_count % #self.tips_card_list + 1
|
|
|
|
|
-- self:ShowTipsCard(index)
|
|
|
|
|
-- self.tips_click_count = self.tips_click_count + 1
|
|
|
|
|
-- end
|
|
|
|
|
if #self.tips_card_list == 2 and self.tips_card_list[2][1].index == self.tips_card_list[1][1].index then
|
|
|
|
|
if #self.tips_card_list[2] == #self.tips_card_list[1] then
|
|
|
|
|
for i = 1, #self.tips_card_list[2] do
|
|
|
|
|
if self.tips_card_list[2][i].index == self.tips_card_list[1][i].index then
|
|
|
|
|
self:ShowTipsCard(1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif #self.tips_card_list == 1 then
|
|
|
|
|
self:ShowTipsCard(1)
|
|
|
|
|
end
|
|
|
|
|
if mustPutMaxCard and play ~= 0 and zdts == 1 then
|
|
|
|
|
-- body
|
|
|
|
|
self:ShowTipsCard(#self.tips_card_list)
|
|
|
|
|
end
|
|
|
|
|
self.ctr_put_card_option.selectedIndex = ctr_select
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:SetOutCardInfo(cardlist, isPass, isAnim)
|
|
|
|
|
self.ctr_put_card_option.selectedIndex = 0
|
|
|
|
|
for i = 1, #self.out_card_list do
|
|
|
|
|
local card = self.out_card_list[i]
|
|
|
|
|
self.cards_view:RemoveChild(card, true)
|
|
|
|
|
end
|
|
|
|
|
self.out_card_list = {}
|
|
|
|
|
if cardlist ~= nil then
|
|
|
|
|
-- todo
|
|
|
|
|
self:SetOutCardList(cardlist, isAnim)
|
|
|
|
|
else
|
|
|
|
|
if isPass == true then
|
|
|
|
|
self.ctr_outpoker.selectedIndex = 2
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card_view = self.card_list[i]
|
|
|
|
|
card_view.btn_card.touchable = true
|
|
|
|
|
self:UpdateCardMove(card_view.btn_card, false, false)
|
|
|
|
|
self:SetBtnCardColor(card_view, 1)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
self.ctr_outpoker.selectedIndex = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:SetOutCardBlack()
|
|
|
|
|
for i = 1, #self.out_card_list do
|
|
|
|
|
local card = self.out_card_list[i]
|
2025-05-26 01:39:48 +08:00
|
|
|
if card and card:GetChildAt(0) and card:GetChildAt(0):GetChildAt(0) and card:GetChildAt(0):GetChildAt(0):GetChildAt(0) then
|
|
|
|
|
card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
|
|
|
|
|
end
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:SetOutCardList(cardlist, isAnim)
|
|
|
|
|
local pos_y = -200
|
|
|
|
|
if isAnim then
|
|
|
|
|
-- self.zhizhanctr_select=0
|
|
|
|
|
-- self.zhizhantype=0
|
|
|
|
|
-- self.zhizhannumber=0
|
|
|
|
|
-- self.zhizhanlength=0
|
|
|
|
|
-- self.zhizhanmustPutMaxCard=0
|
|
|
|
|
-- self.zhizhanplay=0
|
|
|
|
|
-- self.zhizhanzdts=0
|
|
|
|
|
if self.move_cor then
|
|
|
|
|
coroutine.stop(self.move_cor)
|
|
|
|
|
self.move_cor = nil
|
|
|
|
|
end
|
|
|
|
|
local time = 0.1
|
|
|
|
|
for i = 1, #cardlist do
|
|
|
|
|
local card_code_number = cardlist[i]
|
|
|
|
|
for j = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[j]
|
|
|
|
|
if card_code_number == card.card_code_number then
|
|
|
|
|
card.btn_card.onTouchBegin:Set(nil)
|
|
|
|
|
self.out_card_list[#self.out_card_list + 1] = card.btn_card
|
|
|
|
|
list_remove(self.card_list, card)
|
|
|
|
|
-- todo 出牌动画
|
|
|
|
|
local pos =
|
|
|
|
|
self:GetOutCardEndPokerPos(
|
2025-05-26 01:39:48 +08:00
|
|
|
i,
|
|
|
|
|
#cardlist,
|
|
|
|
|
self.cards_view,
|
|
|
|
|
card.btn_card,
|
|
|
|
|
self.out_card_data['maxcount_x'],
|
|
|
|
|
0.7
|
|
|
|
|
)
|
2025-05-24 14:29:14 +08:00
|
|
|
card.btn_card:TweenMove(Vector2.New(pos.x, pos_y), time)
|
|
|
|
|
-- self.tween = TweenUtils.TweenFloat(1, 0.7, time, function(x)
|
|
|
|
|
-- card.btn_card:GetChildAt(0):SetScale(x, x)
|
|
|
|
|
-- end)
|
|
|
|
|
card.btn_card:GetChildAt(0):SetScale(0.7, 0.7)
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
self.move_cor =
|
|
|
|
|
coroutine.start(
|
2025-05-26 01:39:48 +08:00
|
|
|
function()
|
|
|
|
|
coroutine.wait(0.05)
|
|
|
|
|
for i = 1, #self.out_card_list do
|
|
|
|
|
local card = self.out_card_list[i]
|
|
|
|
|
self.cards_view:SetChildIndex(card, i - 1)
|
|
|
|
|
end
|
|
|
|
|
coroutine.wait(0.1)
|
|
|
|
|
ViewUtil.PlaySound('RunFastNew_PK', 'extend/poker/runfast/sound/chupai.mp3')
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
2025-05-26 01:39:48 +08:00
|
|
|
)
|
2025-05-24 14:29:14 +08:00
|
|
|
else
|
|
|
|
|
for i = 1, #cardlist do
|
|
|
|
|
local poker_item = UIPackage.CreateObject('Extend_Poker_RunFastNew', 'poker7')
|
|
|
|
|
local code = self:ChangeCodeByTo(cardlist[i])
|
|
|
|
|
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/" .. code)
|
|
|
|
|
local card_code_obj
|
|
|
|
|
-- if DataManager.CurrenRoom.pai==0 then
|
|
|
|
|
-- card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/"..code)
|
|
|
|
|
-- else
|
|
|
|
|
-- card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2")
|
|
|
|
|
-- end
|
|
|
|
|
-- if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
|
|
|
|
-- -- body
|
|
|
|
|
-- card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/" .. code .. "_1")
|
|
|
|
|
-- end
|
|
|
|
|
if DataManager.CurrenRoom.pai == 0 then
|
|
|
|
|
if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
|
|
|
|
-- body
|
|
|
|
|
card_code_obj = UIPackage.CreateObjectFromURL('ui://Extend_Poker_RunFastNew/' .. code .. '_1')
|
|
|
|
|
else
|
|
|
|
|
card_code_obj = UIPackage.CreateObjectFromURL('ui://Extend_Poker_RunFastNew/' .. code)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
|
|
|
|
-- body
|
|
|
|
|
card_code_obj = UIPackage.CreateObjectFromURL('ui://Extend_Poker_RunFastNew/' .. code .. '_2')
|
|
|
|
|
else
|
|
|
|
|
card_code_obj = UIPackage.CreateObjectFromURL('ui://Main_Poker/' .. code .. '_2')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if card_code_obj == nil then
|
|
|
|
|
card_code_obj = UIPackage.CreateObjectFromURL('ui://Main_Poker/00')
|
|
|
|
|
end
|
|
|
|
|
card_code_obj:SetScale(0.7, 0.7)
|
|
|
|
|
poker_item:AddChild(card_code_obj)
|
|
|
|
|
--local poker = self:CreatPoker(cardlist[i],0.7)
|
|
|
|
|
self.cards_view:AddChild(poker_item)
|
|
|
|
|
local pos =
|
|
|
|
|
self:GetOutCardEndPokerPos(
|
2025-05-26 01:39:48 +08:00
|
|
|
i,
|
|
|
|
|
#cardlist,
|
|
|
|
|
self.cards_view,
|
|
|
|
|
poker_item,
|
|
|
|
|
self.out_card_data['maxcount_x'],
|
|
|
|
|
1
|
|
|
|
|
)
|
2025-05-24 14:29:14 +08:00
|
|
|
poker_item.xy = Vector2.New(pos.x, pos_y)
|
|
|
|
|
self.out_card_list[#self.out_card_list + 1] = poker_item
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:DeleteHandCards(cardlist)
|
|
|
|
|
for i = 1, #cardlist do
|
|
|
|
|
local card_code_number = cardlist[i]
|
|
|
|
|
for j = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[j]
|
|
|
|
|
if card_code_number == card.card_code_number then
|
|
|
|
|
--self.out_card_list[#self.out_card_list + 1] = card
|
|
|
|
|
list_remove(self.card_list, card)
|
|
|
|
|
-- todo 出牌动画
|
|
|
|
|
self.cards_view:RemoveChild(card.btn_card, true)
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
self:UpdateHandCardsPos()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:UpdateHandCardsPos()
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card_view = self.card_list[i]
|
|
|
|
|
card_view.index = i
|
|
|
|
|
card_view.btn_card.touchable = true
|
|
|
|
|
self.cards_view:SetChildIndex(card_view.btn_card, card_view.index - 1)
|
|
|
|
|
--card_view.btn_card.xy = self:GetHandCardPos(i, #self.card_list)
|
|
|
|
|
card_view.btn_card:TweenMove(self:GetHandCardPos(i, #self.card_list), 0.1)
|
|
|
|
|
self:UpdateCardMove(card_view.btn_card, false, false)
|
|
|
|
|
self:SetBtnCardColor(card_view, 1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ResetPoker()
|
|
|
|
|
self.Reset = true
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card_view = self.card_list[i]
|
|
|
|
|
self:UpdateCardMove(card_view.btn_card, false, false)
|
|
|
|
|
end
|
|
|
|
|
self.send_card = {}
|
|
|
|
|
self.Reset = false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:UpdateCardMove(btn_card, isSelected, isPlay)
|
|
|
|
|
btn_card.selected = isSelected
|
|
|
|
|
local card_Move = btn_card:GetChildAt(0)
|
|
|
|
|
local xy = isSelected == true and Vector2.New(0, -30) or Vector2.New(0, 0)
|
|
|
|
|
if isPlay then
|
|
|
|
|
-- body
|
|
|
|
|
card_Move:TweenMove(xy, 0)
|
|
|
|
|
else
|
|
|
|
|
card_Move:TweenMove(xy, 0)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
function M:UpdateHandCardsColor()
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card_view = self.card_list[i]
|
|
|
|
|
local num = card_view.btn_card.touchable == true and 1 or 0.6
|
|
|
|
|
self:SetBtnCardColor(card_view, num)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:BtnEvent()
|
|
|
|
|
self.btn_not_put = self._view:GetChild('btn_not_put')
|
|
|
|
|
self.btn_tips = self._view:GetChild('btn_tips')
|
|
|
|
|
self.btn_put = self._view:GetChild('btn_put')
|
|
|
|
|
|
|
|
|
|
self.btn_put.onClick:Set(
|
|
|
|
|
function()
|
|
|
|
|
if self.Reset then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local send_card = {}
|
|
|
|
|
self.send_card = {}
|
2025-05-26 01:39:48 +08:00
|
|
|
local currentCard = {}
|
2025-05-24 14:29:14 +08:00
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[i]
|
2025-05-26 01:39:48 +08:00
|
|
|
table.insert(currentCard, card.card_code_flower)
|
2025-05-24 14:29:14 +08:00
|
|
|
if card.btn_card.selected then
|
|
|
|
|
send_card[#send_card + 1] = card.card_code_flower
|
|
|
|
|
self.send_card[#self.send_card + 1] = card
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if #send_card == 0 then
|
|
|
|
|
self:ErrorTip('请选择要出的牌 ')
|
|
|
|
|
else
|
2025-05-26 01:39:48 +08:00
|
|
|
self.gameCtr:SendCard(send_card, currentCard)
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
self.btn_tips.onClick:Set(
|
|
|
|
|
function()
|
|
|
|
|
--printlog("wwwwwwwwwww111111111111111111111111")
|
|
|
|
|
--pt(self.tips_card_list)
|
|
|
|
|
if self.tips_card_list ~= nil and #self.tips_card_list ~= 0 then
|
|
|
|
|
local index = self.tips_click_count % #self.tips_card_list + 1
|
|
|
|
|
self:ShowTipsCard(index)
|
|
|
|
|
self.tips_click_count = self.tips_click_count + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
-- 过
|
|
|
|
|
self.btn_not_put.onClick:Set(
|
|
|
|
|
function()
|
|
|
|
|
self.gameCtr:SendPass()
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
local function click_piao()
|
|
|
|
|
self.ctr_piao.selectedIndex = 0
|
|
|
|
|
self.gameCtr:SendPiao(tonumber(self.ctr_piao_value.selectedPage))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local btn_piao0 = self._view:GetChild('piao0')
|
|
|
|
|
btn_piao0.onClick:Set(click_piao)
|
|
|
|
|
|
|
|
|
|
local btn_piao1 = self._view:GetChild('piao1')
|
|
|
|
|
btn_piao1.onClick:Set(click_piao)
|
|
|
|
|
|
|
|
|
|
local btn_piao2 = self._view:GetChild('piao2')
|
|
|
|
|
btn_piao2.onClick:Set(click_piao)
|
|
|
|
|
|
|
|
|
|
local btn_piao3 = self._view:GetChild('piao3')
|
|
|
|
|
btn_piao3.onClick:Set(click_piao)
|
|
|
|
|
|
|
|
|
|
local btn_piao5 = self._view:GetChild('piao5')
|
|
|
|
|
btn_piao5.onClick:Set(click_piao)
|
|
|
|
|
|
|
|
|
|
local btn_piao8 = self._view:GetChild('piao8')
|
|
|
|
|
btn_piao8.onClick:Set(click_piao)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ShowTipsCard(index)
|
|
|
|
|
local item = self.tips_card_list[index]
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
local card = self.card_list[i]
|
|
|
|
|
local isExsit = false
|
|
|
|
|
for j = 1, #item do
|
|
|
|
|
if item[j] == self.card_list[i] then
|
|
|
|
|
self:UpdateCardMove(card.btn_card, true, false)
|
|
|
|
|
isExsit = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if isExsit == false then
|
|
|
|
|
self:UpdateCardMove(card.btn_card, false, false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetHandCardOffset(count)
|
2025-05-26 01:39:48 +08:00
|
|
|
local start = -50 ---54
|
2025-05-24 14:29:14 +08:00
|
|
|
|
|
|
|
|
local offset = 0
|
|
|
|
|
if count > 10 then
|
|
|
|
|
offset = start - count + 18
|
|
|
|
|
else
|
|
|
|
|
offset = -50
|
|
|
|
|
end
|
|
|
|
|
return offset
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetHandCardPos(index, card_count)
|
|
|
|
|
local x, y = 0, -18
|
|
|
|
|
local offset = self:GetHandCardOffset(card_count)
|
|
|
|
|
local middle_x = self.cards_view.width / 2
|
|
|
|
|
local start_x = middle_x - (card_count / 2 * (self.card_width + offset)) + (offset / 2)
|
|
|
|
|
x = start_x + (self.card_width + offset) * (index - 1)
|
|
|
|
|
return Vector2.New(x, y)
|
|
|
|
|
end
|
2025-05-26 01:39:48 +08:00
|
|
|
|
2025-05-24 14:29:14 +08:00
|
|
|
function M:GetHandCardPos1(index, card_count)
|
|
|
|
|
local x, y = 0, -18
|
|
|
|
|
local offset = self:GetHandCardOffset(card_count)
|
|
|
|
|
local middle_x = self.cards_view.width / 2
|
|
|
|
|
local start_x = middle_x - (card_count / 2 * (self.card_width + offset)) + (offset / 2)
|
|
|
|
|
x = start_x + (self.card_width + offset) * (index - 1)
|
|
|
|
|
return x, y
|
|
|
|
|
end
|
2025-05-26 01:39:48 +08:00
|
|
|
|
2025-05-24 14:29:14 +08:00
|
|
|
function M:ChangeOneCodeByFrom(card)
|
|
|
|
|
local flower = math.floor(card / 100)
|
|
|
|
|
local number = card % 100
|
|
|
|
|
if number == 2 then
|
|
|
|
|
number = 15
|
|
|
|
|
end
|
|
|
|
|
return number * 10 + flower
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ErrorTip(error_text)
|
|
|
|
|
if self.cor_init_poker ~= nil then
|
|
|
|
|
coroutine.stop(self.cor_init_poker)
|
|
|
|
|
end
|
|
|
|
|
self.cor_init_poker = nil
|
|
|
|
|
self.cor_init_poker =
|
|
|
|
|
coroutine.start(
|
2025-05-26 01:39:48 +08:00
|
|
|
function()
|
|
|
|
|
self.put_error_text.text = error_text
|
|
|
|
|
self.ctr_put_error.selectedIndex = 1
|
|
|
|
|
coroutine.wait(2)
|
|
|
|
|
self.ctr_put_error.selectedIndex = 0
|
|
|
|
|
end
|
|
|
|
|
)
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--RunFast_CardType
|
|
|
|
|
--None = 0,
|
|
|
|
|
--OneCard = 1,
|
|
|
|
|
--OnePair = 2,
|
|
|
|
|
--Three = 3,
|
|
|
|
|
--Pairs = 4,
|
|
|
|
|
--ThreeAndTwo = 5,
|
|
|
|
|
--ThreeAndOne = 6,
|
|
|
|
|
--Plane = 7,
|
|
|
|
|
--PlaneAndTwo = 8,
|
|
|
|
|
--PlaneAndOne = 9,
|
|
|
|
|
--Straight = 10,
|
|
|
|
|
--Bomb = 11
|
|
|
|
|
function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
|
|
|
|
local tip_list = {}
|
|
|
|
|
local sidaisan = false
|
2025-05-26 01:39:48 +08:00
|
|
|
local touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
2025-05-24 14:29:14 +08:00
|
|
|
--printlog("aaaaaaaaaaaaacccccccccccccccccccc11111111111111111111111111111")
|
|
|
|
|
--pt(self.card_list)
|
|
|
|
|
local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list)
|
|
|
|
|
--printlog("aaaaaaaaaaaaaaaaaa222222222222222222222222222222222222222 ",max_key)
|
|
|
|
|
--pt(card_map)
|
|
|
|
|
if type == RunFast_CardType.None then
|
|
|
|
|
if DataManager.CurrenRoom.is_new_bout then
|
|
|
|
|
tip_list = self:NewBoutTips(card_map)
|
|
|
|
|
end
|
|
|
|
|
return tip_list, touch_key_list
|
|
|
|
|
elseif type == RunFast_CardType.Bomb then
|
|
|
|
|
tip_list, touch_key_list = self:CheckBomb(card_map, number, length)
|
|
|
|
|
else
|
|
|
|
|
local list_type, list_bomb = {}, {}
|
|
|
|
|
local touch_type, touch_bomb
|
|
|
|
|
list_bomb, touch_bomb = self:CheckBomb(card_map, 0, 4)
|
|
|
|
|
|
|
|
|
|
local card_templist = membe_clone(self.card_list)
|
|
|
|
|
|
|
|
|
|
if list_bomb ~= nil and tip_templist == nil then
|
|
|
|
|
-- body
|
|
|
|
|
for i = 1, #list_bomb do
|
|
|
|
|
local templist_bomb = list_bomb[i]
|
|
|
|
|
for j = 1, #templist_bomb do
|
|
|
|
|
for k = 1, #card_templist do
|
|
|
|
|
if templist_bomb[j] == card_templist[k] then
|
|
|
|
|
-- body
|
|
|
|
|
list_remove(card_templist, card_templist[k])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
card_map, max_key = self:GetCardMapAndMaxKey(card_templist)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if type == RunFast_CardType.OneCard then
|
|
|
|
|
-- if mustPutMaxCard then
|
|
|
|
|
-- number = max_key - 1
|
|
|
|
|
-- self:ErrorTip("下家报单,请出最大的牌 ")
|
|
|
|
|
-- end
|
|
|
|
|
list_type, touch_type = self:CheckOneCard(card_map, number, length)
|
|
|
|
|
elseif type == RunFast_CardType.OnePair then
|
|
|
|
|
list_type, touch_type = self:CheckOnePair(card_map, number, length)
|
|
|
|
|
elseif type == RunFast_CardType.Three then
|
|
|
|
|
list_type, touch_type = self:CheckThree(card_map, number, length)
|
|
|
|
|
elseif type == RunFast_CardType.Pairs then
|
|
|
|
|
list_type, touch_type = self:CheckPairs(card_map, number, length)
|
|
|
|
|
elseif type == RunFast_CardType.ThreeAndTwo then
|
|
|
|
|
list_type, touch_type = self:CheckThreeAndTwo(card_map, number, length)
|
|
|
|
|
elseif type == RunFast_CardType.ThreeAndOne then
|
|
|
|
|
list_type, touch_type = self:CheckThreeAndOne(card_map, number, length)
|
|
|
|
|
elseif type == RunFast_CardType.Plane then
|
|
|
|
|
list_type, touch_type = self:CheckPlane(card_map, number, length, 0)
|
|
|
|
|
elseif type == RunFast_CardType.PlaneAndTwo then
|
|
|
|
|
list_type, touch_type = self:CheckPlane(card_map, number, length, 2)
|
|
|
|
|
elseif type == RunFast_CardType.PlaneAndOne then
|
|
|
|
|
list_type, touch_type = self:CheckPlane(card_map, number, length, 1)
|
|
|
|
|
elseif type == RunFast_CardType.Straight then
|
|
|
|
|
list_type, touch_type = self:CheckStraight(card_map, number, length)
|
|
|
|
|
elseif type == RunFast_CardType.FourAndtThree then
|
|
|
|
|
list_type, touch_type = self:CheckBomb(card_map, 0, 4)
|
|
|
|
|
if #list_type > 0 then
|
|
|
|
|
-- body
|
|
|
|
|
sidaisan = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
card_map, max_key = self:GetCardMapAndMaxKey(self.card_list)
|
|
|
|
|
tip_list = self:GetMergeAllList(list_type, list_bomb)
|
|
|
|
|
--list_bomb, touch_bomb = self:CheckBomb(card_map, 0, 4)
|
|
|
|
|
touch_key_list = self:GetMergeAllList(touch_type, touch_bomb)
|
|
|
|
|
local tip_templist2 = {}
|
|
|
|
|
if tip_templist == nil then
|
|
|
|
|
-- body
|
|
|
|
|
tip_templist2 = self:GetCardTips(type, number, length, mustPutMaxCard, tip_list)
|
|
|
|
|
end
|
|
|
|
|
if #tip_templist2 > 0 then
|
|
|
|
|
-- body
|
|
|
|
|
tip_list = self:GetMergeAllList(tip_list, tip_templist2)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if (tip_templist ~= nil and sidaisan == false and #tip_templist >= 1) then
|
|
|
|
|
-- body
|
|
|
|
|
self:SetNotTouchCard(touch_key_list, card_map)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return tip_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 合并多个list
|
|
|
|
|
function M:GetMergeAllList(...)
|
2025-05-26 01:39:48 +08:00
|
|
|
local lists = { ... }
|
2025-05-24 14:29:14 +08:00
|
|
|
local merge_list = {}
|
|
|
|
|
for i = 1, #lists do
|
|
|
|
|
local list_item = lists[i]
|
|
|
|
|
for j = 1, #list_item do
|
|
|
|
|
merge_list[#merge_list + 1] = list_item[j]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return merge_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:NewBoutTips(pokerMap)
|
|
|
|
|
local new_bout_list = {}
|
|
|
|
|
for k, v in pairs(pokerMap) do
|
|
|
|
|
new_bout_list[#new_bout_list + 1] = v
|
|
|
|
|
end
|
|
|
|
|
return new_bout_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckOneCard(pokerMap, num, length)
|
|
|
|
|
local one_card_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return one_card_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(pokerMap) do
|
|
|
|
|
if k > num and #v == 1 then
|
2025-05-26 01:39:48 +08:00
|
|
|
one_card_list[#one_card_list + 1] = { v[1] }
|
2025-05-24 14:29:14 +08:00
|
|
|
touch_key_list[#touch_key_list + 1] = k
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(pokerMap) do
|
|
|
|
|
if k > num and #v ~= 1 then
|
2025-05-26 01:39:48 +08:00
|
|
|
one_card_list[#one_card_list + 1] = { v[1] }
|
2025-05-24 14:29:14 +08:00
|
|
|
touch_key_list[#touch_key_list + 1] = k
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return one_card_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckOnePair(pokerMap, num, length)
|
|
|
|
|
local one_pair_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return one_pair_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(pokerMap) do -- 从三条和对子里面提取
|
|
|
|
|
if #v > 1 and k > num then
|
2025-05-26 01:39:48 +08:00
|
|
|
one_pair_list[#one_pair_list + 1] = { v[1], v[2] }
|
2025-05-24 14:29:14 +08:00
|
|
|
touch_key_list[#touch_key_list + 1] = k
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return one_pair_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckThree(pokerMap, num, length)
|
|
|
|
|
local three_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return three_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(pokerMap) do
|
|
|
|
|
if #v > 2 and k > num then
|
2025-05-26 01:39:48 +08:00
|
|
|
three_list[#three_list + 1] = { v[1], v[2], v[3] }
|
2025-05-24 14:29:14 +08:00
|
|
|
touch_key_list[#touch_key_list + 1] = k
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return three_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckPairs(pokerMap, num, length)
|
|
|
|
|
local pairs_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return pairs_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
local pair_length = length / 2
|
|
|
|
|
local number_start = num - pair_length + 2
|
|
|
|
|
local number_end = 15 - pair_length
|
|
|
|
|
for i = number_start, number_end do
|
|
|
|
|
local item_all_list = {}
|
|
|
|
|
for j = i, i + pair_length - 1 do
|
|
|
|
|
local item_list = pokerMap[j]
|
|
|
|
|
if item_list == nil then
|
|
|
|
|
break
|
|
|
|
|
elseif #item_list < 2 then
|
|
|
|
|
break
|
|
|
|
|
else
|
|
|
|
|
item_all_list[#item_all_list + 1] = item_list[1]
|
|
|
|
|
item_all_list[#item_all_list + 1] = item_list[2]
|
|
|
|
|
end
|
|
|
|
|
if j == i + pair_length - 1 then
|
|
|
|
|
pairs_list[#pairs_list + 1] = item_all_list
|
|
|
|
|
for k = i, i + pair_length - 1 do
|
|
|
|
|
touch_key_list[#touch_key_list + 1] = k
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return pairs_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckThreeAndOne(pokerMap, num, length)
|
|
|
|
|
local three_and_one_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return three_and_one_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(pokerMap) do
|
|
|
|
|
if #v >= 3 and k > num then
|
2025-05-26 01:39:48 +08:00
|
|
|
three_and_one_list[#three_and_one_list + 1] = { v[1], v[2], v[3] }
|
|
|
|
|
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return three_and_one_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckThreeAndTwo(pokerMap, num, length)
|
|
|
|
|
local three_and_two_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return three_and_two_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(pokerMap) do
|
|
|
|
|
if #v >= 3 and k > num then
|
2025-05-26 01:39:48 +08:00
|
|
|
three_and_two_list[#three_and_two_list + 1] = { v[1], v[2], v[3] }
|
|
|
|
|
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return three_and_two_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckStraight(pokerMap, num, length)
|
|
|
|
|
local straight_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return straight_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
local number_start = num - length + 2
|
|
|
|
|
local number_end = 15 - length
|
|
|
|
|
for i = number_start, number_end do
|
|
|
|
|
local item_all_list = {}
|
|
|
|
|
for j = i, i + length - 1 do
|
|
|
|
|
local item_list = pokerMap[j]
|
|
|
|
|
if item_list == nil then
|
|
|
|
|
break
|
|
|
|
|
else
|
|
|
|
|
item_all_list[#item_all_list + 1] = item_list[1]
|
|
|
|
|
end
|
|
|
|
|
if j == i + length - 1 then
|
|
|
|
|
straight_list[#straight_list + 1] = item_all_list
|
|
|
|
|
for k = i, i + length - 1 do
|
|
|
|
|
touch_key_list[#touch_key_list + 1] = k
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return straight_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckBomb(pokerMap, num, length)
|
|
|
|
|
local bomb_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
local threeA = DataManager.CurrenRoom.room_config.threeA
|
|
|
|
|
if threeA == 0 then
|
|
|
|
|
-- body
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return bomb_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if #self.card_list < 3 then
|
|
|
|
|
return bomb_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for k, v in pairs(pokerMap) do
|
|
|
|
|
if #v == 4 and k > num then
|
|
|
|
|
bomb_list[#bomb_list + 1] = v
|
|
|
|
|
touch_key_list[#touch_key_list + 1] = k
|
|
|
|
|
end
|
|
|
|
|
if threeA == 1 and #v == 3 and k == 14 then
|
|
|
|
|
bomb_list[#bomb_list + 1] = v
|
|
|
|
|
touch_key_list[#touch_key_list + 1] = k
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return bomb_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckPlane(pokerMap, num, length, and_num)
|
|
|
|
|
local plane_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
local l = and_num + 3
|
|
|
|
|
local pair_length = length / l
|
|
|
|
|
local number_start = num - pair_length + 2
|
|
|
|
|
local number_end = 15 - pair_length
|
|
|
|
|
for i = number_start, number_end do
|
|
|
|
|
local item_all_list = {}
|
|
|
|
|
for j = i, i + pair_length - 1 do
|
|
|
|
|
local item_list = pokerMap[j]
|
|
|
|
|
if item_list == nil then
|
|
|
|
|
break
|
|
|
|
|
elseif #item_list < 3 then
|
|
|
|
|
break
|
|
|
|
|
else
|
|
|
|
|
item_all_list[#item_all_list + 1] = item_list[1]
|
|
|
|
|
item_all_list[#item_all_list + 1] = item_list[2]
|
|
|
|
|
item_all_list[#item_all_list + 1] = item_list[3]
|
|
|
|
|
end
|
|
|
|
|
if j == i + pair_length - 1 then
|
|
|
|
|
plane_list[#plane_list + 1] = item_all_list
|
2025-05-26 01:39:48 +08:00
|
|
|
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return plane_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:SetNotTouchCard(touch_key_list, card_map)
|
2025-05-26 01:39:48 +08:00
|
|
|
local all_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
2025-05-24 14:29:14 +08:00
|
|
|
for i = 1, #all_key_list do
|
|
|
|
|
local key = all_key_list[i]
|
|
|
|
|
local isExsit = self:IsExistByList(touch_key_list, key)
|
|
|
|
|
if isExsit == false then
|
|
|
|
|
local key_card_item = card_map[key]
|
|
|
|
|
if key_card_item ~= nil then
|
|
|
|
|
for j = 1, #key_card_item do
|
|
|
|
|
local card = key_card_item[j]
|
|
|
|
|
card.btn_card.touchable = false
|
|
|
|
|
self:UpdateCardMove(card.btn_card, false, false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:IsExistByList(list, item)
|
|
|
|
|
for i = 1, #list do
|
|
|
|
|
if list[i] == item then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetCardByNumber(list, number)
|
|
|
|
|
for i = 1, #list do
|
|
|
|
|
if list[i].card_code_number == number then
|
|
|
|
|
return list[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetCardMapAndMaxKey(pokerList)
|
|
|
|
|
local map, max_key = {}, 0
|
|
|
|
|
for i = 1, #pokerList do
|
|
|
|
|
local number = math.floor(pokerList[i].card_code_number / 10)
|
|
|
|
|
if number > max_key then
|
|
|
|
|
max_key = number
|
|
|
|
|
end
|
|
|
|
|
if map[number] == nil then
|
2025-05-26 01:39:48 +08:00
|
|
|
map[number] = { pokerList[i] }
|
2025-05-24 14:29:14 +08:00
|
|
|
else
|
|
|
|
|
map[number][#map[number] + 1] = pokerList[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return map, max_key
|
|
|
|
|
end
|
2025-05-26 01:39:48 +08:00
|
|
|
|
2025-05-24 14:29:14 +08:00
|
|
|
function M:CheckOnes(pokerMap, num, length)
|
|
|
|
|
local one_card_list = {}
|
|
|
|
|
local touch_key_list = {}
|
|
|
|
|
local text = {}
|
|
|
|
|
local text2 = {}
|
|
|
|
|
local x = 0
|
|
|
|
|
if #self.card_list < length then
|
|
|
|
|
return one_card_list, touch_key_list
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(pokerMap) do
|
|
|
|
|
text = {}
|
|
|
|
|
text2 = {}
|
|
|
|
|
if k > num then
|
|
|
|
|
for l, p in pairs(pokerMap) do
|
|
|
|
|
for i = 0, length - 1 do
|
|
|
|
|
if l == k + i and l ~= 15 and l ~= 16 then
|
|
|
|
|
-- body
|
2025-05-26 01:39:48 +08:00
|
|
|
text[#text + 1] = { p[1] }
|
2025-05-24 14:29:14 +08:00
|
|
|
text2[#text2 + 1] = l
|
|
|
|
|
if #text >= length then
|
|
|
|
|
-- body
|
|
|
|
|
local x = #one_card_list
|
|
|
|
|
local y = #touch_key_list
|
|
|
|
|
for i = 1, #text - 1 do
|
|
|
|
|
one_card_list[x + 1] = text[1]
|
|
|
|
|
touch_key_list[y + 1] = text2[2]
|
|
|
|
|
-- for i, v in pairs(text2[i + 1]) do
|
|
|
|
|
-- if v ~= nil then
|
|
|
|
|
-- table.insert(touch_key_list[x + 1], v)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
for i, v in pairs(text[i + 1]) do
|
|
|
|
|
if v ~= nil then
|
|
|
|
|
table.insert(one_card_list[x + 1], v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return one_card_list, touch_key_list, length
|
|
|
|
|
end
|
2025-05-26 01:39:48 +08:00
|
|
|
|
2025-05-24 14:29:14 +08:00
|
|
|
function M:Clear()
|
|
|
|
|
self:PlayScore(nil)
|
|
|
|
|
self:SetOutCardInfo(nil, false)
|
|
|
|
|
self.card_list = {}
|
|
|
|
|
self.out_card_list = {}
|
|
|
|
|
self.cards_view:RemoveChildren(0, -1, true)
|
|
|
|
|
-- self.mask_liangpai:RemoveChildren(0,-1,true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ClearCheck()
|
2025-05-26 01:39:48 +08:00
|
|
|
self.card_list = {}
|
2025-05-24 14:29:14 +08:00
|
|
|
self.out_card_list = {}
|
2025-05-26 01:39:48 +08:00
|
|
|
self.cards_view:RemoveChildren(0, -1, true)
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:Destroy()
|
|
|
|
|
Stage.inst.onTouchMove:Remove(self.touchMoveFun)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|