From fb86fe4259af46d8c759df5333a6b5b6a0581f2c 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, 10 Jun 2025 20:36:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5=E6=A1=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Game/Controller/GameController.lua | 9 +++ lua_probject/base_project/Game/Protocol.lua | 4 +- .../extend/majiang/lichuan/EXWitnessView.lua | 52 +++++++----------- .../main_project/main/majiang/MJMainView.lua | 2 +- .../Main_new/Main_new_2_jiangxi.xml | 13 +++-- .../main_majiang/ui/main_majiang_fui.bytes | Bin 339544 -> 339666 bytes 6 files changed, 43 insertions(+), 37 deletions(-) diff --git a/lua_probject/base_project/Game/Controller/GameController.lua b/lua_probject/base_project/Game/Controller/GameController.lua index a30f0f03..c26b2774 100644 --- a/lua_probject/base_project/Game/Controller/GameController.lua +++ b/lua_probject/base_project/Game/Controller/GameController.lua @@ -133,6 +133,15 @@ function M:WitnessGame(group_id, player_id, room_id) _client:send(Protocol.GAME_WITNESS_ROOM, _data) end +function M:ExitWitnessGame() + local _client = ControllerManager.GameNetClinet + if not _client then + return + end + local _data = {} + _client:send(Protocol.GAME_Exit_WITNESS_ROOM, _data) +end + --聊天 -- --1表情 2固定语音 3语音 4文本 5互动 diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index 686a6217..0339ec89 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -375,8 +375,10 @@ Protocol = { --end::::::::::::::牌友圈协议:::::::::::::::::::: -------------------Game ---------------------------- - -- 进入房间 + -- 观战进入房间 GAME_WITNESS_ROOM = "3013", + -- 观战退出房间 + GAME_Exit_WITNESS_ROOM = "3023", -- 进入房间 GAME_JOIN_ROOM = "1002", diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua index 4e42639f..29673512 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua @@ -117,6 +117,14 @@ function M:InitView(url) self.RuleView:Show() end) end + + local btn_exit = self._view:GetChild('btn_exitWitness') + if btn_exit ~= nil then + btn_exit.onClick:Set(function() + self._gamectr:ExitWitnessGame() + ViewManager.ChangeView(ViewManager.View_Family) + end) + end ------------------------------------------------------- self._ctr_state.selectedIndex = 4 @@ -156,8 +164,9 @@ function M:EventInit() local seat = arg[1] self:UpdateCardBox(self:GetPos(seat)) local playerInfo = self._player_info[self:GetPos(seat)] - playerInfo.hand_left_count = info.hand_left_count + 1 local info = self._player_card_info[self:GetPos(seat)] + print("lingmeng hand_left_count", info._player.hand_left_count) + info._player.hand_left_count = info._player.hand_left_count + 1 info:UpdateHandCardWitness(true) end) @@ -262,7 +271,10 @@ function M:UpdateCardBox(seat) end function M:OnFangziAction(...) - self:__CloseTip() + print("lingmeng OnFangziAction") + -- self:__CloseTip() + print("lingmeng OnFangziAction1") + local arg = { ... } local _player_card_info = self._player_card_info local fz = arg[1] @@ -271,44 +283,22 @@ function M:OnFangziAction(...) printlog("OnFangziAction") local info = _player_card_info[self:GetPos(player.seat)] -- local pNode = info._mask_liangpai - local effect = UIPackage.CreateObject("Extend_MJ_LiChuan", "FzEffect") - if fz.type == FZType.Peng then - self:PlaySound("LiChuan_MJ", player.self_user.sex, "peng" .. math.random(1, 3)) - effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰") - effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰") - -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框") - elseif fz.type == FZType.Chi then - self:PlaySound("LiChuan_MJ", player.self_user.sex, "chi" .. math.random(1, 3)) - effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "吃") - effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "吃") - else - self:PlaySound("LiChuan_MJ", player.self_user.sex, "gang" .. math.random(1, 2)) - effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠") - effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠") - -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框") - end - effect.touchable = false - effect:GetTransition("t2"):Play() - -- pNode:AddChild(effect) - coroutine.start(function() - coroutine.wait(0.3) - self._popEvent = true - end) - coroutine.start(function() - coroutine.wait(2) - effect:Dispose() - end) self:RemoveCursor() if (player.seat ~= fz.from_seat) then local fs_info = _player_card_info[self:GetPos(fz.from_seat)] fs_info:UpdateOutCardList() end + print("lingmeng OnFangziAction5") + info:UpdateFzList(fz, index, true) local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi printlog(getcard) - info:UpdateHandCard(getcard) - self:__CloseTip() + + print("lingmeng hand_left_count", info._player.hand_left_count) + info._player.hand_left_count = info._player.hand_left_count - 1 + info:UpdateHandCardWitness(true) + -- self:__CloseTip() end function M:OnUpdate() diff --git a/lua_probject/main_project/main/majiang/MJMainView.lua b/lua_probject/main_project/main/majiang/MJMainView.lua index 9d4cb269..c1862711 100644 --- a/lua_probject/main_project/main/majiang/MJMainView.lua +++ b/lua_probject/main_project/main/majiang/MJMainView.lua @@ -32,7 +32,7 @@ function M:InitView(url, use_custom_bg, custom_bg_config) local _view = self._view self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj") bg_config = custom_bg_config == nil and bg_config or custom_bg_config - if not use_custom_bg then + if use_custom_bg then TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) end diff --git a/wb_new_ui/assets/Main_Majiang/Main_new/Main_new_2_jiangxi.xml b/wb_new_ui/assets/Main_Majiang/Main_new/Main_new_2_jiangxi.xml index ceedf375..1fd270d4 100644 --- a/wb_new_ui/assets/Main_Majiang/Main_new/Main_new_2_jiangxi.xml +++ b/wb_new_ui/assets/Main_Majiang/Main_new/Main_new_2_jiangxi.xml @@ -6,7 +6,7 @@ - + @@ -152,10 +152,12 @@ - - + + + + -