新git地址同步
parent
8729b34381
commit
7edfac1243
|
|
@ -319,7 +319,7 @@ function ViewUtil.ShowOneChooose(showText, btnType, callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function ViewUtil.ShowTwoChooose(showText, leftCallback,rightCallback)
|
||||
function ViewUtil.ShowTwoChooose(showText, leftCallback, rightCallback)
|
||||
local pop_twoChoose = UIPackage.CreateObjectFromURL("ui://Common/pop_twoChoose")
|
||||
pop_twoChoose:GetChild('text_show').text = showText
|
||||
GRoot.inst:AddChild(pop_twoChoose)
|
||||
|
|
@ -364,6 +364,5 @@ function ViewUtil.ShowOneInput(showText, callback)
|
|||
local btn_center = pop_oneInput:GetChild('btn_close')
|
||||
btn_center.onClick:Add(function()
|
||||
GRoot.inst:RemoveChild(pop_oneInput)
|
||||
|
||||
end)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -182,12 +182,11 @@ function M:fillResult0(room, peopleNum, result)
|
|||
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
|
||||
local handCardList = handCardItem:GetChild("list")
|
||||
--手牌排序
|
||||
table.sort(infoList.hand_card, ViewUtil.HandCardSort)
|
||||
table.sort(infoList.hand_card, self.HandCardSortAndJing)
|
||||
handCardList:SetVirtual()
|
||||
handCardList.itemRenderer = function(index, obj)
|
||||
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
|
||||
ViewUtil:ErrorTip("显示精")
|
||||
obj:GetController('jing').selectedIndex = 1
|
||||
end
|
||||
end
|
||||
|
|
@ -199,7 +198,6 @@ function M:fillResult0(room, peopleNum, result)
|
|||
end
|
||||
|
||||
if infoList.seat == room.banker_seat then
|
||||
ViewUtil:ErrorTip("显示庄家")
|
||||
isZhuang.selectedIndex = 1
|
||||
end
|
||||
|
||||
|
|
@ -215,7 +213,11 @@ function M:fillResult0(room, peopleNum, result)
|
|||
ziMoCtr.selectedIndex = 1
|
||||
end
|
||||
|
||||
|
||||
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
|
||||
|
||||
jiangMaList.visible = true
|
||||
|
|
@ -286,6 +288,36 @@ function M:fillHead(url, view)
|
|||
ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject)
|
||||
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
|
||||
function M:GetPrefix()
|
||||
-- if not prefix then
|
||||
|
|
|
|||
|
|
@ -72,7 +72,10 @@ function M:SendOutCard(card, callback)
|
|||
local p = _room.self_player
|
||||
_room.curren_outcard_seat = -1
|
||||
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
|
||||
if not p.outcard_list then p.outcard_list = {} end
|
||||
p.outcard_list[#p.outcard_list + 1] = card
|
||||
|
|
@ -158,7 +161,8 @@ function M:OnEventSendCards(evt_data)
|
|||
end
|
||||
p.card_list = 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)
|
||||
end)
|
||||
end
|
||||
|
|
@ -176,7 +180,8 @@ function M:OnEventOutCard(evt_data)
|
|||
else
|
||||
if seat == _room.self_player.seat then
|
||||
list_remove(p.card_list, card)
|
||||
table.sort(p.card_list, ViewUtil.HandCardSort)
|
||||
|
||||
table.sort(p.card_list, self.HandCardSortAndJing)
|
||||
end
|
||||
p.hand_left_count = p.hand_left_count - 1
|
||||
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
|
||||
if (seat == _room.self_player.seat) then
|
||||
_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
|
||||
DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count)
|
||||
end)
|
||||
|
|
@ -275,11 +281,11 @@ function M:OnEventFzAction(evt_data)
|
|||
fz.active_card = actice_card
|
||||
if (index == -1) then
|
||||
if (ftype == FZType.Chi) then
|
||||
local data = {}
|
||||
data[1] = opcard[1]
|
||||
data[2] = card
|
||||
data[3] = opcard[2]
|
||||
fz.opcard = data
|
||||
local data = {}
|
||||
data[1] = opcard[1]
|
||||
data[2] = card
|
||||
data[3] = opcard[2]
|
||||
fz.opcard = data
|
||||
end
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
|
|
@ -312,7 +318,7 @@ function M:OnEventHu(evt_data)
|
|||
|
||||
self._cacheEvent:Enqueue(function()
|
||||
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,
|
||||
win_list)
|
||||
end)
|
||||
|
|
@ -414,4 +420,34 @@ function M:Discard(card)
|
|||
_client:send(Protocol.Game_Da, _data)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ function M:EventInit()
|
|||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self._viewText_testName.text = 0
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
self:ShowJing()
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function M:FillRoomData(data)
|
|||
local p = room.player_list[i]
|
||||
local card_info = _player_card_info[self:GetPos(p.seat)]
|
||||
card_info:Clear()
|
||||
table.sort(p.card_list, ViewUtil.HandCardSort)
|
||||
table.sort(p.card_list, self.HandCardSortAndJing)
|
||||
card_info:UpdateHandCard(false, true)
|
||||
self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0
|
||||
end
|
||||
|
|
@ -206,7 +206,7 @@ function M:CmdOutCard(cmd, index)
|
|||
data.last_out_seat = cmd.seat
|
||||
local u = data.player_card_data[cmd.seat]
|
||||
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
|
||||
end
|
||||
|
||||
|
|
@ -294,4 +294,34 @@ function M:UpdateStep(step)
|
|||
self._record:GetChild("tex_step").text = "第 " .. step .. " / " .. #self._step .. "步"
|
||||
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
|
||||
|
|
|
|||
|
|
@ -182,12 +182,11 @@ function M:fillResult0(room, peopleNum, result)
|
|||
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
|
||||
local handCardList = handCardItem:GetChild("list")
|
||||
--手牌排序
|
||||
table.sort(infoList.hand_card, ViewUtil.HandCardSort)
|
||||
table.sort(infoList.hand_card, self.HandCardSortAndJing)
|
||||
handCardList:SetVirtual()
|
||||
handCardList.itemRenderer = function(index, obj)
|
||||
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
|
||||
ViewUtil:ErrorTip("显示精")
|
||||
obj:GetController('jing').selectedIndex = 1
|
||||
end
|
||||
end
|
||||
|
|
@ -199,7 +198,6 @@ function M:fillResult0(room, peopleNum, result)
|
|||
end
|
||||
|
||||
if infoList.seat == room.banker_seat then
|
||||
ViewUtil:ErrorTip("显示庄家")
|
||||
isZhuang.selectedIndex = 1
|
||||
end
|
||||
|
||||
|
|
@ -286,6 +284,36 @@ function M:fillHead(url, view)
|
|||
ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject)
|
||||
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
|
||||
function M:GetPrefix()
|
||||
-- if not prefix then
|
||||
|
|
|
|||
|
|
@ -72,7 +72,10 @@ function M:SendOutCard(card, callback)
|
|||
local p = _room.self_player
|
||||
_room.curren_outcard_seat = -1
|
||||
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
|
||||
if not p.outcard_list then p.outcard_list = {} end
|
||||
p.outcard_list[#p.outcard_list + 1] = card
|
||||
|
|
@ -158,7 +161,8 @@ function M:OnEventSendCards(evt_data)
|
|||
end
|
||||
p.card_list = 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)
|
||||
end)
|
||||
end
|
||||
|
|
@ -176,7 +180,8 @@ function M:OnEventOutCard(evt_data)
|
|||
else
|
||||
if seat == _room.self_player.seat then
|
||||
list_remove(p.card_list, card)
|
||||
table.sort(p.card_list, ViewUtil.HandCardSort)
|
||||
|
||||
table.sort(p.card_list, self.HandCardSortAndJing)
|
||||
end
|
||||
p.hand_left_count = p.hand_left_count - 1
|
||||
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
|
||||
if (seat == _room.self_player.seat) then
|
||||
_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
|
||||
DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count)
|
||||
end)
|
||||
|
|
@ -312,7 +318,7 @@ function M:OnEventHu(evt_data)
|
|||
|
||||
self._cacheEvent:Enqueue(function()
|
||||
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,
|
||||
win_list)
|
||||
end)
|
||||
|
|
@ -414,4 +420,34 @@ function M:Discard(card)
|
|||
_client:send(Protocol.Game_Da, _data)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ function M:EventInit()
|
|||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self._viewText_testName.text = 0
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
self:ShowJing()
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function M:FillRoomData(data)
|
|||
local p = room.player_list[i]
|
||||
local card_info = _player_card_info[self:GetPos(p.seat)]
|
||||
card_info:Clear()
|
||||
table.sort(p.card_list, ViewUtil.HandCardSort)
|
||||
table.sort(p.card_list, self.HandCardSortAndJing)
|
||||
card_info:UpdateHandCard(false, true)
|
||||
self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0
|
||||
end
|
||||
|
|
@ -206,7 +206,7 @@ function M:CmdOutCard(cmd, index)
|
|||
data.last_out_seat = cmd.seat
|
||||
local u = data.player_card_data[cmd.seat]
|
||||
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
|
||||
end
|
||||
|
||||
|
|
@ -294,4 +294,34 @@ function M:UpdateStep(step)
|
|||
self._record:GetChild("tex_step").text = "第 " .. step .. " / " .. #self._step .. "步"
|
||||
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
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ function M:fillResult0(room, peopleNum, result)
|
|||
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
|
||||
local handCardList = handCardItem:GetChild("list")
|
||||
--手牌排序
|
||||
table.sort(infoList.hand_card, ViewUtil.HandCardSort)
|
||||
table.sort(infoList.hand_card, self.HandCardSortAndJing)
|
||||
handCardList:SetVirtual()
|
||||
handCardList.itemRenderer = function(index, obj)
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
jiangMaList.visible = true
|
||||
|
|
@ -284,6 +287,36 @@ function M:fillHead(url, view)
|
|||
ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject)
|
||||
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
|
||||
function M:GetPrefix()
|
||||
-- if not prefix then
|
||||
|
|
|
|||
|
|
@ -72,7 +72,11 @@ function M:SendOutCard(card, callback)
|
|||
local p = _room.self_player
|
||||
_room.curren_outcard_seat = -1
|
||||
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
|
||||
if not p.outcard_list then p.outcard_list = {} end
|
||||
p.outcard_list[#p.outcard_list + 1] = card
|
||||
|
|
@ -158,7 +162,8 @@ function M:OnEventSendCards(evt_data)
|
|||
end
|
||||
p.card_list = 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)
|
||||
end)
|
||||
end
|
||||
|
|
@ -176,7 +181,8 @@ function M:OnEventOutCard(evt_data)
|
|||
else
|
||||
if seat == _room.self_player.seat then
|
||||
list_remove(p.card_list, card)
|
||||
table.sort(p.card_list, ViewUtil.HandCardSort)
|
||||
|
||||
table.sort(p.card_list, self.HandCardSortAndJing)
|
||||
end
|
||||
p.hand_left_count = p.hand_left_count - 1
|
||||
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
|
||||
if (seat == _room.self_player.seat) then
|
||||
_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
|
||||
DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count)
|
||||
end)
|
||||
|
|
@ -312,7 +319,7 @@ function M:OnEventHu(evt_data)
|
|||
|
||||
self._cacheEvent:Enqueue(function()
|
||||
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,
|
||||
win_list)
|
||||
end)
|
||||
|
|
@ -414,4 +421,34 @@ function M:Discard(card)
|
|||
_client:send(Protocol.Game_Da, _data)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ function EXGameInfo.new(blur_view)
|
|||
end
|
||||
|
||||
function M:FillData()
|
||||
self._maxPlayer = 4 -- 默认玩家人数
|
||||
self._maxPlayer = 4 -- 默认玩家人数
|
||||
self._roundChoice = 3 -- 回合选项数
|
||||
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 zimo = _config:GetController("ZiMo").selectedIndex
|
||||
local jingbibo = _config:GetController("jingbibo").selectedIndex
|
||||
local jingbibo = 1 - _config:GetController("jingbibo").selectedIndex
|
||||
|
||||
|
||||
local xi_pai = false
|
||||
|
|
@ -175,9 +175,9 @@ end
|
|||
function M:LoadConfigToDetail(data)
|
||||
local configData = json.decode(data)
|
||||
local returnString = string.format("人数%s人,%s,%s,%s", configData.maxPlayers,
|
||||
configData.zimo and "只能自摸" or "自摸可点炮",
|
||||
configData.tuoguan and string.format("%d秒后自动托管", configData.tuoguan_active_time) or "不能托管",
|
||||
configData.jingbibo and "有精必博" or "有精可胡")
|
||||
configData.zimo == 0 and "只能自摸" or "自摸可点炮",
|
||||
configData.tuoguan == 0 and string.format("%d秒后自动托管", configData.tuoguan_active_time) or "不能托管",
|
||||
configData.jingbibo == 1 and "有精必博" or "有精可胡")
|
||||
return returnString
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -660,10 +660,13 @@ function M:__FangziTip(tip, weight)
|
|||
local info = self._player_card_info[1]
|
||||
local _chipeng_tip = info._view_FZTips
|
||||
local _ctr_tips = info._ctr_tip
|
||||
printlog("__FangziTip1q")
|
||||
|
||||
local _lit_fanzi = _chipeng_tip:GetChild("list")
|
||||
_lit_fanzi:SetVirtual()
|
||||
local _tlist = tip.tip_map_id
|
||||
printlog("__FangziTip1")
|
||||
|
||||
_lit_fanzi.itemRenderer = function(index, obj)
|
||||
local type = obj:GetController('type')
|
||||
if index == tip.tip_num then
|
||||
|
|
@ -712,6 +715,8 @@ function M:__FangziTip(tip, weight)
|
|||
end)
|
||||
end
|
||||
end
|
||||
printlog("__FangziTip2")
|
||||
|
||||
_ctr_tips.selectedIndex = 1
|
||||
_lit_fanzi.numItems = tip.tip_num + 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function M:FillRoomData(data)
|
|||
local p = room.player_list[i]
|
||||
local card_info = _player_card_info[self:GetPos(p.seat)]
|
||||
card_info:Clear()
|
||||
table.sort(p.card_list, ViewUtil.HandCardSort)
|
||||
table.sort(p.card_list, self.HandCardSortAndJing)
|
||||
card_info:UpdateHandCard(false, true)
|
||||
self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0
|
||||
end
|
||||
|
|
@ -206,7 +206,7 @@ function M:CmdOutCard(cmd, index)
|
|||
data.last_out_seat = cmd.seat
|
||||
local u = data.player_card_data[cmd.seat]
|
||||
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
|
||||
end
|
||||
|
||||
|
|
@ -294,4 +294,34 @@ function M:UpdateStep(step)
|
|||
self._record:GetChild("tex_step").text = "第 " .. step .. " / " .. #self._step .. "步"
|
||||
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
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ function M:FillRoomData(s2croom)
|
|||
local _reloadInfo = s2croom["reloadInfo"]
|
||||
local _hand_card = _reloadInfo["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 bank_seat = _reloadInfo["banker_seat"]
|
||||
|
|
@ -162,7 +162,7 @@ function M:FillPlayBackData(pd_data)
|
|||
local _hand_card = _jp["hand_card"]
|
||||
p.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.hand_left_count = #_hand_card
|
||||
if _jp.hp_info then
|
||||
|
|
@ -175,4 +175,34 @@ function M:FillPlayBackData(pd_data)
|
|||
room.cmdList = pd_data["cmdList"]
|
||||
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
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ function M:fillResult0(room, peopleNum, result)
|
|||
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
|
||||
local handCardList = handCardItem:GetChild("list")
|
||||
--手牌排序
|
||||
table.sort(infoList.hand_card, ViewUtil.HandCardSort)
|
||||
table.sort(infoList.hand_card, self.HandCardSortAndJing)
|
||||
handCardList:SetVirtual()
|
||||
handCardList.itemRenderer = function(index, obj)
|
||||
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)
|
||||
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
|
||||
function M:GetPrefix()
|
||||
-- if not prefix then
|
||||
|
|
|
|||
|
|
@ -72,7 +72,10 @@ function M:SendOutCard(card, callback)
|
|||
local p = _room.self_player
|
||||
_room.curren_outcard_seat = -1
|
||||
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
|
||||
if not p.outcard_list then p.outcard_list = {} end
|
||||
p.outcard_list[#p.outcard_list + 1] = card
|
||||
|
|
@ -158,7 +161,8 @@ function M:OnEventSendCards(evt_data)
|
|||
end
|
||||
p.card_list = 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)
|
||||
end)
|
||||
end
|
||||
|
|
@ -176,7 +180,8 @@ function M:OnEventOutCard(evt_data)
|
|||
else
|
||||
if seat == _room.self_player.seat then
|
||||
list_remove(p.card_list, card)
|
||||
table.sort(p.card_list, ViewUtil.HandCardSort)
|
||||
|
||||
table.sort(p.card_list, self.HandCardSortAndJing)
|
||||
end
|
||||
p.hand_left_count = p.hand_left_count - 1
|
||||
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
|
||||
if (seat == _room.self_player.seat) then
|
||||
_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
|
||||
DispatchEvent(self._dispatcher, TX_GameEvent.GetCard, seat, card, left_count)
|
||||
end)
|
||||
|
|
@ -312,7 +318,7 @@ function M:OnEventHu(evt_data)
|
|||
|
||||
self._cacheEvent:Enqueue(function()
|
||||
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,
|
||||
win_list)
|
||||
end)
|
||||
|
|
@ -414,4 +420,34 @@ function M:Discard(card)
|
|||
_client:send(Protocol.Game_Da, _data)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -268,6 +268,7 @@ function M:EventInit()
|
|||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self._viewText_testName.text = 0
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
self:ShowJing()
|
||||
|
|
|
|||
|
|
@ -9,21 +9,20 @@ local M = {}
|
|||
|
||||
--- Create a new
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJPlayBackView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJPlayBackView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayBackView"
|
||||
self:init()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
function M:InitView(url)
|
||||
local room = self._room
|
||||
UIPackage.AddPackage("extend/majiang/nancheng/ui/Extend_MJ_NanCheng")
|
||||
MJPlayBackView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num)
|
||||
local _cardbox = self._view:GetChild("cardbox")
|
||||
--self._view:GetChild("panel_record"):GetChild("btn_LastStep").enabled = false
|
||||
local room = self._room
|
||||
UIPackage.AddPackage("extend/majiang/nancheng/ui/Extend_MJ_NanCheng")
|
||||
MJPlayBackView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num)
|
||||
local _cardbox = self._view:GetChild("cardbox")
|
||||
--self._view:GetChild("panel_record"):GetChild("btn_LastStep").enabled = false
|
||||
self._ctr_cardbox = _cardbox:GetController("c1")
|
||||
self._tex_round = self._view:GetChild("tex_round")
|
||||
self._tex_LeftCard = self._view:GetChild("remaining_card")
|
||||
|
|
@ -41,33 +40,33 @@ function M:InitView(url)
|
|||
end
|
||||
|
||||
function M:FillRoomData(data)
|
||||
MJPlayBackView.FillRoomData(self)
|
||||
if self._win_pic then self._win_pic:Dispose() end
|
||||
if self._niao then self._niao:Dispose() end
|
||||
self._currentStep = 0
|
||||
local room = DataManager.CurrenRoom
|
||||
local _player_card_info = self._player_card_info
|
||||
local left_count = data.info.left_card
|
||||
self:UpdateLeftCard(left_count)
|
||||
local round = data.info.round
|
||||
self:UpdateRound(round)
|
||||
MJPlayBackView.FillRoomData(self)
|
||||
if self._win_pic then self._win_pic:Dispose() end
|
||||
if self._niao then self._niao:Dispose() end
|
||||
self._currentStep = 0
|
||||
local room = DataManager.CurrenRoom
|
||||
local _player_card_info = self._player_card_info
|
||||
local left_count = data.info.left_card
|
||||
self:UpdateLeftCard(left_count)
|
||||
local round = data.info.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()
|
||||
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 p = room.player_list[i]
|
||||
local card_info = _player_card_info[self:GetPos(p.seat)]
|
||||
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
|
||||
for i = 1, #room.player_list do
|
||||
local p = room.player_list[i]
|
||||
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)
|
||||
self:GenerateAllStepData(data)
|
||||
self:UpdateStep(1)
|
||||
-- self:ShowStep(0)
|
||||
end
|
||||
|
||||
function M:ShowStep(index)
|
||||
|
|
@ -102,7 +101,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 then
|
||||
info:UpdateHandCard(true, true)
|
||||
else
|
||||
info:UpdateHandCard(false, true)
|
||||
|
|
@ -125,7 +124,7 @@ function M:ShowStep(index)
|
|||
list:RemoveChildrenToPool()
|
||||
for i = 1, #niao_list do
|
||||
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
|
||||
item:GetController("bg").selectedIndex = 2
|
||||
end
|
||||
|
|
@ -207,7 +206,7 @@ function M:CmdOutCard(cmd, index)
|
|||
data.last_out_seat = cmd.seat
|
||||
local u = data.player_card_data[cmd.seat]
|
||||
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
|
||||
end
|
||||
|
||||
|
|
@ -273,7 +272,7 @@ function M:CopyLastStep(index)
|
|||
end
|
||||
|
||||
function M:UpdateLeftCard(num)
|
||||
self._tex_LeftCard.text = "剩余 "..num.." 张牌"
|
||||
self._tex_LeftCard.text = "剩余 " .. num .. " 张牌"
|
||||
end
|
||||
|
||||
function M:UpdateCardBox(seat)
|
||||
|
|
@ -288,11 +287,41 @@ function M:UpdateCardBox(seat)
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
function M:UpdateStep(step)
|
||||
self._record:GetChild("tex_step").text = "第 " .. step .. " / " .. #self._step .. "步"
|
||||
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
|
||||
|
|
@ -20,6 +20,7 @@ local CardType = {
|
|||
one = 1,
|
||||
long = 2,
|
||||
dui = 3,
|
||||
duiLong = 10,
|
||||
threeAndTwo = 4,
|
||||
normolPlant = 5,
|
||||
zha = 6,
|
||||
|
|
@ -44,20 +45,22 @@ function M:InitFlag()
|
|||
return self
|
||||
end
|
||||
|
||||
function M:InitLastCard(cardList)
|
||||
function M:InitLastCard(cardList, mustPutMaxCard)
|
||||
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
|
||||
self._flag_fristCard = true
|
||||
return
|
||||
end
|
||||
self.lastCardNum = #cardList
|
||||
table.sort(cardList)
|
||||
pt(cardList)
|
||||
self.lastMinCard = math.floor(cardList[1] / 10)
|
||||
local temp_long = 0
|
||||
self:Clear()
|
||||
self._flag_allCards = false
|
||||
self._flag_checkLst = true
|
||||
for i = 1, #cardList do
|
||||
local number = math.floor(cardList[i] / 10)
|
||||
if self.cardList[number] then
|
||||
|
|
@ -77,7 +80,6 @@ function M:InitLastCard(cardList)
|
|||
end
|
||||
end
|
||||
self.long = temp_long == self.cardNum and self.cardNum >= 5
|
||||
self.type = -1
|
||||
print("lingmengCheckAloneOrLong2")
|
||||
if self:CheckAloneOrLong() then
|
||||
self.type = self:CheckAloneOrLong()
|
||||
|
|
@ -100,7 +102,7 @@ function M:InitLastCard(cardList)
|
|||
self.type = self:CheckZha()
|
||||
return
|
||||
end
|
||||
if self.type == -1 then
|
||||
if self.type == 0 then
|
||||
ViewUtil.ErrorTip(-1, "上一份牌型判断错误")
|
||||
end
|
||||
end
|
||||
|
|
@ -160,6 +162,13 @@ function M:CheckCards()
|
|||
if self.cardNum ~= 4 and self.cardNum ~= self.lastCardNum and not self._flag_fristCard then
|
||||
return
|
||||
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")
|
||||
if self:CheckAloneOrLong() then
|
||||
|
|
@ -168,7 +177,7 @@ function M:CheckCards()
|
|||
print("lingmengCheckDuiZi")
|
||||
|
||||
if self:CheckDuiZi() then
|
||||
return true
|
||||
return true and not flag_mustZha
|
||||
end
|
||||
print("lingmengCheckSanDai")
|
||||
|
||||
|
|
@ -185,18 +194,19 @@ function M:CheckCards()
|
|||
end
|
||||
|
||||
function M:CheckOutCard(cardList)
|
||||
print("lingmengCheckOutCard===============")
|
||||
pt(cardList)
|
||||
self.tipCardList = {}
|
||||
self.touchCardSet = {}
|
||||
self.touchCardMao = {}
|
||||
|
||||
local cardMap = {}
|
||||
local cardSet = {}
|
||||
local cardType,only,longLength = self:CheckOutCardGetType()
|
||||
|
||||
if cardType == 0 then
|
||||
return
|
||||
end
|
||||
local temp_long = 0
|
||||
local temp_longList = {}
|
||||
local longList = {}
|
||||
local lastCard = -1
|
||||
|
||||
local flag_threeOrFour = false
|
||||
for i = 1, #cardList do
|
||||
local number = math.floor(cardList[i].card_code_number / 10)
|
||||
if cardMap[number] then
|
||||
|
|
@ -209,39 +219,148 @@ function M:CheckOutCard(cardList)
|
|||
table.insert(cardMap[number].cardList, cardList[i])
|
||||
table.insert(cardSet, number)
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
function M:CheckOutCardGetType()
|
||||
local cardType = 0
|
||||
local only = 0
|
||||
local longLength = 1
|
||||
if self.type == 0 then
|
||||
return cardType, only, longLength
|
||||
end
|
||||
if self.type == CardType.one or self.type == CardType.long then
|
||||
cardType = 1
|
||||
if self.type == CardType.long then
|
||||
longLength = self.lastCardNum
|
||||
end
|
||||
elseif self.type == CardType.dui then
|
||||
elseif self.type == CardType.dui or self.type == CardType.duiLong then
|
||||
cardType = 2
|
||||
if self.lastCardNum > 2 then
|
||||
longLength = self.lastCardNum/2
|
||||
longLength = self.lastCardNum / 2
|
||||
end
|
||||
elseif self.type == CardType.threeAndTwo or self.type == CardType.onlyThree or self.type == CardType.normolPlant or self.type == CardType.onlyPlant then
|
||||
cardType = 3
|
||||
if self.type == CardType.onlyThree or self.type == CardType.onlyPlant then
|
||||
only = 1
|
||||
if self.type == CardType.onlyPlant then
|
||||
longLength = self.lastCardNum/3
|
||||
longLength = self.lastCardNum / 3
|
||||
end
|
||||
end
|
||||
if self.type == CardType.normolPlant then
|
||||
longLength = self.lastCardNum/5
|
||||
longLength = self.lastCardNum / 5
|
||||
end
|
||||
elseif self.type == CardType.zha or self.type == CardType.zhaAndThreee then
|
||||
cardType = 4
|
||||
|
|
@ -249,11 +368,11 @@ function M:CheckOutCardGetType()
|
|||
only = 1
|
||||
end
|
||||
end
|
||||
return cardType,only,longLength
|
||||
return cardType, only, longLength
|
||||
end
|
||||
|
||||
function M:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength)
|
||||
print("lingmengCheckOutCardGetTouchSet",cardType,longLength,self.lastMinCard)
|
||||
function M:CheckOutCardGetTouchSet(cardSet, cardMap, cardType, longLength)
|
||||
print("lingmengCheckOutCardGetTouchSet", cardType, longLength, self.lastMinCard)
|
||||
pt(cardSet)
|
||||
pt(cardMap)
|
||||
local tempLong = 0
|
||||
|
|
@ -262,7 +381,7 @@ function M:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength)
|
|||
local tipCardSet = {}
|
||||
for i = 1, #cardSet do
|
||||
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
|
||||
tempLong = 1
|
||||
else
|
||||
|
|
@ -270,57 +389,66 @@ function M:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength)
|
|||
tempLong = tempLong + 1
|
||||
else
|
||||
if tempLong >= longLength then
|
||||
for j = 1,tempLong do
|
||||
table.insert(self.touchCardSet,tempCardSet[j])
|
||||
for j = 1, tempLong do
|
||||
table.insert(self.touchCardSet, tempCardSet[j])
|
||||
self.touchCardMao[tempCardSet[j]] = 1
|
||||
end
|
||||
end
|
||||
table.insert(tipCardSet,tempCardSet)
|
||||
table.insert(tipCardSet, tempCardSet)
|
||||
tempLong = 1
|
||||
tempCardSet = {}
|
||||
end
|
||||
end
|
||||
table.insert(tempCardSet,card)
|
||||
table.insert(tempCardSet, card)
|
||||
lastCard = card
|
||||
end
|
||||
if cardMap[card].value == 4 then
|
||||
table.insert(self.touchCardSet, card)
|
||||
self.touchCardMao[card] = 1
|
||||
table.insert(tipCardSet, card)
|
||||
end
|
||||
end
|
||||
if tempLong >= longLength then
|
||||
for j = 1,tempLong do
|
||||
table.insert(self.touchCardSet,tempCardSet[j])
|
||||
for j = 1, tempLong do
|
||||
table.insert(self.touchCardSet, tempCardSet[j])
|
||||
self.touchCardMao[tempCardSet[j]] = 1
|
||||
end
|
||||
end
|
||||
table.insert(tipCardSet,tempCardSet)
|
||||
table.insert(tipCardSet, tempCardSet)
|
||||
return tipCardSet
|
||||
end
|
||||
|
||||
function M:CheckOutCardSetTipList(tipCardSet,longLength,cardMap,cardType)
|
||||
print("lingmengCheckOutCardSetTipList",longLength,cardMap,cardType)
|
||||
function M:CheckOutCardSetTipList(tipCardSet, longLength, cardMap, cardType)
|
||||
print("lingmengCheckOutCardSetTipList", longLength, cardMap, cardType)
|
||||
pt(tipCardSet)
|
||||
for i = 1, #tipCardSet do
|
||||
local tipCardSetLen = #tipCardSet[i]
|
||||
if tipCardSetLen == longLength then
|
||||
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)
|
||||
if type(tipCardSet[i]) == 'number' then
|
||||
table.insert(self.tipCardList, cardMap[tipCardSet[i]].cardList)
|
||||
else
|
||||
for j = 1, tipCardSetLen do
|
||||
if j + longLength <= tipCardSetLen then
|
||||
local tempList = {}
|
||||
for k = j,j + longLength 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
|
||||
local tipCardSetLen = #tipCardSet[i]
|
||||
if tipCardSetLen == longLength then
|
||||
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
|
||||
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
|
||||
table.insert(self.tipCardList,tempList)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -340,7 +468,7 @@ function M:CheckDuiZi()
|
|||
if self.cardNum == 2 and self.cardSize == 1 and M:CheckType(CardType.dui) then
|
||||
return CardType.dui
|
||||
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
|
||||
for i = 1, self.cardSize do
|
||||
local k = self.cardListSord[i]
|
||||
|
|
@ -358,7 +486,7 @@ function M:CheckDuiZi()
|
|||
return
|
||||
end
|
||||
end
|
||||
return CardType.dui
|
||||
return CardType.duiLong
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -478,10 +606,10 @@ function M:CheckZha()
|
|||
local k = self.cardListSord[i]
|
||||
local v = self.cardList[k]
|
||||
if v == 4 then
|
||||
return true
|
||||
return CardType.zhaAndThreee
|
||||
end
|
||||
end
|
||||
return CardType.zhaAndThreee
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -338,7 +338,8 @@ function M:FillPoker(poker, prefix, num, code)
|
|||
if num ~= nil then
|
||||
code = self:ChangeCodeByTo(num)
|
||||
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
|
||||
if not poker.icon then
|
||||
poker:GetChild('icon').url = string.format("ui://Extend_Poker_RunFastNew/%s%s%s", prefix, code, suffix)
|
||||
|
|
|
|||
|
|
@ -779,7 +779,7 @@ function M:HidePiao()
|
|||
end
|
||||
|
||||
function M:ShowOutCardOption2(lastCardList,ctr_select,mustPutMaxCard)
|
||||
self._cardCheck:InitLastCard(lastCardList)
|
||||
self._cardCheck:InitLastCard(lastCardList,mustPutMaxCard)
|
||||
self._cardCheck:CheckOutCard(self.card_list)
|
||||
self.tips_card_list = self._cardCheck:GetTipsList()
|
||||
self.touchCardSet = self._cardCheck:GetTouchSet()
|
||||
|
|
@ -788,10 +788,8 @@ function M:ShowOutCardOption2(lastCardList,ctr_select,mustPutMaxCard)
|
|||
print("lingmengShowOutCardOption2",#self.touchCardSet )
|
||||
pt( self.touchCardSet )
|
||||
pt(self.touchCardMap)
|
||||
if #self.touchCardSet >= 1 then
|
||||
-- body --在这个方法里添加判断抬起牌是否符合出牌类型(少跑一次手牌循环)
|
||||
self:UpdateHandCardsColor()
|
||||
end
|
||||
|
||||
if #self.tips_card_list == 1 then
|
||||
self:ShowTipsCard(1)
|
||||
|
|
@ -1076,7 +1074,7 @@ function M:UpdateHandCardsColor()
|
|||
local send_card = {}
|
||||
for i = 1, #self.card_list do
|
||||
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
|
||||
self:SetBtnCardColor(card_view, 0)
|
||||
else
|
||||
|
|
@ -1188,7 +1186,7 @@ function M:ShowTipsCard(index)
|
|||
end
|
||||
end
|
||||
pt(item)
|
||||
self._cardCheck:InitFlag(item)
|
||||
self._cardCheck:initCards(item)
|
||||
self._ctr_canSendCard.selectedIndex = self._cardCheck:CheckCards() and 1 or 0
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ end
|
|||
function M:Clear()
|
||||
MJPlayerCardInfoView.Clear(self)
|
||||
|
||||
self._view_FZTips:RemoveChildren(0, -1, true)
|
||||
-- self._view_FZTips:RemoveChildren(0, -1, true)
|
||||
|
||||
self._ctr_seletedGet.selectedIndex = 1
|
||||
self._ctr_tip.selectedIndex = 0
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue