diff --git a/lua_probject/extend_project/extend/majiang/hechi/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/hechi/EXClearingView.lua index 103d3120..8ad06204 100644 --- a/lua_probject/extend_project/extend/majiang/hechi/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/hechi/EXClearingView.lua @@ -229,30 +229,55 @@ function M:FillItemData(room, data, item, active_player, niao) local hand_cards = data["hand_card"] --table.sort( hand_cards, ViewUtil.HandCardSort) - -- 癞子(501)排第一,其他牌按 ViewUtil.HandCardSort 规则排序 + --癞子(501)排第一,字牌风牌排最后,其他牌按 ViewUtil.HandCardSort 规则排序 if hand_cards and #hand_cards > 1 then - table.sort(hand_cards, function(a, b) - local isLaiziA = (a == 501) - local isLaiziB = (b == 501) - -- 1. 如果 A 是癞子,B 不是,A 排前面 (返回 true) - if isLaiziA and not isLaiziB then - return true - end - -- 2. 如果 A 不是癞子,B 是,A 排后面 (返回 false) - if not isLaiziA and isLaiziB then + -- 判断是否为字牌 (东南西北中发白) + local function IsZiPai(cardId) + -- 排除癞子 + if cardId == 501 then return false end + -- 根据实际项目ID定义判断字牌范围 + -- 常见定义:31 <= id <= 37 + if cardId >= 401 and cardId <= 503 then + return true + end return false end - -- 3. 如果两者都是癞子,或都不是癞子,使用标准排序规则 - -- 尝试获取比较结果 - local result = ViewUtil.HandCardSort(a, b) - - -- 兼容处理:如果 ViewUtil.HandCardSort 返回的是数字 (-1, 0, 1) - if type(result) == "number" then - return result < 0 - end - -- 如果返回的是布尔值,直接返回 - return result - end) + table.sort(hand_cards, function(a, b) + local isLaiziA = (a == 501) + local isLaiziB = (b == 501) + -- 1. 癞子永远排第一,如果 A 是癞子,B 不是,A 排前面 (返回 true) + if isLaiziA and not isLaiziB then + return true + end + -- 2. 如果 A 不是癞子,B 是,A 排后面 (返回 false) + if not isLaiziA and isLaiziB then + return false + end + local isZiA = IsZiPai(a) + local isZiB = IsZiPai(b) + + -- 2. 处理字牌与数牌的相对位置 + if isZiA ~= isZiB then + -- 字牌在后 + if true then + -- A是字牌,B不是 -> A排后面 (返回 false) + if isZiA then return false end + -- A不是字牌,B是 -> A排前面 (返回 true) + return true + end + end + + -- 3. 如果两者都是癞子,或都不是癞子,使用标准排序规则 + -- 尝试获取比较结果 + local result = ViewUtil.HandCardSort(a, b) + + -- 兼容处理:如果 ViewUtil.HandCardSort 返回的是数字 (-1, 0, 1) + if type(result) == "number" then + return result < 0 + end + -- 如果返回的是布尔值,直接返回 + return result + end) end diff --git a/lua_probject/extend_project/extend/majiang/hechi/EXGameController.lua b/lua_probject/extend_project/extend/majiang/hechi/EXGameController.lua index 69e7e737..0654a20b 100644 --- a/lua_probject/extend_project/extend/majiang/hechi/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/hechi/EXGameController.lua @@ -78,31 +78,55 @@ function M:SendOutCard(card, callback) list_remove(p.card_list, card) --table.sort(p.card_list, ViewUtil.HandCardSort) - - -- 癞子(501)排第一,其他牌按 ViewUtil.HandCardSort 规则排序 +--癞子(501)排第一,字牌风牌排最后,其他牌按 ViewUtil.HandCardSort 规则排序 if p.card_list and #p.card_list > 1 then - table.sort(p.card_list, function(a, b) - local isLaiziA = (a == 501) - local isLaiziB = (b == 501) - -- 1. 如果 A 是癞子,B 不是,A 排前面 (返回 true) - if isLaiziA and not isLaiziB then - return true - end - -- 2. 如果 A 不是癞子,B 是,A 排后面 (返回 false) - if not isLaiziA and isLaiziB then + -- 判断是否为字牌 (东南西北中发白) + local function IsZiPai(cardId) + -- 排除癞子 + if cardId == 501 then return false end + -- 根据实际项目ID定义判断字牌范围 + -- 常见定义:31 <= id <= 37 + if cardId >= 401 and cardId <= 503 then + return true + end return false end - -- 3. 如果两者都是癞子,或都不是癞子,使用标准排序规则 - -- 尝试获取比较结果 - local result = ViewUtil.HandCardSort(a, b) - - -- 兼容处理:如果 ViewUtil.HandCardSort 返回的是数字 (-1, 0, 1) - if type(result) == "number" then - return result < 0 - end - -- 如果返回的是布尔值,直接返回 - return result - end) + table.sort(p.card_list, function(a, b) + local isLaiziA = (a == 501) + local isLaiziB = (b == 501) + -- 1. 癞子永远排第一,如果 A 是癞子,B 不是,A 排前面 (返回 true) + if isLaiziA and not isLaiziB then + return true + end + -- 2. 如果 A 不是癞子,B 是,A 排后面 (返回 false) + if not isLaiziA and isLaiziB then + return false + end + local isZiA = IsZiPai(a) + local isZiB = IsZiPai(b) + + -- 2. 处理字牌与数牌的相对位置 + if isZiA ~= isZiB then + -- 字牌在后 + if true then + -- A是字牌,B不是 -> A排后面 (返回 false) + if isZiA then return false end + -- A不是字牌,B是 -> A排前面 (返回 true) + return true + end + end + + -- 3. 如果两者都是癞子,或都不是癞子,使用标准排序规则 + -- 尝试获取比较结果 + local result = ViewUtil.HandCardSort(a, b) + + -- 兼容处理:如果 ViewUtil.HandCardSort 返回的是数字 (-1, 0, 1) + if type(result) == "number" then + return result < 0 + end + -- 如果返回的是布尔值,直接返回 + return result + end) end @@ -158,8 +182,8 @@ function M:OnEventSendCards(evt_data) end if _room.curren_round > 0 then _room.playing = true end - printlog("开始发牌===========>>>") - pt(evt_data) + -- printlog("开始发牌===========>>>") + -- pt(evt_data) local room = DataManager.CurrenRoom --printlog(evt_data.laiziCard) @@ -186,12 +210,23 @@ function M:OnEventSendCards(evt_data) p.card_list = handcards self._room.self_player.hand_left_count = #handcards --table.sort(handcards, ViewUtil.HandCardSort) - -- 癞子(501)排第一,其他牌按 ViewUtil.HandCardSort 规则排序 + --癞子(501)排第一,字牌风牌排最后,其他牌按 ViewUtil.HandCardSort 规则排序 if handcards and #handcards > 1 then + -- 判断是否为字牌 (东南西北中发白) + local function IsZiPai(cardId) + -- 排除癞子 + if cardId == 501 then return false end + -- 根据实际项目ID定义判断字牌范围 + -- 常见定义:31 <= id <= 37 + if cardId >= 401 and cardId <= 503 then + return true + end + return false + end table.sort(handcards, function(a, b) local isLaiziA = (a == 501) local isLaiziB = (b == 501) - -- 1. 如果 A 是癞子,B 不是,A 排前面 (返回 true) + -- 1. 癞子永远排第一,如果 A 是癞子,B 不是,A 排前面 (返回 true) if isLaiziA and not isLaiziB then return true end @@ -199,6 +234,20 @@ function M:OnEventSendCards(evt_data) if not isLaiziA and isLaiziB then return false end + local isZiA = IsZiPai(a) + local isZiB = IsZiPai(b) + + -- 2. 处理字牌与数牌的相对位置 + if isZiA ~= isZiB then + -- 字牌在后 + if true then + -- A是字牌,B不是 -> A排后面 (返回 false) + if isZiA then return false end + -- A不是字牌,B是 -> A排前面 (返回 true) + return true + end + end + -- 3. 如果两者都是癞子,或都不是癞子,使用标准排序规则 -- 尝试获取比较结果 local result = ViewUtil.HandCardSort(a, b) @@ -218,8 +267,8 @@ end function M:OnEventOutCard(evt_data) local seat = evt_data["seat"] local card = evt_data["card"] - printlog("OnEventOutCard----------------------------------------------") - pt(evt_data) + -- printlog("OnEventOutCard----------------------------------------------") + -- pt(evt_data) local ting_list = nil local p = self._room:GetPlayerBySeat(seat) self._cacheEvent:Enqueue(function() diff --git a/wb_new_ui/.objs/metas/27vd145b/hez87j20.info b/wb_new_ui/.objs/metas/27vd145b/hez87j20.info new file mode 100644 index 00000000..6bf09448 --- /dev/null +++ b/wb_new_ui/.objs/metas/27vd145b/hez87j20.info @@ -0,0 +1,10 @@ +{ + "objectStatus": { + "n14_10i2p": { + "hidden": true + }, + "n16_10i2p": { + "hidden": true + } + } +} \ No newline at end of file diff --git a/wb_new_ui/.objs/metas/m7iejg46/10snh5j.info b/wb_new_ui/.objs/metas/m7iejg46/10snh5j.info index e99c2420..831fc35b 100644 --- a/wb_new_ui/.objs/metas/m7iejg46/10snh5j.info +++ b/wb_new_ui/.objs/metas/m7iejg46/10snh5j.info @@ -3,12 +3,18 @@ "n259_imp5": { "collapsed": true }, - "n78_i7lq": { - "hidden": true + "n294_ik9v": { + "collapsed": true }, "n251_ilon": { "hidden": true }, + "n78_i7lq": { + "hidden": true + }, + "n176_mn85": { + "collapsed": true + }, "n290_ik9v": { "hidden": true } diff --git a/wb_new_ui/.objs/workspace.json b/wb_new_ui/.objs/workspace.json index 7b8429ae..1a8571a1 100644 --- a/wb_new_ui/.objs/workspace.json +++ b/wb_new_ui/.objs/workspace.json @@ -8,31 +8,35 @@ "ui://v0j9abjygq7m7m", "ui://v0j9abjygq7mgx", "ui://v0j9abjygq7m8f", + "ui://27vd145bhez87j20", + "ui://v0j9abjygq7med", + "ui://m7iejg4610snh5j", + "ui://m7iejg46e5q7hu2", + "ui://2d9xdj6zl0lzb", + "ui://2d9xdj6zomkm7cna", + "ui://2d9xdj6zxbqujn", + "ui://27vd145bst2l7ijp", + "ui://2d9xdj6znaupko", + "ui://27vd145bhez87j27", "ui://v0j9abjygq7m8u" ], "test.device": "iPhone XR", "canvasColor": 10066329, "auxline2": true, - "doc.activeDoc": "ui://v0j9abjygq7m8f", + "doc.activeDoc": "ui://2d9xdj6zl0lzb", "libview.twoColumn": false, "libview.expandedNodes": [ - "l0ds4ys6", - "/", - "l0ds4ys6", - "/images/", - "l0ds4ys6", - "/images/chatMui/", "27vd145b", "/", "27vd145b", - "/buttons/", - "27vd145b", "/images/", "27vd145b", "/images/COMMui/", "v0j9abjy", "/", "v0j9abjy", + "/Main_style_2/", + "v0j9abjy", "/buttons/", "v0j9abjy", "/image/", @@ -40,10 +44,18 @@ "/images/", "v0j9abjy", "/images/MMaJiangMui/", + "v0j9abjy", + "/images/cards/", + "v0j9abjy", + "/images/cards/1/", + "v0j9abjy", + "/images/cards/2/", "m7iejg46", "/", "m7iejg46", - "/NGMui/" + "/NGMui/", + "m7iejg46", + "/images/" ], "auxline1": true, "snapToGrid": true, diff --git a/wb_new_ui/assets/Common/component/Component/btn_emoji.xml b/wb_new_ui/assets/Common/component/Component/btn_emoji.xml index f05e9423..b795941f 100644 --- a/wb_new_ui/assets/Common/component/Component/btn_emoji.xml +++ b/wb_new_ui/assets/Common/component/Component/btn_emoji.xml @@ -1,9 +1,10 @@ - + - + + diff --git a/wb_new_ui/assets/Common/component/playerDetail.xml b/wb_new_ui/assets/Common/component/playerDetail.xml index 8bd8d0b0..2a16ea01 100644 --- a/wb_new_ui/assets/Common/component/playerDetail.xml +++ b/wb_new_ui/assets/Common/component/playerDetail.xml @@ -1,32 +1,37 @@ - + - + + + +