diff --git a/lua_probject/base_project/Game/View/Family/FamilyRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyRecord.lua index 8b865e1c..08c2691f 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyRecord.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyRecord.lua @@ -1,4 +1,9 @@ -local FamilAllRank = {} +local FamilAllRank = { + allCount = 0, + pageCount = 0, + currenPage = 0, + onePageChildCount = 0 +} local M = FamilAllRank @@ -41,8 +46,10 @@ function M:init() self._viewList_record:SetVirtual() self._viewList_record.scrollPane.touchEffect = false -- 禁止拖动滚动 self._viewList_record.scrollPane.bouncebackEffect = false -- 关闭回弹效果 + -- self._viewList_record.scrollPane.snapToItem = true self._viewList_record.itemRenderer = function(index, obj) - self:RecordItemRenderer(self.records[index + 1], obj) + local baseIndex = (self.currenPage - 1) * self.onePageChildCount + self:RecordItemRenderer(self.records[baseIndex + index + 1], obj) end self._viewList_recordDetail = self._view:GetChild('list_record_detail') @@ -62,11 +69,100 @@ function M:init() --分页 self._btn_nextPage = self._view:GetChild('btn_nextPage') self._btn_lastPage = self._view:GetChild('btn_lastPage') - self._text_pageNum = self._view:GetChild('_text_pageNum') + self._text_pageNum = self._view:GetChild('text_pageNum') + self._btn_nextPage.onClick:Set(function() + if self.currenPage < self.pageCount then + self.currenPage = self.currenPage + 1 + self:SetPageNum() + end + end) + + self._btn_lastPage.onClick:Set(function() + if self.currenPage > 1 then + self.currenPage = self.currenPage - 1 + self:SetPageNum() + end + end) self:ShowNumberRecord() end +--------分页功能函数------------ +function M:SetDontTouch(btn) + btn:GetController('donTouch').selectedIndex = 1 + btn.touchable = false +end + +function M:SetTouch(btn) + btn:GetController('donTouch').selectedIndex = 0 + btn.touchable = true +end + +function M:SetPageNum() + if self.currenPage < self.pageCount then + self._viewList_record.numItems = self.onePageChildCount + self._viewList_record:RefreshVirtualList() + self:SetTouch(self._btn_nextPage) + else + local num = self.allCount % self.onePageChildCount + self._viewList_record.numItems = num == 0 and self.onePageChildCount or num + self._viewList_record:RefreshVirtualList() + self:SetDontTouch(self._btn_nextPage) + end + if self.currenPage > 1 then + self:SetTouch(self._btn_lastPage) + else + self:SetDontTouch(self._btn_lastPage) + end + self._text_pageNum.text = string.format("%d/%d", self.currenPage, self.pageCount) +end + +function M:InitPageNum(allCount) + self.allCount = allCount + self.onePageChildCount = self._viewList_record.columnCount * self._viewList_record.lineCount + self.pageCount = math.ceil(allCount / self.onePageChildCount) + self.currenPage = 1 + self:SetDontTouch(self._btn_lastPage) + if self.currenPage < self.pageCount then + self:SetTouch(self._btn_nextPage) + else + self:SetDontTouch(self._btn_nextPage) + end +end + +function M:ShowNumberRecord() + local fgCtr = ControllerManager.GetController(NewGroupController) + self.records = {} + local uid = DataManager.SelfUser.account_id + + self:RecursionRecord(fgCtr, 0, uid, self.selectTimes, self.selectTimes + 86399) +end + +function M:RecursionRecord(fgCtr, index, uid, leftTime, rightTime) + fgCtr:FG_GetGroupRecordSpe2(self.group_id, GetPlatform(), uid, 0, index * 60, 60, leftTime, rightTime, 0, + function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "查看个人战绩失败") + self.visible = false + return + else + local records = res.Data.records + if records and #records > 0 then + for i = 1, #records do + records[i].totalScore = json.decode(records[i].totalScore) + table.insert(self.records, records[i]) + end + self:RecursionRecord(fgCtr, index + 1, uid, leftTime, rightTime) + else + self:InitPageNum(#self.records) + self:SetPageNum() + -- self._viewList_record:EnsureBoundsCorrect() + end + end + end) +end + +------------------------------- function M:InitTime() local timeTable = os.date("*t", os.time()) timeTable.hour = 0 @@ -88,14 +184,6 @@ function M:InitTime() return serverDayValues, serverDayItems end -function M:ShowNumberRecord() - local fgCtr = ControllerManager.GetController(NewGroupController) - self.records = {} - local uid = DataManager.SelfUser.account_id - - self:RecursionRecord(fgCtr, 0, uid, self.selectTimes, self.selectTimes + 86399) -end - function M:RecordItemDetailRender(round, allDate, rdata, obj) obj:GetChild('text_round').text = round obj:GetChild('text_time').text = os.date("%Y-%m-%d\n%H:%M:%S", tonumber(allDate.createTime)) @@ -213,32 +301,6 @@ function M:RecordItemRenderer(data, obj) resultDetailList.numItems = #data.totalScore end -function M:RecursionRecord(fgCtr, index, uid, leftTime, rightTime) - fgCtr:FG_GetGroupRecordSpe2(self.group_id, GetPlatform(), uid, 0, index * 60, 60, leftTime, rightTime, 0, - function(res) - if res.ReturnCode ~= 0 then - ViewUtil.ErrorTip(res.ReturnCode, "查看个人战绩失败") - self.visible = false - return - else - local records = res.Data.records - if records and #records > 0 then - for i = 1, #records do - records[i].totalScore = json.decode(records[i].totalScore) - table.insert(self.records, records[i]) - end - self:RecursionRecord(fgCtr, index + 1, uid, leftTime, rightTime) - else - self._viewList_record.numItems = #self.records - local currentPage = self._viewList_record.scrollPane.currentPageY - local pageCount = self._viewList_record.scrollPane.pageCountY - self._text_pageNum.text = "" - self._text_pageNum.text = string.format("%d/%d", currentPage, pageCount) - end - end - end) -end - function M:GenaratePlayBack(id, game_id, ...) local tem = nil local dview_class = nil diff --git a/lua_probject/base_project/Game/View/PlayBackView.lua b/lua_probject/base_project/Game/View/PlayBackView.lua index 8c5f311e..c3e97fa3 100644 --- a/lua_probject/base_project/Game/View/PlayBackView.lua +++ b/lua_probject/base_project/Game/View/PlayBackView.lua @@ -60,6 +60,7 @@ function M:InitView(url) btn_restart.onClick:Add(handler(self, self.RestartRecordPlay)) btn_play.onClick:Add(handler(self, self.Play)) + self._viewGroup_huifang = self._view:GetChild('huifang') self.com_logocType = self._view:GetChild("com_logo"):GetController("cType") local _view = self._view local _room = self._room @@ -154,6 +155,13 @@ function M:InitView(url) ) end + local bg_image = self._view:GetChild('bg_playback') + if bg_image then + bg_image.onClick:Set(function() + self:ChangeAlpha() + end) + end + --没有update先不显示跑马灯 self.com_notice.visible = false -- local text_notice = self.com_notice:GetChild("text_notice") @@ -334,14 +342,14 @@ end function M:CmdBackToLobby() self:ChangeAlpha() local tipStr = '是否返回大厅' - local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel) - _curren_msg.onOk:Add( - function() - ExtendManager.GetExtendConfig(self._room.game_id):UnAssets() - self:Destroy() - end - ) - _curren_msg:Show() + -- local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel) + -- _curren_msg.onOk:Add( + -- function() + ExtendManager.GetExtendConfig(self._room.game_id):UnAssets() + self:Destroy() + -- end + -- ) + -- _curren_msg:Show() end function M:GetPos(seat, myseat) @@ -388,9 +396,11 @@ function M:ChangeAlpha(...) self._record_alpha = coroutine.start( function() - self._record.alpha = 1 + self._viewGroup_huifang.visible = true + -- self._record.alpha = 1 coroutine.wait(2) - self._record.alpha = 0.5 + -- self._record.alpha = 0 + self._viewGroup_huifang.visible = false end ) end diff --git a/lua_probject/base_project/Game/View/ResultView.lua b/lua_probject/base_project/Game/View/ResultView.lua index e6b7acb0..249a2f0c 100644 --- a/lua_probject/base_project/Game/View/ResultView.lua +++ b/lua_probject/base_project/Game/View/ResultView.lua @@ -108,6 +108,8 @@ function M:init(url, isBigFull) else BaseWindow.init(self, url) end + --强制让牌类型为1,只有一种牌 + DataManager.CurrenRoom.card_type = 1 self:InitView() @@ -138,6 +140,13 @@ function M:init(url, isBigFull) ) end + local bg_image = self._view:GetChild('bg_playback') + if bg_image then + bg_image.onClick:Set(function() + + end) + end + local big_result = self._view:GetChild('big_result') if big_result ~= nil then if isBigFull then diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/CardCheck.lua b/lua_probject/extend_project/extend/majiang/fuzhou/CardCheck.lua index 14ae7109..0d52848a 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/CardCheck.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/CardCheck.lua @@ -72,7 +72,46 @@ function M:rollBack() end function M:tryShunzi(card) - if (card < 400 and card % 100 > 7) then + if card > 400 or card % 100 > 7 then + return false + end + if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) 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) + return true + end + return false +end + +--特殊牌,风牌也就是东南西北的成顺逻辑,中发白逻辑在普通顺子里 +function M:tryFengShunzi(card) + --只有牌里有东南风的时候才能成顺,401东风,402南方 + if self._flag_zikechengshun ~= 0 then + return false + end + local canShunziFeng = { 401, 402 } + for i = 1, #canShunziFeng do + if card == canShunziFeng[i] then + local tempFengList = {} + for j = 1, 4 - i do + if checkCard(405 - j, self.cardList) then + table.insert(tempFengList, 405 - j) + end + end + if #tempFengList >= 2 then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, tempFengList[1], 1) + removeCard(self.cardList, tempFengList[2], 1) + local cardGroup = { card, tempFengList[1], tempFengList[2] } + self:push(cardGroup) + return true + end + end + end + if card < 500 then return false end if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then @@ -224,6 +263,13 @@ function M:tryWin() self:rollBack() end + if (self:tryFengShunzi(activeCard)) then + if (self:tryWin()) then + return true + end + self:rollBack() + end + if (self:tryKezi1Zhong(activeCard)) then if (self:tryWin()) then return true @@ -295,24 +341,54 @@ function M:isQdPari(cardList) return false end -local function init(self, cardInhand, addCard, isZhong, qidui, eightLaizi) +function M:checkshisanlan() + if (not self.shisanlan) then + return false + end + if ((#self.cardList + self.zhong_count) ~= 14) then + return false + end + local cardList = membe_clone(self.cardList) + self.hongzhong_count = self.zhong_count + return self:isShiSanLan(cardList, table.remove(cardList, 1)) +end + +function M:isShiSanLan(cardList, card) + if (#cardList == 0) then + return true + end + if card < 400 then + if not (checkCard(card, cardList) or checkCard(card + 1, cardList) or checkCard(card + 2, cardList)) then + return self:isShiSanLan(cardList, table.remove(cardList, 1)) + end + else + if not checkCard(card, cardList) then + return self:isShiSanLan(cardList, table.remove(cardList, 1)) + end + end + return false +end + +--._flag_haveLaizi, data._hu_qidui, data._data_laizi +local function init(self, cardInhand, addCard, data) self.stack = {} self.pair_count = 0 self.cardList = membe_clone(cardInhand) - self.qidui = qidui - self.eight_laizi = eightLaizi + self.qidui = data._hu_qidui + self.shisanlan = data._hu_shisanlan + self.eight_laizi = nil self.cardList[#self.cardList + 1] = addCard - if (isZhong) then + if (data._flag_haveLaizi) then self.zhong_count = cardNum(zhongid, self.cardList) removeCard(self.cardList, zhongid, self.zhong_count) end table.sort(self.cardList) --printlog("添加排序====>>>") --pt(self.cardList) - return self:checkQidui() or self:tryWin() + return self:checkQidui() or self:checkshisanlan() or self:tryWin() end -local specialCardList = { 401, 402, 403, 404, 405, 406, 407 } +local specialCardList = { 401, 402, 403, 404, 501, 502, 503 } function M.tingPai(cardInhand, data) data = data or {} local self = setmetatable({}, { __index = M }) @@ -323,7 +399,7 @@ function M.tingPai(cardInhand, data) for k = 100, 300, 100 do for i = 1, 9 do local tem = k + i - local result = init(self, cardInhand, tem, data._flag_haveLaizi, data._hu_qidui, data._data_laizi) + local result = init(self, cardInhand, tem, data) --printlog("返回结果为===>>>",result) if (result) then tingList[#tingList + 1] = tem @@ -333,7 +409,7 @@ function M.tingPai(cardInhand, data) for j = 1, #specialCardList do local tem = specialCardList[j] - local result = init(self, cardInhand, tem, data._flag_haveLaizi, data._hu_qidui, data._data_laizi) + local result = init(self, cardInhand, tem, data) if (result) then tingList[#tingList + 1] = tem end @@ -343,14 +419,16 @@ function M.tingPai(cardInhand, data) end function M.MuiltiplteCaculateTingPai(cardInhand, isZhong, qidui, eightLaizi) - if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then - zhongid = DataManager.CurrenRoom.laiziInfo[1] + local room = DataManager.CurrenRoom + + if room.laiziInfo and #room.laiziInfo > 0 then + zhongid = room.laiziInfo[1] local tempTingList2 = {} local tempTingList1 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi) - if DataManager.CurrenRoom.laiziInfo[2] then - zhongid = DataManager.CurrenRoom.laiziInfo[2] + if room.laiziInfo[2] then + zhongid = room.laiziInfo[2] tempTingList2 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi) - zhongid = DataManager.CurrenRoom.laiziInfo[1] + zhongid = room.laiziInfo[1] end local currentTingList = {} if #tempTingList1 > 0 and #tempTingList2 > 0 then @@ -363,6 +441,7 @@ function M.MuiltiplteCaculateTingPai(cardInhand, isZhong, qidui, eightLaizi) return currentTingList else + M._flag_zikechengshun = room.room_config.config.zikechengshun or 0 zhongid = 0 return M.tingPai(cardInhand, isZhong, qidui, eightLaizi) end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua index 035c75d7..b0dded67 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua @@ -251,7 +251,19 @@ function M:fillResult0(room, peopleNum, result) end end handCardList.numItems = handInfoNum - allCardsList.width = 234 * fzInfoNum + 82 + (handInfoNum - 1) * 79 + 10 * (fzInfoNum) + --拿取实际的子项大小 + local handCard = 78 + local hangColumGrap = -4 + local fzCard = 234 + local fzColumGrap = 36 + handCard = handCardList:GetChildAt(handInfoNum - 1).width + hangColumGrap = handCard + handCardList.columnGap + if fzInfoNum > 0 then + fzCard = allCardsList:GetChildAt(0).width + fzColumGrap = allCardsList.columnGap + end + allCardsList.width = fzCard * fzInfoNum + handCard + (handInfoNum - 1) * hangColumGrap + + fzColumGrap * (fzInfoNum) if infoList.seat == room.self_player.seat then isMeCtr.selectedIndex = 1 diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua index 14ccc715..01fc7fd1 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua @@ -256,6 +256,9 @@ function M:EventInit() local card_info = self._player_card_info[self:GetPos(p.seat)] card_info:Clear() card_info:UpdateHandCard() + if _room.curren_round == 1 then + self._touxiangMove:Play() + end end end) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) @@ -307,6 +310,12 @@ function M:EventInit() -- self:UpdateRoomInfo() local info = self._player_card_info[self:GetPos(seat)] info:UpdateHandCard(true) + if self:GetPos(seat) == 1 then + info:ShowHuTip() + self._btn_selectTing.visible = false + info._ctr_tip.selectedIndex = 0 + info._ctr_showGuoHu.selectedIndex = 0 + end end) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) @@ -608,12 +617,18 @@ function M:OutCard(card) local info = self._player_card_info[1] self:RemoveCursor() info:UpdateHandCard() - + info._ctr_tip.selectedIndex = 0 + info._ctr_showGuoHu.selectedIndex = 0 info:UpdateOutCardList(nil, card, self._cursor) + info:ShowHuTip() + if #info:GetTingList(DataManager.CurrenRoom.self_player.card_list) > 0 then + self._btn_selectTing.visible = true + else + self._btn_selectTing.visible = false + end self:markOutCards(false, card) self:PlaySound("FuZhou_MJ", self._room.self_player.self_user.sex, tostring(card)) self:PlayMJSound("chupai.mp3") - self:ShowHuTip() end) else printlog("鬼牌不能出===>>>" .. card) @@ -895,7 +910,7 @@ function M:ReloadRoom(bskip) self._room._reload_flag = true end end - + self:reqResidueCard() self:ShowJing() for i = 1, #room.player_list do local p = room.player_list[i] @@ -919,6 +934,11 @@ function M:ReloadRoom(bskip) if p.seat == room.last_outcard_seat then local card = p.outcard_list[#p.outcard_list] info:UpdateOutCardList(nil, card, self._cursor) + if self:GetPos(p.seat) == 1 and #info:GetTingList(DataManager.CurrenRoom.self_player.card_list) > 0 then + self._btn_selectTing.visible = true + else + self._btn_selectTing.visible = false + end elseif p.seat == room.curren_outcard_seat then info:UpdateHandCard(true) info:UpdateOutCardList() diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua index b6fb0525..92da5863 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua @@ -67,6 +67,7 @@ function M:FillRoomData(data) self:GenerateAllStepData(data) self:UpdateStep(1) + self:Play() -- self:ShowStep(0) end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/MJPlayerSelfCardInfoView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/MJPlayerSelfCardInfoView.lua index afffccb1..134c3f64 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/MJPlayerSelfCardInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/MJPlayerSelfCardInfoView.lua @@ -12,6 +12,7 @@ function M.new(view, mainView, record, direction) self._view = view self._mainView = mainView self.direction = direction + self._flag_canTing = true self:init() return self end @@ -20,12 +21,15 @@ function M:init() getmetatable(M).__index.init(self) end -function M:ShowHuTip(card_list) - self._mainView._hu_tip:FillData(self:GetTingList(card_list)) +function M:ShowHuTip(card_list, have_bg) + self._mainView._hu_tip:FillData(self:GetTingList(card_list), have_bg) end function M:GetTingList(card_list) - return CardCheck.MuiltiplteCaculateTingPai(card_list, { _hu_qidui = true }) + if not self._flag_canTing then + return {} + end + return CardCheck.MuiltiplteCaculateTingPai(card_list, { _hu_qidui = true, _hu_shisanlan = true }) end function M:UpdateHandCard(getcard, mp) diff --git a/lua_probject/extend_project/extend/majiang/jinxi/CardCheck.lua b/lua_probject/extend_project/extend/majiang/jinxi/CardCheck.lua index b8724844..0d52848a 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/CardCheck.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/CardCheck.lua @@ -1,11 +1,11 @@ -- 检测牌是否存在 -local function checkCard(eventCard,cardList,num) +local function checkCard(eventCard, cardList, num) num = num == nil and 1 or num local result = 0 - for i = 1,#cardList do + for i = 1, #cardList do if (cardList[i] == eventCard) then result = result + 1 - if(result ==num) then + if (result == num) then return true end end @@ -14,24 +14,24 @@ local function checkCard(eventCard,cardList,num) end -- 移除指定数量的牌 -local function removeCard(cardList, card,count) - for i=1,count do - list_remove(cardList,card) +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) +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 function cardNum(eventCard, cardList) local result = 0 - for i=1,#cardList do + for i = 1, #cardList do local card = cardList[i] if (card == eventCard) then result = result + 1 @@ -40,7 +40,7 @@ local function cardNum(eventCard,cardList) return result end -local zhongid = 0 +local zhongid = 0 local M = { @@ -54,16 +54,16 @@ local M = { } -function M:push(cardGroup) - self.stack[#self.stack+1] = cardGroup +function M:push(cardGroup) + self.stack[#self.stack + 1] = cardGroup end function M:rollBack() local cardGroup = self.stack[#self.stack] - table.remove(self.stack,#self.stack) - for _,card in ipairs(cardGroup) do + table.remove(self.stack, #self.stack) + for _, card in ipairs(cardGroup) do if (card == zhongid) then - self.zhong_count = self.zhong_count +1 + self.zhong_count = self.zhong_count + 1 else self.cardList[#self.cardList + 1] = card end @@ -71,36 +71,75 @@ function M:rollBack() table.sort(self.cardList) end -function M:tryShunzi(card) - if (card < 400 and card % 100 > 7) then +function M:tryShunzi(card) + if card > 400 or card % 100 > 7 then return false end - if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then + if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) 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} + local cardGroup = { card, card + 1, card + 2 } self:push(cardGroup) return true end return false end -function M:tryKezi(card) +--特殊牌,风牌也就是东南西北的成顺逻辑,中发白逻辑在普通顺子里 +function M:tryFengShunzi(card) + --只有牌里有东南风的时候才能成顺,401东风,402南方 + if self._flag_zikechengshun ~= 0 then + return false + end + local canShunziFeng = { 401, 402 } + for i = 1, #canShunziFeng do + if card == canShunziFeng[i] then + local tempFengList = {} + for j = 1, 4 - i do + if checkCard(405 - j, self.cardList) then + table.insert(tempFengList, 405 - j) + end + end + if #tempFengList >= 2 then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, tempFengList[1], 1) + removeCard(self.cardList, tempFengList[2], 1) + local cardGroup = { card, tempFengList[1], tempFengList[2] } + self:push(cardGroup) + return true + end + end + end + if card < 500 then + return false + end + if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) 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) + return true + end + return false +end + +function M:tryKezi(card) if (checkCardAndRomve(card, self.cardList, 3)) then - local cardGroup = {card,card,card} + local cardGroup = { card, card, card } self:push(cardGroup) return true end return false end -function M:tryPair(card) +function M:tryPair(card) if (self.pair_count > 0) then return false end if (checkCardAndRomve(card, self.cardList, 2)) then - local cardGroup = {card,card} + local cardGroup = { card, card } self:push(cardGroup) self.pair_count = 1 return true @@ -108,28 +147,27 @@ function M:tryPair(card) return false end - -function M:tryKezi1Zhong(card) - if (self.zhong_count >= 1 and checkCardAndRomve(card, self.cardList,2)) then - local cardGroup = {card,card,zhongid} +function M:tryKezi1Zhong(card) + if (self.zhong_count >= 1 and checkCardAndRomve(card, self.cardList, 2)) then + local cardGroup = { card, card, zhongid } self:push(cardGroup) - self.zhong_count = self.zhong_count -1 - return true - end - return false -end - -function M:tryKezi2Zhong(card) - if (self.zhong_count >= 2 and checkCardAndRomve(card, self.cardList,1)) then - local cardGroup = {card,zhongid,zhongid} - self:push(cardGroup) - self.zhong_count = self.zhong_count -2 + self.zhong_count = self.zhong_count - 1 return true end return false end -function M:tryShunzi1Zhong(card) +function M:tryKezi2Zhong(card) + if (self.zhong_count >= 2 and checkCardAndRomve(card, self.cardList, 1)) then + local cardGroup = { card, zhongid, zhongid } + self:push(cardGroup) + self.zhong_count = self.zhong_count - 2 + return true + end + return false +end + +function M:tryShunzi1Zhong(card) if (card % 100 > 8) then return false end @@ -141,8 +179,8 @@ function M:tryShunzi1Zhong(card) if (checkCard(card + 1, self.cardList)) then removeCard(self.cardList, card, 1) removeCard(self.cardList, card + 1, 1) - self.zhong_count = self.zhong_count -1 - local cardGroup = {card,card+1,zhongid} + self.zhong_count = self.zhong_count - 1 + local cardGroup = { card, card + 1, zhongid } self:push(cardGroup) return true end @@ -150,15 +188,15 @@ function M:tryShunzi1Zhong(card) if (checkCard(card + 2, self.cardList) and ((card + 1) % 100 ~= 0)) then removeCard(self.cardList, card, 1) removeCard(self.cardList, card + 2, 1) - self.zhong_count = self.zhong_count -1 - local cardGroup = {card,zhongid,card+2} + self.zhong_count = self.zhong_count - 1 + local cardGroup = { card, zhongid, card + 2 } self:push(cardGroup) return true end return false end -function M:tryPair1Zhong(card) +function M:tryPair1Zhong(card) if (self.pair_count > 0) then return false end @@ -166,28 +204,28 @@ function M:tryPair1Zhong(card) return false end removeCard(self.cardList, card, 1) - local cardGroup = {card,zhongid} + local cardGroup = { card, zhongid } self:push(cardGroup) - self.zhong_count = self.zhong_count -1 + self.zhong_count = self.zhong_count - 1 self.pair_count = 1 return true end -function M:tryPair2Zhong() +function M:tryPair2Zhong() if (self.pair_count > 0) then return false end if (self.zhong_count < 2) then return false end - local cardGroup = {zhongid,zhongid} + local cardGroup = { zhongid, zhongid } self:push(cardGroup) - self.zhong_count = self.zhong_count -2 + self.zhong_count = self.zhong_count - 2 self.pair_count = 1 return true end -function M:tryWin() +function M:tryWin() if (self.zhong_count == 4 and not self.eight_laizi) or (self.zhong_count == 8 and self.eight_laizi) then return true end @@ -225,6 +263,13 @@ function M:tryWin() self:rollBack() end + if (self:tryFengShunzi(activeCard)) then + if (self:tryWin()) then + return true + end + self:rollBack() + end + if (self:tryKezi1Zhong(activeCard)) then if (self:tryWin()) then return true @@ -233,7 +278,6 @@ function M:tryWin() end if (self:tryKezi2Zhong(activeCard)) then - if (self:tryWin()) then return true end @@ -257,7 +301,7 @@ function M:tryWin() return false end -function M:checkQidui() +function M:checkQidui() if (not self.qidui) then return false end @@ -270,17 +314,17 @@ function M:checkQidui() return self:isQdPari(cardList) end -function M:isQdPari(cardList) - if(self.qidui_pari_count == 7) then +function M:isQdPari(cardList) + if (self.qidui_pari_count == 7) then return true end - if (#cardList== 0) then + if (#cardList == 0) then return true end local card = cardList[1] if (cardNum(card, cardList) >= 2) then removeCard(cardList, card, 2) - self.qidui_pari_count = self.qidui_pari_count +1 + self.qidui_pari_count = self.qidui_pari_count + 1 if (self:isQdPari(cardList)) then return true end @@ -289,7 +333,7 @@ function M:isQdPari(cardList) if (self.hongzhong_count > 0) then removeCard(cardList, card, 1) self.hongzhong_count = self.hongzhong_count - 1 - self.qidui_pari_count = self.qidui_pari_count +1 + self.qidui_pari_count = self.qidui_pari_count + 1 if (self:isQdPari(cardList)) then return true end @@ -297,82 +341,110 @@ function M:isQdPari(cardList) return false end -local function init(self,cardInhand,addCard,isZhong,qidui,eightLaizi) +function M:checkshisanlan() + if (not self.shisanlan) then + return false + end + if ((#self.cardList + self.zhong_count) ~= 14) then + return false + end + local cardList = membe_clone(self.cardList) + self.hongzhong_count = self.zhong_count + return self:isShiSanLan(cardList, table.remove(cardList, 1)) +end + +function M:isShiSanLan(cardList, card) + if (#cardList == 0) then + return true + end + if card < 400 then + if not (checkCard(card, cardList) or checkCard(card + 1, cardList) or checkCard(card + 2, cardList)) then + return self:isShiSanLan(cardList, table.remove(cardList, 1)) + end + else + if not checkCard(card, cardList) then + return self:isShiSanLan(cardList, table.remove(cardList, 1)) + end + end + return false +end + +--._flag_haveLaizi, data._hu_qidui, data._data_laizi +local function init(self, cardInhand, addCard, data) self.stack = {} self.pair_count = 0 self.cardList = membe_clone(cardInhand) - self.qidui = qidui - self.eight_laizi = eightLaizi - self.cardList[#self.cardList+1] = addCard - if (isZhong) then + self.qidui = data._hu_qidui + self.shisanlan = data._hu_shisanlan + self.eight_laizi = nil + self.cardList[#self.cardList + 1] = addCard + if (data._flag_haveLaizi) then self.zhong_count = cardNum(zhongid, self.cardList) removeCard(self.cardList, zhongid, self.zhong_count) end table.sort(self.cardList) --printlog("添加排序====>>>") --pt(self.cardList) - return self:checkQidui() or self:tryWin() + return self:checkQidui() or self:checkshisanlan() or self:tryWin() end -local specialCardList = { 401, 402, 403, 404, 405, 406, 407 } -function M.tingPai(cardInhand, isZhong, qidui, eightLaizi) - -- printlog("isZhong", isZhong) - -- printlog("qidui", qidui) - -- printlog("eightLaizi", eightLaizi) - -- pt(cardInhand) +local specialCardList = { 401, 402, 403, 404, 501, 502, 503 } +function M.tingPai(cardInhand, data) + data = data or {} local self = setmetatable({}, { __index = M }) local tingList = {} if not cardInhand or #cardInhand == 0 then return tingList end - for k=100,300,100 do - for i=1,9 do + for k = 100, 300, 100 do + for i = 1, 9 do local tem = k + i - local result = init(self,cardInhand,tem,isZhong,qidui,eightLaizi) + local result = init(self, cardInhand, tem, data) --printlog("返回结果为===>>>",result) - if(result) then - tingList[#tingList + 1] = tem + if (result) then + tingList[#tingList + 1] = tem end end end - - for j=1,#specialCardList do + + for j = 1, #specialCardList do local tem = specialCardList[j] - local result = init(self,cardInhand,tem,isZhong,qidui,eightLaizi) - if(result) then - tingList[#tingList + 1] = tem + local result = init(self, cardInhand, tem, data) + if (result) then + tingList[#tingList + 1] = tem end end - + return tingList end -function M.MuiltiplteCaculateTingPai(cardInhand,isZhong,qidui,eightLaizi) - if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then - zhongid=DataManager.CurrenRoom.laiziInfo[1] - local tempTingList2={} - local tempTingList1=M.tingPai(cardInhand,isZhong,qidui,eightLaizi) - if DataManager.CurrenRoom.laiziInfo[2] then - zhongid=DataManager.CurrenRoom.laiziInfo[2] - tempTingList2=M.tingPai(cardInhand,isZhong,qidui,eightLaizi) - zhongid=DataManager.CurrenRoom.laiziInfo[1] +function M.MuiltiplteCaculateTingPai(cardInhand, isZhong, qidui, eightLaizi) + local room = DataManager.CurrenRoom + + if room.laiziInfo and #room.laiziInfo > 0 then + zhongid = room.laiziInfo[1] + local tempTingList2 = {} + local tempTingList1 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi) + if room.laiziInfo[2] then + zhongid = room.laiziInfo[2] + tempTingList2 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi) + zhongid = room.laiziInfo[1] end - local currentTingList={} - if #tempTingList1>0 and #tempTingList2>0 then - currentTingList=CombineDictionaryAndRemoveSomeItem(tempTingList1,tempTingList2) - elseif #tempTingList1>0 then - currentTingList=tempTingList1 - elseif #tempTingList2>0 then - currentTingList=tempTingList2 + local currentTingList = {} + if #tempTingList1 > 0 and #tempTingList2 > 0 then + currentTingList = CombineDictionaryAndRemoveSomeItem(tempTingList1, tempTingList2) + elseif #tempTingList1 > 0 then + currentTingList = tempTingList1 + elseif #tempTingList2 > 0 then + currentTingList = tempTingList2 end - + return currentTingList - else - zhongid=0 - return M.tingPai(cardInhand,isZhong,qidui,eightLaizi) + M._flag_zikechengshun = room.room_config.config.zikechengshun or 0 + zhongid = 0 + return M.tingPai(cardInhand, isZhong, qidui, eightLaizi) end - end -return M \ No newline at end of file +return M diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua index 6fc24183..44548e92 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua @@ -253,7 +253,23 @@ function M:fillResult0(room, peopleNum, result) end end handCardList.numItems = handInfoNum - allCardsList.width = 234 * fzInfoNum + 82 + (handInfoNum - 1) * 79 + 10 * (fzInfoNum) + --拿取实际的子项大小 + local handCard = 78 + local hangColumGrap = -4 + local fzCard = 234 + local fzColumGrap = 36 + handCard = handCardList:GetChildAt(handInfoNum - 1).width + hangColumGrap = handCard + handCardList.columnGap + if fzInfoNum > 0 then + fzCard = allCardsList:GetChildAt(0).width + fzColumGrap = allCardsList.columnGap + end + allCardsList.width = fzCard * fzInfoNum + handCard + (handInfoNum - 1) * hangColumGrap + + fzColumGrap * (fzInfoNum) + + if infoList.seat == room.self_player.seat then + isMeCtr.selectedIndex = 1 + end if infoList.seat == room.self_player.seat then isMeCtr.selectedIndex = 1 diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua index a25800ff..385a744f 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua @@ -66,7 +66,31 @@ function M:InitView(url) self.showNextCtr = self._view:GetController('showNext') self.showNextList = self._view:GetChild('list_showNext') self._view:GetChild('btn_showNext').onClick:Set(function() - self:reqResidueCard() + coroutine.start(function() + local time = 0 + + ViewUtil:ShowModalWait2(0.01) + while not self._flag_getRemindCard do + if time > 20 then + break + end + coroutine.wait(0.05) + end + ViewUtil.CloseModalWait2() + if self._flag_getRemindCard then + self.showNextCtr.selectedIndex = 1 + self.showNextList:SetVirtual() + self.showNextList.itemRenderer = function(index, obj) + local card = self.cardSet[index + 1] + self:FillShowCards(obj, card, self.cardMap[card]) + obj.data = { card = card } + end + self.showNextList.numItems = #self.cardSet + time = time + 1 + else + self:reqResidueCard() + end + end) end) self._view:GetChild('btn_closeShow').onClick:Set(function() self.showNextCtr.selectedIndex = 0 @@ -169,13 +193,10 @@ function M:UpdatePlayerInfoView() end function M:NewMJPlayerCardInfoView(view, index) - return MJMainView.NewMJPlayerCardInfoView(self, view, index) - --[[ if index == 1 then - return MJPlayerSelfCardInfoView.new(view, self) + return MJPlayerSelfCardInfoView.new(view, self, nil, "S") end - return MJPlayerCardInfoView.new(view, self) - ]] + return MJMainView.NewMJPlayerCardInfoView(self, view, index) end function M:EventInit() @@ -217,6 +238,7 @@ function M:EventInit() --self._viewText_testName.text = 0 self:UpdateRound() self:RemoveCursor() + self:reqResidueCard() self._state.selectedIndex = 1 self:ShowJing() if self._niao_View then @@ -234,6 +256,9 @@ function M:EventInit() local card_info = self._player_card_info[self:GetPos(p.seat)] card_info:Clear() card_info:UpdateHandCard() + if _room.curren_round == 1 then + self._touxiangMove:Play() + end end end) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) @@ -266,7 +291,8 @@ function M:EventInit() info:UpdateHandCard() local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url) info:UpdateOutCardList(outcard, card, self._cursor) - + self._player_card_info[1]._ctr_tip.selectedIndex = 0 + self._player_card_info[1]._ctr_showGuoHu.selectedIndex = 0 self:PlayMJSound("chupai.mp3") self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then @@ -275,6 +301,7 @@ function M:EventInit() end) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) self:__CloseTip() + self:reqResidueCard() local arg = { ... } local seat = arg[1] local card = arg[2] @@ -283,6 +310,12 @@ function M:EventInit() -- self:UpdateRoomInfo() local info = self._player_card_info[self:GetPos(seat)] info:UpdateHandCard(true) + if self:GetPos(seat) == 1 then + info:ShowHuTip() + self._btn_selectTing.visible = false + info._ctr_tip.selectedIndex = 0 + info._ctr_showGuoHu.selectedIndex = 0 + end end) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) @@ -544,26 +577,19 @@ function M:EventInit() _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) local arg = { ... } local residueCard = arg[1] - local cardMap = {} - local cardSet = {} - self.showNextCtr.selectedIndex = 1 + self.cardMap = {} + self.cardSet = {} for i = 1, #residueCard do local cardNum = residueCard[i] - if not cardMap[cardNum] then - cardMap[cardNum] = 1 - table.insert(cardSet, cardNum) + if not self.cardMap[cardNum] then + self.cardMap[cardNum] = 1 + table.insert(self.cardSet, cardNum) else - cardMap[cardNum] = cardMap[cardNum] + 1 + self.cardMap[cardNum] = self.cardMap[cardNum] + 1 end end - table.sort(cardSet) - self.showNextList:SetVirtual() - self.showNextList.itemRenderer = function(index, obj) - local card = cardSet[index + 1] - self:FillShowCards(obj, card, cardMap[card]) - obj.data = { card = card } - end - self.showNextList.numItems = #cardSet + table.sort(self.cardSet) + self._flag_getRemindCard = true end) --替换mianview的事件 @@ -593,10 +619,15 @@ function M:OutCard(card) local info = self._player_card_info[1] self:RemoveCursor() info:UpdateHandCard() - - info:UpdateOutCardList(nil, card, self._cursor) info._ctr_tip.selectedIndex = 0 info._ctr_showGuoHu.selectedIndex = 0 + info:UpdateOutCardList(nil, card, self._cursor) + info:ShowHuTip() + if #info:GetTingList(DataManager.CurrenRoom.self_player.card_list) > 0 then + self._btn_selectTing.visible = true + else + self._btn_selectTing.visible = false + end self:markOutCards(false, card) self:PlaySound("JinXi_MJ", self._room.self_player.self_user.sex, tostring(card)) self:PlayMJSound("chupai.mp3") @@ -882,7 +913,7 @@ function M:ReloadRoom(bskip) self._room._reload_flag = true end end - + self:reqResidueCard() self:ShowJing() for i = 1, #room.player_list do local p = room.player_list[i] @@ -906,6 +937,11 @@ function M:ReloadRoom(bskip) if p.seat == room.last_outcard_seat then local card = p.outcard_list[#p.outcard_list] info:UpdateOutCardList(nil, card, self._cursor) + if self:GetPos(p.seat) == 1 and #info:GetTingList(DataManager.CurrenRoom.self_player.card_list) > 0 then + self._btn_selectTing.visible = true + else + self._btn_selectTing.visible = false + end elseif p.seat == room.curren_outcard_seat then info:UpdateHandCard(true) info:UpdateOutCardList() @@ -964,6 +1000,7 @@ end -----------------------展示牌---------------------------- function M:reqResidueCard() + self._flag_getRemindCard = false local _gamectr = ControllerManager.GetController(GameController) _gamectr:ReqResidueCard() end diff --git a/lua_probject/extend_project/extend/majiang/jinxi/MJPlayerSelfCardInfoView.lua b/lua_probject/extend_project/extend/majiang/jinxi/MJPlayerSelfCardInfoView.lua index 4fa39205..c66c4068 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/MJPlayerSelfCardInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/MJPlayerSelfCardInfoView.lua @@ -4,32 +4,33 @@ local CardCheck = import(".CardCheck") local M = {} -- -function M.new(view, mainView) +function M.new(view, mainView, record, direction) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView }) setmetatable(M, { __index = MJPlayerSelfCardInfoView }) local self = setmetatable({}, { __index = M }) self.class = "PlayerSelfCardInfoView" self._view = view self._mainView = mainView + self.direction = direction + self._flag_canTing = false self:init() return self end --- function M:ShowHuTip(card_list) --- printlog("ShowHuTip") --- local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, --- DataManager.CurrenRoom.room_config.Laizi) --- if #tingList > 0 then --- if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then --- for i = 1, #DataManager.CurrenRoom.laiziInfo do --- if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then --- table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i]) --- end --- end --- end --- end --- self._mainView._hu_tip:FillData(tingList) --- end +function M:init() + getmetatable(M).__index.init(self) +end + +function M:ShowHuTip(card_list, have_bg) + self._mainView._hu_tip:FillData(self:GetTingList(card_list), have_bg) +end + +function M:GetTingList(card_list) + if not self._flag_canTing then + return {} + end + return CardCheck.MuiltiplteCaculateTingPai(card_list, { _hu_qidui = true, _hu_shisanlan = true }) +end function M:UpdateHandCard(getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/CardCheck.lua b/lua_probject/extend_project/extend/majiang/lichuan/CardCheck.lua index e761fdeb..0d52848a 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/CardCheck.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/CardCheck.lua @@ -72,7 +72,46 @@ function M:rollBack() end function M:tryShunzi(card) - if (card < 400 and card % 100 > 7) then + if card > 400 or card % 100 > 7 then + return false + end + if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) 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) + return true + end + return false +end + +--特殊牌,风牌也就是东南西北的成顺逻辑,中发白逻辑在普通顺子里 +function M:tryFengShunzi(card) + --只有牌里有东南风的时候才能成顺,401东风,402南方 + if self._flag_zikechengshun ~= 0 then + return false + end + local canShunziFeng = { 401, 402 } + for i = 1, #canShunziFeng do + if card == canShunziFeng[i] then + local tempFengList = {} + for j = 1, 4 - i do + if checkCard(405 - j, self.cardList) then + table.insert(tempFengList, 405 - j) + end + end + if #tempFengList >= 2 then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, tempFengList[1], 1) + removeCard(self.cardList, tempFengList[2], 1) + local cardGroup = { card, tempFengList[1], tempFengList[2] } + self:push(cardGroup) + return true + end + end + end + if card < 500 then return false end if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then @@ -224,6 +263,13 @@ function M:tryWin() self:rollBack() end + if (self:tryFengShunzi(activeCard)) then + if (self:tryWin()) then + return true + end + self:rollBack() + end + if (self:tryKezi1Zhong(activeCard)) then if (self:tryWin()) then return true @@ -295,29 +341,56 @@ function M:isQdPari(cardList) return false end -local function init(self, cardInhand, addCard, isZhong, qidui, eightLaizi) +function M:checkshisanlan() + if (not self.shisanlan) then + return false + end + if ((#self.cardList + self.zhong_count) ~= 14) then + return false + end + local cardList = membe_clone(self.cardList) + self.hongzhong_count = self.zhong_count + return self:isShiSanLan(cardList, table.remove(cardList, 1)) +end + +function M:isShiSanLan(cardList, card) + if (#cardList == 0) then + return true + end + if card < 400 then + if not (checkCard(card, cardList) or checkCard(card + 1, cardList) or checkCard(card + 2, cardList)) then + return self:isShiSanLan(cardList, table.remove(cardList, 1)) + end + else + if not checkCard(card, cardList) then + return self:isShiSanLan(cardList, table.remove(cardList, 1)) + end + end + return false +end + +--._flag_haveLaizi, data._hu_qidui, data._data_laizi +local function init(self, cardInhand, addCard, data) self.stack = {} self.pair_count = 0 self.cardList = membe_clone(cardInhand) - self.qidui = qidui - self.eight_laizi = eightLaizi + self.qidui = data._hu_qidui + self.shisanlan = data._hu_shisanlan + self.eight_laizi = nil self.cardList[#self.cardList + 1] = addCard - if (isZhong) then + if (data._flag_haveLaizi) then self.zhong_count = cardNum(zhongid, self.cardList) removeCard(self.cardList, zhongid, self.zhong_count) end table.sort(self.cardList) --printlog("添加排序====>>>") --pt(self.cardList) - return self:checkQidui() or self:tryWin() + return self:checkQidui() or self:checkshisanlan() or self:tryWin() end -local specialCardList = { 401, 402, 403, 404, 405, 406, 407 } -function M.tingPai(cardInhand, isZhong, qidui, eightLaizi) - -- printlog("isZhong", isZhong) - -- printlog("qidui", qidui) - -- printlog("eightLaizi", eightLaizi) - -- pt(cardInhand) +local specialCardList = { 401, 402, 403, 404, 501, 502, 503 } +function M.tingPai(cardInhand, data) + data = data or {} local self = setmetatable({}, { __index = M }) local tingList = {} if not cardInhand or #cardInhand == 0 then @@ -326,7 +399,7 @@ function M.tingPai(cardInhand, isZhong, qidui, eightLaizi) for k = 100, 300, 100 do for i = 1, 9 do local tem = k + i - local result = init(self, cardInhand, tem, isZhong, qidui, eightLaizi) + local result = init(self, cardInhand, tem, data) --printlog("返回结果为===>>>",result) if (result) then tingList[#tingList + 1] = tem @@ -336,7 +409,7 @@ function M.tingPai(cardInhand, isZhong, qidui, eightLaizi) for j = 1, #specialCardList do local tem = specialCardList[j] - local result = init(self, cardInhand, tem, isZhong, qidui, eightLaizi) + local result = init(self, cardInhand, tem, data) if (result) then tingList[#tingList + 1] = tem end @@ -346,14 +419,16 @@ function M.tingPai(cardInhand, isZhong, qidui, eightLaizi) end function M.MuiltiplteCaculateTingPai(cardInhand, isZhong, qidui, eightLaizi) - if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then - zhongid = DataManager.CurrenRoom.laiziInfo[1] + local room = DataManager.CurrenRoom + + if room.laiziInfo and #room.laiziInfo > 0 then + zhongid = room.laiziInfo[1] local tempTingList2 = {} local tempTingList1 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi) - if DataManager.CurrenRoom.laiziInfo[2] then - zhongid = DataManager.CurrenRoom.laiziInfo[2] + if room.laiziInfo[2] then + zhongid = room.laiziInfo[2] tempTingList2 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi) - zhongid = DataManager.CurrenRoom.laiziInfo[1] + zhongid = room.laiziInfo[1] end local currentTingList = {} if #tempTingList1 > 0 and #tempTingList2 > 0 then @@ -366,6 +441,7 @@ function M.MuiltiplteCaculateTingPai(cardInhand, isZhong, qidui, eightLaizi) return currentTingList else + M._flag_zikechengshun = room.room_config.config.zikechengshun or 0 zhongid = 0 return M.tingPai(cardInhand, isZhong, qidui, eightLaizi) end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua index dd7cd86b..6461af0e 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua @@ -246,7 +246,23 @@ function M:fillResult0(room, peopleNum, result) end end handCardList.numItems = handInfoNum - allCardsList.width = 234 * fzInfoNum + 82 + (handInfoNum - 1) * 79 + 10 * (fzInfoNum) + --拿取实际的子项大小 + local handCard = 78 + local hangColumGrap = -4 + local fzCard = 234 + local fzColumGrap = 36 + handCard = handCardList:GetChildAt(handInfoNum - 1).width + hangColumGrap = handCard + handCardList.columnGap + if fzInfoNum > 0 then + fzCard = allCardsList:GetChildAt(0).width + fzColumGrap = allCardsList.columnGap + end + allCardsList.width = fzCard * fzInfoNum + handCard + (handInfoNum - 1) * hangColumGrap + + fzColumGrap * (fzInfoNum) + + if infoList.seat == room.self_player.seat then + isMeCtr.selectedIndex = 1 + end if infoList.seat == room.self_player.seat then isMeCtr.selectedIndex = 1 diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua index e2c40150..595e5d18 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua @@ -67,7 +67,31 @@ function M:InitView(url) self.showNextCtr = self._view:GetController('showNext') self.showNextList = self._view:GetChild('list_showNext') self._view:GetChild('btn_showNext').onClick:Set(function() - self:reqResidueCard() + coroutine.start(function() + local time = 0 + + ViewUtil:ShowModalWait2(0.01) + while not self._flag_getRemindCard do + if time > 20 then + break + end + coroutine.wait(0.05) + end + ViewUtil.CloseModalWait2() + if self._flag_getRemindCard then + self.showNextCtr.selectedIndex = 1 + self.showNextList:SetVirtual() + self.showNextList.itemRenderer = function(index, obj) + local card = self.cardSet[index + 1] + self:FillShowCards(obj, card, self.cardMap[card]) + obj.data = { card = card } + end + self.showNextList.numItems = #self.cardSet + time = time + 1 + else + self:reqResidueCard() + end + end) end) self._view:GetChild('btn_closeShow').onClick:Set(function() self.showNextCtr.selectedIndex = 0 @@ -168,13 +192,10 @@ function M:UpdatePlayerInfoView() end function M:NewMJPlayerCardInfoView(view, index) - return MJMainView.NewMJPlayerCardInfoView(self, view, index) - --[[ if index == 1 then - return MJPlayerSelfCardInfoView.new(view, self) + return MJPlayerSelfCardInfoView.new(view, self, nil, "S") end - return MJPlayerCardInfoView.new(view, self) - ]] + return MJMainView.NewMJPlayerCardInfoView(self, view, index) end function M:EventInit() @@ -216,6 +237,7 @@ function M:EventInit() --self._viewText_testName.text = 0 self:UpdateRound() self:RemoveCursor() + self:reqResidueCard() self._state.selectedIndex = 1 self:ShowJing() if self._niao_View then @@ -234,9 +256,9 @@ function M:EventInit() local card_info = self._player_card_info[self:GetPos(p.seat)] card_info:Clear() card_info:UpdateHandCard() - end - if _room.curren_round == 1 then - self._touxiangMove:Play() + if _room.curren_round == 1 then + self._touxiangMove:Play() + end end end) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) @@ -269,6 +291,8 @@ function M:EventInit() info:UpdateHandCard() local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url) info:UpdateOutCardList(outcard, card, self._cursor) + self._player_card_info[1]._ctr_tip.selectedIndex = 0 + self._player_card_info[1]._ctr_showGuoHu.selectedIndex = 0 self:PlayMJSound("chupai.mp3") self:PlaySound("LiChuan_MJ", p.self_user.sex, tostring(card)) @@ -278,6 +302,7 @@ function M:EventInit() end) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) self:__CloseTip() + self:reqResidueCard() local arg = { ... } local seat = arg[1] local card = arg[2] @@ -286,6 +311,12 @@ function M:EventInit() -- self:UpdateRoomInfo() local info = self._player_card_info[self:GetPos(seat)] info:UpdateHandCard(true) + if self:GetPos(seat) == 1 then + info:ShowHuTip() + self._btn_selectTing.visible = false + info._ctr_tip.selectedIndex = 0 + info._ctr_showGuoHu.selectedIndex = 0 + end end) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) @@ -545,26 +576,19 @@ function M:EventInit() _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) local arg = { ... } local residueCard = arg[1] - local cardMap = {} - local cardSet = {} - self.showNextCtr.selectedIndex = 1 + self.cardMap = {} + self.cardSet = {} for i = 1, #residueCard do local cardNum = residueCard[i] - if not cardMap[cardNum] then - cardMap[cardNum] = 1 - table.insert(cardSet, cardNum) + if not self.cardMap[cardNum] then + self.cardMap[cardNum] = 1 + table.insert(self.cardSet, cardNum) else - cardMap[cardNum] = cardMap[cardNum] + 1 + self.cardMap[cardNum] = self.cardMap[cardNum] + 1 end end - table.sort(cardSet) - self.showNextList:SetVirtual() - self.showNextList.itemRenderer = function(index, obj) - local card = cardSet[index + 1] - self:FillShowCards(obj, card, cardMap[card]) - obj.data = { card = card } - end - self.showNextList.numItems = #cardSet + table.sort(self.cardSet) + self._flag_getRemindCard = true end) --替换mianview的事件 @@ -594,10 +618,15 @@ function M:OutCard(card) local info = self._player_card_info[1] self:RemoveCursor() info:UpdateHandCard() - - info:UpdateOutCardList(nil, card, self._cursor) info._ctr_tip.selectedIndex = 0 info._ctr_showGuoHu.selectedIndex = 0 + info:UpdateOutCardList(nil, card, self._cursor) + info:ShowHuTip() + if #info:GetTingList(DataManager.CurrenRoom.self_player.card_list) > 0 then + self._btn_selectTing.visible = true + else + self._btn_selectTing.visible = false + end self:markOutCards(false, card) self:PlaySound("LiChuan_MJ", self._room.self_player.self_user.sex, tostring(card)) self:PlayMJSound("chupai.mp3") @@ -883,7 +912,7 @@ function M:ReloadRoom(bskip) self._room._reload_flag = true end end - + self:reqResidueCard() self:ShowJing() for i = 1, #room.player_list do local p = room.player_list[i] @@ -907,6 +936,11 @@ function M:ReloadRoom(bskip) if p.seat == room.last_outcard_seat then local card = p.outcard_list[#p.outcard_list] info:UpdateOutCardList(nil, card, self._cursor) + if self:GetPos(p.seat) == 1 and #info:GetTingList(DataManager.CurrenRoom.self_player.card_list) > 0 then + self._btn_selectTing.visible = true + else + self._btn_selectTing.visible = false + end elseif p.seat == room.curren_outcard_seat then info:UpdateHandCard(true) info:UpdateOutCardList() @@ -965,6 +999,7 @@ end -----------------------展示牌---------------------------- function M:reqResidueCard() + self._flag_getRemindCard = false local _gamectr = ControllerManager.GetController(GameController) _gamectr:ReqResidueCard() end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua index 27036030..fd75e955 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua @@ -68,6 +68,7 @@ function M:FillRoomData(data) self:GenerateAllStepData(data) self:UpdateStep(1) + self:Play() -- self:ShowStep(0) end @@ -103,7 +104,7 @@ function M:ShowStep(index) else info:UpdateOutCardList() end - if step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat then + if (step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat) or step.cmd == Record_Event.Evt_Action then info:UpdateHandCard(true, true) else info:UpdateHandCard(false, true) @@ -141,7 +142,7 @@ function M:ShowStep(index) end if step.cmd == Record_Event.Evt_Result then if not self.result then - self.result = EXClearingView.new(self._root_view, { flag_back = true }) + self.result = EXClearingView.new(self, { flag_back = true }) self.result:InitData(0, self._room, step.result_data) self.result._view.x = (GRoot.inst.width - self.result._view.width) * -0.5 self.result._view.width = GRoot.inst.width @@ -225,6 +226,7 @@ function M:CmdAction(cmd, index) fz.type = cmd.data.type fz.card = cmd.data.card fz.opcard = cmd.data.opcard + fz.from_seat = cmd.data.from_seat local uf = data.player_card_data[cmd.data.from_seat] if fz.type ~= FZType.Gang_An and fz.type ~= FZType.Gang_Peng then table.remove(uf.outcard_list, #uf.outcard_list) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView.lua b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView.lua index 4fa39205..c66c4068 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView.lua @@ -4,32 +4,33 @@ local CardCheck = import(".CardCheck") local M = {} -- -function M.new(view, mainView) +function M.new(view, mainView, record, direction) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView }) setmetatable(M, { __index = MJPlayerSelfCardInfoView }) local self = setmetatable({}, { __index = M }) self.class = "PlayerSelfCardInfoView" self._view = view self._mainView = mainView + self.direction = direction + self._flag_canTing = false self:init() return self end --- function M:ShowHuTip(card_list) --- printlog("ShowHuTip") --- local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, --- DataManager.CurrenRoom.room_config.Laizi) --- if #tingList > 0 then --- if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then --- for i = 1, #DataManager.CurrenRoom.laiziInfo do --- if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then --- table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i]) --- end --- end --- end --- end --- self._mainView._hu_tip:FillData(tingList) --- end +function M:init() + getmetatable(M).__index.init(self) +end + +function M:ShowHuTip(card_list, have_bg) + self._mainView._hu_tip:FillData(self:GetTingList(card_list), have_bg) +end + +function M:GetTingList(card_list) + if not self._flag_canTing then + return {} + end + return CardCheck.MuiltiplteCaculateTingPai(card_list, { _hu_qidui = true, _hu_shisanlan = true }) +end function M:UpdateHandCard(getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) diff --git a/lua_probject/extend_project/extend/majiang/nancheng/CardCheck.lua b/lua_probject/extend_project/extend/majiang/nancheng/CardCheck.lua index b8724844..0d52848a 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/CardCheck.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/CardCheck.lua @@ -1,11 +1,11 @@ -- 检测牌是否存在 -local function checkCard(eventCard,cardList,num) +local function checkCard(eventCard, cardList, num) num = num == nil and 1 or num local result = 0 - for i = 1,#cardList do + for i = 1, #cardList do if (cardList[i] == eventCard) then result = result + 1 - if(result ==num) then + if (result == num) then return true end end @@ -14,24 +14,24 @@ local function checkCard(eventCard,cardList,num) end -- 移除指定数量的牌 -local function removeCard(cardList, card,count) - for i=1,count do - list_remove(cardList,card) +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) +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 function cardNum(eventCard, cardList) local result = 0 - for i=1,#cardList do + for i = 1, #cardList do local card = cardList[i] if (card == eventCard) then result = result + 1 @@ -40,7 +40,7 @@ local function cardNum(eventCard,cardList) return result end -local zhongid = 0 +local zhongid = 0 local M = { @@ -54,16 +54,16 @@ local M = { } -function M:push(cardGroup) - self.stack[#self.stack+1] = cardGroup +function M:push(cardGroup) + self.stack[#self.stack + 1] = cardGroup end function M:rollBack() local cardGroup = self.stack[#self.stack] - table.remove(self.stack,#self.stack) - for _,card in ipairs(cardGroup) do + table.remove(self.stack, #self.stack) + for _, card in ipairs(cardGroup) do if (card == zhongid) then - self.zhong_count = self.zhong_count +1 + self.zhong_count = self.zhong_count + 1 else self.cardList[#self.cardList + 1] = card end @@ -71,36 +71,75 @@ function M:rollBack() table.sort(self.cardList) end -function M:tryShunzi(card) - if (card < 400 and card % 100 > 7) then +function M:tryShunzi(card) + if card > 400 or card % 100 > 7 then return false end - if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then + if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) 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} + local cardGroup = { card, card + 1, card + 2 } self:push(cardGroup) return true end return false end -function M:tryKezi(card) +--特殊牌,风牌也就是东南西北的成顺逻辑,中发白逻辑在普通顺子里 +function M:tryFengShunzi(card) + --只有牌里有东南风的时候才能成顺,401东风,402南方 + if self._flag_zikechengshun ~= 0 then + return false + end + local canShunziFeng = { 401, 402 } + for i = 1, #canShunziFeng do + if card == canShunziFeng[i] then + local tempFengList = {} + for j = 1, 4 - i do + if checkCard(405 - j, self.cardList) then + table.insert(tempFengList, 405 - j) + end + end + if #tempFengList >= 2 then + removeCard(self.cardList, card, 1) + removeCard(self.cardList, tempFengList[1], 1) + removeCard(self.cardList, tempFengList[2], 1) + local cardGroup = { card, tempFengList[1], tempFengList[2] } + self:push(cardGroup) + return true + end + end + end + if card < 500 then + return false + end + if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) 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) + return true + end + return false +end + +function M:tryKezi(card) if (checkCardAndRomve(card, self.cardList, 3)) then - local cardGroup = {card,card,card} + local cardGroup = { card, card, card } self:push(cardGroup) return true end return false end -function M:tryPair(card) +function M:tryPair(card) if (self.pair_count > 0) then return false end if (checkCardAndRomve(card, self.cardList, 2)) then - local cardGroup = {card,card} + local cardGroup = { card, card } self:push(cardGroup) self.pair_count = 1 return true @@ -108,28 +147,27 @@ function M:tryPair(card) return false end - -function M:tryKezi1Zhong(card) - if (self.zhong_count >= 1 and checkCardAndRomve(card, self.cardList,2)) then - local cardGroup = {card,card,zhongid} +function M:tryKezi1Zhong(card) + if (self.zhong_count >= 1 and checkCardAndRomve(card, self.cardList, 2)) then + local cardGroup = { card, card, zhongid } self:push(cardGroup) - self.zhong_count = self.zhong_count -1 - return true - end - return false -end - -function M:tryKezi2Zhong(card) - if (self.zhong_count >= 2 and checkCardAndRomve(card, self.cardList,1)) then - local cardGroup = {card,zhongid,zhongid} - self:push(cardGroup) - self.zhong_count = self.zhong_count -2 + self.zhong_count = self.zhong_count - 1 return true end return false end -function M:tryShunzi1Zhong(card) +function M:tryKezi2Zhong(card) + if (self.zhong_count >= 2 and checkCardAndRomve(card, self.cardList, 1)) then + local cardGroup = { card, zhongid, zhongid } + self:push(cardGroup) + self.zhong_count = self.zhong_count - 2 + return true + end + return false +end + +function M:tryShunzi1Zhong(card) if (card % 100 > 8) then return false end @@ -141,8 +179,8 @@ function M:tryShunzi1Zhong(card) if (checkCard(card + 1, self.cardList)) then removeCard(self.cardList, card, 1) removeCard(self.cardList, card + 1, 1) - self.zhong_count = self.zhong_count -1 - local cardGroup = {card,card+1,zhongid} + self.zhong_count = self.zhong_count - 1 + local cardGroup = { card, card + 1, zhongid } self:push(cardGroup) return true end @@ -150,15 +188,15 @@ function M:tryShunzi1Zhong(card) if (checkCard(card + 2, self.cardList) and ((card + 1) % 100 ~= 0)) then removeCard(self.cardList, card, 1) removeCard(self.cardList, card + 2, 1) - self.zhong_count = self.zhong_count -1 - local cardGroup = {card,zhongid,card+2} + self.zhong_count = self.zhong_count - 1 + local cardGroup = { card, zhongid, card + 2 } self:push(cardGroup) return true end return false end -function M:tryPair1Zhong(card) +function M:tryPair1Zhong(card) if (self.pair_count > 0) then return false end @@ -166,28 +204,28 @@ function M:tryPair1Zhong(card) return false end removeCard(self.cardList, card, 1) - local cardGroup = {card,zhongid} + local cardGroup = { card, zhongid } self:push(cardGroup) - self.zhong_count = self.zhong_count -1 + self.zhong_count = self.zhong_count - 1 self.pair_count = 1 return true end -function M:tryPair2Zhong() +function M:tryPair2Zhong() if (self.pair_count > 0) then return false end if (self.zhong_count < 2) then return false end - local cardGroup = {zhongid,zhongid} + local cardGroup = { zhongid, zhongid } self:push(cardGroup) - self.zhong_count = self.zhong_count -2 + self.zhong_count = self.zhong_count - 2 self.pair_count = 1 return true end -function M:tryWin() +function M:tryWin() if (self.zhong_count == 4 and not self.eight_laizi) or (self.zhong_count == 8 and self.eight_laizi) then return true end @@ -225,6 +263,13 @@ function M:tryWin() self:rollBack() end + if (self:tryFengShunzi(activeCard)) then + if (self:tryWin()) then + return true + end + self:rollBack() + end + if (self:tryKezi1Zhong(activeCard)) then if (self:tryWin()) then return true @@ -233,7 +278,6 @@ function M:tryWin() end if (self:tryKezi2Zhong(activeCard)) then - if (self:tryWin()) then return true end @@ -257,7 +301,7 @@ function M:tryWin() return false end -function M:checkQidui() +function M:checkQidui() if (not self.qidui) then return false end @@ -270,17 +314,17 @@ function M:checkQidui() return self:isQdPari(cardList) end -function M:isQdPari(cardList) - if(self.qidui_pari_count == 7) then +function M:isQdPari(cardList) + if (self.qidui_pari_count == 7) then return true end - if (#cardList== 0) then + if (#cardList == 0) then return true end local card = cardList[1] if (cardNum(card, cardList) >= 2) then removeCard(cardList, card, 2) - self.qidui_pari_count = self.qidui_pari_count +1 + self.qidui_pari_count = self.qidui_pari_count + 1 if (self:isQdPari(cardList)) then return true end @@ -289,7 +333,7 @@ function M:isQdPari(cardList) if (self.hongzhong_count > 0) then removeCard(cardList, card, 1) self.hongzhong_count = self.hongzhong_count - 1 - self.qidui_pari_count = self.qidui_pari_count +1 + self.qidui_pari_count = self.qidui_pari_count + 1 if (self:isQdPari(cardList)) then return true end @@ -297,82 +341,110 @@ function M:isQdPari(cardList) return false end -local function init(self,cardInhand,addCard,isZhong,qidui,eightLaizi) +function M:checkshisanlan() + if (not self.shisanlan) then + return false + end + if ((#self.cardList + self.zhong_count) ~= 14) then + return false + end + local cardList = membe_clone(self.cardList) + self.hongzhong_count = self.zhong_count + return self:isShiSanLan(cardList, table.remove(cardList, 1)) +end + +function M:isShiSanLan(cardList, card) + if (#cardList == 0) then + return true + end + if card < 400 then + if not (checkCard(card, cardList) or checkCard(card + 1, cardList) or checkCard(card + 2, cardList)) then + return self:isShiSanLan(cardList, table.remove(cardList, 1)) + end + else + if not checkCard(card, cardList) then + return self:isShiSanLan(cardList, table.remove(cardList, 1)) + end + end + return false +end + +--._flag_haveLaizi, data._hu_qidui, data._data_laizi +local function init(self, cardInhand, addCard, data) self.stack = {} self.pair_count = 0 self.cardList = membe_clone(cardInhand) - self.qidui = qidui - self.eight_laizi = eightLaizi - self.cardList[#self.cardList+1] = addCard - if (isZhong) then + self.qidui = data._hu_qidui + self.shisanlan = data._hu_shisanlan + self.eight_laizi = nil + self.cardList[#self.cardList + 1] = addCard + if (data._flag_haveLaizi) then self.zhong_count = cardNum(zhongid, self.cardList) removeCard(self.cardList, zhongid, self.zhong_count) end table.sort(self.cardList) --printlog("添加排序====>>>") --pt(self.cardList) - return self:checkQidui() or self:tryWin() + return self:checkQidui() or self:checkshisanlan() or self:tryWin() end -local specialCardList = { 401, 402, 403, 404, 405, 406, 407 } -function M.tingPai(cardInhand, isZhong, qidui, eightLaizi) - -- printlog("isZhong", isZhong) - -- printlog("qidui", qidui) - -- printlog("eightLaizi", eightLaizi) - -- pt(cardInhand) +local specialCardList = { 401, 402, 403, 404, 501, 502, 503 } +function M.tingPai(cardInhand, data) + data = data or {} local self = setmetatable({}, { __index = M }) local tingList = {} if not cardInhand or #cardInhand == 0 then return tingList end - for k=100,300,100 do - for i=1,9 do + for k = 100, 300, 100 do + for i = 1, 9 do local tem = k + i - local result = init(self,cardInhand,tem,isZhong,qidui,eightLaizi) + local result = init(self, cardInhand, tem, data) --printlog("返回结果为===>>>",result) - if(result) then - tingList[#tingList + 1] = tem + if (result) then + tingList[#tingList + 1] = tem end end end - - for j=1,#specialCardList do + + for j = 1, #specialCardList do local tem = specialCardList[j] - local result = init(self,cardInhand,tem,isZhong,qidui,eightLaizi) - if(result) then - tingList[#tingList + 1] = tem + local result = init(self, cardInhand, tem, data) + if (result) then + tingList[#tingList + 1] = tem end end - + return tingList end -function M.MuiltiplteCaculateTingPai(cardInhand,isZhong,qidui,eightLaizi) - if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then - zhongid=DataManager.CurrenRoom.laiziInfo[1] - local tempTingList2={} - local tempTingList1=M.tingPai(cardInhand,isZhong,qidui,eightLaizi) - if DataManager.CurrenRoom.laiziInfo[2] then - zhongid=DataManager.CurrenRoom.laiziInfo[2] - tempTingList2=M.tingPai(cardInhand,isZhong,qidui,eightLaizi) - zhongid=DataManager.CurrenRoom.laiziInfo[1] +function M.MuiltiplteCaculateTingPai(cardInhand, isZhong, qidui, eightLaizi) + local room = DataManager.CurrenRoom + + if room.laiziInfo and #room.laiziInfo > 0 then + zhongid = room.laiziInfo[1] + local tempTingList2 = {} + local tempTingList1 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi) + if room.laiziInfo[2] then + zhongid = room.laiziInfo[2] + tempTingList2 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi) + zhongid = room.laiziInfo[1] end - local currentTingList={} - if #tempTingList1>0 and #tempTingList2>0 then - currentTingList=CombineDictionaryAndRemoveSomeItem(tempTingList1,tempTingList2) - elseif #tempTingList1>0 then - currentTingList=tempTingList1 - elseif #tempTingList2>0 then - currentTingList=tempTingList2 + local currentTingList = {} + if #tempTingList1 > 0 and #tempTingList2 > 0 then + currentTingList = CombineDictionaryAndRemoveSomeItem(tempTingList1, tempTingList2) + elseif #tempTingList1 > 0 then + currentTingList = tempTingList1 + elseif #tempTingList2 > 0 then + currentTingList = tempTingList2 end - + return currentTingList - else - zhongid=0 - return M.tingPai(cardInhand,isZhong,qidui,eightLaizi) + M._flag_zikechengshun = room.room_config.config.zikechengshun or 0 + zhongid = 0 + return M.tingPai(cardInhand, isZhong, qidui, eightLaizi) end - end -return M \ No newline at end of file +return M diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua index fd9b3811..0c9f3139 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua @@ -252,11 +252,26 @@ function M:fillResult0(room, peopleNum, result) end end handCardList.numItems = handInfoNum - allCardsList.width = 234 * fzInfoNum + 82 + (handInfoNum - 1) * 79 + 10 * (fzInfoNum) + --拿取实际的子项大小 + local handCard = 78 + local hangColumGrap = -4 + local fzCard = 234 + local fzColumGrap = 36 + handCard = handCardList:GetChildAt(handInfoNum - 1).width + hangColumGrap = handCard + handCardList.columnGap + if fzInfoNum > 0 then + fzCard = allCardsList:GetChildAt(0).width + fzColumGrap = allCardsList.columnGap + end + allCardsList.width = fzCard * fzInfoNum + handCard + (handInfoNum - 1) * hangColumGrap + + fzColumGrap * (fzInfoNum) if infoList.seat == room.self_player.seat then isMeCtr.selectedIndex = 1 end + if infoList.seat == room.self_player.seat then + isMeCtr.selectedIndex = 1 + end if infoList.seat == room.banker_seat then isZhuang.selectedIndex = 1 diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index 825daee3..89620e25 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -65,7 +65,31 @@ function M:InitView(url) self.showNextCtr = self._view:GetController('showNext') self.showNextList = self._view:GetChild('list_showNext') self._view:GetChild('btn_showNext').onClick:Set(function() - self:reqResidueCard() + coroutine.start(function() + local time = 0 + + ViewUtil:ShowModalWait2(0.01) + while not self._flag_getRemindCard do + if time > 20 then + break + end + coroutine.wait(0.05) + end + ViewUtil.CloseModalWait2() + if self._flag_getRemindCard then + self.showNextCtr.selectedIndex = 1 + self.showNextList:SetVirtual() + self.showNextList.itemRenderer = function(index, obj) + local card = self.cardSet[index + 1] + self:FillShowCards(obj, card, self.cardMap[card]) + obj.data = { card = card } + end + self.showNextList.numItems = #self.cardSet + time = time + 1 + else + self:reqResidueCard() + end + end) end) self._view:GetChild('btn_closeShow').onClick:Set(function() self.showNextCtr.selectedIndex = 0 @@ -167,13 +191,10 @@ function M:UpdatePlayerInfoView() end function M:NewMJPlayerCardInfoView(view, index) - return MJMainView.NewMJPlayerCardInfoView(self, view, index) - --[[ if index == 1 then - return MJPlayerSelfCardInfoView.new(view, self) + return MJPlayerSelfCardInfoView.new(view, self, nil, "S") end - return MJPlayerCardInfoView.new(view, self) - ]] + return MJMainView.NewMJPlayerCardInfoView(self, view, index) end function M:EventInit() @@ -215,6 +236,7 @@ function M:EventInit() --self._viewText_testName.text = 0 self:UpdateRound() self:RemoveCursor() + self:reqResidueCard() self._state.selectedIndex = 1 self:ShowJing() if self._niao_View then @@ -232,6 +254,9 @@ function M:EventInit() local card_info = self._player_card_info[self:GetPos(p.seat)] card_info:Clear() card_info:UpdateHandCard() + if _room.curren_round == 1 then + self._touxiangMove:Play() + end end end) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) @@ -264,7 +289,8 @@ function M:EventInit() info:UpdateHandCard() local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url) info:UpdateOutCardList(outcard, card, self._cursor) - + self._player_card_info[1]._ctr_tip.selectedIndex = 0 + self._player_card_info[1]._ctr_showGuoHu.selectedIndex = 0 self:PlayMJSound("chupai.mp3") self:PlaySound("NanCheng_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then @@ -273,6 +299,7 @@ function M:EventInit() end) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) self:__CloseTip() + self:reqResidueCard() local arg = { ... } local seat = arg[1] local card = arg[2] @@ -281,6 +308,12 @@ function M:EventInit() -- self:UpdateRoomInfo() local info = self._player_card_info[self:GetPos(seat)] info:UpdateHandCard(true) + if self:GetPos(seat) == 1 then + info:ShowHuTip() + self._btn_selectTing.visible = false + info._ctr_tip.selectedIndex = 0 + info._ctr_showGuoHu.selectedIndex = 0 + end end) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) @@ -543,26 +576,19 @@ function M:EventInit() _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) local arg = { ... } local residueCard = arg[1] - local cardMap = {} - local cardSet = {} - self.showNextCtr.selectedIndex = 1 + self.cardMap = {} + self.cardSet = {} for i = 1, #residueCard do local cardNum = residueCard[i] - if not cardMap[cardNum] then - cardMap[cardNum] = 1 - table.insert(cardSet, cardNum) + if not self.cardMap[cardNum] then + self.cardMap[cardNum] = 1 + table.insert(self.cardSet, cardNum) else - cardMap[cardNum] = cardMap[cardNum] + 1 + self.cardMap[cardNum] = self.cardMap[cardNum] + 1 end end - table.sort(cardSet) - self.showNextList:SetVirtual() - self.showNextList.itemRenderer = function(index, obj) - local card = cardSet[index + 1] - self:FillShowCards(obj, card, cardMap[card]) - obj.data = { card = card } - end - self.showNextList.numItems = #cardSet + table.sort(self.cardSet) + self._flag_getRemindCard = true end) --替换mianview的事件 @@ -592,10 +618,15 @@ function M:OutCard(card) local info = self._player_card_info[1] self:RemoveCursor() info:UpdateHandCard() - - info:UpdateOutCardList(nil, card, self._cursor) info._ctr_tip.selectedIndex = 0 info._ctr_showGuoHu.selectedIndex = 0 + info:UpdateOutCardList(nil, card, self._cursor) + info:ShowHuTip() + if #info:GetTingList(DataManager.CurrenRoom.self_player.card_list) > 0 then + self._btn_selectTing.visible = true + else + self._btn_selectTing.visible = false + end self:markOutCards(false, card) self:PlaySound("NanCheng_MJ", self._room.self_player.self_user.sex, tostring(card)) self:PlayMJSound("chupai.mp3") @@ -904,6 +935,11 @@ function M:ReloadRoom(bskip) if p.seat == room.last_outcard_seat then local card = p.outcard_list[#p.outcard_list] info:UpdateOutCardList(nil, card, self._cursor) + if self:GetPos(p.seat) == 1 and #info:GetTingList(DataManager.CurrenRoom.self_player.card_list) > 0 then + self._btn_selectTing.visible = true + else + self._btn_selectTing.visible = false + end elseif p.seat == room.curren_outcard_seat then info:UpdateHandCard(true) info:UpdateOutCardList() @@ -963,6 +999,7 @@ end -----------------------展示牌---------------------------- function M:reqResidueCard() + self._flag_getRemindCard = false local _gamectr = ControllerManager.GetController(GameController) _gamectr:ReqResidueCard() end diff --git a/lua_probject/extend_project/extend/majiang/nancheng/MJPlayerSelfCardInfoView.lua b/lua_probject/extend_project/extend/majiang/nancheng/MJPlayerSelfCardInfoView.lua index 4fa39205..134c3f64 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/MJPlayerSelfCardInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/MJPlayerSelfCardInfoView.lua @@ -4,32 +4,33 @@ local CardCheck = import(".CardCheck") local M = {} -- -function M.new(view, mainView) +function M.new(view, mainView, record, direction) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView }) setmetatable(M, { __index = MJPlayerSelfCardInfoView }) local self = setmetatable({}, { __index = M }) self.class = "PlayerSelfCardInfoView" self._view = view self._mainView = mainView + self.direction = direction + self._flag_canTing = true self:init() return self end --- function M:ShowHuTip(card_list) --- printlog("ShowHuTip") --- local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, --- DataManager.CurrenRoom.room_config.Laizi) --- if #tingList > 0 then --- if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then --- for i = 1, #DataManager.CurrenRoom.laiziInfo do --- if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then --- table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i]) --- end --- end --- end --- end --- self._mainView._hu_tip:FillData(tingList) --- end +function M:init() + getmetatable(M).__index.init(self) +end + +function M:ShowHuTip(card_list, have_bg) + self._mainView._hu_tip:FillData(self:GetTingList(card_list), have_bg) +end + +function M:GetTingList(card_list) + if not self._flag_canTing then + return {} + end + return CardCheck.MuiltiplteCaculateTingPai(card_list, { _hu_qidui = true, _hu_shisanlan = true }) +end function M:UpdateHandCard(getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua index 8b5cc69d..267af82d 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua @@ -566,7 +566,7 @@ function M:EventInit() -- end -- end self._leftClock_continue = coroutine.start(function() - coroutine.wait(1.2) + coroutine.wait(1) for i = 1, #self._player_card_info do local card_info = self._player_card_info[i] if i == index then diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua index e82785d8..3a1c0024 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua @@ -98,6 +98,7 @@ function M:FillRoomData(data) -- print("hidezhanji 1111") self._currentStep = 1 local room = DataManager.CurrenRoom + self._room = DataManager.CurrenRoom local _player_card_info = self._player_card_info local roominfo_panel = self._view:GetChild('roominfo_panel1') @@ -128,10 +129,11 @@ function M:FillRoomData(data) head_info:UpdatePiao(p.piao) end - self:UpdateRound() + self:UpdateRound(self._room.curren_round) self:GenerateAllStepData(data) self:ShowStep(1) + self:Play() end function M:ShowStep(index) @@ -152,6 +154,7 @@ function M:ShowStep(index) else info:InitPoker(p.hand_list, false) end + info:SetOutCardInfo(nil, false) end if step.cmd == RunFast_Record_Event.Evt_OutCard then @@ -302,9 +305,17 @@ function M:ClearNextSeatOutCard(currenOutCardSeat) card_info:SetOutCardInfo(nil, false) end -function M:UpdateRound() - local round = self._room.curren_round - self._tex_round.text = string.format('第 %d 局', round) +function M:UpdateRound(round) + local total_round = self._room.room_config.Times + -- self._text_round.text = string.format("%d / %d 局", round, total_round) + if not self._text_currenRound then + self._text_currenRound = self._view:GetChild('Text_CurrenRound') + end + if not self._text_maxRound then + self._text_maxRound = self._view:GetChild('Text_MaxMaxRound') + end + self._text_currenRound.text = round + self._text_maxRound.text = string.format("/%s局", total_round) end function M:NextRecordPlay() @@ -338,77 +349,6 @@ function M:LastRecordPlay() end end -function M:Play() - self:ChangeAlpha() - self:ChangePlayState(not self._play) - if not self._play then - return - end - if (self._currentStep == #self.cmdList and self._playFoward) or (self._currentStep == 0 and not self._playFoward) then - self._currentStep = 0 - self._speed = 1 - self._playFoward = true - self:ChangeTextSpeed() - end -end - -function M:ChangePlayState(state) - self._play = state - self:ChangeTextSpeed() - local btn_play = self._view:GetChild('panel_record'):GetChild('btn_play') - if self._play then - btn_play:GetController('state').selectedIndex = 1 - else - btn_play:GetController('state').selectedIndex = 0 - end -end - -function M:ChangeTextSpeed() - local str1 = self._play and self._speed or '' - self._view:GetChild('panel_record'):GetChild('tex_speed').text = str1 - local str2 = - not self._play and (self._playFoward and '播放暂停' or '回退暂停') or - self._playFoward and (self._speed == 1 and '播放' or '快进') or - (self._speed == 1 and '回退' or '快退') - self._view:GetChild('panel_record'):GetChild('tex_2').text = str2 - local str3 = self._play and '倍速度' or '' - self._view:GetChild('panel_record'):GetChild('tex_1').text = str3 -end - -function M:CmdLeftArrows() - self:ChangeAlpha() - self:ChangePlayState(true) - if not self._playFoward then - if self._speed < 16 then - self._speed = self._speed * 2 - else - self._speed = 1 - end - self:ChangeTextSpeed() - else - self._speed = 1 - self._playFoward = false - self:ChangeTextSpeed() - end -end - -function M:CmdRightArrows() - self:ChangeAlpha() - self:ChangePlayState(true) - if self._playFoward then - if self._speed < 16 then - self._speed = self._speed * 2 - else - self._speed = 1 - end - self:ChangeTextSpeed() - else - self._speed = 1 - self._playFoward = true - self:ChangeTextSpeed() - end -end - function M:OnUpdate() if self._play then if (self._currentStep == #self.cmdList + 1 and self._playFoward) then diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerPokerInfoView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerPokerInfoView.lua index 59278605..71e8a98e 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerPokerInfoView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerPokerInfoView.lua @@ -29,7 +29,8 @@ function M:init() self.ctr_outpoker = view:GetController("output") self.outpoker_list = view:GetChild(self.out_card_data["parent"]) - self.hand_card_list = view:GetChild("hand_card_list") + -- self.hand_card_list = view:GetChild("hand_card_list") + self.hand_card_list = view:GetChild("list_backHand") self.ctr_one_card = view:GetController("one_card") self.eff_one_card = view:GetChild("one_card_eff"):GetTransition("t0") @@ -314,8 +315,9 @@ function M:UpdateHandPoker(cardList, isPlayAni, isMing) else for i = card_length, 1, -1 do local code = isMing == true and new_card_list[i] or 0 - local poker = self:CreatPoker1(code, 0.4) - self.hand_card_list:AddChild(poker) + local card_number_code = self:ChangeOneCodeByFrom(cardList[i]) + local btn_card = self.hand_card_list:AddItemFromPool() + self:FillPoker(btn_card, "", card_number_code) end end end @@ -430,6 +432,15 @@ function M:PlayEffect(type, callback) end, Time.deltaTime, 1, false):Start() end +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:FillPoker(poker, prefix, num, code) if num ~= nil then code = self:ChangeCodeByTo(num) diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerSelfPokerInfoView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerSelfPokerInfoView.lua index dd7b5d93..bfc1ee47 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerSelfPokerInfoView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerSelfPokerInfoView.lua @@ -1237,15 +1237,6 @@ function M:GetHandCardPos1(index, card_count) return x, y end -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) diff --git a/lua_probject/main_project/main/majiang/HuTipView.lua b/lua_probject/main_project/main/majiang/HuTipView.lua index b61a17f0..15a9e4b2 100644 --- a/lua_probject/main_project/main/majiang/HuTipView.lua +++ b/lua_probject/main_project/main/majiang/HuTipView.lua @@ -39,7 +39,7 @@ function M:init() self._main_view._view:AddChild(self._view) -- 初始位置 self._view:Center() - self._view.y = GRoot.inst.height * 0.723 + self._view.y = GRoot.inst.height * 0.8085 SetObjEnabled(self._view, false) -- self._view.onTouchBegin:Add(handler(self, self.OnTouchBegin)) -- self._view.onTouchMove:Add(handler(self, self.OnTouchMove)) @@ -67,20 +67,35 @@ end -- end -- end -function M:FillData(cards, posX) +function M:FillData(cards, have_bg) -- local btn_showtip = self._main_view._view:GetChild("btn_showtip") local lst_card = self._view:GetChild("lst_card") - lst_card:SetVirtual() + lst_card:RemoveChildrenToPool() local num = #cards if num > 0 then - if num == lst_card.numItems then - lst_card:RefreshVirtualList() - else - lst_card.numItems = num + for i = 1, num do + local item = lst_card:AddItemFromPool() + item.icon = "ui://Main_Majiang/b202_" .. cards[i] + item.text = string.format("剩%d张", self._main_view.cardMap[cards[i]] or 0) end + lst_card:ResizeToFit(num) + SetObjEnabled(self._view, true) else SetObjEnabled(self._view, false) end + if have_bg then + self._view_bg = UIPackage.CreateObjectFromURL("ui://Main_Majiang/btn_bg") + self._main_view._view:AddChild(self._view_bg) + self._view_bg:GetChild('n3').color = Color(1, 1, 1, 0) + -- self._view_bg:Center() + self._view_bg.width = GRoot.inst.width + self._view_bg.height = GRoot.inst.height + self._view_bg.onClick:Set(function() + self._view_bg:RemoveFromParent() + self._view_bg:Dispose() + SetObjEnabled(self._view, false) + end) + end end function M:GetPrefix() diff --git a/lua_probject/main_project/main/majiang/MJClearingView.lua b/lua_probject/main_project/main/majiang/MJClearingView.lua index 12d6bbb6..10897e41 100644 --- a/lua_probject/main_project/main/majiang/MJClearingView.lua +++ b/lua_probject/main_project/main/majiang/MJClearingView.lua @@ -223,8 +223,21 @@ function M:fillResult0(room, peopleNum, result) end end handCardList.numItems = handInfoNum - allCardsList.width = 234 * fzInfoNum + 84 + (handInfoNum - 1) * 80 + 36 * (fzInfoNum) - + --拿取实际的子项大小 + local handCard = 78 + local hangColumGrap = -4 + local fzCard = 234 + local fzColumGrap = 36 + handCard = handCardList:GetChildAt(handInfoNum - 1).width + hangColumGrap = handCardList.columnGap + if fzInfoNum > 0 then + fzCard = allCardsList:GetChildAt(0).width + fzColumGrap = allCardsList.columnGap + end + allCardsList.width = fzCard * fzInfoNum + handCard + (handInfoNum - 1) * hangColumGrap + + fzColumGrap * (fzInfoNum) + printlog("lingmeng grap", fzCard * fzInfoNum + handCard + (handInfoNum - 1) * hangColumGrap + + fzColumGrap * (fzInfoNum), allCardsList.width) if infoList.seat == room.self_player.seat then isMeCtr.selectedIndex = 1 end diff --git a/lua_probject/main_project/main/majiang/MJMainView.lua b/lua_probject/main_project/main/majiang/MJMainView.lua index 8ccf73f2..a118848a 100644 --- a/lua_probject/main_project/main/majiang/MJMainView.lua +++ b/lua_probject/main_project/main/majiang/MJMainView.lua @@ -202,6 +202,11 @@ function M:InitView(url, use_custom_bg, custom_bg_config) self._touxiangMove = self._view:GetTransition('touxiangMove') --闹钟倒计时报时 self._leftTime_xiangling = 3 + --听牌按钮 + self._btn_selectTing = self._view:GetChild('btn_selectTing') + self._btn_selectTing.onClick:Set(function() + self._player_card_info[1]:ShowHuTip(DataManager.CurrenRoom.self_player.card_list, true) + end) end function M:ClickSetting() diff --git a/lua_probject/main_project/main/majiang/MJPlayBackView.lua b/lua_probject/main_project/main/majiang/MJPlayBackView.lua index db5ad84d..47135982 100644 --- a/lua_probject/main_project/main/majiang/MJPlayBackView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayBackView.lua @@ -1,6 +1,7 @@ local MJPlayerCardInfoView = import(".MJPlayerCardInfoView") local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView") local TableBG = import('Game.Data.TableBG') +local MJMainView = import(".MJMainView") --- local M = {} @@ -67,7 +68,43 @@ function M:SetCardBoxPosition() end function M:NewMJPlayerCardInfoView(view, index) - return MJPlayerCardInfoView.new(view, self, 1) + return MJMainView.NewMJPlayerCardInfoView(self, view, index) + --[[ + if index == 1 then + return MJPlayerSelfCardInfoView.new(view, self) + end + return MJPlayerCardInfoView.new(view, self) + ]] +end + +function M:markOutCards(showTip, data) + MJMainView.markOutCards(self, showTip, data) + -- for i = 1, #self._room.player_list do + -- local p = self._room.player_list[i] + -- local info = self._player_card_info[self:GetPos(p.seat)] + -- -- for j = 1, #p.outcard_list do + -- -- local card = p.outcard_list[j] + -- -- if card == data then + -- -- for k = 1, #p.outcard_list do + -- -- local obj = info:GetOutCardByIndex(k) + -- -- if obj.data == card then + -- -- obj:GetController("gray").selectedIndex = showTip and 1 or 0 + -- -- end + -- -- end + -- -- end + -- -- end + -- for j = 1, info._view_outCardList.numItems do + -- local card = p.outcard_list[j] + -- if card == data then + -- for k = 1, info._view_outCardList.numItems do + -- local obj = info:GetOutCardByIndex(k) + -- if obj.data == card then + -- obj:GetController("gray").selectedIndex = showTip and 1 or 0 + -- end + -- end + -- end + -- end + -- end end function M:NextRecordPlay() @@ -120,6 +157,13 @@ function M:ChangePlayState(state) else btn_play:GetController("state").selectedIndex = 0 end + --开始时,隐藏显示结算界面 + if state then + if self.result then + self.result:Destroy() + self.result = nil + end + end end function M:ChangeTextSpeed() diff --git a/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua index 9c73b696..b63bb35f 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua @@ -33,6 +33,7 @@ function M:init() self._area_allDown.onClick:Set(function() self:ClearChoose() + self:ShowHuTip() end) self._viewBtn_buGuoHu.onClick:Set(function() @@ -87,7 +88,7 @@ function M:UpdateHandCard(getcard, mp) end self:FillHandCard(i, btn_card, tem_card, true) local tingList = {} - if getcard then + if getcard and self.GetTingList then tingList = self:GetTingList(self:RemoverCardListByIndexGetCardList(i)) end btn_card:GetController('ting').selectedIndex = (tingList and #tingList > 0) and 1 or 0 @@ -163,8 +164,6 @@ function M:onTouchMove(context) end end else - print("lingmengonTouchMove", chooseIndex, self._view_handCardList.numItems) - self.ischoose = true if self._view_handCardList.selectedIndex ~= chooseIndex then self:ChooseHand(chooseIndex) @@ -294,7 +293,7 @@ function M:__OnClickGetCard(context, flag) self._click_index = self._view_handCardList.selectedIndex local button = context.sender local _room = DataManager.CurrenRoom - + self:ShowHuTip(self:RemoverCardListByIndexGetCardList(self._view_handCardList.numItems)) if _room.curren_outcard_seat == _room.self_player.seat then if self._mainView.clickMode == "single" or Utils.IsDoubleClick(context) or self._flag_seletedGet == 1 then local card = button.data @@ -321,6 +320,7 @@ function M:ChooseHand(index) self._view_handCardList.selectedIndex = index self._ctr_seletedGet.selectedIndex = 1 self._flag_seletedGet = 0 + self:ShowHuTip(self:RemoverCardListByIndexGetCardList(self._view_handCardList.selectedIndex)) end function M:ChooseOut() @@ -329,6 +329,7 @@ function M:ChooseOut() self._view_handCardList.selectedIndex = -1 self._ctr_seletedGet.selectedIndex = 0 self._flag_seletedGet = 1 + self:ShowHuTip(self:RemoverCardListByIndexGetCardList(self._view_handCardList.numItems)) end function M:ClearChoose() diff --git a/lua_probject/main_project/main/poker/PKPlayBackView.lua b/lua_probject/main_project/main/poker/PKPlayBackView.lua index 6b0727c2..9ae527b9 100644 --- a/lua_probject/main_project/main/poker/PKPlayBackView.lua +++ b/lua_probject/main_project/main/poker/PKPlayBackView.lua @@ -2,44 +2,55 @@ local TableBG = import('Game.Data.TableBG') local M = {} -setmetatable(M,{__index = PlayBackView}) +setmetatable(M, { __index = PlayBackView }) local pk_default_bg = 1 local pk_bg_config = { - {id = 1, url = "base/main_poker/bg/bg1", thumb = "ui://Main_Poker/bg1"}, - {id = 2, url = "base/main_poker/bg/bg2", thumb = "ui://Main_Poker/bg2"}, - {id = 3, url = "base/main_poker/bg/bg3", thumb = "ui://Main_Poker/bg3"}, + { id = 1, url = "base/main_poker/bg/bg1", thumb = "ui://Main_Poker/bg1" }, + { id = 2, url = "base/main_poker/bg/bg2", thumb = "ui://Main_Poker/bg2" }, + { id = 3, url = "base/main_poker/bg/bg3", thumb = "ui://Main_Poker/bg3" }, } function M:InitView(url, ex_defaultbg, ex_bgconfig) UIPackage.AddPackage("base/main_poker/ui/Main_Poker") - PlayBackView.InitView(self,url) + PlayBackView.InitView(self, url) local _view = self._view - - local default_bg = ex_defaultbg or pk_default_bg - local bg_config = ex_bgconfig or pk_bg_config - TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) - UpdateBeat:Add(self.OnUpdate,self) + + local default_bg = ex_defaultbg or pk_default_bg + local bg_config = ex_bgconfig or pk_bg_config + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + UpdateBeat:Add(self.OnUpdate, self) end function M:NextRecordPlay() + self:RemoveCursor() local result = PlayBackView.NextRecordPlay(self) if not result then return end - self:ChangePlayState(false) + self:ChangePlayState(true) self._speed = 1 self._playFoward = true self:ChangeTextSpeed() end function M:LastRecordPlay() + self:RemoveCursor() local result = PlayBackView.LastRecordPlay(self) if not result then return end - self:ChangePlayState(false) + self:ChangePlayState(true) self._speed = 1 self._playFoward = true self:ChangeTextSpeed() end +function M:RestartRecordPlay() + self:ChangeAlpha() + self._currentStep = 0 + self._speed = 1 + self._playFoward = true + self:ChangeTextSpeed() + self:ChangePlayState(true) +end + function M:Play() self:ChangeAlpha() self:ChangePlayState(not self._play) @@ -61,23 +72,32 @@ function M:ChangePlayState(state) else btn_play:GetController("state").selectedIndex = 0 end + --开始时,隐藏显示结算界面 + if state then + if self.result then + self.result:Destroy() + self.result = nil + end + end end function M:ChangeTextSpeed() - local str1 = self._play and self._speed or "" - self._view:GetChild("panel_record"):GetChild("tex_speed").text = str1 - local str2 = not self._play and (self._playFoward and "播放暂停" or "回退暂停") or self._playFoward and (self._speed == 1 and "播放" or "快进") or (self._speed == 1 and "回退" or "快退") - self._view:GetChild("panel_record"):GetChild("tex_2").text = str2 - local str3 = self._play and "倍速度" or "" - self._view:GetChild("panel_record"):GetChild("tex_1").text = str3 + -- local str1 = self._play and self._speed or "" + -- self._view:GetChild("panel_record"):GetChild("tex_speed").text = str1 + -- local str2 = not self._play and (self._playFoward and "播放暂停" or "回退暂停") or + -- self._playFoward and (self._speed == 1 and "播放" or "快进") or (self._speed == 1 and "回退" or "快退") + -- self._view:GetChild("panel_record"):GetChild("tex_2").text = str2 + -- local str3 = self._play and "倍速度" or "" + -- self._view:GetChild("panel_record"):GetChild("tex_1").text = str3 + self._record:GetChild('tex_speed').text = self._speed end function M:CmdLeftArrows() self:ChangeAlpha() self:ChangePlayState(true) if not self._playFoward then - if self._speed < 16 then - self._speed = self._speed * 2 + if self._speed < 5 then + self._speed = self._speed + 1 else self._speed = 1 end @@ -93,8 +113,8 @@ function M:CmdRightArrows() self:ChangeAlpha() self:ChangePlayState(true) if self._playFoward then - if self._speed < 16 then - self._speed = self._speed * 2 + if self._speed < 5 then + self._speed = self._speed + 1 else self._speed = 1 end @@ -106,15 +126,21 @@ function M:CmdRightArrows() end end +function M:MaxSpeedArriws() + self:ChangeAlpha() + self:ChangePlayState(true) + self._speed = 30 +end + function M:OnUpdate() if self._play then if (self._currentStep == #self.cmdList and self._playFoward) then self:ChangePlayState(false) - ViewUtil.ErrorTip(nil,"当前已是录像结尾了,再次点击播放按钮可重新播放") + ViewUtil.ErrorTip(nil, "当前已是录像结尾了,再次点击播放按钮可重新播放") return elseif (self._currentStep == 0 and not self._playFoward) then self:ChangePlayState(false) - ViewUtil.ErrorTip(nil,"当前已是录像开头了,再次点击播放按钮可重新播放") + ViewUtil.ErrorTip(nil, "当前已是录像开头了,再次点击播放按钮可重新播放") return end self._timer = self._timer + Time.deltaTime @@ -128,8 +154,8 @@ function M:OnUpdate() end function M:Destroy() - UpdateBeat:Remove(self.OnUpdate,self) + UpdateBeat:Remove(self.OnUpdate, self) PlayBackView.Destroy(self) end -return M \ No newline at end of file +return M diff --git a/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Component/com_logo.xml b/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Component/com_logo.xml new file mode 100644 index 00000000..01a23a94 --- /dev/null +++ b/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Component/com_logo.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/Extend_Poker_RunFastNew/logo_301.png b/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Image/logo_301.png similarity index 100% rename from wb_new_ui/assets/Extend_Poker_RunFastNew/logo_301.png rename to wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Image/logo_301.png diff --git a/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Component/btn_normol(1).xml b/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Component/btn_normol(1).xml new file mode 100644 index 00000000..46e79fb5 --- /dev/null +++ b/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Component/btn_normol(1).xml @@ -0,0 +1,10 @@ + + + + + + + + +