新git地址同步

master
罗家炜 2025-05-13 10:30:27 +08:00
parent 8729b34381
commit 7edfac1243
24 changed files with 706 additions and 155 deletions

View File

@ -319,7 +319,7 @@ function ViewUtil.ShowOneChooose(showText, btnType, callback)
end) end)
end end
function ViewUtil.ShowTwoChooose(showText, leftCallback,rightCallback) function ViewUtil.ShowTwoChooose(showText, leftCallback, rightCallback)
local pop_twoChoose = UIPackage.CreateObjectFromURL("ui://Common/pop_twoChoose") local pop_twoChoose = UIPackage.CreateObjectFromURL("ui://Common/pop_twoChoose")
pop_twoChoose:GetChild('text_show').text = showText pop_twoChoose:GetChild('text_show').text = showText
GRoot.inst:AddChild(pop_twoChoose) GRoot.inst:AddChild(pop_twoChoose)
@ -364,6 +364,5 @@ function ViewUtil.ShowOneInput(showText, callback)
local btn_center = pop_oneInput:GetChild('btn_close') local btn_center = pop_oneInput:GetChild('btn_close')
btn_center.onClick:Add(function() btn_center.onClick:Add(function()
GRoot.inst:RemoveChild(pop_oneInput) GRoot.inst:RemoveChild(pop_oneInput)
end) end)
end end

View File

@ -182,12 +182,11 @@ function M:fillResult0(room, peopleNum, result)
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
local handCardList = handCardItem:GetChild("list") local handCardList = handCardItem:GetChild("list")
--手牌排序 --手牌排序
table.sort(infoList.hand_card, ViewUtil.HandCardSort) table.sort(infoList.hand_card, self.HandCardSortAndJing)
handCardList:SetVirtual() handCardList:SetVirtual()
handCardList.itemRenderer = function(index, obj) handCardList.itemRenderer = function(index, obj)
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1]) obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])
if room.jing == infoList.hand_card[index + 1] then if room.jing == infoList.hand_card[index + 1] then
ViewUtil:ErrorTip("显示精")
obj:GetController('jing').selectedIndex = 1 obj:GetController('jing').selectedIndex = 1
end end
end end
@ -199,7 +198,6 @@ function M:fillResult0(room, peopleNum, result)
end end
if infoList.seat == room.banker_seat then if infoList.seat == room.banker_seat then
ViewUtil:ErrorTip("显示庄家")
isZhuang.selectedIndex = 1 isZhuang.selectedIndex = 1
end end
@ -215,7 +213,11 @@ function M:fillResult0(room, peopleNum, result)
ziMoCtr.selectedIndex = 1 ziMoCtr.selectedIndex = 1
end end
huCardBtn.icon = string.format("ui://Main_Majiang/202_%d", infoList.win_card) huCardBtn.icon = string.format("ui://Main_Majiang/202_%d", infoList.win_card)
if room.jing == infoList.win_card then
huCardBtn:GetController('jing').selectedIndex = 1
end
huCardBtn.visible = true huCardBtn.visible = true
jiangMaList.visible = true jiangMaList.visible = true
@ -286,6 +288,36 @@ function M:fillHead(url, view)
ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject)
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
local prefix local prefix
function M:GetPrefix() function M:GetPrefix()
-- if not prefix then -- if not prefix then

View File

@ -72,7 +72,10 @@ function M:SendOutCard(card, callback)
local p = _room.self_player local p = _room.self_player
_room.curren_outcard_seat = -1 _room.curren_outcard_seat = -1
list_remove(p.card_list, card) list_remove(p.card_list, card)
table.sort(p.card_list, ViewUtil.HandCardSort)
table.sort(p.card_list, self.HandCardSortAndJing)
p.hand_left_count = p.hand_left_count - 1 p.hand_left_count = p.hand_left_count - 1
if not p.outcard_list then p.outcard_list = {} end if not p.outcard_list then p.outcard_list = {} end
p.outcard_list[#p.outcard_list + 1] = card p.outcard_list[#p.outcard_list + 1] = card
@ -158,7 +161,8 @@ function M:OnEventSendCards(evt_data)
end end
p.card_list = handcards p.card_list = handcards
self._room.self_player.hand_left_count = #handcards self._room.self_player.hand_left_count = #handcards
table.sort(handcards, ViewUtil.HandCardSort)
table.sort(handcards, self.HandCardSortAndJing)
DispatchEvent(self._dispatcher, TX_GameEvent.SendCards, p) DispatchEvent(self._dispatcher, TX_GameEvent.SendCards, p)
end) end)
end end
@ -176,7 +180,8 @@ function M:OnEventOutCard(evt_data)
else else
if seat == _room.self_player.seat then if seat == _room.self_player.seat then
list_remove(p.card_list, card) list_remove(p.card_list, card)
table.sort(p.card_list, ViewUtil.HandCardSort)
table.sort(p.card_list, self.HandCardSortAndJing)
end end
p.hand_left_count = p.hand_left_count - 1 p.hand_left_count = p.hand_left_count - 1
if not p.outcard_list then p.outcard_list = {} end if not p.outcard_list then p.outcard_list = {} end
@ -196,7 +201,8 @@ function M:OnEventTakeCard(evt_data)
p.hand_left_count = p.hand_left_count + 1 p.hand_left_count = p.hand_left_count + 1
if (seat == _room.self_player.seat) then if (seat == _room.self_player.seat) then
_room.self_player.card_list[#_room.self_player.card_list + 1] = card _room.self_player.card_list[#_room.self_player.card_list + 1] = card
-- table.sort( _room.self_player.card_list, ViewUtil.HandCardSort )
-- table.sort( _room.self_player.card_list, self.HandCardSortAndJing )
end end
DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count) DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count)
end) end)
@ -275,11 +281,11 @@ function M:OnEventFzAction(evt_data)
fz.active_card = actice_card fz.active_card = actice_card
if (index == -1) then if (index == -1) then
if (ftype == FZType.Chi) then if (ftype == FZType.Chi) then
local data = {} local data = {}
data[1] = opcard[1] data[1] = opcard[1]
data[2] = card data[2] = card
data[3] = opcard[2] data[3] = opcard[2]
fz.opcard = data fz.opcard = data
end end
p.fz_list[#p.fz_list + 1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
@ -312,7 +318,7 @@ function M:OnEventHu(evt_data)
self._cacheEvent:Enqueue(function() self._cacheEvent:Enqueue(function()
win_p.card_list = cards win_p.card_list = cards
table.sort(win_p.card_list, ViewUtil.HandCardSort) table.sort(win_p.card_list, self.HandCardSortAndJing)
DispatchEvent(self._dispatcher, TX_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards, DispatchEvent(self._dispatcher, TX_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards,
win_list) win_list)
end) end)
@ -414,4 +420,34 @@ function M:Discard(card)
_client:send(Protocol.Game_Da, _data) _client:send(Protocol.Game_Da, _data)
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M return M

View File

@ -269,6 +269,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self._viewText_testName.text = 0
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self:ShowJing() self:ShowJing()

View File

@ -59,7 +59,7 @@ function M:FillRoomData(data)
local p = room.player_list[i] local p = room.player_list[i]
local card_info = _player_card_info[self:GetPos(p.seat)] local card_info = _player_card_info[self:GetPos(p.seat)]
card_info:Clear() card_info:Clear()
table.sort(p.card_list, ViewUtil.HandCardSort) table.sort(p.card_list, self.HandCardSortAndJing)
card_info:UpdateHandCard(false, true) card_info:UpdateHandCard(false, true)
self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0
end end
@ -206,7 +206,7 @@ function M:CmdOutCard(cmd, index)
data.last_out_seat = cmd.seat data.last_out_seat = cmd.seat
local u = data.player_card_data[cmd.seat] local u = data.player_card_data[cmd.seat]
list_remove(u.card_list, cmd.data.card) list_remove(u.card_list, cmd.data.card)
table.sort(u.card_list, ViewUtil.HandCardSort) table.sort(u.card_list, self.HandCardSortAndJing)
u.outcard_list[#u.outcard_list + 1] = cmd.data.card u.outcard_list[#u.outcard_list + 1] = cmd.data.card
end end
@ -294,4 +294,34 @@ function M:UpdateStep(step)
self._record:GetChild("tex_step").text = "" .. step .. " / " .. #self._step .. "" self._record:GetChild("tex_step").text = "" .. step .. " / " .. #self._step .. ""
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M return M

View File

@ -182,12 +182,11 @@ function M:fillResult0(room, peopleNum, result)
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
local handCardList = handCardItem:GetChild("list") local handCardList = handCardItem:GetChild("list")
--手牌排序 --手牌排序
table.sort(infoList.hand_card, ViewUtil.HandCardSort) table.sort(infoList.hand_card, self.HandCardSortAndJing)
handCardList:SetVirtual() handCardList:SetVirtual()
handCardList.itemRenderer = function(index, obj) handCardList.itemRenderer = function(index, obj)
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1]) obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])
if room.jing == infoList.hand_card[index + 1] then if room.jing == infoList.hand_card[index + 1] then
ViewUtil:ErrorTip("显示精")
obj:GetController('jing').selectedIndex = 1 obj:GetController('jing').selectedIndex = 1
end end
end end
@ -199,7 +198,6 @@ function M:fillResult0(room, peopleNum, result)
end end
if infoList.seat == room.banker_seat then if infoList.seat == room.banker_seat then
ViewUtil:ErrorTip("显示庄家")
isZhuang.selectedIndex = 1 isZhuang.selectedIndex = 1
end end
@ -286,6 +284,36 @@ function M:fillHead(url, view)
ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject)
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
local prefix local prefix
function M:GetPrefix() function M:GetPrefix()
-- if not prefix then -- if not prefix then

