From 98e5a0d49adc6b0a21b8bdfaa3dbe0dabd3c314e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=AE=B6=E7=82=9C?= <2029049582@qq.com> Date: Wed, 9 Apr 2025 13:53:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base_project/Game/View/FamilyView.lua | 23 ++++++--- .../extend/majiang/jinxi/EXGameInfo.lua | 17 +++---- .../extend/majiang/jinxi/EXMainView.lua | 31 ++++++------ .../extend/majiang/jinxi/EXPlayerInfoView.lua | 50 +++++++++---------- .../extend/majiang/lichuan/EXGameInfo.lua | 15 +++--- 5 files changed, 71 insertions(+), 65 deletions(-) diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index fab4a2e7..0c873b63 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -295,6 +295,15 @@ function M:UpdateFamilyRoom(fgCtr, id) local list_gamePlay = self._view:GetChild('list_gamePlay') list_gamePlay:SetVirtual() local playList = self._group.playList + --初始化玩法列表,用于房间使用 + local playGameInfoTable = {} + for i = 1, #playList do + playGameInfoTable[playList[i].id] = { + gameId = playList[i].gameId, + config = playList[i].config, + name = playList[i].name, + } + end local roomList = self._group.rooms print("=========================playList,rooms") pt(playList) @@ -302,11 +311,12 @@ function M:UpdateFamilyRoom(fgCtr, id) list_room.itemRenderer = function(index, obj) if index < #roomList then local newIndex = index + 1 - -- local config = ExtendManager.GetExtendConfig(roomList[index + 1].pid) - -- local mode = config:GetGameInfo() - -- local gamePlay = mode:LoadConfigToDetail("这是房间") - -- obj:GetChild('Label_gameRule').title = gamePlay - obj:GetChild('game_type').text = string.format("房间-%s", roomList[newIndex].id) + 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 obj:GetChild('btn_joinGame').onClick:Set(function() ViewUtil.ShowModalWait(self._root_view, "匹配房间中", 'join_room') @@ -327,7 +337,8 @@ function M:UpdateFamilyRoom(fgCtr, id) -- ViewManager.ChangeView(ViewManager.View_Lobby) return else - ViewManager.ChangeView(ViewManager.View_Main, playList[index + 1].gameId) + ViewManager.ChangeView(ViewManager.View_Main, playGameInfoTable[roomList[newIndex].pid] + .gameId) end end, id, diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXGameInfo.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXGameInfo.lua index 60dd23b6..0766af4c 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXGameInfo.lua @@ -185,15 +185,14 @@ function M:LoadConfigData(data) 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人,%s马,%s,%s,%s%s,%s", configData.maxPlayers, + configData.jiangma and string.format("奖%d", configData.jiangma) or "不奖", + configData.zimo and "只能自摸" or "自摸可点炮", + configData.tuoguan and string.format("%d秒后自动托管", configData.tuoguan_active_time) or "不能托管", + configData.sanjingjiangma and "三精算奖马" or "三精不算奖马", configData.fengding and ",封顶10炮" or "", + configData.zikechengshun and "字可成顺" or "字不可成顺") + return returnString end return M diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua index 4feb50ad..e7147ec2 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua @@ -25,11 +25,11 @@ function M:InitView(url) self._gps_style = 1 self._full = true UIPackage.AddPackage("extend/majiang/jinxi/ui/Extend_MJ_JinXi") - 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 + -- 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 .. '倍' @@ -99,13 +99,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 + -- 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() @@ -212,8 +212,7 @@ function M:EventInit() local arg = { ... } local seat = arg[1] local card = arg[2] - -- self._tex_leftTime.text = arg[3] - self._tex_LeftCard.text = string.format("剩余%d张牌", arg[3]) + self._tex_leftTime.text = arg[3] -- self:UpdateRoomInfo() local info = self._player_card_info[self:GetPos(seat)] info:UpdateHandCard(true) @@ -417,7 +416,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) @@ -769,7 +768,7 @@ function M:ReloadRoom(bskip) if bskip == nil or bskip == false then self:UpdateCardBox(self:GetPos(room.curren_outcard_seat)) - self._tex_LeftCard.text = string.format("剩余%d张牌", room.left_count) + self._tex_LeftCard.text = room.left_count self:UpdateRound() end end diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayerInfoView.lua index 6f78ae8a..2722ce25 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayerInfoView.lua @@ -4,11 +4,11 @@ local PlayerInfoView_copy = require("Game.View.PlayerInfoView copy") local M = {} function M.new(view, mainView) - if mainView._room.room_config.people_num == 2 then - setmetatable(M, { __index = PlayerInfoView_copy }) - else - setmetatable(M, { __index = PlayerInfoView }) - end + -- 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 @@ -17,20 +17,20 @@ function M.new(view, mainView) end function M:init() - 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 + -- 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) +function M:ShowInteraction(type, str) if type == 3 then Voice.DownLoad(str, function(clip) - if (clip ) then + if (clip) then self:ShowMaskVoice(clip.length) GameApplication.Instance:PlayVoice(clip) end @@ -39,30 +39,30 @@ function M:ShowInteraction(type,str) self:SetChat(str) elseif type == 2 then local chat_index = tonumber(str) - self._main_view:PlayChatSound(self._player.self_user.sex,chat_index) + self._main_view:PlayChatSound(self._player.self_user.sex, chat_index) local language, index = self._main_view:GetChatMsgLanguage(chat_index) self:SetChat(self._main_view.Fix_Msg_Chat[index]) elseif type == 1 then - self:SetBiaoqing("ui://Chat/"..str) + self:SetBiaoqing("ui://Chat/" .. str) end end function M:UpdateRemainCard(card_num, hide) if hide then - self._view:GetController("show_remain").selectedIndex = 0 + self._view:GetController("show_remain").selectedIndex = 0 else - self._view:GetController("show_remain").selectedIndex = 1 + self._view:GetController("show_remain").selectedIndex = 1 end self._view:GetChild("com_remain"):GetChild("tex_remain").text = card_num end function M:FillData(player) - 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 + -- 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/EXGameInfo.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXGameInfo.lua index e91e80c2..0f90792b 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXGameInfo.lua @@ -173,15 +173,12 @@ function M:LoadConfigData(data) 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人%s%s,%s", configData.maxPlayers, + configData.zimo and ",只能自摸" or ",自摸可点炮", + configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or "不能托管", + configData.jingbibo and "有精必博" or "有精可胡") + return returnString end return M