diff --git a/lua_probject/base_project/Game/View/ResultView.lua b/lua_probject/base_project/Game/View/ResultView.lua index 122a517b..25fedba7 100644 --- a/lua_probject/base_project/Game/View/ResultView.lua +++ b/lua_probject/base_project/Game/View/ResultView.lua @@ -270,7 +270,8 @@ function M:InitBigResult(room, fontsize) local isWin = false for i = 1, #self._resultInfo.player_list do local player_info = self._resultInfo.player_list[i] - + printlog("player_info:") + pt(player_info) local total_score = room:GetTotalScore(player_info.score) local hp_nonnegative = room:checkHpNonnegative() player_info.total_score = 0 diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/EXGameController.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/EXGameController.lua index c6609ef5..d4f2e839 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/EXGameController.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/EXGameController.lua @@ -584,6 +584,7 @@ function M:OneventResult1(evt_data) DataManager.CurrenRoom.Over = true ControllerManager.SetGameNetClient(nil,true) local total_result = evt_data.total_result + local result = evt_data.result self._cacheEvent:Enqueue(function() DispatchEvent(self._dispatcher,FanPaoFa_GameEvent.ZPResult2, result, total_result, over); diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua index f504a6b6..00a22b67 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua @@ -35,7 +35,7 @@ function M:getCardItem(card_1, card_2) if self._room.change_card_display ~= nil then return card_1 .. self._room.change_card_display .. card_2 else - return card_1 .. '2_' .. card_2 + return card_1 .. '6_' .. card_2 end end function M:InitView(url) @@ -213,18 +213,6 @@ function M:EventInit() info:MarkBank(p.seat == _room.banker_seat) info:Ready(false) --info:UpdatePiao(-1) - info._view:GetController('huxi').selectedIndex = 1 - info._view:GetChild('huxi').text = p.hu_xi - info._view:GetController('zhanji').selectedIndex = 0 - - if _room.hpOnOff == 1 or _room:checkHpNonnegative() then - if p.total_hp == nil then - p.total_hp = 0 - end - info._view:GetController('zhanji').selectedIndex = 1 - info._view:GetChild('tex_jifen').text = d2ad(p.total_hp) - info._view:GetChild('tex_jifen_text').text = "总胡息" - end end end @@ -270,16 +258,17 @@ function M:EventInit() info:Ready(false) info._view:GetController('huxi').selectedIndex = 1 info._view:GetChild('huxi').text = p.hu_xi - info._view:GetController('zhanji').selectedIndex = 0 - - if _room.hpOnOff == 1 or _room:checkHpNonnegative() then + info._view:GetController('zhanji').selectedIndex = 1 + info._view:GetChild('tex_jifen').text = p.total_score --d2ad(p.total_hp) + info._view:GetChild('tex_jifen_text').text = "总胡息" + --[[if _room.hpOnOff == 1 or _room:checkHpNonnegative() then if p.total_hp == nil then p.total_hp = 0 end info._view:GetController('zhanji').selectedIndex = 1 info._view:GetChild('tex_jifen').text = d2ad(p.total_hp) info._view:GetChild('tex_jifen_text').text = "总胡息" - end + end]] end local card_info = self._player_card_info[1] card_info:UpdateIsOnClick(false) @@ -538,6 +527,7 @@ function M:EventInit() function() coroutine.wait(0.5) -- if self._clearingView._is_destroy then return end + self._clearingView:Show() if _room.curren_round ~= _room.room_config.round then for i = 1, #data do @@ -545,18 +535,11 @@ function M:EventInit() local card_info = self._player_card_info[self:GetPos(p.seat)] local info = self._player_info[self:GetPos(p.seat)] p.total_score = data[i].total_score - p.cur_hp = data[i]['cur_hp'] or 0 - p.total_hp = data[i]['total_hp'] or 0 - if data[i]['hp_info'] then - p.cur_hp = data[i].hp_info.cur_hp - p.total_hp = data[i].hp_info.total_hp == nil and 0 or data[i].hp_info.total_hp - info._view:GetController('zhanji').selectedIndex = 0 - if _room.hpOnOff == 1 or _room:checkHpNonnegative() then - info._view:GetController('zhanji').selectedIndex = 1 - info._view:GetChild('tex_jifen').text = d2ad(p.total_hp) - info._view:GetChild('tex_jifen_text').text = "总胡息" - end - end + + info._view:GetController('zhanji').selectedIndex = 1 + info._view:GetChild('tex_jifen').text =p.total_score + info._view:GetChild('tex_jifen_text').text = "总胡息" + card_info:Clear() info:UpdateScore() @@ -604,6 +587,7 @@ function M:EventInit() local total_result = arg[2] local result = arg[1] local over = arg[3] + local data = result.info_list local x = {} self._hu_tip:FillData(x) self:__CloseTip() @@ -669,13 +653,18 @@ function M:__FangziTip(tip, _uid,fptype) local count = #_tlist for k = 1, #_tlist do local td = tip.tip_map_type[_tlist[k]][1] - if td.type == 8 then tip_hu = true tip_id = td.id - + --自动放炮 + --[[ if td.weight==7 then + _gamectr:SendAction(tip_id) + _chipeng_tip:Dispose() + self._chipeng_tip = nil + return + end]] + end - end for k = 1, #_tlist do @@ -1099,15 +1088,12 @@ function M:ReloadRoom() local info = self._player_info[self:GetPos(p.seat)] info._view:GetController('huxi').selectedIndex = 1 info._view:GetChild('huxi').text = p.hu_xi - info._view:GetController('zhanji').selectedIndex = 0 - if room.hpOnOff == 1 or room:checkHpNonnegative() then - if p.total_hp == nil then - p.total_hp = 0 - end + + info._view:GetController('zhanji').selectedIndex = 1 - info._view:GetChild('tex_jifen').text = d2ad(p.total_hp) + info._view:GetChild('tex_jifen').text = p.total_score -- d2ad(p.total_hp) info._view:GetChild('tex_jifen_text').text = "总胡息" - end + end local card_info = self._player_card_info[self:GetPos(p.seat)] diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/FanPaoFa_ResultView.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/FanPaoFa_ResultView.lua index bd7f2538..b7375b6c 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/FanPaoFa_ResultView.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/FanPaoFa_ResultView.lua @@ -188,8 +188,9 @@ function M:AddClearItem(room, data, total_data, over) local list_view2 = self._view:GetChild('player_list_2') printlog("result32") if data ~= nil and data.liuju == true then - self:FillLiuJuItemData(room, data) + self:FillLiuJuItemData(room, data,list_view1) if over == 1 then + printlog("result32222222ss") self:FillItemData2(room, total_data, list_view2) end else @@ -209,10 +210,16 @@ end function M:GetPos(room, seat) return ViewUtil.GetPos(room.self_player.seat, seat, room.room_config.people_num) end -function M:FillLiuJuItemData(room, data) +function M:FillLiuJuItemData(room, data,item) + printlog("FillLiuJuItemData") local qipai_list = self._view:GetChild('qipai_listl') local _dipaiC = self._view:GetController('qipai') + + pt(data) + + qipai_list:RemoveChildrenToPool() + printlog("FillLiuJuItemData1") if data.throw_card ~= nil and #data.throw_card > 0 then _dipaiC.selectedIndex = 1 local hand_card = PendulumRule.GetHandCard(data.throw_card, 3) @@ -225,10 +232,21 @@ function M:FillLiuJuItemData(room, data) else _dipaiC.selectedIndex = 0 end + printlog("FillLiuJuItemData2") for i = 1, #data.info_list do + if data.info_list[i].seat == room.banker_seat then + local p = room:GetPlayerBySeat(data.info_list[i].seat) + self._view:GetChild('WinerName').text = p.self_user.nick_name + self._view:GetChild("WinerID").text = "ID:"..p.self_user.account_id + local btn_head = self._view:GetChild('btn_head') + ImageLoad.Load(p.self_user.head_url, btn_head._iconObject) + end + + + if data.info_list[i].seat ~= room.self_player.seat and #data.info_list[i].hand_card > 0 then local card_list - if #data.info_list == 2 then + --[[if #data.info_list == 2 then card_list = self._view:GetChild('card_list_2') else if self:GetPos(room, data.info_list[i].seat) == 2 then @@ -236,19 +254,22 @@ function M:FillLiuJuItemData(room, data) else card_list = self._view:GetChild('card_list_3') end - end - + end]] + card_list = self._view:GetChild('card_list_2') + printlog("FillLiuJuItemData3") card_list:RemoveChildrenToPool() + pt(data.info_list[i].opCardList) for k = 1, #data.info_list[i].opCardList do + local fztype = data.info_list[i].opCardList[k].type if fztype == RB_FZType.Kan then local cards = card_list:AddItemFromPool() for j = 1, 3 do - cards:GetChild('card_' .. j).icon = - self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1) + cards:GetChild('card_' .. j).icon = self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1) end end end + printlog("FillLiuJuItemData4") local hand_card = PendulumRule.GetHandCard(data.info_list[i].hand_card, 3) for k = 1, #hand_card do local item = card_list:AddItemFromPool() @@ -256,6 +277,97 @@ function M:FillLiuJuItemData(room, data) item:GetChild('card_' .. (j)).icon = self:getCardItem('ui://Main_RunBeard/202_', hand_card[k][j]) end end + + printlog("FillLiuJuItemData5") + end + end + + item:RemoveChildrenToPool() + local info_list = data.info_list + for i = 1, #info_list do + if info_list[i].is_win == false then + local player = item:AddItemFromPool() + local p = room:GetPlayerBySeat(info_list[i].seat) + if p.self_user.account_id == room.owner_id then + player:GetController('owner').selectedIndex = 1 + end + if p.seat == room.banker_seat then + player:GetController('bank').selectedIndex = 1 + end + local btn_head = player:GetChild('btn_head') + ImageLoad.Load(p.self_user.head_url, btn_head._iconObject) + player:GetChild('playerName').text = p.self_user.nick_name + if info_list[i].round_score >= 0 then + player:GetChild('score').text = '+' .. info_list[i].round_score + player:GetChild('score').grayed = false + else + player:GetChild('score').text = info_list[i].round_score + player:GetChild('score').grayed = true + end + local hp_info = info_list[i].hp_info + player:GetChild("txt_userid").text = p.self_user.account_id + if (hp_info ~= nil and room.hpOnOff == 1 or room:checkHpNonnegative()) then + local isupper_limit = hp_info.upper_limit -- // 输赢是否已达上限 + if (isupper_limit) then + player:GetChild('yidashangxian').text = '已达上限' + else + player:GetChild('yidashangxian').text = '' + end + end + local card_list = player:GetChild('card_list') + card_list:RemoveChildrenToPool() + for k = 1, #info_list[i].opCardList do + local fztype = info_list[i].opCardList[k].type + if fztype == RB_FZType.Chi then + local cards = card_list:AddItemFromPool() + cards:GetChild('card_1').icon = + self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1) + cards:GetChild('card_2').icon = + self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card2) + cards:GetChild('card_3').icon = + self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card3) + elseif fztype == RB_FZType.Peng then + local cards = card_list:AddItemFromPool() + for j = 1, 3 do + cards:GetChild('card_' .. j).icon = + self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1) + end + elseif fztype == RB_FZType.Kan then + local cards = card_list:AddItemFromPool() + for j = 1, 3 do + cards:GetChild('card_' .. j).icon = + self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1) + end + elseif fztype == RB_FZType.Wei or fztype == RB_FZType.ChouWei then + local cards = card_list:AddItemFromPool() + for j = 1, 3 do + cards:GetChild('card_' .. j).icon = + self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1) + end + elseif fztype == RB_FZType.Pao then + local cards = card_list:AddItemFromPool() + for j = 1, 4 do + cards:GetChild('card_' .. j).icon = + self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1) + end + elseif fztype == RB_FZType.Ti then + local cards = card_list:AddItemFromPool() + for j = 1, 4 do + cards:GetChild('card_' .. j).icon = + self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1) + end + end + end + if #info_list[i].hand_card > 0 then + local hand_card = PendulumRule.GetHandCard(info_list[i].hand_card, 3) + for k = 1, #hand_card do + local cards = card_list:AddItemFromPool() + for j = 1, #hand_card[k] do + cards:GetChild('card_' .. (j)).icon = + self:getCardItem('ui://Main_RunBeard/202_', hand_card[k][j]) + end + end + end end end end @@ -318,17 +430,19 @@ function M:FillItemData(room, data, item) self._view:GetChild('huxi').text = '胡 息:+' .. win_data.hu_xi -- self._view:GetChild('tunshu').text = '基础囤数:' .. win_data.tun -- self._view:GetChild('zongtunshu').text = '总囤数:' .. win_data.total_tun - if win_data.round_score >= 0 then - self._view:GetChild('score').text = '总胡息:+' .. win_data.round_score + if win_data.total_score >= 0 then + self._view:GetChild('score').text = '总胡息:+' .. win_data.total_score self._view:GetChild('score').grayed = false else - self._view:GetChild('score').text = '总胡息:+' .. win_data.round_score + self._view:GetChild('score').text = '总胡息:' .. win_data.total_score self._view:GetChild('score').grayed = true end local hp_info = win_data.hp_info self._view:GetController("hudianpao").selectedIndex = win_data.hu_type + self._view:GetChild("fangpaoscore").text = "放炮扣息:-"..win_data.fangpaoscore + if (hp_info ~= nil and room.hpOnOff == 1 or room:checkHpNonnegative()) then local isupper_limit = hp_info.upper_limit -- // 输赢是否已达上限 if (isupper_limit) then @@ -673,7 +787,7 @@ function M:FillItemData2(room, data, list) player_list[i].param[4].value = tostring(ppcount) player_list[i].param[5] = {} - player_list[i].param[5].key = '鸟分:' + player_list[i].param[5].key = '打鸟总分:' player_list[i].param[5].value = tostring(dncount) end @@ -682,9 +796,11 @@ function M:FillItemData2(room, data, list) self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list) self:SetGSListlineGap(5) - + -- room.room_config.isNonnegative = 0 self:InitBigResult(room, 26) + + DataManager.CurrenRoom = nil -- list:RemoveChildrenToPool() -- for i =1, #data do @@ -783,7 +899,7 @@ function M:getCardItem(card_1, card_2) if _room ~= nil and _room.change_card_display ~= nil then return card_1 .. _room.change_card_display .. card_2 else - return card_1 .. '2_' .. card_2 + return card_1 .. '6_' .. card_2 end end diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/PlayerSelfCardInfoView.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/PlayerSelfCardInfoView.lua index b124a8c8..f83ad069 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/PlayerSelfCardInfoView.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/PlayerSelfCardInfoView.lua @@ -451,7 +451,6 @@ end local card = DataManager.CurrenRoom.self_player.handcard_list[i] list_remove(player.handcard_list, card) local _player = membe_deep_clone(player) - local tingList = CardCheck.tingPai(_player,DataManager.CurrenRoom) local isKan = false for j=1,#player.fz_list do diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/main/CardCheck copy.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/main/CardCheck copy.lua new file mode 100644 index 00000000..43e12948 --- /dev/null +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/main/CardCheck copy.lua @@ -0,0 +1,695 @@ +-- 检测牌是否存在 +local function checkCard(eventCard, cardList, num) + if num == nil then + num = 1 + end + local result = 0 + for i = 1, #cardList do + if (cardList[i] == eventCard) then + result = result + 1 + if (result == num) then + return true + end + end + end + + return false +end + +-- 移除指定数量的牌 +local function removeCard(cardList, card, count) + for i = 1, count do + list_remove(cardList, card) + end +end + +local function checkCardAndRomve(eventCard, cardList, num) + if (checkCard(eventCard, cardList, num)) then + removeCard(cardList, eventCard, num) + return true + end + return false +end + +-- 获取列表中牌数量 +local function cardNum(eventCard, cardList) + local result = 0 + for i = 1, #cardList do + local card = cardList[i] + if (card == eventCard) then + result = result + 1 + end + end + return result +end + +local M = { + pair_count = 0, + cardList = nil, + stack = nil, + stackHuxi = nil +} + +function M:push(cardGroup) + self.stack[#self.stack + 1] = cardGroup +end +function M:pushhuxi(cardGroup) + self.stackHuxi[#self.stackHuxi + 1] = cardGroup +end + +function M:rollBack() + local cardGroup = self.stack[#self.stack] + table.remove(self.stack, #self.stack) + for _, card in ipairs(cardGroup) do + self.cardList[#self.cardList + 1] = card + end + table.sort(self.cardList) +end +-- 顺子 +function M:tryShunzi1(card, player) + printlog("tryShunzi1") + if card < 300 and card % 100 > 8 then + return false + end + if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then + removeCard(self.cardList, card + 1, 1) + removeCard(self.cardList, card + 2, 1) + removeCard(self.cardList, card, 1) + local cardGroup = {card, card + 1, card + 2} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + return true + end + return false +end + + +-- 2 7 10 +function M:tryShunzi3(card, player) + printlog("tryShunzi3") + if card % 100 == 2 then + if (checkCard(card + 5, self.cardList, 1)) and (checkCard(card + 8, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card + 5, 1) + removeCard(self.cardList, card + 8, 1) + local cardGroup = {card, card + 5, card + 8} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + return true + end + end + return false +end + + +-- 坎 +function M:tryKezi(card, player) + printlog("tryKezi") + if (checkCard(card, self.cardList, 3)) then + removeCard(self.cardList, card, 3) + local cardGroup = {card, card, card} + self:push(cardGroup) + local _huxi = 1 + if self.drawCard~=card then + _huxi = 3 + end + self:pushhuxi(_huxi) + return true + end + return false +end + + + +function M:tryPair(card) + printlog("tryPair") + if (self.pair_count > 0) then + return false + end + + printlog(card) + pt(self.cardList) + if (checkCard(card, self.cardList, 2)) then + printlog("checkCard 2") + removeCard(self.cardList, card, 2) + local cardGroup = {card, card} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + elseif (checkCard(card, self.cardList, 1)) then + printlog("checkCard 1") + if card % 100 <=9 then + if (checkCard(card+1, self.cardList, 1)) then + printlog("checkCard 12") + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+1, 1) + local cardGroup = {card, card+1} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + end + + if card % 100 <=8 then + if (checkCard(card+2, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+2, 1) + local cardGroup = {card, card+2} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + end + + if card % 100 >=2 then + if (checkCard(card-1, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-1, 1) + local cardGroup = {card, card-1} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + end + + if card % 100 >=3 then + if (checkCard(card-2, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-2, 1) + local cardGroup = {card, card-2} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + end + + if card % 100 ==2 then + if (checkCard(card+5, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+5, 1) + local cardGroup = {card, card+5} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + if (checkCard(card+8, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+8, 1) + local cardGroup = {card, card+8} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + + end + + + if card % 100 ==7 then + if (checkCard(card-5, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-5, 1) + local cardGroup = {card, card-5} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + if (checkCard(card+3, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+3, 1) + local cardGroup = {card, card+3} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + + end + + if card % 100 ==10 then + if (checkCard(card-8, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-8, 1) + local cardGroup = {card, card-8} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + if (checkCard(card-3, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-3, 1) + local cardGroup = {card, card-3} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + + end + + + end + + return false +end + + +function M:tryPair2(card) + printlog("tryPair2") + if (self.pair_count > 0) then + return false + end + + if (checkCard(card, self.cardList, 1)) then + if card % 100 ==2 then + if (checkCard(card+5, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+5, 1) + local cardGroup = {card, card+5} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + if (checkCard(card+8, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+8, 1) + local cardGroup = {card, card+8} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + + end + + + if card % 100 ==7 then + if (checkCard(card-5, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-5, 1) + local cardGroup = {card, card-5} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + if (checkCard(card+3, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+3, 1) + local cardGroup = {card, card+3} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + + end + + if card % 100 ==10 then + if (checkCard(card-8, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-8, 1) + local cardGroup = {card, card-8} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + if (checkCard(card-3, self.cardList, 1)) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-3, 1) + local cardGroup = {card, card-3} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + self.pair_count = 1 + return true + end + + + end + + + end + + return false +end + + + +function M:tryWin(player) + + if #self.cardList == 0 then + if (self.pair_count == 1) then + return true + elseif self.pair_count == 2 and #self.stack==2 then + local tempPList={} + for i=1,#self.stack do + local card1=self.stack[i][1] + local card2=self.stack[i][2] + table.insert(tempPList,card1) + table.insert(tempPList,card2) + end + + if #tempPList~=4 then return false end + + table.sort(tempPList) + + if tempPList[1]==tempPList[2]+1 and tempPList[2]==tempPList[3]+1 and tempPList[3]==tempPList[4]+1 then + return true + end + + end + + return false + end + + + local activeCard = 0 + for i = 1, #self.cardList do + if (self.cardList[i] == 201 or self.cardList[i] == 202) then + activeCard = self.cardList[i] + break + end + end + if (activeCard == 0) then + activeCard = self.cardList[1] + end + + + print("check win:") + -- pt(self.cardList) + print("activeCard:"..activeCard) + + + + + if (activeCard % 100 == 1) then + + if self:tryShunzi1(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + if self:tryKezi(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + + + if self:tryPair(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + if self:tryPair2(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + elseif activeCard % 100 == 2 then + if self:tryShunzi3(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + if self:tryKezi(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + if self:tryPair(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + if self:tryPair2(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + if self:tryShunzi1(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + else + + if self:tryShunzi3(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + if self:tryKezi(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + + if self:tryPair(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + if self:tryPair2(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + + if self:tryShunzi1(activeCard, player) then + + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + + + + + -- end + return false +end + +local function init(self, player, cardInhand, addCard) + self.stack = {} + self.stackHuxi = {} + self.pair_count = 0 + self.kong_count = 0 + self.drawCard=0 + print("+++++++++++++++++++++++++++++++++++++++++++++++++") + + self.cardList = membe_clone(cardInhand) + --[[ + if addCard == nil then + self.kong_count = 1 + else + self.kong_count = 0 + self.cardList[#self.cardList + 1] = addCard + self.drawCard=addCard + end + ]] + table.sort(self.cardList) + + self.cardList = {106,107,108,109} + local eventCard = 108 + --local cardList ={108,109} + + local res = self:tryPair(eventCard) + + --local res = self:tryWin(player) + print("jefe check res") + print(res) + return false -- res +end + +function M.tingPai(player, room) + local self = setmetatable({}, {__index = M}) + local tingList = {} + local cardInhand = player.handcard_list + + + if not cardInhand or #cardInhand == 0 then + return tingList + end + local kan_huxi = 0 + local kan_cards = {} + + for j = 1, #player.fz_list do + for i = 1, #cardInhand do + if cardInhand[i] == player.fz_list[j].active_card and player.fz_list[j].type == 3 then + kan_cards[#kan_cards + 1] = cardInhand[i] + break + end + end + end + if #kan_cards > 0 then + for i = 1, #kan_cards do + kan_huxi = kan_huxi + 3 + removeCard(cardInhand, kan_cards[i], 3) + end + end + + + + player.tiCount = 0 + player.paoCount = 0 + + + -- for k = 100, 200, 100 do + -- for i = 1, 10 do + local tem =106 -- k + i + local result = init(self, player, cardInhand, tem) + + local num = 0 + for k = 1, #self.stackHuxi do + num = num + self.stackHuxi[k] + end + + if result then + local num1 = 0 + --pt(self.stackHuxi) + for k = 1, #self.stackHuxi do + num1 = num1 + self.stackHuxi[k] + --printlog(self.stackHuxi[k]) + end + if (player.hu_xi + num1 + kan_huxi) >= (self:getHuxi(room)-1) then + tingList[#tingList + 1] = tem + end + end + print("==============================================================") + + --return + --end + -- end + + return tingList +end + +function M:getHuxi(room) + if room.game_id == 301 then + return 8 + end + + if room.room_config.config.hunum==0 then + return 15 + end + + if room.game_id == 13 or room.game_id == 14 or room.game_id == 23 then + return 15 + elseif room.game_id == 26 then + return 10 + elseif room.game_id == 29 then + if room.room_config.maxPlayers == 3 then + return 15 + else + return 9 + end + end +end + +function M:GetFzData(tem, ctype) + local huxi + + if ctype == 1 then + huxi=1 + elseif ctype == 2 then + huxi=1 + elseif ctype == 3 then + huxi = 3 + elseif ctype == 4 then + huxi = 3 + elseif ctype == 5 then + huxi = 3 + elseif ctype == 7 then + huxi = 5 + end + return huxi +end + +return M diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/main/CardCheck.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/main/CardCheck.lua index 299fbcd7..91830d46 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/main/CardCheck.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/main/CardCheck.lua @@ -12,9 +12,15 @@ local function checkCard(eventCard, cardList, num) end end end + return false end +local function cardType(card) + return card/100 +end + + -- 移除指定数量的牌 local function removeCard(cardList, card, count) for i = 1, count do @@ -64,46 +70,11 @@ function M:rollBack() end table.sort(self.cardList) end --- 顺子 -function M:tryShunzi1(card, player) - if card < 300 and card % 100 > 8 then - return false - end - if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then - removeCard(self.cardList, card + 1, 1) - removeCard(self.cardList, card + 2, 1) - removeCard(self.cardList, card, 1) - local cardGroup = {card, card + 1, card + 2} - self:push(cardGroup) - local _huxi = 0 - self:pushhuxi(_huxi) - return true - end - return false -end - --- 2 7 10 -function M:tryShunzi3(card, player) - if card % 100 == 2 then - if (checkCard(card + 5, self.cardList, 1)) and (checkCard(card + 8, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card + 5, 1) - removeCard(self.cardList, card + 8, 1) - local cardGroup = {card, card + 5, card + 8} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - return true - end - end - return false -end - - --- 坎 +--坎 function M:tryKezi(card, player) - if (checkCard(card, self.cardList, 3)) then + if cardNum(card, self.cardList)>=3 then + removeCard(self.cardList, card, 3) local cardGroup = {card, card, card} self:push(cardGroup) @@ -117,258 +88,128 @@ function M:tryKezi(card, player) return false end +--顺子1 +function M:tryShunzi1(card, player) + if card < 200 and card % 100 > 8 then + return false + end + if (cardNum(card + 1, self.cardList)> 0 and cardNum(card + 2, self.cardList) > 0 ) then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card + 1, 1) + removeCard(self.cardList, card + 2, 1) + + local cardGroup = {card, card + 1, card + 2} + self:push(cardGroup) + local _huxi = 0 + if card%100==1 then + if card>200 then + _huxi = 6 + else + _huxi = 3 + end + end + self:pushhuxi(_huxi) + return true + end + return false +end +--顺子2 +function M:tryShunzi2(card, player) + + if cardType(card) == 1 then + if cardNum(card+100,self.cardList) >= 1 and cardNum(card,self.cardList)>=2 then + removeCard(self.cardList, card, 2) + removeCard(self.cardList, card + 100, 1) + local cardGroup = {card, card, card+100} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + return true + end + + if cardNum(card+100,self.cardList)>=2 then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card+100, 2) + local cardGroup = {card, card+100, card+100} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + return true + end + + else + + if cardNum(card-100,self.cardList) >= 1 and cardNum(card,self.cardList)>=2 then + removeCard(self.cardList, card, 2) + removeCard(self.cardList, card - 100, 1) + local cardGroup = {card, card, card-100} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + return true + end + + if cardNum(card-100,self.cardList)>=2 then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card-100, 2) + local cardGroup = {card, card-100, card-100} + self:push(cardGroup) + local _huxi = 0 + self:pushhuxi(_huxi) + return true + end + + + end + return false + +end + +function M:tryShunzi3(card, player) + if card % 100 == 2 then + if cardNum(card + 5, self.cardList)>0 and cardNum(card + 8, self.cardList)>0 then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, card + 5, 1) + removeCard(self.cardList, card + 8, 1) + local cardGroup = {card, card + 5, card + 8} + self:push(cardGroup) + local _huxi = 1 + self:pushhuxi(_huxi) + return true + end + end + return false +end + +function M:tryHuazi(card) + +end function M:tryPair(card) - if (self.pair_count > 0) then + + if (self.pair_count > 0) then return false end - if (checkCard(card, self.cardList, 2)) then + + if cardNum(card, self.cardList)>=2 then removeCard(self.cardList, card, 2) - local cardGroup = {card, card} + local cardGroup = {card, card , card} self:push(cardGroup) - local _huxi = 0 - self:pushhuxi(_huxi) - self.pair_count = 1 + self.pair_count = 1; + local _huxi = 0 + self:pushhuxi(_huxi) return true - elseif (checkCard(card, self.cardList, 1)) then - if card % 100 <=9 then - if (checkCard(card+1, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card+1, 1) - local cardGroup = {card, card+1} - self:push(cardGroup) - local _huxi = 0 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - end - - if card % 100 <=8 then - if (checkCard(card+2, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card+2, 1) - local cardGroup = {card, card+2} - self:push(cardGroup) - local _huxi = 0 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - end - - if card % 100 >=2 then - if (checkCard(card-1, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card-1, 1) - local cardGroup = {card, card-1} - self:push(cardGroup) - local _huxi = 0 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - end - - if card % 100 >=3 then - if (checkCard(card-2, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card-2, 1) - local cardGroup = {card, card-2} - self:push(cardGroup) - local _huxi = 0 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - end - - if card % 100 ==2 then - if (checkCard(card+5, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card+5, 1) - local cardGroup = {card, card+5} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - if (checkCard(card+8, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card+8, 1) - local cardGroup = {card, card+8} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - - end - - - if card % 100 ==7 then - if (checkCard(card-5, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card-5, 1) - local cardGroup = {card, card-5} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - if (checkCard(card+3, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card+3, 1) - local cardGroup = {card, card+3} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - - end - - if card % 100 ==10 then - if (checkCard(card-8, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card-8, 1) - local cardGroup = {card, card-8} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - if (checkCard(card-3, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card-3, 1) - local cardGroup = {card, card-3} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - - end - - end - - return false + end -function M:tryPair2(card) - if (self.pair_count > 0) then - return false - end - - if (checkCard(card, self.cardList, 1)) then - if card % 100 ==2 then - if (checkCard(card+5, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card+5, 1) - local cardGroup = {card, card+5} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - if (checkCard(card+8, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card+8, 1) - local cardGroup = {card, card+8} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - - end - - - if card % 100 ==7 then - if (checkCard(card-5, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card-5, 1) - local cardGroup = {card, card-5} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - if (checkCard(card+3, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card+3, 1) - local cardGroup = {card, card+3} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - - end - - if card % 100 ==10 then - if (checkCard(card-8, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card-8, 1) - local cardGroup = {card, card-8} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - if (checkCard(card-3, self.cardList, 1)) then - removeCard(self.cardList, card, 1) - removeCard(self.cardList, card-3, 1) - local cardGroup = {card, card-3} - self:push(cardGroup) - local _huxi = 1 - self:pushhuxi(_huxi) - self.pair_count = 1 - return true - end - - - end - - - end - - return false -end - - - function M:tryWin(player) - - if #self.cardList == 0 then + --[[ if #self.cardList == 0 then if (self.pair_count == 1) then return true - elseif self.pair_count == 2 and #self.stack==2 then + elseif #self.stack>=2 then local tempPList={} for i=1,#self.stack do local card1=self.stack[i][1] @@ -389,27 +230,44 @@ function M:tryWin(player) return false end - - + ]] + if #self.cardList == 0 then + if (player.tiCount+player.paoCount)>0 then + if self.pair_count ==1 then + return true + end + return false + else + if self.pair_count >0 then + return false + end + return true + end + end + local activeCard = 0 + for i = 1, #self.cardList do if (self.cardList[i] == 201 or self.cardList[i] == 202) then activeCard = self.cardList[i] break end end + if (activeCard == 0) then activeCard = self.cardList[1] end - + + if (activeCard % 100 == 1) then - if self:tryShunzi1(activeCard, player) then + if self:tryShunzi1(activeCard, player) then if self:tryWin(player) then return true end self:rollBack() table.remove(self.stackHuxi, #self.stackHuxi) end + if self:tryKezi(activeCard, player) then if self:tryWin(player) then return true @@ -417,26 +275,28 @@ function M:tryWin(player) self:rollBack() table.remove(self.stackHuxi, #self.stackHuxi) end - - if self:tryPair(activeCard) then + + if (player.tiCount + player.paoCount)>0 then + if self:tryPair(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + end + + if self:tryShunzi2(activeCard, player) then if self:tryWin(player) then return true end - self.pair_count = 0 self:rollBack() - table.remove(self.stackHuxi, #self.stackHuxi) + table.remove(self.stackHuxi, #self.stackHuxi) end - - if self:tryPair2(activeCard) then - if self:tryWin(player) then - return true - end - self.pair_count = 0 - self:rollBack() - table.remove(self.stackHuxi, #self.stackHuxi) - end - + elseif activeCard % 100 == 2 then + if self:tryShunzi3(activeCard, player) then if self:tryWin(player) then return true @@ -444,6 +304,7 @@ function M:tryWin(player) self:rollBack() table.remove(self.stackHuxi, #self.stackHuxi) end + if self:tryKezi(activeCard, player) then if self:tryWin(player) then return true @@ -451,33 +312,34 @@ function M:tryWin(player) self:rollBack() table.remove(self.stackHuxi, #self.stackHuxi) end - - if self:tryPair(activeCard) then - if self:tryWin(player) then - return true + + if (player.tiCount + player.paoCount)>0 then + if self:tryPair(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) end - self.pair_count = 0 - self:rollBack() - table.remove(self.stackHuxi, #self.stackHuxi) end - - if self:tryPair2(activeCard) then - if self:tryWin(player) then - return true - end - self.pair_count = 0 - self:rollBack() - table.remove(self.stackHuxi, #self.stackHuxi) - end - - if self:tryShunzi1(activeCard, player) then + + if self:tryShunzi1(activeCard, player) then if self:tryWin(player) then return true end self:rollBack() table.remove(self.stackHuxi, #self.stackHuxi) end - + + if self:tryShunzi2(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + else if self:tryKezi(activeCard, player) then if self:tryWin(player) then @@ -486,37 +348,41 @@ function M:tryWin(player) self:rollBack() table.remove(self.stackHuxi, #self.stackHuxi) end - - if self:tryPair(activeCard) then - if self:tryWin(player) then - return true + + if (player.tiCount + player.paoCount)>0 then + if self:tryPair(activeCard) then + if self:tryWin(player) then + return true + end + self.pair_count = 0 + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) end - self.pair_count = 0 - self:rollBack() - table.remove(self.stackHuxi, #self.stackHuxi) end - - if self:tryPair2(activeCard) then - if self:tryWin(player) then - return true - end - self.pair_count = 0 - self:rollBack() - table.remove(self.stackHuxi, #self.stackHuxi) - end - - - if self:tryShunzi1(activeCard, player) then + + if self:tryShunzi1(activeCard, player) then if self:tryWin(player) then return true end self:rollBack() table.remove(self.stackHuxi, #self.stackHuxi) end + + if self:tryShunzi2(activeCard, player) then + if self:tryWin(player) then + return true + end + self:rollBack() + table.remove(self.stackHuxi, #self.stackHuxi) + end + end return false + end + + local function init(self, player, cardInhand, addCard) self.stack = {} self.stackHuxi = {} @@ -531,44 +397,82 @@ local function init(self, player, cardInhand, addCard) self.cardList[#self.cardList + 1] = addCard self.drawCard=addCard end - table.sort(self.cardList) - return self:tryWin(player) + + table.sort(self.cardList) + + local res = self:tryWin(player) + return res end function M.tingPai(player, room) local self = setmetatable({}, {__index = M}) local tingList = {} local cardInhand = player.handcard_list + + if not cardInhand or #cardInhand == 0 then return tingList end local kan_huxi = 0 local kan_cards = {} + + if player.tiCount==nil then + player.tiCount = 0 + end + if player.paoCount==nil then + player.paoCount = 0 + end + for j = 1, #player.fz_list do for i = 1, #cardInhand do if cardInhand[i] == player.fz_list[j].active_card and player.fz_list[j].type == 3 then kan_cards[#kan_cards + 1] = cardInhand[i] break end + if player.fz_list[j].type==6 then + player.paoCount = 1 + if cardType(player.fz_list[j].active_card) ==2 then + kan_huxi = kan_huxi + 9 + else + kan_huxi = kan_huxi + 6 + end + + end + if player.fz_list[j].type==7 then + player.tiCount = 1 + if cardType(player.fz_list[j].active_card) ==2 then + kan_huxi = kan_huxi + 12 + else + kan_huxi = kan_huxi + 9 + end + end + if player.fz_list[j].type==2 then + if cardType(player.fz_list[j].active_card) ==2 then + kan_huxi = kan_huxi + 3 + else + kan_huxi = kan_huxi + 1 + end + end end end if #kan_cards > 0 then for i = 1, #kan_cards do - kan_huxi = kan_huxi + 3 + + if cardType(kan_cards[i])==2 then + kan_huxi = kan_huxi + 6 + else + kan_huxi = kan_huxi + 3 + end + removeCard(cardInhand, kan_cards[i], 3) end end - player.tiCount = 0 - player.paoCount = 0 - - + for k = 100, 200, 100 do for i = 1, 10 do local tem = k + i + local result = init(self, player, cardInhand, tem) - if result then - --printlog("是否胡牌===>>>",tem) - end local num = 0 for k = 1, #self.stackHuxi do @@ -577,18 +481,13 @@ function M.tingPai(player, room) if result then local num1 = 0 - --pt(self.stackHuxi) for k = 1, #self.stackHuxi do num1 = num1 + self.stackHuxi[k] - --printlog(self.stackHuxi[k]) end if (player.hu_xi + num1 + kan_huxi) >= (self:getHuxi(room)-1) then tingList[#tingList + 1] = tem end end - - - end end return tingList diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPCardView.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPCardView.lua index d14119e9..95cd60a0 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPCardView.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPCardView.lua @@ -56,7 +56,7 @@ function M:GetCardItem(card_1, card_2) if room.change_card_display ~= nil then return card_1 .. room.change_card_display .. card_2 else - return card_1 .. "2_" .. card_2 + return card_1 .. "6_" .. card_2 end end diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPPlayerCardInfoView.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPPlayerCardInfoView.lua index 1dcd0832..cc5c8a02 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPPlayerCardInfoView.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPPlayerCardInfoView.lua @@ -174,8 +174,9 @@ function M:InitHandCard(handcard) for i =1,#pokerList do for j =1,#pokerList[i] do local card_code = pokerList[i][j] - local btn_card =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipai") + local btn_card =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipais") btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_",card_code) + self._area_handcard_list:AddChild(btn_card) self._area_handcard_list:SetChildIndex(btn_card,5-j) local card_view = NewCardView(btn_card,card_code,i,j) @@ -468,7 +469,7 @@ function M:getCardItem( card_1,card_2 ) if self._room.change_card_display ~=nil then return card_1..self._room.change_card_display..card_2 else - return card_1.."2_"..card_2 + return card_1.."6_"..card_2 end end diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPPlayerSelfCardInfoView.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPPlayerSelfCardInfoView.lua index 828f042e..25e08568 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPPlayerSelfCardInfoView.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/main/ZPPlayerSelfCardInfoView.lua @@ -160,10 +160,14 @@ function M:ShowHuTip(card) selfplayeTable.paoCount = _aplayer.paoCount selfplayeTable.hu_xi = _aplayer.hu_xi local player = membe_deep_clone(selfplayeTable) + player.tiCount = _aplayer.tiCount + player.paoCount = _aplayer.paoCount if card ~= nil then list_remove(player.handcard_list, card) end + printlog("jefe ting pai") local tingList = CardCheck.tingPai(player, DataManager.CurrenRoom) + pt(tingList) if self._mainView._hu_tip ~= nil then self._mainView._hu_tip:FillData(tingList) end diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/main/functions.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/main/functions.lua new file mode 100644 index 00000000..94dffd4e --- /dev/null +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/main/functions.lua @@ -0,0 +1,304 @@ +local setmetatable = setmetatable + +function class(classname, super) + local superType = type(super) + local cls + + if superType ~= "function" and superType ~= "table" then + superType = nil + super = nil + end + + if superType == "function" or (super and super.__ctype == 1) then + -- inherited from native C++ Object + cls = {} + + if superType == "table" then + -- copy fields from super + for k,v in pairs(super) do cls[k] = v end + cls.__create = super.__create + cls.super = super + else + cls.__create = super + cls.ctor = function() end + end + + cls.__cname = classname + cls.__ctype = 1 + + function cls.new(...) + local instance = cls.__create(...) + -- copy fields from class to native object + for k,v in pairs(cls) do instance[k] = v end + instance.class = cls + instance:ctor(...) + return instance + end + + else + -- inherited from Lua Object + if super then + cls = {} + setmetatable(cls, {__index = super}) + cls.super = super + else + cls = {ctor = function() end} + end + + cls.__cname = classname + cls.__ctype = 2 -- lua + cls.__index = cls + + function cls.new(...) + local instance = setmetatable({}, cls) + instance.class = cls + instance:ctor(...) + return instance + end + end + + return cls +end + +-- 刘海偏移 +function get_offset(full_offset) + if full_offset then + local r = GRoot.inst.width / GRoot.inst.height + if r >= 2 then + local d = (Screen.dpi /160) + return d * 20 + end + end + return 0 +end + +---lua table 浅拷贝 +function membe_clone(orig) + local copy + if type(orig) == "table" then + copy = {} + for orig_key, orig_value in pairs(orig) do + copy[orig_key] = orig_value + end + else -- number, string, boolean, etc + copy = orig + end + return copy +end + +-- lua table 深拷贝 +function membe_deep_clone(orig) + local copy + if type(orig) == "table" then + copy = {} + for orig_key, orig_value in pairs(orig) do + copy[membe_deep_clone(orig_key)] = membe_deep_clone(orig_value) + end + else + copy = orig + end + return copy +end + + +---字符串分割函数 +function split(str, delimiter) + if str==nil or str=='' or delimiter==nil then + return nil + end + + local result = {} + for match in (str..delimiter):gmatch("(.-)"..delimiter) do + table.insert(result, match) + end + return result +end + + +function handler( obj,func) + return function(...) + return func(obj, ...) + end +end + +--重新require一个lua文件,替代系统文件。 +function unimport(moduleName,currentModuleName) + local package = package + local currentModuleNameParts + local moduleFullName = moduleName + local offset = 1 + + while true do + if string.byte(moduleName, offset) ~= 46 then -- . + moduleFullName = string.sub(moduleName, offset) + if currentModuleNameParts and #currentModuleNameParts > 0 then + moduleFullName = table.concat(currentModuleNameParts, ".") .. "." .. moduleFullName + end + break + end + offset = offset + 1 + + if not currentModuleNameParts then + if not currentModuleName then + local n,v = debug.getlocal(3, 1) + currentModuleName = v + end + + currentModuleNameParts = string.split(currentModuleName, ".") + end + table.remove(currentModuleNameParts, #currentModuleNameParts) + end + + package.loaded[moduleFullName] = nil + package.preload[moduleFullName] = nil +end + +function table.nums(t) + local count = 0 + for k, v in pairs(t) do + count = count + 1 + end + return count +end + +-- @param t 要检查的表格(t表示是table) +-- @param table 返回指定表格的所有键(key),它是一个键集合的表格 +--]] +function table.keys( t ) + local keys = {} + for k, _ in pairs( t ) do + keys[#keys + 1] = k + end + return keys +end + +function list_remove(t,item) + for i,v in ipairs(t) do + if v == item then + table.remove(t,i) + break + end + end +end + +function list_check(t,item) + for i,v in ipairs(t) do + if v == item then + return true + end + end + return false +end + +function list_index(t,item) + for i,v in ipairs(t) do + if v == item then + return i + end + end + return 0 +end + +function list_concat(des,tag) + for i = 1, #tag do + table.insert(des, tag[i]) + end + return des +end + +function vardump(object, label) + local lookupTable = {} + local result = {} + + local function _v(v) + if type(v) == "string" then + v = "\"" .. v .. "\"" + end + return tostring(v) + end + + local function _vardump(object, label, indent, nest) + label = label or "" + local postfix = "" + if nest > 1 then postfix = "," end + if type(object) ~= "table" then + -- if type(label) == "string" then + result[#result +1] = string.format("%s%s = %s%s", indent, label, _v(object), postfix) + -- else + -- result[#result +1] = string.format("%s%s%s", indent, _v(object), postfix) + -- end + elseif not lookupTable[object] then + lookupTable[object] = true + + -- if type(label) == "string" then + result[#result +1 ] = string.format("%s%s = {", indent, label) + -- else + -- result[#result +1 ] = string.format("%s{", indent) + -- end + local indent2 = indent .. " " + local keys = {} + local values = {} + for k, v in pairs(object) do + keys[#keys + 1] = k + values[k] = v + end + table.sort(keys, function(a, b) + if type(a) == "number" and type(b) == "number" then + return a < b + else + return tostring(a) < tostring(b) + end + end) + for i, k in ipairs(keys) do + _vardump(values[k], k, indent2, nest + 1) + end + result[#result +1] = string.format("%s}%s", indent, postfix) + end + end + _vardump(object, label, "", 1) + + return table.concat(result, "\n") +end + +function sysrandom(min,max) + local num = math.random(min,max) + return num +end + + +function IsHasDictionary(currentTarget,list) + if list and #list>0 then + for k,v in ipairs(list) do + if v==currentTarget then + return true + end + end + return false + else + return false + end +end + + +function CheckDictionaryFromContent(target,list) + if list and #list>0 then + for k,v in pairs(list) do + if v.card==target then + return true,k + end + end + else + return false + end +end + + +function CombineDictionaryAndRemoveSomeItem(list1,list2) + local tempList=membe_clone(list2) + for i=1,#list1 do + if IsHasDictionary(list1[i],list2)==false then + table.insert(tempList,list1[i]) + end + end + return tempList +end \ No newline at end of file diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/main/test.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/main/test.lua new file mode 100644 index 00000000..7a321e8c --- /dev/null +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/main/test.lua @@ -0,0 +1,148 @@ + +local funcs = require("functions") +local CardCheck = require("CardCheck") + +function LuaPrint(lua_table, limit, indent, step) + step = step or 0 + indent = indent or 0 + local content = "" + if limit ~= nil then + if step > limit then + return "..." + end + end + if step > 10 then + return content .. "..." + end + if lua_table == nil then + return "nil" + end + if type(lua_table) == "userdata" or type(lua_table) == "lightuserdata" or type(lua_table) == "thread" then + return tostring(lua_table) + end + + if type(lua_table) == "string" or type(lua_table) == "number" then + return "[No-Table]:" .. lua_table + end + + for k, v in pairs(lua_table) do + if k ~= "_class_type" then + local szBuffer = "" + Typev = type(v) + if Typev == "table" then + szBuffer = "{" + end + local szPrefix = string.rep(" ", indent) + if Typev == "table" and v._fields then + local kk, vv = next(v._fields) + if type(vv) == "table" then + content = content .. "\n\t" .. kk.name .. "={" .. LuaPrint(vv._fields, 5, indent + 1, step + 1) .. + "}" + else + content = content .. "\n\t" .. kk.name .. "=" .. vv + end + else + if type(k) == "table" then + if k.name then + if type(v) ~= "table" then + content = content .. "\n" .. k.name .. "=" .. v + else + content = content .. "\n" .. k.name .. " = list:" + local tmp = "\n" + for ka, va in ipairs(v) do + tmp = tmp .. "#" .. ka .. "_" .. tostring(va) + end + content = content .. tmp + end + end + elseif type(k) == "function" then + content = content .. "\n fun=function" + else + formatting = szPrefix .. tostring(k) .. " = " .. szBuffer + if Typev == "table" then + content = content .. "\n" .. formatting + content = content .. LuaPrint(v, limit, indent + 1, step + 1) + content = content .. "\n" .. szPrefix .. "}," + else + local szValue = "" + if Typev == "string" then + szValue = string.format("%q", v) + else + szValue = tostring(v) + end + content = content .. "\n" .. formatting .. (szValue or "nil") .. "," + end + end + end + end + end + return content +end + +function printlog(...) + if true then + print(...) + end +end + +function pt(...) + if true then + local arg = { ... } + local has = false + for _, v in pairs(arg) do + if v and type(v) == "table" then + has = true + break + end + end + if not has then + print(...) + end + + local content = "" + for _, v in pairs(arg) do + if v == "table" then + content = content .. tostring(v) .. "\n" + else + content = content .. "==>[T]:" .. LuaPrint(v, limit), debug.traceback() .. "\n" + end + print(content) + end + end +end + +local player = {} +local room = {} +room.game_id = 17 +room.room_config = { + config = { + hunum = 0 + } +} + +player.hu_xi = 0 +player.handcard_list ={106,107,105,109,109,205,205,205,204,204,204,108,108,108,201,201,202,207,210,209} + + +player.fz_list = { + --[[ + { + type = 2, + active_card = 208, + opcard = {208,208}, + card = 208, + }, + { + type = 1, + card = 204, + opcard = { + 203, + 202, + }, + active_card = 204, + }]] +} + +CardCheck.tingPai(player,room) + + diff --git a/qyq_new_unity/Assets/ART/base/main_majiang/ui/MajiangCard3d_atlas0.png b/qyq_new_unity/Assets/ART/base/main_majiang/ui/MajiangCard3d_atlas0.png index e078dbbb..85f03107 100644 Binary files a/qyq_new_unity/Assets/ART/base/main_majiang/ui/MajiangCard3d_atlas0.png and b/qyq_new_unity/Assets/ART/base/main_majiang/ui/MajiangCard3d_atlas0.png differ diff --git a/qyq_new_unity/Assets/ART/base/main_majiang/ui/MajiangCard3d_fui.bytes b/qyq_new_unity/Assets/ART/base/main_majiang/ui/MajiangCard3d_fui.bytes index f8239774..8d46756e 100644 Binary files a/qyq_new_unity/Assets/ART/base/main_majiang/ui/MajiangCard3d_fui.bytes and b/qyq_new_unity/Assets/ART/base/main_majiang/ui/MajiangCard3d_fui.bytes differ diff --git a/qyq_new_unity/Assets/ART/extend/zipai/weimaque/ui/Extend_Poker_WeiMaQue_atlas0.png b/qyq_new_unity/Assets/ART/extend/zipai/weimaque/ui/Extend_Poker_WeiMaQue_atlas0.png index ab4b6654..78256ea4 100644 Binary files a/qyq_new_unity/Assets/ART/extend/zipai/weimaque/ui/Extend_Poker_WeiMaQue_atlas0.png and b/qyq_new_unity/Assets/ART/extend/zipai/weimaque/ui/Extend_Poker_WeiMaQue_atlas0.png differ diff --git a/qyq_new_unity/Assets/ART/extend/zipai/weimaque/ui/Extend_Poker_WeiMaQue_fui.bytes b/qyq_new_unity/Assets/ART/extend/zipai/weimaque/ui/Extend_Poker_WeiMaQue_fui.bytes index 56e7d1a4..b821e7f0 100644 Binary files a/qyq_new_unity/Assets/ART/extend/zipai/weimaque/ui/Extend_Poker_WeiMaQue_fui.bytes and b/qyq_new_unity/Assets/ART/extend/zipai/weimaque/ui/Extend_Poker_WeiMaQue_fui.bytes differ diff --git a/wb_new_ui/.objs/metas/ppu1wv76/j4mf9j.info b/wb_new_ui/.objs/metas/ppu1wv76/j4mf9j.info index e64d38e1..90df6874 100644 --- a/wb_new_ui/.objs/metas/ppu1wv76/j4mf9j.info +++ b/wb_new_ui/.objs/metas/ppu1wv76/j4mf9j.info @@ -1,5 +1,14 @@ { "objectStatus": { + "n51_fmkv": { + "collapsed": true + }, + "n58_fnpw": { + "collapsed": true + }, + "n19_pt1r": { + "collapsed": true + }, "n33_n1ry": { "hidden": true } diff --git a/wb_new_ui/.objs/metas/v6yvqp7w/aen81bf.info b/wb_new_ui/.objs/metas/v6yvqp7w/aen81bf.info new file mode 100644 index 00000000..b6f2bc41 --- /dev/null +++ b/wb_new_ui/.objs/metas/v6yvqp7w/aen81bf.info @@ -0,0 +1,7 @@ +{ + "objectStatus": { + "n27_rbpg": { + "hidden": true + } + } +} \ No newline at end of file diff --git a/wb_new_ui/.objs/workspace.json b/wb_new_ui/.objs/workspace.json index 69a42772..d3c1f466 100644 --- a/wb_new_ui/.objs/workspace.json +++ b/wb_new_ui/.objs/workspace.json @@ -10,8 +10,15 @@ "doc.openedDocs": [ "ui://ppu1wv76j4mf9d", "ui://27vd145bko559b", + "ui://v6yvqp7wf55qwa", "ui://niy3ldiwl9mny", "ui://ppu1wv76j4mf9j", + "ui://v6yvqp7wlyf1qx", + "ui://v6yvqp7wwyal80", + "ui://v6yvqp7wvt8rz0", + "ui://v6yvqp7wyfzf1h4", + "ui://ppu1wv76j4mf9k", + "ui://ppu1wv76j4mf9n", "ui://v0j9abjygq7m7w", "ui://vplxondscioehnd", "ui://ppu1wv76j4mf9e", @@ -25,13 +32,21 @@ "test.device": "720p Phone", "canvasColor": 10066329, "auxline2": true, - "doc.activeDoc": "ui://27vd145bko559b", + "doc.activeDoc": "ui://v6yvqp7wwyal80", "libview.twoColumn": false, "libview.expandedNodes": [ - "vplxonds", + "27vd145b", "/", - "vplxonds", - "/invite/" + "ppu1wv76", + "/", + "ppu1wv76", + "/component/", + "yzaioi79", + "/", + "yzaioi79", + "/component/", + "yzaioi79", + "/component/tips/" ], "auxline1": true, "snapToGrid": true, diff --git a/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/FullName.xml b/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/FullName.xml index 6506d7c8..429e24b5 100644 --- a/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/FullName.xml +++ b/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/FullName.xml @@ -1,9 +1,9 @@ - + - + \ No newline at end of file diff --git a/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/card_item.xml b/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/card_item.xml index b7510f5c..53e50281 100644 --- a/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/card_item.xml +++ b/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/card_item.xml @@ -9,13 +9,13 @@ - + - + - + diff --git a/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/clearing.xml b/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/clearing.xml index 060c9ac4..55a0efaa 100644 --- a/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/clearing.xml +++ b/wb_new_ui/assets/Extend_Poker_FanPaoFa/component/clearing/clearing.xml @@ -1,20 +1,20 @@ - + - + - + @@ -49,49 +49,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -113,7 +70,10 @@