From 3f1b85e49d560877ec94a173aa6ae95d35849076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=AE=B6=E7=82=9C?= <2029049582@qq.com> Date: Fri, 11 Apr 2025 16:27:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E4=BA=BA=E5=90=8C=E6=AD=A5=E9=BB=8E?= =?UTF-8?q?=E5=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base_project/Game/View/FamilyView.lua | 18 +++--- .../extend/majiang/fuzhou/EXMainView.lua | 53 ++++++++++-------- .../majiang/fuzhou/EXPlayerInfoView.lua | 29 +++++++--- .../extend/majiang/lichuan/EXMainView.lua | 15 +++-- .../majiang/lichuan/EXPlayerInfoView.lua | 29 +++++++--- .../extend/poker/runfast/EXGameInfo.lua | 12 +--- .../main_majiang/ui/main_majiang_fui.bytes | Bin 255274 -> 255306 bytes 7 files changed, 93 insertions(+), 63 deletions(-) diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 030c9c27..e10dac57 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -310,10 +310,10 @@ function M:UpdateFamilyRoom(fgCtr, id) list_room.itemRenderer = function(index, obj) if index < #roomList then local newIndex = index + 1 - -- local config = ExtendManager.GetExtendConfig(playGameInfoTable[roomList[newIndex].pid].gameId) - -- local mode = config:GetGameInfo() - -- local gamePlay = mode:LoadConfigToDetail(playGameInfoTable[roomList[newIndex].pid].config) - -- obj:GetChild('Label_gameRule').title = gamePlay + local config = ExtendManager.GetExtendConfig(playGameInfoTable[roomList[newIndex].pid].gameId) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetail(playGameInfoTable[roomList[newIndex].pid].config) + obj:GetChild('Label_gameRule').title = gamePlay obj:GetChild('game_type').text = string.format("%s房间-%s", playGameInfoTable[roomList[newIndex].pid].name, roomList[newIndex].id) obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1 @@ -334,8 +334,6 @@ function M:UpdateFamilyRoom(fgCtr, id) -- ViewManager.ChangeView(ViewManager.View_Lobby) return else - ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间成功') - ViewManager.ChangeView(ViewManager.View_Main, playGameInfoTable[roomList[newIndex].pid] .gameId) end @@ -346,10 +344,10 @@ function M:UpdateFamilyRoom(fgCtr, id) end) else local newIndex = index - #roomList + 1 - -- local config = ExtendManager.GetExtendConfig(playList[newIndex].gameId) - -- local mode = config:GetGameInfo() - -- local gamePlay = mode:LoadConfigToDetail(playList[newIndex].config) - -- obj:GetChild('Label_gameRule').title = gamePlay + local config = ExtendManager.GetExtendConfig(playList[newIndex].gameId) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetail(playList[newIndex].config) + obj:GetChild('Label_gameRule').title = gamePlay obj:GetChild('game_type').text = playList[newIndex].name obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 0 obj:GetChild('btn_joinGame').onClick:Set(function() diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua index 51235ccd..66e583a2 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua @@ -25,7 +25,11 @@ function M:InitView(url) self._gps_style = 1 self._full = true UIPackage.AddPackage("extend/majiang/fuzhou/ui/Extend_MJ_FuZhou") - MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2") + if self._room.room_config.people_num == 2 then + MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num) + else + MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2") + end self._hu_tip = HuTipView.new(self) self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人个旧麻将 ' .. room.score_times .. '倍' @@ -45,24 +49,22 @@ function M:InitView(url) end end -function M:__BuGang(card1, card2, callback) - local _gang_tip_choice = UIPackage.CreateObject("Extend_MJ_FuZhou", "Gang_tip_choice") +function M:__BuGang(cardInfo, callback) + local _gang_tip_choice = UIPackage.CreateObject("Extend_MJ_NanCheng", "Gang_tip_choice") _gang_tip_choice.visible = true - local gangcard1 = _gang_tip_choice:GetChild("card1") - local gangcard2 = _gang_tip_choice:GetChild("card2") - - - gangcard1.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" .. card1) - gangcard2.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" .. card2) - - gangcard1.onClick:Add(function() - callback(card1) + local list_card = _gang_tip_choice:GetChild("list_card") + list_card:SetVirtual() + list_card.itemRenderer = function(index, obj) + obj.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" .. cardInfo[index + 1]) + end + list_card.numItems = #cardInfo + list_card.onClickItem:Set(function(context) + local item = context.data + local index = list_card:GetChildIndex(item) + callback(cardInfo[index + 1]) end) - gangcard2.onClick:Add(function() - callback(card2) - end) _gang_tip_choice.xy = Vector2((self._view.width - _gang_tip_choice.width) / 2, (self._view.height - _gang_tip_choice.height) / 2) @@ -97,8 +99,13 @@ function M:IsShowGangZi(btn, isShow) end function M:UpdateRound() - self._view:GetChild("tex_round1").text = self._room.curren_round - self._view:GetChild("tex_round2").text = self._room.room_config.round + if self._room.room_config.people_num == 2 then + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) + else + self._view:GetChild("tex_round1").text = self._room.curren_round + self._view:GetChild("tex_round2").text = self._room.room_config.round + end end function M:InitPlayerInfoView() @@ -141,7 +148,7 @@ function M:EventInit() _gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...) local arg = { ... } - self:__BuGang(arg[1], arg[2], + self:__BuGang(arg[1], function(id) printlog(id) _gamectr:SendGangCard(id) @@ -206,7 +213,7 @@ function M:EventInit() local seat = arg[1] local card = arg[2] -- self._tex_leftTime.text = arg[3] - self._tex_LeftCard.text = arg[3] + self._tex_LeftCard.text = string.format("剩余%d张牌", arg[3]) -- self:UpdateRoomInfo() local info = self._player_card_info[self:GetPos(seat)] info:UpdateHandCard(true) @@ -367,7 +374,7 @@ function M:EventInit() if _room:checkHpNonnegative() then p.cur_hp = data[i].hp_info.cur_hp end - info:UpdateScore() + -- info:UpdateScore() info._view:GetChild("zhanji").visible = true local num = data[i].hp_info.total_hp if num > 0 then @@ -410,7 +417,7 @@ function M:EventInit() _gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function() self:UpdateRound() - self._tex_LeftCard.text = "0" + self._tex_LeftCard.text = "剩余0张牌" self._state.selectedIndex = 1 self:__PiaoNiaoTip() end) @@ -721,7 +728,7 @@ function M:ReloadRoom(bskip) end info:UpdateHandCard() local head_info = self._player_info[self:GetPos(p.seat)] - head_info:UpdateScore() + -- head_info:UpdateScore() head_info._view:GetChild('zhanji').visible = true local num = p.total_hp or 0 if num > 0 then @@ -762,7 +769,7 @@ function M:ReloadRoom(bskip) if bskip == nil or bskip == false then self:UpdateCardBox(self:GetPos(room.curren_outcard_seat)) - self._tex_LeftCard.text = room.left_count + self._tex_LeftCard.text = string.format("剩余%d张牌", room.left_count) self:UpdateRound() end end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayerInfoView.lua index f8a5fd69..8a4f41af 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayerInfoView.lua @@ -1,10 +1,15 @@ local PlayerInfoView = require("Game.View.PlayerInfoView") +local PlayerInfoView_copy = require("Game.View.PlayerInfoView_copy") local M = {} function M.new(view, mainView) - setmetatable(M, {__index = PlayerInfoView}) - local self = setmetatable({}, {__index = M}) + if mainView._room.room_config.people_num == 2 then + setmetatable(M, { __index = PlayerInfoView_copy }) + else + setmetatable(M, { __index = PlayerInfoView }) + end + local self = setmetatable({}, { __index = M }) self._view = view self._main_view = mainView self:init() @@ -12,10 +17,14 @@ function M.new(view, mainView) end function M:init() - PlayerInfoView.init(self) - self._tex_score = self._view:GetChild("info"):GetChild("tex_score1") - self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2") - self._ct_score = self._view:GetChild("info"):GetController("score") + if self._main_view._room.room_config.people_num ~= 2 then + PlayerInfoView.init(self) + self._tex_score = self._view:GetChild("info"):GetChild("tex_score1") + self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2") + self._ct_score = self._view:GetChild("info"):GetController("score") + else + PlayerInfoView_copy.init(self) + end end function M:ShowInteraction(type,str) @@ -48,8 +57,12 @@ function M:UpdateRemainCard(card_num, hide) end function M:FillData(player) - PlayerInfoView.FillData(self, player) - self:UpdateScore(player.total_score) + if self._main_view._room.room_config.people_num == 2 then + PlayerInfoView_copy.FillData(self, player) + else + PlayerInfoView.FillData(self, player) + self:UpdateScore(player.total_score) + end end function M:UpdateScore() diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua index c56feeb1..b2b4ce26 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua @@ -96,8 +96,13 @@ function M:IsShowGangZi(btn, isShow) end function M:UpdateRound() + if self._room.room_config.people_num == 2 then + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) + else self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round2").text = self._room.room_config.round + end end function M:ShowJing() @@ -220,7 +225,7 @@ function M:EventInit() local seat = arg[1] local card = arg[2] -- self._tex_leftTime.text = arg[3] - self._tex_LeftCard.text = arg[3] + self._tex_LeftCard.text = string.format("剩余%d张牌", arg[3]) -- self:UpdateRoomInfo() local info = self._player_card_info[self:GetPos(seat)] info:UpdateHandCard(true) @@ -382,7 +387,7 @@ function M:EventInit() if _room:checkHpNonnegative() then p.cur_hp = data[i].hp_info.cur_hp end - info:UpdateScore() + -- info:UpdateScore() info._view:GetChild("zhanji").visible = true local num = data[i].hp_info.total_hp if num > 0 then @@ -425,7 +430,7 @@ function M:EventInit() _gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function() self:UpdateRound() - self._tex_LeftCard.text = "0" + self._tex_LeftCard.text = "剩余0张牌" self._state.selectedIndex = 1 self:__PiaoNiaoTip() end) @@ -736,7 +741,7 @@ function M:ReloadRoom(bskip) end info:UpdateHandCard() local head_info = self._player_info[self:GetPos(p.seat)] - head_info:UpdateScore() + -- head_info:UpdateScore() head_info._view:GetChild('zhanji').visible = true local num = p.total_hp or 0 if num > 0 then @@ -777,7 +782,7 @@ function M:ReloadRoom(bskip) if bskip == nil or bskip == false then self:UpdateCardBox(self:GetPos(room.curren_outcard_seat)) - self._tex_LeftCard.text = room.left_count + self._tex_LeftCard.text = string.format("剩余%d张牌", room.left_count) self:UpdateRound() end end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua index f8a5fd69..8a4f41af 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua @@ -1,10 +1,15 @@ local PlayerInfoView = require("Game.View.PlayerInfoView") +local PlayerInfoView_copy = require("Game.View.PlayerInfoView_copy") local M = {} function M.new(view, mainView) - setmetatable(M, {__index = PlayerInfoView}) - local self = setmetatable({}, {__index = M}) + if mainView._room.room_config.people_num == 2 then + setmetatable(M, { __index = PlayerInfoView_copy }) + else + setmetatable(M, { __index = PlayerInfoView }) + end + local self = setmetatable({}, { __index = M }) self._view = view self._main_view = mainView self:init() @@ -12,10 +17,14 @@ function M.new(view, mainView) end function M:init() - PlayerInfoView.init(self) - self._tex_score = self._view:GetChild("info"):GetChild("tex_score1") - self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2") - self._ct_score = self._view:GetChild("info"):GetController("score") + if self._main_view._room.room_config.people_num ~= 2 then + PlayerInfoView.init(self) + self._tex_score = self._view:GetChild("info"):GetChild("tex_score1") + self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2") + self._ct_score = self._view:GetChild("info"):GetController("score") + else + PlayerInfoView_copy.init(self) + end end function M:ShowInteraction(type,str) @@ -48,8 +57,12 @@ function M:UpdateRemainCard(card_num, hide) end function M:FillData(player) - PlayerInfoView.FillData(self, player) - self:UpdateScore(player.total_score) + if self._main_view._room.room_config.people_num == 2 then + PlayerInfoView_copy.FillData(self, player) + else + PlayerInfoView.FillData(self, player) + self:UpdateScore(player.total_score) + end end function M:UpdateScore() diff --git a/lua_probject/extend_project/extend/poker/runfast/EXGameInfo.lua b/lua_probject/extend_project/extend/poker/runfast/EXGameInfo.lua index 579827a9..1d6d4ab8 100644 --- a/lua_probject/extend_project/extend/poker/runfast/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/poker/runfast/EXGameInfo.lua @@ -307,15 +307,9 @@ function M:OnChangeOption(ctype, pay_obj) end function M:LoadConfigToDetail(data) - -- local configData = json.decode(data) - -- local returnString = string.format("人数%s人,%s马%s%s%s%s%s%s,%s", configData.maxPlayers, - -- configData.jiangma and string.format("奖%d", configData.jiangma) or "不奖", configData.shaozhuang and ",有烧庄" or "", - -- configData.zuoma and ",庄家坐马" or "", - -- configData.zimo and ",只能自摸" or ",自摸可点炮", - -- configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or "不能托管", - -- configData.jiahu and ",可以假胡" or "", configData.fengding and ",封顶20炮" or "", - -- configData.zhuanwan and "大转弯" or "小转弯") - return data + local configData = json.decode(data) + local returnString = string.format("人数%s人", configData.maxPlayers) + return returnString end return M diff --git a/wb_unity_pro/Assets/ART/base/main_majiang/ui/main_majiang_fui.bytes b/wb_unity_pro/Assets/ART/base/main_majiang/ui/main_majiang_fui.bytes index 016ffa2699697dbc49d51e007a86e496047cd00e..a4fb9633e30385121d28410a80e5864d8470447f 100644 GIT binary patch delta 810 zcmah_Ur1A76#vfI?%dt*Zf-g^H|MM{6Ec=om~L((iLf5TFfD_8a1aVv4>@1b{wY2b z+83Qctt1dZ@F9XO(Sw25!ybevd@%zfBnXind&qU}(kOc9gLCise*ez7cQ)(DW*rj= zwOJU))b4xMIzDK}W$sr%2nfk|sz$1*THEjr6kw>+_LZ+64Ml>l0Xd&K>G2 zSy@#^n^Ckox>>s{s)hKapvxDr{CVHd`vq-*g@c@;9OmXx-Z2$Ml?EbkQ%kdf1<<^n zOg67mcn*AW0L>JPLbY~@4W<8*vSLJ`t5Mjk9bnSf?+>^BItpv35$C@6n<2ji-1MI%AuQRnF`f|uU7uvMF4V#y$indmZzGHP&RiIOL%-HoUIr}@Mh zn;|y_pjY;E`e@jLd+A&W7V4wLSclr=Hf_4gV=OS%@CGKzQF`HoowVoV5CBE(mrCrLjH_ zLgNl-(}&YoW2Uh-aM4B^Sc`JGAE$GCc%BmG@Z^Id5Tx1++U3K9o2(feCw~lF0nwM+ zQhZ8?_iAFDmkr`5SF3;+&39lKg-TGNYZ)w{)eMfpD}pGLlRpl7X!(3fs-g&@K) zrHYqFzGQbj$AF8QeH_EDm|Uy#Nk>wZXW!ZM*b_W%svRo;;S??6gy>>LkGO5gZE;9O uF~(ovx@GKggR5$LmkOHbN2mVbDK?qq{tlHYXRy&|#(HN^@0~F%Mt%aK1<%L; delta 708 zcmaiyOK1~e5XZln&6jKv+AK-CO`=Uh4^?|me1g@iZRo99T1D}7(1QhO5f!9a2pB!Y zidvhlFg;iWQ37Ip(8FE?u|A+d6h#Cnf`|q^NU`8SC|M_qt@Y%>e9X@L=Kr5>*-|NV zyA&Ep`+VD_C@$)~GJCyrv{WWV|LiTui@gJkT6ZW>L&VL2%TmZ`7}5~S^c03{7* zk@px1Efyn`HK0*e7oKyAg^#K=VFvA22E0Lel3k2Hbsr_XpxHAW(D@R6+DQ#_SbK+o zX}%ifSYaQ%Mu^h$Fm}}rapT25jW}(NV7+u3v@3!;{>OY;V5$bnO*S}ao%ya)PRABH zP>(fsz7E%;E3=4Pbde7_hFqs<`-hGza_eG>no&*I=u}wC|5*snDC=nzl~2*kv4-Oo zSNI!h-#F%Jwgz=NM0mw3dia9FRzY1x6A1`Xatt?kz2)lULNQ>U9>Z1-4f!DwJ?>QG zWf^yzN|qTfJIb}3^tr3eUBx2p_d!?_{mjK=k{2?$ty9(qO?1BwJyagYOE5)`Php&f zui*fh35-Nj%s0rW<2cWl-^98Q=46%Cn~hmopK5ns$6kfnJE1`vmu=kga2#PyoVD7& hBxqy+HGBRBZuQWyH2)CkBDT5NxqK1rd{KFt`VH3Jy#@dP