View File

@ -72,7 +72,10 @@ function M:SendOutCard(card, callback)
local p = _room.self_player local p = _room.self_player
_room.curren_outcard_seat = -1 _room.curren_outcard_seat = -1
list_remove(p.card_list, card) list_remove(p.card_list, card)
table.sort(p.card_list, ViewUtil.HandCardSort)
table.sort(p.card_list, self.HandCardSortAndJing)
p.hand_left_count = p.hand_left_count - 1 p.hand_left_count = p.hand_left_count - 1
if not p.outcard_list then p.outcard_list = {} end if not p.outcard_list then p.outcard_list = {} end
p.outcard_list[#p.outcard_list + 1] = card p.outcard_list[#p.outcard_list + 1] = card
@ -158,7 +161,8 @@ function M:OnEventSendCards(evt_data)
end end
p.card_list = handcards p.card_list = handcards
self._room.self_player.hand_left_count = #handcards self._room.self_player.hand_left_count = #handcards
table.sort(handcards, ViewUtil.HandCardSort)
table.sort(handcards, self.HandCardSortAndJing)
DispatchEvent(self._dispatcher, TX_GameEvent.SendCards, p) DispatchEvent(self._dispatcher, TX_GameEvent.SendCards, p)
end) end)
end end
@ -176,7 +180,8 @@ function M:OnEventOutCard(evt_data)
else else
if seat == _room.self_player.seat then if seat == _room.self_player.seat then
list_remove(p.card_list, card) list_remove(p.card_list, card)
table.sort(p.card_list, ViewUtil.HandCardSort)
table.sort(p.card_list, self.HandCardSortAndJing)
end end
p.hand_left_count = p.hand_left_count - 1 p.hand_left_count = p.hand_left_count - 1
if not p.outcard_list then p.outcard_list = {} end if not p.outcard_list then p.outcard_list = {} end
@ -196,7 +201,8 @@ function M:OnEventTakeCard(evt_data)
p.hand_left_count = p.hand_left_count + 1 p.hand_left_count = p.hand_left_count + 1
if (seat == _room.self_player.seat) then if (seat == _room.self_player.seat) then
_room.self_player.card_list[#_room.self_player.card_list + 1] = card _room.self_player.card_list[#_room.self_player.card_list + 1] = card
-- table.sort( _room.self_player.card_list, ViewUtil.HandCardSort )
-- table.sort( _room.self_player.card_list, self.HandCardSortAndJing )
end end
DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count) DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count)
end) end)
@ -312,7 +318,7 @@ function M:OnEventHu(evt_data)
self._cacheEvent:Enqueue(function() self._cacheEvent:Enqueue(function()
win_p.card_list = cards win_p.card_list = cards
table.sort(win_p.card_list, ViewUtil.HandCardSort) table.sort(win_p.card_list, self.HandCardSortAndJing)
DispatchEvent(self._dispatcher, TX_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards, DispatchEvent(self._dispatcher, TX_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards,
win_list) win_list)
end) end)
@ -414,4 +420,34 @@ function M:Discard(card)
_client:send(Protocol.Game_Da, _data) _client:send(Protocol.Game_Da, _data)
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M return M

View File

@ -269,6 +269,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self._viewText_testName.text = 0
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self:ShowJing() self:ShowJing()

View File

@ -59,7 +59,7 @@ function M:FillRoomData(data)
local p = room.player_list[i] local p = room.player_list[i]
local card_info = _player_card_info[self:GetPos(p.seat)] local card_info = _player_card_info[self:GetPos(p.seat)]
card_info:Clear() card_info:Clear()
table.sort(p.card_list, ViewUtil.HandCardSort) table.sort(p.card_list, self.HandCardSortAndJing)
card_info:UpdateHandCard(false, true) card_info:UpdateHandCard(false, true)
self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0
end end
@ -206,7 +206,7 @@ function M:CmdOutCard(cmd, index)
data.last_out_seat = cmd.seat data.last_out_seat = cmd.seat
local u = data.player_card_data[cmd.seat] local u = data.player_card_data[cmd.seat]
list_remove(u.card_list, cmd.data.card) list_remove(u.card_list, cmd.data.card)
table.sort(u.card_list, ViewUtil.HandCardSort) table.sort(u.card_list, self.HandCardSortAndJing)
u.outcard_list[#u.outcard_list + 1] = cmd.data.card u.outcard_list[#u.outcard_list + 1] = cmd.data.card
end end
@ -294,4 +294,34 @@ function M:UpdateStep(step)
self._record:GetChild("tex_step").text = "" .. step .. " / " .. #self._step .. "" self._record:GetChild("tex_step").text = "" .. step .. " / " .. #self._step .. ""
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M return M

View File

@ -182,7 +182,7 @@ function M:fillResult0(room, peopleNum, result)
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
local handCardList = handCardItem:GetChild("list") local handCardList = handCardItem:GetChild("list")
--手牌排序 --手牌排序
table.sort(infoList.hand_card, ViewUtil.HandCardSort) table.sort(infoList.hand_card, self.HandCardSortAndJing)
handCardList:SetVirtual() handCardList:SetVirtual()
handCardList.itemRenderer = function(index, obj) handCardList.itemRenderer = function(index, obj)
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1]) obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])
@ -214,6 +214,9 @@ function M:fillResult0(room, peopleNum, result)
end end
huCardBtn.icon = string.format("ui://Main_Majiang/202_%d", infoList.win_card) huCardBtn.icon = string.format("ui://Main_Majiang/202_%d", infoList.win_card)
if room.jing == infoList.win_card then
huCardBtn:GetController('jing').selectedIndex = 1
end
huCardBtn.visible = true huCardBtn.visible = true
jiangMaList.visible = true jiangMaList.visible = true
@ -284,6 +287,36 @@ function M:fillHead(url, view)
ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject)
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
local prefix local prefix
function M:GetPrefix() function M:GetPrefix()
-- if not prefix then -- if not prefix then

View File

@ -72,7 +72,11 @@ function M:SendOutCard(card, callback)
local p = _room.self_player local p = _room.self_player
_room.curren_outcard_seat = -1 _room.curren_outcard_seat = -1
list_remove(p.card_list, card) list_remove(p.card_list, card)
table.sort(p.card_list, ViewUtil.HandCardSort)
pt(p.card_list)
table.sort(p.card_list, self.HandCardSortAndJing)
p.hand_left_count = p.hand_left_count - 1 p.hand_left_count = p.hand_left_count - 1
if not p.outcard_list then p.outcard_list = {} end if not p.outcard_list then p.outcard_list = {} end
p.outcard_list[#p.outcard_list + 1] = card p.outcard_list[#p.outcard_list + 1] = card
@ -158,7 +162,8 @@ function M:OnEventSendCards(evt_data)
end end
p.card_list = handcards p.card_list = handcards
self._room.self_player.hand_left_count = #handcards self._room.self_player.hand_left_count = #handcards
table.sort(handcards, ViewUtil.HandCardSort)
table.sort(handcards, self.HandCardSortAndJing)
DispatchEvent(self._dispatcher, TX_GameEvent.SendCards, p) DispatchEvent(self._dispatcher, TX_GameEvent.SendCards, p)
end) end)
end end
@ -176,7 +181,8 @@ function M:OnEventOutCard(evt_data)
else else
if seat == _room.self_player.seat then if seat == _room.self_player.seat then
list_remove(p.card_list, card) list_remove(p.card_list, card)
table.sort(p.card_list, ViewUtil.HandCardSort)
table.sort(p.card_list, self.HandCardSortAndJing)
end end
p.hand_left_count = p.hand_left_count - 1 p.hand_left_count = p.hand_left_count - 1
if not p.outcard_list then p.outcard_list = {} end if not p.outcard_list then p.outcard_list = {} end
@ -196,7 +202,8 @@ function M:OnEventTakeCard(evt_data)
p.hand_left_count = p.hand_left_count + 1 p.hand_left_count = p.hand_left_count + 1
if (seat == _room.self_player.seat) then if (seat == _room.self_player.seat) then
_room.self_player.card_list[#_room.self_player.card_list + 1] = card _room.self_player.card_list[#_room.self_player.card_list + 1] = card
-- table.sort( _room.self_player.card_list, ViewUtil.HandCardSort )
-- table.sort( _room.self_player.card_list, self.HandCardSortAndJing )
end end
DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count) DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count)
end) end)
@ -312,7 +319,7 @@ function M:OnEventHu(evt_data)
self._cacheEvent:Enqueue(function() self._cacheEvent:Enqueue(function()
win_p.card_list = cards win_p.card_list = cards
table.sort(win_p.card_list, ViewUtil.HandCardSort) table.sort(win_p.card_list, self.HandCardSortAndJing)
DispatchEvent(self._dispatcher, TX_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards, DispatchEvent(self._dispatcher, TX_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards,
win_list) win_list)
end) end)
@ -414,4 +421,34 @@ function M:Discard(card)
_client:send(Protocol.Game_Da, _data) _client:send(Protocol.Game_Da, _data)
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M return M

View File

@ -12,7 +12,7 @@ function EXGameInfo.new(blur_view)
end end
function M:FillData() function M:FillData()
self._maxPlayer = 4 -- 默认玩家人数 self._maxPlayer = 4 -- 默认玩家人数
self._roundChoice = 3 -- 回合选项数 self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_LiChuan/Label_Detail_83") self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_LiChuan/Label_Detail_83")
@ -104,7 +104,7 @@ function M:SelectedConfigData()
local people = _config:GetController("peopleNum").selectedIndex + 2 local people = _config:GetController("peopleNum").selectedIndex + 2
local zimo = _config:GetController("ZiMo").selectedIndex local zimo = _config:GetController("ZiMo").selectedIndex
local jingbibo = _config:GetController("jingbibo").selectedIndex local jingbibo = 1 - _config:GetController("jingbibo").selectedIndex
local xi_pai = false local xi_pai = false
@ -175,9 +175,9 @@ end
function M:LoadConfigToDetail(data) function M:LoadConfigToDetail(data)
local configData = json.decode(data) local configData = json.decode(data)
local returnString = string.format("人数%s人,%s,%s,%s", configData.maxPlayers, local returnString = string.format("人数%s人,%s,%s,%s", configData.maxPlayers,
configData.zimo and "只能自摸" or "自摸可点炮", configData.zimo == 0 and "只能自摸" or "自摸可点炮",
configData.tuoguan and string.format("%d秒后自动托管", configData.tuoguan_active_time) or "不能托管", configData.tuoguan == 0 and string.format("%d秒后自动托管", configData.tuoguan_active_time) or "不能托管",
configData.jingbibo and "有精必博" or "有精可胡") configData.jingbibo == 1 and "有精必博" or "有精可胡")
return returnString return returnString
end end

View File

@ -660,10 +660,13 @@ function M:__FangziTip(tip, weight)
local info = self._player_card_info[1] local info = self._player_card_info[1]
local _chipeng_tip = info._view_FZTips local _chipeng_tip = info._view_FZTips
local _ctr_tips = info._ctr_tip local _ctr_tips = info._ctr_tip
printlog("__FangziTip1q")
local _lit_fanzi = _chipeng_tip:GetChild("list") local _lit_fanzi = _chipeng_tip:GetChild("list")
_lit_fanzi:SetVirtual() _lit_fanzi:SetVirtual()
local _tlist = tip.tip_map_id local _tlist = tip.tip_map_id
printlog("__FangziTip1")
_lit_fanzi.itemRenderer = function(index, obj) _lit_fanzi.itemRenderer = function(index, obj)
local type = obj:GetController('type') local type = obj:GetController('type')
if index == tip.tip_num then if index == tip.tip_num then
@ -712,6 +715,8 @@ function M:__FangziTip(tip, weight)
end) end)
end end
end end
printlog("__FangziTip2")
_ctr_tips.selectedIndex = 1 _ctr_tips.selectedIndex = 1
_lit_fanzi.numItems = tip.tip_num + 1 _lit_fanzi.numItems = tip.tip_num + 1
end end

View File

@ -59,7 +59,7 @@ function M:FillRoomData(data)
local p = room.player_list[i] local p = room.player_list[i]
local card_info = _player_card_info[self:GetPos(p.seat)] local card_info = _player_card_info[self:GetPos(p.seat)]
card_info:Clear() card_info:Clear()
table.sort(p.card_list, ViewUtil.HandCardSort) table.sort(p.card_list, self.HandCardSortAndJing)
card_info:UpdateHandCard(false, true) card_info:UpdateHandCard(false, true)
self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0
end end
@ -206,7 +206,7 @@ function M:CmdOutCard(cmd, index)
data.last_out_seat = cmd.seat data.last_out_seat = cmd.seat
local u = data.player_card_data[cmd.seat] local u = data.player_card_data[cmd.seat]
list_remove(u.card_list, cmd.data.card) list_remove(u.card_list, cmd.data.card)
table.sort(u.card_list, ViewUtil.HandCardSort) table.sort(u.card_list, self.HandCardSortAndJing)
u.outcard_list[#u.outcard_list + 1] = cmd.data.card u.outcard_list[#u.outcard_list + 1] = cmd.data.card
end end
@ -294,4 +294,34 @@ function M:UpdateStep(step)
self._record:GetChild("tex_step").text = "" .. step .. " / " .. #self._step .. "" self._record:GetChild("tex_step").text = "" .. step .. " / " .. #self._step .. ""
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M return M

View File

@ -81,7 +81,7 @@ function M:FillRoomData(s2croom)
local _reloadInfo = s2croom["reloadInfo"] local _reloadInfo = s2croom["reloadInfo"]
local _hand_card = _reloadInfo["hand_card"] local _hand_card = _reloadInfo["hand_card"]
room.self_player.card_list = _hand_card room.self_player.card_list = _hand_card
table.sort(_hand_card, ViewUtil.HandCardSort) table.sort(_hand_card, self.HandCardSortAndJing)
local active_seat = _reloadInfo["active_seat"] local active_seat = _reloadInfo["active_seat"]
local bank_seat = _reloadInfo["banker_seat"] local bank_seat = _reloadInfo["banker_seat"]
@ -162,7 +162,7 @@ function M:FillPlayBackData(pd_data)
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]
p.card_list = _hand_card p.card_list = _hand_card
--room.self_player.card_list = _hand_card --room.self_player.card_list = _hand_card
table.sort(_hand_card, ViewUtil.HandCardSort) table.sort(_hand_card, self.HandCardSortAndJing)
p.total_score = _jp["score"] p.total_score = _jp["score"]
p.hand_left_count = #_hand_card p.hand_left_count = #_hand_card
if _jp.hp_info then if _jp.hp_info then
@ -175,4 +175,34 @@ function M:FillPlayBackData(pd_data)
room.cmdList = pd_data["cmdList"] room.cmdList = pd_data["cmdList"]
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M return M

View File

@ -183,7 +183,7 @@ function M:fillResult0(room, peopleNum, result)
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
local handCardList = handCardItem:GetChild("list") local handCardList = handCardItem:GetChild("list")
--手牌排序 --手牌排序
table.sort(infoList.hand_card, ViewUtil.HandCardSort) table.sort(infoList.hand_card, self.HandCardSortAndJing)
handCardList:SetVirtual() handCardList:SetVirtual()
handCardList.itemRenderer = function(index, obj) handCardList.itemRenderer = function(index, obj)
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(),
@ -286,6 +286,36 @@ function M:fillHead(url, view)
ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject)
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
local prefix local prefix
function M:GetPrefix() function M:GetPrefix()
-- if not prefix then -- if not prefix then

View File

@ -72,7 +72,10 @@ function M:SendOutCard(card, callback)
local p = _room.self_player local p = _room.self_player
_room.curren_outcard_seat = -1 _room.curren_outcard_seat = -1
list_remove(p.card_list, card) list_remove(p.card_list, card)
table.sort(p.card_list, ViewUtil.HandCardSort)
table.sort(p.card_list, self.HandCardSortAndJing)
p.hand_left_count = p.hand_left_count - 1 p.hand_left_count = p.hand_left_count - 1
if not p.outcard_list then p.outcard_list = {} end if not p.outcard_list then p.outcard_list = {} end
p.outcard_list[#p.outcard_list + 1] = card p.outcard_list[#p.outcard_list + 1] = card
@ -158,7 +161,8 @@ function M:OnEventSendCards(evt_data)
end end
p.card_list = handcards p.card_list = handcards
self._room.self_player.hand_left_count = #handcards self._room.self_player.hand_left_count = #handcards
table.sort(handcards, ViewUtil.HandCardSort)
table.sort(handcards, self.HandCardSortAndJing)
DispatchEvent(self._dispatcher, TX_GameEvent.SendCards, p) DispatchEvent(self._dispatcher, TX_GameEvent.SendCards, p)
end) end)
end end
@ -176,7 +180,8 @@ function M:OnEventOutCard(evt_data)
else else
if seat == _room.self_player.seat then if seat == _room.self_player.seat then
list_remove(p.card_list, card) list_remove(p.card_list, card)
table.sort(p.card_list, ViewUtil.HandCardSort)
table.sort(p.card_list, self.HandCardSortAndJing)
end end
p.hand_left_count = p.hand_left_count - 1 p.hand_left_count = p.hand_left_count - 1
if not p.outcard_list then p.outcard_list = {} end if not p.outcard_list then p.outcard_list = {} end
@ -196,7 +201,8 @@ function M:OnEventTakeCard(evt_data)
p.hand_left_count = p.hand_left_count + 1 p.hand_left_count = p.hand_left_count + 1
if (seat == _room.self_player.seat) then if (seat == _room.self_player.seat) then
_room.self_player.card_list[#_room.self_player.card_list + 1] = card _room.self_player.card_list[#_room.self_player.card_list + 1] = card
-- table.sort( _room.self_player.card_list, ViewUtil.HandCardSort )
-- table.sort( _room.self_player.card_list, self.HandCardSortAndJing )
end end
DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count) DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count)
end) end)
@ -312,7 +318,7 @@ function M:OnEventHu(evt_data)
self._cacheEvent:Enqueue(function() self._cacheEvent:Enqueue(function()
win_p.card_list = cards win_p.card_list = cards
table.sort(win_p.card_list, ViewUtil.HandCardSort) table.sort(win_p.card_list, self.HandCardSortAndJing)
DispatchEvent(self._dispatcher, TX_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards, DispatchEvent(self._dispatcher, TX_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards,
win_list) win_list)
end) end)
@ -414,4 +420,34 @@ function M:Discard(card)
_client:send(Protocol.Game_Da, _data) _client:send(Protocol.Game_Da, _data)
end end
function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M return M

View File

@ -268,6 +268,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self._viewText_testName.text = 0
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self:ShowJing() self:ShowJing()

View File

@ -7,23 +7,22 @@ local Record_Event = import(".RecordEvent")
local M = {} local M = {}
--- Create a new --- Create a new
function M.new() function M.new()
setmetatable(M,{__index = MJPlayBackView}) setmetatable(M, { __index = MJPlayBackView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayBackView" self.class = "PlayBackView"
self:init() self:init()
return self return self
end end
function M:InitView(url) function M:InitView(url)
local room = self._room local room = self._room
UIPackage.AddPackage("extend/majiang/nancheng/ui/Extend_MJ_NanCheng") UIPackage.AddPackage("extend/majiang/nancheng/ui/Extend_MJ_NanCheng")
MJPlayBackView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num) MJPlayBackView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num)
local _cardbox = self._view:GetChild("cardbox") local _cardbox = self._view:GetChild("cardbox")
--self._view:GetChild("panel_record"):GetChild("btn_LastStep").enabled = false --self._view:GetChild("panel_record"):GetChild("btn_LastStep").enabled = false
self._ctr_cardbox = _cardbox:GetController("c1") self._ctr_cardbox = _cardbox:GetController("c1")
self._tex_round = self._view:GetChild("tex_round") self._tex_round = self._view:GetChild("tex_round")
self._tex_LeftCard = self._view:GetChild("remaining_card") self._tex_LeftCard = self._view:GetChild("remaining_card")
@ -41,33 +40,33 @@ function M:InitView(url)
end end
function M:FillRoomData(data) function M:FillRoomData(data)
MJPlayBackView.FillRoomData(self) MJPlayBackView.FillRoomData(self)
if self._win_pic then self._win_pic:Dispose() end if self._win_pic then self._win_pic:Dispose() end
if self._niao then self._niao:Dispose() end if self._niao then self._niao:Dispose() end
self._currentStep = 0 self._currentStep = 0
local room = DataManager.CurrenRoom local room = DataManager.CurrenRoom
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
local left_count = data.info.left_card local left_count = data.info.left_card
self:UpdateLeftCard(left_count) self:UpdateLeftCard(left_count)
local round = data.info.round local round = data.info.round
self:UpdateRound(round) self:UpdateRound(round)
local roominfo_panel = self._view:GetChild("roominfo_panel1")
roominfo_panel:GetChild("tex_roomid").text = room.room_id
roominfo_panel:GetChild("tex_gametype").text = room.room_config:GetGameName()
for i = 1, #room.player_list do local roominfo_panel = self._view:GetChild("roominfo_panel1")
local p = room.player_list[i] roominfo_panel:GetChild("tex_roomid").text = room.room_id
local card_info = _player_card_info[self:GetPos(p.seat)] roominfo_panel:GetChild("tex_gametype").text = room.room_config:GetGameName()
card_info:Clear()
table.sort(p.card_list, ViewUtil.HandCardSort)
card_info:UpdateHandCard(false, true)
self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0
end
self:GenerateAllStepData(data) for i = 1, #room.player_list do
self:UpdateStep(1) local p = room.player_list[i]
-- self:ShowStep(0) local card_info = _player_card_info[self:GetPos(p.seat)]
card_info:Clear()
table.sort(p.card_list, self.HandCardSortAndJing)
card_info:UpdateHandCard(false, true)
self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0
end
self:GenerateAllStepData(data)
self:UpdateStep(1)
-- self:ShowStep(0)
end end
function M:ShowStep(index) function M:ShowStep(index)
@ -94,7 +93,7 @@ function M:ShowStep(index)
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
head_info._view:GetController("piao_niao").selectedIndex = 1 head_info._view:GetController("piao_niao").selectedIndex = 1
else else
head_info._view:GetController("piao_niao").selectedIndex = 0 head_info._view:GetController("piao_niao").selectedIndex = 0
end end
if step.cmd == Record_Event.Evt_OutCard and i == step.last_out_seat then if step.cmd == Record_Event.Evt_OutCard and i == step.last_out_seat then
local card = p.outcard_list[#p.outcard_list] local card = p.outcard_list[#p.outcard_list]
@ -102,7 +101,7 @@ function M:ShowStep(index)
else else
info:UpdateOutCardList() info:UpdateOutCardList()
end 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 then
info:UpdateHandCard(true, true) info:UpdateHandCard(true, true)
else else
info:UpdateHandCard(false, true) info:UpdateHandCard(false, true)
@ -125,7 +124,7 @@ function M:ShowStep(index)
list:RemoveChildrenToPool() list:RemoveChildrenToPool()
for i = 1, #niao_list do for i = 1, #niao_list do
local item = list:AddItemFromPool() local item = list:AddItemFromPool()
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..niao_list[i].card) item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. niao_list[i].card)
if niao_list[i].score > 0 then if niao_list[i].score > 0 then
item:GetController("bg").selectedIndex = 2 item:GetController("bg").selectedIndex = 2
end end
@ -192,7 +191,7 @@ function M:GenerateAllStepData(data)
end end
end end
function M:CmdGetCard(cmd, index) function M:CmdGetCard(cmd, index)
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.current_out_seat = cmd.seat data.current_out_seat = cmd.seat
@ -207,7 +206,7 @@ function M:CmdOutCard(cmd, index)
data.last_out_seat = cmd.seat data.last_out_seat = cmd.seat
local u = data.player_card_data[cmd.seat] local u = data.player_card_data[cmd.seat]
list_remove(u.card_list, cmd.data.card) list_remove(u.card_list, cmd.data.card)
table.sort(u.card_list, ViewUtil.HandCardSort) table.sort(u.card_list, self.HandCardSortAndJing)
u.outcard_list[#u.outcard_list + 1] = cmd.data.card u.outcard_list[#u.outcard_list + 1] = cmd.data.card
end end
@ -273,7 +272,7 @@ function M:CopyLastStep(index)
end end
function M:UpdateLeftCard(num) function M:UpdateLeftCard(num)
self._tex_LeftCard.text = "剩余 "..num.." 张牌" self._tex_LeftCard.text = "剩余 " .. num .. " 张牌"
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)
@ -288,11 +287,41 @@ function M:UpdateCardBox(seat)
end end
function M:UpdateRound(round) function M:UpdateRound(round)
self._tex_round.text = ""..round.."/"..self._room.room_config.round.."" self._tex_round.text = "" .. round .. "/" .. self._room.room_config.round .. ""
end end
function M:UpdateStep(step) function M:UpdateStep(step)
self._record:GetChild("tex_step").text = "" .. step .. " / " .. #self._step .. "" self._record:GetChild("tex_step").text = "" .. step .. " / " .. #self._step .. ""
end end
return M function M.HandCardSortAndJing(a, b)
local jing = DataManager.CurrenRoom.jing
if a == jing or b == jing then
if a == b then
return a < b
end
return a == jing
else
if a < 200 then
a = a + 1000
elseif a < 300 then
a = a + 3000
elseif a < 400 then
a = a + 2000
else
a = a + 4000
end
if b < 200 then
b = b + 1000
elseif b < 300 then
b = b + 3000
elseif b < 400 then
b = b + 2000
else
b = b + 4000
end
return a < b
end
end
return M

