diff --git a/lua_probject/extend_project/extend/poker/duoduo/CardCheck.lua b/lua_probject/extend_project/extend/poker/duoduo/CardCheck.lua index 99a79232..8b17c719 100644 --- a/lua_probject/extend_project/extend/poker/duoduo/CardCheck.lua +++ b/lua_probject/extend_project/extend/poker/duoduo/CardCheck.lua @@ -1,128 +1,25 @@ local CardCheck = { - cardList = {}, - cardListSord = {}, - cardNum = 0, - cardSize = 0, - long = false, - planeNoBelt = false, - threeNoBelt = false, - planelack = false, - threelack = false, - fourDaiThree = false, - fristCard = true, - haveRuleCard = false, - tipCardList = {}, - touchCardSet = {}, - touchCardMao = {} -} - -local CardType = { - one = 1, - long = 2, - dui = 3, - duiLong = 10, - threeAndTwo = 4, - normolPlant = 5, - zha = 6, - onlyThree = 7, - onlyPlant = 8, - zhaAndThreee = 9, - lessThree = 11, - lessPlant = 12 } local M = CardCheck function M:InitFlag() - local config = DataManager.CurrenRoom.room_config.config - self.planeNoBelt = config.planeNoBelt == 1 - self.threeNoBelt = config.threeNoBelt == 1 - self.planelack = config.planelack == 1 - self.threelack = config.threelack == 1 - self.fourDaiThree = config.fourDaiThree - self.rule = config.rule - self._flag_fristCard = true - print("==============================lingmengcheckinitFlag") - pt(config) - pt(self) + return self end -function M:InitLastCard(cardList, mustPutMaxCard) +function M:InitLastCard(cardList) self._flag_fristCard = false self:Clear() - self._flag_mustMax = mustPutMaxCard - self.type = 0 - self.specilCard = {} self.lastCardNum = #cardList - self._flag_allCards = false - self._flag_checkLst = true if #cardList == 0 then self._flag_fristCard = true return end - table.sort(cardList) - pt(cardList) - self.lastMinCard = math.floor(cardList[1] / 10) local temp_long = 0 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] / 10) - number) == 1 then - temp_long = i - end - end - end - self.long = temp_long == self.cardNum and self.cardNum >= 5 - 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 - local a, b, c = self:CheckSanDai() - self.type = a - if b then - self.specilCard = b - end - if c then - self.lastMinCard = c - end - return - end - print("lingmengCheckZha2") - - if self:CheckZha() then - local a, b, c = self:CheckZha() - self.type = a - if b then - self.specilCard = b - end - if c then - self.lastMinCard = c - end - return - end - if self.type == 0 then - -- ViewUtil.ErrorTip(-1, "上一份牌型判断错误") end end diff --git a/lua_probject/extend_project/extend/poker/duoduo/EXGameController.lua b/lua_probject/extend_project/extend/poker/duoduo/EXGameController.lua index aa6244f4..ae99d1dd 100644 --- a/lua_probject/extend_project/extend/poker/duoduo/EXGameController.lua +++ b/lua_probject/extend_project/extend/poker/duoduo/EXGameController.lua @@ -241,17 +241,10 @@ function M:OnPlaySuccCheck(evt_data) local remain = evt_data["remain"] -- 报单 self._cacheEvent:Enqueue( function() - local otherList = self:GetOtherSeatList(seat) local player = self._room:GetPlayerBySeat(seat) - local out_card_list = self:ChangeCodeByFrom(cards, true) player.hand_count = remain - -- if remain ~= 0 then - self._cardCheck:InitLastCard(out_card_list) - -- end - 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, EXGameEvent.OnPlaySucc, player, remain, card_type, number, otherList, - length, out_card_list) + player.out_card_list = cards + DispatchEvent(self._dispatcher, EXGameEvent.OnPlaySucc, player, remain) end ) end diff --git a/lua_probject/extend_project/extend/poker/duoduo/EXMainView.lua b/lua_probject/extend_project/extend/poker/duoduo/EXMainView.lua index 8745c34b..1dd08272 100644 --- a/lua_probject/extend_project/extend/poker/duoduo/EXMainView.lua +++ b/lua_probject/extend_project/extend/poker/duoduo/EXMainView.lua @@ -600,13 +600,19 @@ function M:EventInit() end) - if self._room.ming_card ~= nil then - self._view:GetTransition("t" .. index):Play() - self._room.ming_card = nil - if self.tween ~= nil then - TweenUtils.Kill(self.tween) - self.tween = nil - end + -- if self._room.ming_card ~= nil then + -- self._view:GetTransition("t" .. index):Play() + -- self._room.ming_card = nil + -- if self.tween ~= nil then + -- TweenUtils.Kill(self.tween) + -- self.tween = nil + -- end + -- end + + --出牌权和前端出牌提示挪到转向协议 + local lastCardList = self._gamectr:GetLastCardList(self._room.self_player.seat) + if index == 1 then + card_info:ShowOutCardOption2(lastCardList, 1) end end) @@ -628,11 +634,6 @@ function M:EventInit() local arg = { ... } local p = arg[1] local card_number = arg[2] - local cardstype = arg[3] - local num = arg[4] - local otherList = arg[5] - local length = arg[6] - local lastCardList = arg[7] self.ctr_time.selectedIndex = 0 local index = self:GetPos(p.seat) if index == 1 then @@ -649,54 +650,12 @@ function M:EventInit() head_info._view:GetChild("shengyu").text = card_number end end - head_info:SetBaoDan(card_number == 1) local card_info = self._player_card_info[index] card_info:SetOutCardInfo(p.out_card_list, false, true) card_info._ctr_time_clock.selectedIndex = 0 - for i = 1, #otherList do - local other_seat = otherList[i] - local other_card_info = self._player_card_info[self:GetPos(other_seat)] - other_card_info:SetOutCardBlack() - end - if index == 1 then card_info:DeleteHandCards(p.out_card_list) - else - -- card_info:SetRemainCardNumber(card_number == 1) - --card_info:UpdateHandPoker(card_number,false,false) -- todo - end - - -- if self._room.is_new_bout == true then - -- for i = 1, #self._room.player_list do - -- local player = self._room.player_list[i] - -- local card_info_i = self._player_card_info[self:GetPos(player.seat)] - -- if p.seat ~= player.seat then - -- card_info_i:SetOutCardInfo(nil, false) - -- end - -- end - -- self:_Effect(cardstype, p) - -- else - -- if cardstype == 11 and cardstype ~= 12 then - -- self:_Effect(cardstype, p) - -- end - -- end - self:_Effect(self._cardCheck.type, p) - print("lingmeng end _Effect", self._cardCheck.type) - self:PlaySound(p.self_user.sex, - self:GetSoundFileName(self._cardCheck.type, num, self._room.is_new_bout)) - -- self:PlaySound(p.self_user.sex, self:GetSoundFileName(cardstype, num, self._room.is_new_bout)) - - if card_number == 1 then - --self:ChangeBgmMusic(2) - self:ChangeBgmMusic(1) - if self._cor_sound ~= nil then - coroutine.stop(self._cor_sound) - end - self._cor_sound = nil - self._cor_sound = coroutine.start(function() - self:PlaySound(p.self_user.sex, "card_1") - end) end end) _gamectr:AddEventListener(EXGameEvent.OnCheckCard, function(...) @@ -791,7 +750,7 @@ function M:EventInit() local arg = { ... } local error_str = arg[1] self._player_card_info[1]:ErrorTip(error_str) - -- self._player_card_info[1]:ResetPoker() + self._player_card_info[1]:UpdateHandCardsPos() end) _gamectr:AddEventListener(EXGameEvent.OnPiaoTips, function(...) @@ -844,36 +803,36 @@ function M:EventInit() end) _gamectr:AddEventListener(EXGameEvent.OnOptions, function(...) - local arg = { ... } - local play = arg[1] - local pass = arg[5] - 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 - local m = false - local next_seat = self._room.self_player.seat + 1 - local card_info = self._player_card_info[1] - card_info:SetOutCardInfo(nil, false) - if self.MypokerList ~= nil then - -- body - card_info:Clear() - card_info:InitPoker(self.MypokerList, false) - self.MypokerList = nil - end - if next_seat > self._room.room_config.people_num then - next_seat = next_seat - self._room.room_config.people_num - end - if self._room:GetPlayerBySeat(next_seat).hand_count == 1 and self._room.room_config.WillBeOut == 1 then - m = true - end - local zdts = self._view:GetController("zidongtishi").selectedIndex - -- self._player_card_info[1]._cardCheck:InitLastCard(lastCardList) - -- self._player_card_info[1]:ShowOutCardOption(ctr_number, card_type, card_number, card_length, m, play, zdts) - card_info:ShowOutCardOption2(lastCardList, ctr_number, m) + -- local arg = { ... } + -- local play = arg[1] + -- local pass = arg[5] + -- 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 + -- local m = false + -- local next_seat = self._room.self_player.seat + 1 + -- local card_info = self._player_card_info[1] + -- card_info:SetOutCardInfo(nil, false) + -- if self.MypokerList ~= nil then + -- -- body + -- card_info:Clear() + -- card_info:InitPoker(self.MypokerList, false) + -- self.MypokerList = nil + -- end + -- if next_seat > self._room.room_config.people_num then + -- next_seat = next_seat - self._room.room_config.people_num + -- end + -- if self._room:GetPlayerBySeat(next_seat).hand_count == 1 and self._room.room_config.WillBeOut == 1 then + -- m = true + -- end + -- local zdts = self._view:GetController("zidongtishi").selectedIndex + -- -- self._player_card_info[1]._cardCheck:InitLastCard(lastCardList) + -- -- self._player_card_info[1]:ShowOutCardOption(ctr_number, card_type, card_number, card_length, m, play, zdts) + -- card_info:ShowOutCardOption2(lastCardList, ctr_number, m) end) -- 托管 _gamectr:AddEventListener(EXGameEvent.Game_TuoGuan, function(...) @@ -1187,6 +1146,7 @@ function M:ReConnectForStart() -- body head_info._view:GetChild("shengyu").text = player.hand_count end + if player.seat == self._room.self_player.seat then if player.open ~= nil and player.open == 0 and self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then -- body @@ -1195,10 +1155,16 @@ function M:ReConnectForStart() else player_card_info:InitPoker(player.hand_list, false) end + if not player.out_card_list or #player.out_card_list == 0 or player.out_card_list[1] == 0 then + player_card_info:SetOutCardInfo(nil, false) + else + player_card_info:SetOutCardInfo(player.out_card_list, false) + end else - -- player_card_info:SetRemainCardNumber(player.hand_count == 1) - if player.hand_count == 1 then - -- self.bgm_index = 2 + if not player.out_card_list or #player.out_card_list == 0 or player.out_card_list[1] == 0 then + player_card_info:SetOutCardInfo(nil, true) + else + player_card_info:SetOutCardInfo(player.out_card_list, false) end end if self._room.curren_turn_seat == player.seat then @@ -1206,11 +1172,11 @@ function M:ReConnectForStart() player_card_info._ctr_time_clock.selectedIndex = 1 self._tex_leftTime = player_card_info._view_comp_clock self._left_time = 15 - -- if player.out_card_list[1] == 0 then player_card_info:SetOutCardInfo(nil, false) - -- else - -- player_card_info:SetOutCardInfo(player.out_card_list, false) - -- end + if player.seat == self._room.self_player.seat then + local lastCardList = self._gamectr:GetLastCardList(self._room.self_player.seat) + player_card_info:ShowOutCardOption2(lastCardList, 1) + end else -- head_info:MarkBank(true) end diff --git a/lua_probject/extend_project/extend/poker/duoduo/EXPlayerPokerInfoView.lua b/lua_probject/extend_project/extend/poker/duoduo/EXPlayerPokerInfoView.lua index 5a1d8fed..c288d906 100644 --- a/lua_probject/extend_project/extend/poker/duoduo/EXPlayerPokerInfoView.lua +++ b/lua_probject/extend_project/extend/poker/duoduo/EXPlayerPokerInfoView.lua @@ -159,30 +159,41 @@ function M:SetOutCardInfo(cardlist, isPass, isAnim) end else self.ctr_outpoker.selectedIndex = 1 - if isAnim then - if self.move_cor then - coroutine.stop(self.move_cor) - self.move_cor = nil - end - for i = 1, #cardlist do + -- if isAnim then + -- if self.move_cor then + -- coroutine.stop(self.move_cor) + -- self.move_cor = nil + -- end + -- for i = 1, #cardlist do + -- local poker_item = self._view_Out:AddItemFromPool() + -- local code = self:ChangeCodeByTo(cardlist[i]) + + -- self:FillPoker(poker_item, "", cardlist[i]) + -- end + -- self.move_cor = coroutine.start(function() + -- coroutine.wait(0.1) + -- ViewUtil.PlaySound("DuoDuo_PK", "extend/poker/duoduo/sound/chupai.mp3") + -- end) + -- else + local showOneCard + for i = 1, #cardlist do + if cardlist[i] % 100 < 3 then local poker_item = self._view_Out:AddItemFromPool() - local code = self:ChangeCodeByTo(cardlist[i]) - - self:FillPoker(poker_item, "", cardlist[i]) - end - self.move_cor = coroutine.start(function() - coroutine.wait(0.1) - ViewUtil.PlaySound("DuoDuo_PK", "extend/poker/duoduo/sound/chupai.mp3") - end) - else - for i = 1, #cardlist do - local poker_item = self._view_Out:AddItemFromPool() - - local code = self:ChangeCodeByTo(cardlist[i]) - - self:FillPoker(poker_item, "", cardlist[i]) + self:FillPoker2(poker_item, cardlist[i]) + else + showOneCard = cardlist[i] end end + if showOneCard then + local poker_item = self._view_Out:AddItemFromPool() + + self:FillPoker2(poker_item, showOneCard) + self._view:GetChild('text_paiNum').text = string.format("X%s", #cardlist) + else + printlog("error 190", "除了鬼牌没有其他牌") + end + self._view_Out:ResizeToFit(self._view_Out.numItems) + -- end end end diff --git a/lua_probject/extend_project/extend/poker/duoduo/EXPlayerSelfPokerInfoView.lua b/lua_probject/extend_project/extend/poker/duoduo/EXPlayerSelfPokerInfoView.lua index 094e2400..3caf42d8 100644 --- a/lua_probject/extend_project/extend/poker/duoduo/EXPlayerSelfPokerInfoView.lua +++ b/lua_probject/extend_project/extend/poker/duoduo/EXPlayerSelfPokerInfoView.lua @@ -179,58 +179,7 @@ function M:InitPoker(pokerList, isPlayAni, open) self.newCard_list[pokerList[i] % 100][math.floor(pokerList[i] / 100)] = (self.newCard_list[pokerList[i] % 100][math.floor(pokerList[i] / 100)] or 0) + 1 end - local maxHeight = 0 - for k, v in pairs(self.newCard_list) do - local btn_cardListFather = self._view_handCard:AddItemFromPool() - btn_cardListFather.width = self.scaleW - -- btn_cardListFather.height = scaleH*12 - local btn_cardList = btn_cardListFather:GetChild('list') - self.linegap = btn_cardList.lineGap - local tmpHeight = 0 - for k1, v1 in pairs(v) do - local card_number_code = k * 10 + k1 - local card_flower_code = k1 * 100 + k - if v1 ~= 4 then - for i = 1, v1 do - local btn_card = btn_cardList:AddItemFromPool() - btn_card.height = self.scaleH - self:FillPoker2(btn_card, card_flower_code) - -- self.cards_view:AddChild(btn_card) - local card_view = NewCardView(btn_card, card_number_code, card_flower_code) - card_view.fatherList = btn_cardList - self.card_list[#self.card_list + 1] = card_view - btn_card.data = card_view - tmpHeight = tmpHeight + 1 - end - else - local btn_card = btn_cardList:GetFromPool('') - btn_cardList:AddChildAt(btn_card, 0) - btn_card.height = self.scaleH - self:FillPoker2(btn_card, card_flower_code, "_z") - -- self.cards_view:AddChild(btn_card) - local card_view = NewCardView(btn_card, card_number_code, card_flower_code) - card_view.fatherList = btn_cardList - card_view.zha = true - self.card_list[#self.card_list + 1] = card_view - btn_card.data = card_view - tmpHeight = tmpHeight + 1 - end - end - if tmpHeight > maxHeight then - maxHeight = tmpHeight - end - end - self._view:GetChild('n82').y = self._view_handCard.height - - (self.scaleH + (self.scaleH + self.linegap) * (maxHeight - 1) + 50) - table.sort(self.card_list, tableSortNumber) - self:AddTouchMoveEvent(self._view_handCard) - for i = 1, #self.card_list do - local card = self.card_list[i] - if open ~= 1 then - -- body - self:AddCardTouchEvent(card) - end - end + self:UpdateHandCardsPos() end end @@ -281,9 +230,7 @@ function M:AddCardTouchEvent(card) table.insert(self._SendCards, oncard.data.card_code_flower) end end - pt("lingmeng SendCards", self._SendCards) local xy = self.touchCard.fatherList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y)) - printlog("lingmeng card.btn_card.xy", card.btn_card.xy.x, card.btn_card.xy.y) self.touchBegin = xy - card.btn_card.xy Stage.inst.onTouchMove:Add(self.touchMoveFun) Stage.inst.onTouchEnd:Add(self.touchMoveEndFun) @@ -358,30 +305,57 @@ function M:TouchMoving(context) end function M:TouchMoveEnd(context) - printlog("lingmeng chupai end") local linexy = self._view_handCard:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y)) - if linexy.y < self._view:GetChild('n82').y then - local allcards = {} - for i, v in ipairs(self.card_list) do - table.insert(allcards, v.card_code_flower) - end - self.gameCtr:SendCard(self._SendCards, allcards) - else - for i = self.touchIndex, 0, -1 do - local oncard = self.touchCard.fatherList:GetChildAt(i) - oncard.xy = Vector2.New(0, self.touchCard.fatherList.height) + local allcards = {} + for k, v in pairs(self.newCard_list) do + for k1, v1 in pairs(v) do + if v1 > 0 then + for i = 1, v1 do + local card_flower_code = k1 * 100 + k + table.insert(allcards, card_flower_code) + end + end end end - + if linexy.y < self._view:GetChild('n82').y then + self.gameCtr:SendCard(self._SendCards, allcards) + else + if self.touchCard.card_code_flower % 100 < 3 then + for i = self._view_handCard.numItems - 1, 0, -1 do + local oneCardList = self._view_handCard:GetChildAt(i):GetChild('list') + local listxy = oneCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, + context.inputEvent.y)) + if listxy.x > 0 and oneCardList:GetChildAt(0).data.card_code_flower % 100 > 2 then + for i = 0, oneCardList.numItems - 1 do + local oncard = oneCardList:GetChildAt(i) + if oncard.data.zha then + for j = 1, 4 do + table.insert(self._SendCards, oncard.data.card_code_flower) + end + else + table.insert(self._SendCards, oncard.data.card_code_flower) + end + end + self.gameCtr:SendCard(self._SendCards, allcards) + break + end + end + end + end + for i = 0, self.touchIndex do + local oncard = self.touchCard.fatherList:GetChildAt(i) + self:SetBtnCardColor(oncard.data, 0) + oncard.xy = Vector2.New(0, (self.scaleH + self.linegap) * i) + end -- local fristCard = self._view_handCard:GetChildAt(0) -- local CardWidth = fristCard.width -- local columnGap = self._view_handCard.columnGap -- local oneCardWidth = CardWidth + columnGap -- local xy = fristCard:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y)) -- local downCards = #self.card_list - -- Stage.inst.onTouchMove:Remove(self.touchMoveFun) - -- Stage.inst.onTouchEnd:Remove(self.touchMoveEndFun) + Stage.inst.onTouchMove:Remove(self.touchMoveFun) + Stage.inst.onTouchEnd:Remove(self.touchMoveEndFun) -- local max_x -- local min_x @@ -471,22 +445,22 @@ function M:HidePiao() end function M:ShowOutCardOption2(lastCardList, ctr_select, mustPutMaxCard) - self._cardCheck:InitLastCard(lastCardList, mustPutMaxCard) - self._cardCheck:CheckOutCard(self.card_list) - self.tips_card_list = self._cardCheck:GetTipsList() - self.touchCardSet = self._cardCheck:GetTouchSet() - self.touchCardMap = self._cardCheck:GetTouchCardMap() - self.tips_click_count = 0 + -- self._cardCheck:InitLastCard(lastCardList, mustPutMaxCard) + -- self._cardCheck:CheckOutCard(self.card_list) + -- self.tips_card_list = self._cardCheck:GetTipsList() + -- self.touchCardSet = self._cardCheck:GetTouchSet() + -- self.touchCardMap = self._cardCheck:GetTouchCardMap() + -- self.tips_click_count = 0 - print("lingmengShowOutCardOption2", #self.touchCardSet) - pt(self.touchCardSet) - pt(self.touchCardMap) - -- body --在这个方法里添加判断抬起牌是否符合出牌类型(少跑一次手牌循环) - self:UpdateHandCardsColor() + -- print("lingmengShowOutCardOption2", #self.touchCardSet) + -- pt(self.touchCardSet) + -- pt(self.touchCardMap) + -- -- body --在这个方法里添加判断抬起牌是否符合出牌类型(少跑一次手牌循环) + -- self:UpdateHandCardsColor() - if #self.tips_card_list == 1 then - self:ShowTipsCard(1) - end + -- if #self.tips_card_list == 1 then + -- self:ShowTipsCard(1) + -- end self.ctr_put_card_option.selectedIndex = ctr_select end @@ -549,31 +523,29 @@ function M:SetOutCardInfo(cardlist, isPass, isAnim) end else self.ctr_outpoker.selectedIndex = 1 - if isAnim then - if self.move_cor then - coroutine.stop(self.move_cor) - self.move_cor = nil - end + -- if isAnim then + -- if self.move_cor then + -- coroutine.stop(self.move_cor) + -- self.move_cor = nil + -- end - for i = 1, #cardlist do - local poker_item = self._view_Out:AddItemFromPool() - local code = self:ChangeCodeByTo(cardlist[i]) + -- for i = 1, #cardlist do + -- local poker_item = self._view_Out:AddItemFromPool() + -- local code = self:ChangeCodeByTo(cardlist[i]) - self:FillPoker(poker_item, "", cardlist[i]) - end - self.move_cor = coroutine.start(function() - coroutine.wait(0.1) - ViewUtil.PlaySound("DuoDuo_PK", "extend/poker/duoduo/sound/chupai.mp3") - end) - else - for i = 1, #cardlist do - local poker_item = self._view_Out:AddItemFromPool() + -- self:FillPoker(poker_item, "", cardlist[i]) + -- end + -- self.move_cor = coroutine.start(function() + -- coroutine.wait(0.1) + -- ViewUtil.PlaySound("DuoDuo_PK", "extend/poker/duoduo/sound/chupai.mp3") + -- end) + -- else + for i = 1, #cardlist do + local poker_item = self._view_Out:AddItemFromPool() - local code = self:ChangeCodeByTo(cardlist[i]) - - self:FillPoker(poker_item, "", cardlist[i]) - end + self:FillPoker2(poker_item, cardlist[i]) end + -- end end end @@ -711,13 +683,23 @@ end function M:DeleteHandCards(cardlist) self.ctr_put_card_option.selectedIndex = 0 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 - list_remove(self.card_list, card) - self._view_handCard:RemoveChild(card.btn_card, true) - break + local tmpNum = nil + if self.newCard_list[cardlist[i] % 100] then + tmpNum = self.newCard_list[cardlist[i] % 100][math.floor(cardlist[i] / 100)] + end + if tmpNum then + if tmpNum == 1 then + self.newCard_list[cardlist[i] % 100][math.floor(cardlist[i] / 100)] = nil + else + self.newCard_list[cardlist[i] % 100][math.floor(cardlist[i] / 100)] = tmpNum - 1 + end + else + ViewUtil:ErrorTip("牌型出错,重新加载页面") + ViewManager.refreshGameView() + end + if i == #cardlist then + if #self.newCard_list[cardlist[i] % 100] == 0 then + self.newCard_list[cardlist[i] % 100] = nil end end end @@ -725,13 +707,56 @@ function M:DeleteHandCards(cardlist) 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:UpdateCardMove(card_view.btn_card, false, false) - self:SetBtnCardColor(card_view, 0) + local maxHeight = 0 + self._view_handCard:RemoveChildrenToPool() + self._newCardSize = {} + for k, v in pairs(self.newCard_list) do + local btn_cardListFather = self._view_handCard:AddItemFromPool() + btn_cardListFather.width = self.scaleW + -- btn_cardListFather.height = scaleH*12 + local btn_cardList = btn_cardListFather:GetChild('list') + btn_cardList:RemoveChildrenToPool() + self.linegap = btn_cardList.lineGap + local tmpHeight = 0 + for k1, v1 in pairs(v) do + local card_number_code = k * 10 + k1 + local card_flower_code = k1 * 100 + k + if v1 ~= 4 then + for i = 1, v1 do + local btn_card = btn_cardList:AddItemFromPool() + btn_card.height = self.scaleH + self:FillPoker2(btn_card, card_flower_code) + -- self.cards_view:AddChild(btn_card) + local card_view = NewCardView(btn_card, card_number_code, card_flower_code) + card_view.fatherList = btn_cardList + self.card_list[#self.card_list + 1] = card_view + btn_card.data = card_view + tmpHeight = tmpHeight + 1 + self:AddCardTouchEvent(card_view) + end + else + local btn_card = btn_cardList:GetFromPool('') + btn_cardList:AddChildAt(btn_card, 0) + btn_card.height = self.scaleH + self:FillPoker2(btn_card, card_flower_code, "_z") + -- self.cards_view:AddChild(btn_card) + local card_view = NewCardView(btn_card, card_number_code, card_flower_code) + card_view.fatherList = btn_cardList + card_view.zha = true + self.card_list[#self.card_list + 1] = card_view + btn_card.data = card_view + tmpHeight = tmpHeight + 1 + self:AddCardTouchEvent(card_view) + end + self._newCardSize[k1] = tmpHeight + end + + if tmpHeight > maxHeight then + maxHeight = tmpHeight + end end + self._view:GetChild('n82').y = self._view_handCard.height - + (self.scaleH + (self.scaleH + self.linegap) * (maxHeight - 1) + 50) end function M:ResetPoker() @@ -848,6 +873,7 @@ function M:BtnEvent() -- 过 self.btn_not_put.onClick:Set( function() + self.ctr_put_card_option.selectedIndex = 0 self.gameCtr:SendPass() end ) diff --git a/lua_probject/extend_project/extend/poker/duoduo/ExtendConfig.lua b/lua_probject/extend_project/extend/poker/duoduo/ExtendConfig.lua index 1f21c9aa..39df2321 100644 --- a/lua_probject/extend_project/extend/poker/duoduo/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/poker/duoduo/ExtendConfig.lua @@ -161,7 +161,7 @@ function M:FillRoomData(s2croom) p.outCards = info_list[i]["outCards"] local last_outcard = info_list[i]["last_outcard"] if last_outcard ~= nil and last_outcard[1] ~= 0 then - local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true) + local out_card_list = last_outcard.card_list local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list) p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count) else diff --git a/wb_new_ui/assets/Extend_Poker_DuoDuo/EXMain_New_4.xml b/wb_new_ui/assets/Extend_Poker_DuoDuo/EXMain_New_4.xml index db7e1e6e..8eab1ae6 100644 --- a/wb_new_ui/assets/Extend_Poker_DuoDuo/EXMain_New_4.xml +++ b/wb_new_ui/assets/Extend_Poker_DuoDuo/EXMain_New_4.xml @@ -1,6 +1,6 @@ - + @@ -34,41 +34,41 @@ - + - - + + - - + + - - + + - + - + - + - + - + diff --git a/wb_new_ui/assets/Extend_Poker_DuoDuo/Main_New/Component/Btn_ListOneCard.xml b/wb_new_ui/assets/Extend_Poker_DuoDuo/Main_New/Component/Btn_ListOneCard.xml index 93e41321..d47c843e 100644 --- a/wb_new_ui/assets/Extend_Poker_DuoDuo/Main_New/Component/Btn_ListOneCard.xml +++ b/wb_new_ui/assets/Extend_Poker_DuoDuo/Main_New/Component/Btn_ListOneCard.xml @@ -9,13 +9,6 @@ - - - - - - -