From b5fb6912dac0bc1eca7a0f2f0286f91b836508a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=AE=B6=E7=82=9C?= <2029049582@qq.com> Date: Tue, 8 Apr 2025 14:35:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=97=E5=9F=8E=E4=BD=BF=E7=94=A8=E6=96=B0?= =?UTF-8?q?=E4=BA=8C=E4=BA=BA=E5=AF=B9=E6=88=98=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E5=88=9D=E5=A7=8Bhp=E7=A7=BB=E5=8A=A8=E5=88=B0=E9=82=80?= =?UTF-8?q?=E8=AF=B7=E4=BA=BA=E6=97=B6=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base_project/Game/View/FamilyView.lua | 29 ++++++------- .../majiang/changsha/EXPlayerInfoView.lua | 6 ++- .../extend/majiang/nancheng/EXMainView.lua | 25 +++++++---- .../majiang/nancheng/EXPlayerInfoView.lua | 41 ++++++++++++------- 4 files changed, 64 insertions(+), 37 deletions(-) diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 33c6c6f7..0041b8e8 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -282,19 +282,6 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type) else list_familyNumber.itemRenderer = function(index, obj) obj:GetChild('text_name').text = members[index + 1].nick - if self._lev ~= 3 then - if members[index + 1].hp < 777777000 then - fgCtr:FG_ChangeFag(group_id, members[index + 1].uid, members[index + 1].hp + 777777000, - function(res) - if res.ReturnCode == 0 then - - else - ViewUtil.CloseModalWait('join_room') - ViewUtil.ErrorMsg(self._root_view, res.ReturnCode, '默认分配积分失败') - end - end) - end - end end list_familyNumber.numItems = res.Data.member_num return 1 @@ -506,7 +493,21 @@ function M:JoinRoom(roomId) -- ViewUtil.ShowBannerOnScreenCenter("加入房间回调") -- end) --先换成邀请玩家 - fgCtr:FG_AddMember(self._group.id, tonumber(roomId), function() + fgCtr:FG_AddMember(self._group.id, tonumber(roomId), function(res) + if (res.ReturnCode == 0) then + ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1) + fgCtr:FG_ChangeFag(self._group.id, tonumber(roomId), 777777000, + function(res) + if res.ReturnCode == 0 then + ViewUtil.ShowBannerOnScreenCenter('分配默认积分成功!', 1) + else + ViewUtil.ErrorMsg(self._root_view, res.ReturnCode, '默认分配积分失败') + end + end) + else + ViewUtil.ErrorTip(res.ReturnCode, '邀请玩家失败!') + end + self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num1, false, 1) end) diff --git a/lua_probject/extend_project/extend/majiang/changsha/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/majiang/changsha/EXPlayerInfoView.lua index 3973eed6..6420d25d 100644 --- a/lua_probject/extend_project/extend/majiang/changsha/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/changsha/EXPlayerInfoView.lua @@ -57,7 +57,11 @@ function M:UpdateRemainCard(card_num, hide) end function M:FillData(player) - PlayerInfoView.FillData(self, player) + if self._main_view._room.room_config.people_num == 2 then + PlayerInfoView_copy.FillData(self, player) + else + PlayerInfoView.FillData(self, player) + end end return M diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index 6076bd22..495db580 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -25,7 +25,11 @@ function M:InitView(url) self._gps_style = 1 self._full = true UIPackage.AddPackage("extend/majiang/nancheng/ui/Extend_MJ_NanCheng") - 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 .. '倍' @@ -95,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() @@ -204,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) @@ -365,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 @@ -408,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) @@ -719,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 @@ -760,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/nancheng/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayerInfoView.lua index f8a5fd69..d61af11c 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/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,16 +17,20 @@ 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) +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 @@ -30,26 +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) - 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()