新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

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -17,7 +17,6 @@ function M.new()
return self
end
function M:InitView(url)
local room = self._room
UIPackage.AddPackage("extend/majiang/nancheng/ui/Extend_MJ_NanCheng")
@ -60,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
@ -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
@ -295,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

View File

@ -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,25 +219,134 @@ 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]
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
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
@ -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
@ -283,6 +402,11 @@ function M:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength)
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
@ -298,6 +422,9 @@ function M:CheckOutCardSetTipList(tipCardSet,longLength,cardMap,cardType)
print("lingmengCheckOutCardSetTipList", longLength, cardMap, cardType)
pt(tipCardSet)
for i = 1, #tipCardSet do
if type(tipCardSet[i]) == 'number' then
table.insert(self.tipCardList, cardMap[tipCardSet[i]].cardList)
else
local tipCardSetLen = #tipCardSet[i]
if tipCardSetLen == longLength then
local tempList = {}
@ -311,9 +438,9 @@ function M:CheckOutCardSetTipList(tipCardSet,longLength,cardMap,cardType)
table.insert(self.tipCardList, tempList)
else
for j = 1, tipCardSetLen do
if j + longLength <= tipCardSetLen then
if j + longLength - 1 <= tipCardSetLen then
local tempList = {}
for k = j,j + longLength do
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
@ -326,6 +453,7 @@ function M:CheckOutCardSetTipList(tipCardSet,longLength,cardMap,cardType)
end
end
end
end
function M:CheckAloneOrLong()
if self.cardNum == 1 and M:CheckType(CardType.one) then
@ -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,12 +606,12 @@ function M:CheckZha()
local k = self.cardListSord[i]
local v = self.cardList[k]
if v == 4 then
return true
end
end
return CardType.zhaAndThreee
end
end
return
end
end
function M:CheckType(type)
return self._flag_checkLst or self._flag_fristCard or type == self.type

View File

@ -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)

View File

@ -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

View File

@ -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