View File

@ -20,6 +20,7 @@ local CardType = {
one = 1, one = 1,
long = 2, long = 2,
dui = 3, dui = 3,
duiLong = 10,
threeAndTwo = 4, threeAndTwo = 4,
normolPlant = 5, normolPlant = 5,
zha = 6, zha = 6,
@ -44,20 +45,22 @@ function M:InitFlag()
return self return self
end end
function M:InitLastCard(cardList) function M:InitLastCard(cardList, mustPutMaxCard)
self._flag_fristCard = false self._flag_fristCard = false
self:Clear()
self._flag_mustMax = mustPutMaxCard
self.type = 0
self.lastCardNum = #cardList
self._flag_allCards = false
self._flag_checkLst = true
if #cardList == 0 then if #cardList == 0 then
self._flag_fristCard = true self._flag_fristCard = true
return return
end end
self.lastCardNum = #cardList
table.sort(cardList) table.sort(cardList)
pt(cardList) pt(cardList)
self.lastMinCard = math.floor(cardList[1] / 10) self.lastMinCard = math.floor(cardList[1] / 10)
local temp_long = 0 local temp_long = 0
self:Clear()
self._flag_allCards = false
self._flag_checkLst = true
for i = 1, #cardList do for i = 1, #cardList do
local number = math.floor(cardList[i] / 10) local number = math.floor(cardList[i] / 10)
if self.cardList[number] then if self.cardList[number] then
@ -77,7 +80,6 @@ function M:InitLastCard(cardList)
end end
end end
self.long = temp_long == self.cardNum and self.cardNum >= 5 self.long = temp_long == self.cardNum and self.cardNum >= 5
self.type = -1
print("lingmengCheckAloneOrLong2") print("lingmengCheckAloneOrLong2")
if self:CheckAloneOrLong() then if self:CheckAloneOrLong() then
self.type = self:CheckAloneOrLong() self.type = self:CheckAloneOrLong()
@ -100,7 +102,7 @@ function M:InitLastCard(cardList)
self.type = self:CheckZha() self.type = self:CheckZha()
return return
end end
if self.type == -1 then if self.type == 0 then
ViewUtil.ErrorTip(-1, "上一份牌型判断错误") ViewUtil.ErrorTip(-1, "上一份牌型判断错误")
end end
end end
@ -160,6 +162,13 @@ function M:CheckCards()
if self.cardNum ~= 4 and self.cardNum ~= self.lastCardNum and not self._flag_fristCard then if self.cardNum ~= 4 and self.cardNum ~= self.lastCardNum and not self._flag_fristCard then
return return
end end
local flag_mustZha = self.cardNum == 4 and self.lastCardNum ~= 4
if self.cardNum == 1 and self._flag_mustMax and self.maxCard ~= self.cardListSord[1] then
return
end
if self.cardNum == 0 then
return
end
print("lingmengCheckAloneOrLong") print("lingmengCheckAloneOrLong")
if self:CheckAloneOrLong() then if self:CheckAloneOrLong() then
@ -168,7 +177,7 @@ function M:CheckCards()
print("lingmengCheckDuiZi") print("lingmengCheckDuiZi")
if self:CheckDuiZi() then if self:CheckDuiZi() then
return true return true and not flag_mustZha
end end
print("lingmengCheckSanDai") print("lingmengCheckSanDai")
@ -185,18 +194,19 @@ function M:CheckCards()
end end
function M:CheckOutCard(cardList) function M:CheckOutCard(cardList)
print("lingmengCheckOutCard===============")
pt(cardList)
self.tipCardList = {} self.tipCardList = {}
self.touchCardSet = {} self.touchCardSet = {}
self.touchCardMao = {} self.touchCardMao = {}
local cardMap = {} local cardMap = {}
local cardSet = {} local cardSet = {}
local cardType,only,longLength = self:CheckOutCardGetType() local temp_long = 0
local temp_longList = {}
if cardType == 0 then local longList = {}
return local lastCard = -1
end
local flag_threeOrFour = false
for i = 1, #cardList do for i = 1, #cardList do
local number = math.floor(cardList[i].card_code_number / 10) local number = math.floor(cardList[i].card_code_number / 10)
if cardMap[number] then if cardMap[number] then
@ -209,39 +219,148 @@ function M:CheckOutCard(cardList)
table.insert(cardMap[number].cardList, cardList[i]) table.insert(cardMap[number].cardList, cardList[i])
table.insert(cardSet, number) table.insert(cardSet, number)
end end
if cardMap[number].value >= 3 then
flag_threeOrFour = true
end
if lastCard ~= number then
if lastCard - number ~= 1 then
if temp_long >= 5 then
table.insert(longList, temp_longList)
end
temp_long = 1
temp_longList = {}
else
temp_long = temp_long + 1
end
lastCard = number
table.insert(temp_longList, number)
end
end
if temp_long >= 4 then
table.insert(longList, temp_longList)
end end
table.sort(cardSet) table.sort(cardSet)
self.maxCard = cardSet[#cardSet]
local tipCardSet = self:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength) if self._flag_fristCard then
if self._flag_mustMax then
self:CheckOutCardGetMustMax(cardSet, cardMap, flag_threeOrFour, longList)
else
self:CheckOutCardGetFristTipList(cardSet, cardMap)
end
return
end
self:CheckOutCardSetTipList(tipCardSet,longLength,cardMap,cardType) local cardType, only, longLength = self:CheckOutCardGetType()
local tipCardSet = self:CheckOutCardGetTouchSet(cardSet, cardMap, cardType, longLength)
self:CheckOutCardSetTipList(tipCardSet, longLength, cardMap, cardType)
if cardType >= 3 and only == 0 then
self:CheckOutCardGetAllCardSetAndMap()
end
end
function M:CheckOutCardGetAllCardSetAndMap()
self.touchCardSet = {}
self.touchCardMao = {}
for i = 3, 15 do
table.insert(self.touchCardSet, i)
self.touchCardMao[i] = 1
end
end
function M:CheckOutCardGetFristTipList(cardSet, cardMap)
for i = 1, #cardSet do
local card = cardSet[i]
table.insert(self.touchCardSet, card)
self.touchCardMao[card] = 1
local temp = {}
table.insert(temp, cardMap[card].cardList[1])
table.insert(self.tipCardList, temp)
end
end
function M:CheckOutCardGetMustMax(cardSet, cardMap, flag_threeOrFour, longList)
if flag_threeOrFour then
for i = 3, 15 do
if cardMap[i] then
if i == cardSet[#cardSet] then
table.insert(self.touchCardSet, i)
self.touchCardMao[i] = 1
table.insert(self.tipCardList, cardMap[i].cardList)
elseif cardMap[i].value >= 2 then
table.insert(self.touchCardSet, i)
self.touchCardMao[i] = 1
table.insert(self.tipCardList, cardMap[i].cardList)
else
table.insert(self.touchCardSet, i)
self.touchCardMao[i] = 1
end
else
table.insert(self.touchCardSet, i)
self.touchCardMao[i] = 1
end
end
else
for i = 1, #cardSet do
local card = cardSet[i]
if i == #cardSet then
table.insert(self.touchCardSet, card)
self.touchCardMao[card] = 1
table.insert(self.tipCardList, cardMap[card].cardList)
elseif cardMap[card].value >= 2 then
table.insert(self.touchCardSet, card)
self.touchCardMao[card] = 1
table.insert(self.tipCardList, cardMap[card].cardList)
end
end
end
---单数顺另外添加到提示和现实
for i = 1, #longList do
local tempTipList = {}
for j = 1, #longList[i] do
local card = longList[i][j]
if not self.touchCardMao[card] then
table.insert(self.touchCardSet, card)
self.touchCardMao[card] = 1
end
table.insert(tempTipList, cardMap[card].cardList[1])
end
table.insert(self.tipCardList, tempTipList)
end
end end
function M:CheckOutCardGetType() function M:CheckOutCardGetType()
local cardType = 0 local cardType = 0
local only = 0 local only = 0
local longLength = 1 local longLength = 1
if self.type == 0 then
return cardType, only, longLength
end
if self.type == CardType.one or self.type == CardType.long then if self.type == CardType.one or self.type == CardType.long then
cardType = 1 cardType = 1
if self.type == CardType.long then if self.type == CardType.long then
longLength = self.lastCardNum longLength = self.lastCardNum
end end
elseif self.type == CardType.dui then elseif self.type == CardType.dui or self.type == CardType.duiLong then
cardType = 2 cardType = 2
if self.lastCardNum > 2 then if self.lastCardNum > 2 then
longLength = self.lastCardNum/2 longLength = self.lastCardNum / 2
end end
elseif self.type == CardType.threeAndTwo or self.type == CardType.onlyThree or self.type == CardType.normolPlant or self.type == CardType.onlyPlant then elseif self.type == CardType.threeAndTwo or self.type == CardType.onlyThree or self.type == CardType.normolPlant or self.type == CardType.onlyPlant then
cardType = 3 cardType = 3
if self.type == CardType.onlyThree or self.type == CardType.onlyPlant then if self.type == CardType.onlyThree or self.type == CardType.onlyPlant then
only = 1 only = 1
if self.type == CardType.onlyPlant then if self.type == CardType.onlyPlant then
longLength = self.lastCardNum/3 longLength = self.lastCardNum / 3
end end
end end
if self.type == CardType.normolPlant then if self.type == CardType.normolPlant then
longLength = self.lastCardNum/5 longLength = self.lastCardNum / 5
end end
elseif self.type == CardType.zha or self.type == CardType.zhaAndThreee then elseif self.type == CardType.zha or self.type == CardType.zhaAndThreee then
cardType = 4 cardType = 4
@ -249,11 +368,11 @@ function M:CheckOutCardGetType()
only = 1 only = 1
end end
end end
return cardType,only,longLength return cardType, only, longLength
end end
function M:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength) function M:CheckOutCardGetTouchSet(cardSet, cardMap, cardType, longLength)
print("lingmengCheckOutCardGetTouchSet",cardType,longLength,self.lastMinCard) print("lingmengCheckOutCardGetTouchSet", cardType, longLength, self.lastMinCard)
pt(cardSet) pt(cardSet)
pt(cardMap) pt(cardMap)
local tempLong = 0 local tempLong = 0
@ -262,7 +381,7 @@ function M:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength)
local tipCardSet = {} local tipCardSet = {}
for i = 1, #cardSet do for i = 1, #cardSet do
local card = cardSet[i] local card = cardSet[i]
if (cardMap[card].value >= cardType or cardMap[card].value == 4) and card > self.lastMinCard then if cardMap[card].value >= cardType and card > self.lastMinCard then
if tempLong == 0 then if tempLong == 0 then
tempLong = 1 tempLong = 1
else else
@ -270,57 +389,66 @@ function M:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength)
tempLong = tempLong + 1 tempLong = tempLong + 1
else else
if tempLong >= longLength then if tempLong >= longLength then
for j = 1,tempLong do for j = 1, tempLong do
table.insert(self.touchCardSet,tempCardSet[j]) table.insert(self.touchCardSet, tempCardSet[j])
self.touchCardMao[tempCardSet[j]] = 1 self.touchCardMao[tempCardSet[j]] = 1
end end
end end
table.insert(tipCardSet,tempCardSet) table.insert(tipCardSet, tempCardSet)
tempLong = 1 tempLong = 1
tempCardSet = {} tempCardSet = {}
end end
end end
table.insert(tempCardSet,card) table.insert(tempCardSet, card)
lastCard = card lastCard = card
end end
if cardMap[card].value == 4 then
table.insert(self.touchCardSet, card)
self.touchCardMao[card] = 1
table.insert(tipCardSet, card)
end
end end
if tempLong >= longLength then if tempLong >= longLength then
for j = 1,tempLong do for j = 1, tempLong do
table.insert(self.touchCardSet,tempCardSet[j]) table.insert(self.touchCardSet, tempCardSet[j])
self.touchCardMao[tempCardSet[j]] = 1 self.touchCardMao[tempCardSet[j]] = 1
end end
end end
table.insert(tipCardSet,tempCardSet) table.insert(tipCardSet, tempCardSet)
return tipCardSet return tipCardSet
end end
function M:CheckOutCardSetTipList(tipCardSet,longLength,cardMap,cardType) function M:CheckOutCardSetTipList(tipCardSet, longLength, cardMap, cardType)
print("lingmengCheckOutCardSetTipList",longLength,cardMap,cardType) print("lingmengCheckOutCardSetTipList", longLength, cardMap, cardType)
pt(tipCardSet) pt(tipCardSet)
for i = 1, #tipCardSet do for i = 1, #tipCardSet do
local tipCardSetLen = #tipCardSet[i] if type(tipCardSet[i]) == 'number' then
if tipCardSetLen == longLength then table.insert(self.tipCardList, cardMap[tipCardSet[i]].cardList)
local tempList = {}
for j = 1, tipCardSetLen do
local card = tipCardSet[i][j]
local minNum = Mathf.Min(cardMap[card].value,cardType)
for k = 1 , minNum do
table.insert(tempList,cardMap[card].cardList[k])
end
end
table.insert(self.tipCardList,tempList)
else else
for j = 1, tipCardSetLen do local tipCardSetLen = #tipCardSet[i]
if j + longLength <= tipCardSetLen then if tipCardSetLen == longLength then
local tempList = {} local tempList = {}
for k = j,j + longLength do for j = 1, tipCardSetLen do
local card = tipCardSet[i][k] local card = tipCardSet[i][j]
local minNum = Mathf.Min(cardMap[card].value,cardType) local minNum = Mathf.Min(cardMap[card].value, cardType)
for l = 1 , minNum do for k = 1, minNum do
table.insert(tempList,cardMap[card].cardList[l]) table.insert(tempList, cardMap[card].cardList[k])
end end
end
table.insert(self.tipCardList, tempList)
else
for j = 1, tipCardSetLen do
if j + longLength - 1 <= tipCardSetLen then
local tempList = {}
for k = j, j + longLength - 1 do
local card = tipCardSet[i][k]
local minNum = Mathf.Min(cardMap[card].value, cardType)
for l = 1, minNum do
table.insert(tempList, cardMap[card].cardList[l])
end
end
table.insert(self.tipCardList, tempList)
end end
table.insert(self.tipCardList,tempList)
end end
end end
end end
@ -340,7 +468,7 @@ function M:CheckDuiZi()
if self.cardNum == 2 and self.cardSize == 1 and M:CheckType(CardType.dui) then if self.cardNum == 2 and self.cardSize == 1 and M:CheckType(CardType.dui) then
return CardType.dui return CardType.dui
end end
if self.cardNum % 2 == 0 and M:CheckType(CardType.dui) then if self.cardNum % 2 == 0 and M:CheckType(CardType.duiLong) then
local last_k local last_k
for i = 1, self.cardSize do for i = 1, self.cardSize do
local k = self.cardListSord[i] local k = self.cardListSord[i]
@ -358,7 +486,7 @@ function M:CheckDuiZi()
return return
end end
end end
return CardType.dui return CardType.duiLong
end end
end end
@ -478,10 +606,10 @@ function M:CheckZha()
local k = self.cardListSord[i] local k = self.cardListSord[i]
local v = self.cardList[k] local v = self.cardList[k]
if v == 4 then if v == 4 then
return true return CardType.zhaAndThreee
end end
end end
return CardType.zhaAndThreee return
end end
end end

View File

@ -338,7 +338,8 @@ function M:FillPoker(poker, prefix, num, code)
if num ~= nil then if num ~= nil then
code = self:ChangeCodeByTo(num) code = self:ChangeCodeByTo(num)
end end
local suffix = code == 310 and (DataManager.CurrenRoom.pai == 0 and "_1" or "_2") or "" local suffix = code == 310 and
(DataManager.CurrenRoom.pai == 0 and (DataManager.CurrenRoom.room_config.Heart10 == 2 and "_1" or "") or "_2") or ""
code = code == 1 and "00" or code code = code == 1 and "00" or code
if not poker.icon then if not poker.icon then
poker:GetChild('icon').url = string.format("ui://Extend_Poker_RunFastNew/%s%s%s", prefix, code, suffix) poker:GetChild('icon').url = string.format("ui://Extend_Poker_RunFastNew/%s%s%s", prefix, code, suffix)

View File

@ -779,7 +779,7 @@ function M:HidePiao()
end end
function M:ShowOutCardOption2(lastCardList,ctr_select,mustPutMaxCard) function M:ShowOutCardOption2(lastCardList,ctr_select,mustPutMaxCard)
self._cardCheck:InitLastCard(lastCardList) self._cardCheck:InitLastCard(lastCardList,mustPutMaxCard)
self._cardCheck:CheckOutCard(self.card_list) self._cardCheck:CheckOutCard(self.card_list)
self.tips_card_list = self._cardCheck:GetTipsList() self.tips_card_list = self._cardCheck:GetTipsList()
self.touchCardSet = self._cardCheck:GetTouchSet() self.touchCardSet = self._cardCheck:GetTouchSet()
@ -788,10 +788,8 @@ function M:ShowOutCardOption2(lastCardList,ctr_select,mustPutMaxCard)
print("lingmengShowOutCardOption2",#self.touchCardSet ) print("lingmengShowOutCardOption2",#self.touchCardSet )
pt( self.touchCardSet ) pt( self.touchCardSet )
pt(self.touchCardMap) pt(self.touchCardMap)
if #self.touchCardSet >= 1 then
-- body --在这个方法里添加判断抬起牌是否符合出牌类型(少跑一次手牌循环) -- body --在这个方法里添加判断抬起牌是否符合出牌类型(少跑一次手牌循环)
self:UpdateHandCardsColor() self:UpdateHandCardsColor()
end
if #self.tips_card_list == 1 then if #self.tips_card_list == 1 then
self:ShowTipsCard(1) self:ShowTipsCard(1)
@ -1076,7 +1074,7 @@ function M:UpdateHandCardsColor()
local send_card = {} local send_card = {}
for i = 1, #self.card_list do for i = 1, #self.card_list do
local card_view = self.card_list[i] local card_view = self.card_list[i]
if self.touchCardMap[math.floor(card_view.card_code_number / 10)] then if self.touchCardMap[math.floor(card_view.card_code_number / 10)] or #self.touchCardSet == 0 then
card_view.btn_card.touchable = true card_view.btn_card.touchable = true
self:SetBtnCardColor(card_view, 0) self:SetBtnCardColor(card_view, 0)
else else
@ -1188,7 +1186,7 @@ function M:ShowTipsCard(index)
end end
end end
pt(item) pt(item)
self._cardCheck:InitFlag(item) self._cardCheck:initCards(item)
self._ctr_canSendCard.selectedIndex = self._cardCheck:CheckCards() and 1 or 0 self._ctr_canSendCard.selectedIndex = self._cardCheck:CheckCards() and 1 or 0
end end

View File

@ -327,7 +327,7 @@ end
function M:Clear() function M:Clear()
MJPlayerCardInfoView.Clear(self) MJPlayerCardInfoView.Clear(self)
self._view_FZTips:RemoveChildren(0, -1, true) -- self._view_FZTips:RemoveChildren(0, -1, true)
self._ctr_seletedGet.selectedIndex = 1 self._ctr_seletedGet.selectedIndex = 1
self._ctr_tip.selectedIndex = 0 self._ctr_tip.selectedIndex = 0