From ad6a07242f3fa6bc400288f018e55fd78379d94e 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, 10 Oct 2025 20:34:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=91=E7=9A=84=E5=BF=AB=E8=A7=82=E6=88=98?= =?UTF-8?q?=E3=80=82=E5=9B=9E=E6=94=BE=E4=B8=8A=E6=AC=A1=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=EF=BC=8C=E7=BB=A7=E7=BB=AD=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=9B=9E=E6=94=BE=EF=BC=8C=E5=A3=B0=E9=9F=B3=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B9=8B=E7=B1=BB=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base_project/Game/View/WitnessView.lua | 62 +- .../extend/majiang/fuzhou/EXClearingView.lua | 4 + .../extend/majiang/fuzhou/EXPlayBackView.lua | 7 +- .../extend/majiang/jinxi/EXPlayBackView.lua | 8 +- .../extend/majiang/lichuan/EXPlayBackView.lua | 9 +- .../extend/majiang/nancheng/EXMainView.lua | 2 +- .../majiang/nancheng/EXPlayBackView.lua | 8 +- .../extend/poker/runfast/EXWitnessView.lua | 724 ++++++++++++++++++ .../extend/poker/runfast/ExtendConfig.lua | 57 ++ .../extend/poker/runfast/RunFast_MainView.lua | 4 +- .../poker/runfast/RunFast_PlayerBackView.lua | 2 + .../poker/runfast/RunFast_ResultView.lua | 3 +- .../main/majiang/MJPlayBackView.lua | 19 +- .../main_project/main/poker/PKMainView.lua | 71 +- .../main_project/main/poker/PKSettingView.lua | 2 +- .../main_project/main/poker/PKWitnessView.lua | 79 ++ .../Main_New/Component/Btn_Check.xml | 4 +- .../Main_New/Component/Btn_GamePlay.xml | 4 +- .../Main_New/Component/Btn_Message.xml | 4 +- .../Main_New/Component/Btn_MessageTalk.xml | 4 +- .../Main_New/Component/Btn_Setting.xml | 4 +- .../Main_New/Main/Component/btn_head.xml | 16 + .../Main_New/Main/Component/btn_normol(2).xml | 10 + .../Main_New/Main/Component/comp_witness.xml | 10 + .../Main/Component/comp_witnessPlayer.xml | 15 + .../Main_New/Main/Image/Group 241(1).png | Bin 0 -> 6203 bytes .../Main_New/Main/Image/Group 541.png | Bin 0 -> 2959 bytes .../Main_New/Player_card_info_2.xml | 4 +- .../RunFast_Main_New_2.xml | 38 +- .../RunFast_Main_New_3.xml | 28 +- .../Extend_Poker_RunFastNew/package.xml | 6 + .../ui/Extend_Poker_RunFastNew_atlas0.png | Bin 2166514 -> 2478411 bytes .../ui/Extend_Poker_RunFastNew_atlas0_1.png | Bin 1926461 -> 1643214 bytes .../ui/Extend_Poker_RunFastNew_fui.bytes | Bin 206896 -> 209695 bytes 34 files changed, 1071 insertions(+), 137 deletions(-) create mode 100644 lua_probject/extend_project/extend/poker/runfast/EXWitnessView.lua create mode 100644 lua_probject/main_project/main/poker/PKWitnessView.lua create mode 100644 wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Component/btn_head.xml create mode 100644 wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Component/btn_normol(2).xml create mode 100644 wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Component/comp_witness.xml create mode 100644 wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Component/comp_witnessPlayer.xml create mode 100644 wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Image/Group 241(1).png create mode 100644 wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Main/Image/Group 541.png diff --git a/lua_probject/base_project/Game/View/WitnessView.lua b/lua_probject/base_project/Game/View/WitnessView.lua index e238cb28..91f7505c 100644 --- a/lua_probject/base_project/Game/View/WitnessView.lua +++ b/lua_probject/base_project/Game/View/WitnessView.lua @@ -38,9 +38,8 @@ function M:InitView(url) local room = self._room BaseView.InitView(self, url) - - self.com_logocType = self._view:GetChild("com_logo"):GetController("cType") + self._state = self._view:GetController("state") self.com_notice = self._view:GetChild("com_notice") end @@ -50,7 +49,7 @@ function M:EventInit() local _room = self._room _gamectr:AddEventListener(GameEvent.PlayerEnter, function(...) - self:PlayMJSound("user_enter.mp3") + ViewUtil.PlaySound("WitnessView", "base/main_majiang/sound/user_enter.mp3") local arg = { ... } local p = arg[1] local info1 = self._player_info[self:GetPos(p.seat)] @@ -58,8 +57,10 @@ function M:EventInit() info1._view.visible = true local info2 = self._player_card_info[self:GetPos(p.seat)] - info2:SetPlayer(p) - info2:FillData() + if info2.SetPlayer then + info2:SetPlayer(p) + info2:FillData() + end end) _gamectr:AddEventListener(GameEvent.PlayerLeave, function(...) @@ -67,11 +68,12 @@ function M:EventInit() local p = arg[1] local info1 = self._player_info[self:GetPos(p.seat)] info1._view.visible = false - self:PlayMJSound("user_leave.mp3") + ViewUtil.PlaySound("WitnessView", "base/main_majiang/sound/user_leave.mp3") end) _gamectr:AddEventListener(GameEvent.WitnessPlayerEnter, function(...) - self:PlayMJSound("user_enter.mp3") + ViewUtil.PlaySound("WitnessView", "base/main_majiang/sound/user_enter.mp3") + local arg = { ... } local witnessPlayerList = arg[1] self._room.witness_player_list = witnessPlayerList @@ -221,47 +223,6 @@ function M:MarkSelfTuoguan() GRoot.inst:AddChild(com_tuoguan) com_tuoguan:MakeFullScreen() com_tuoguan:Center() - --com_tuoguan.y = GRoot.inst.height - com_tuoguan.height - --com_tuoguan.x = (GRoot.inst.width - com_tuoguan.width) * 0.5 - -- local _msg_view = nil - -- com_tuoguan:GetChild('n0').onClick:Set( - -- function() - -- if _msg_view then - -- _msg_view:Dispose() - -- end - -- local _curren_msg = UIPackage.CreateObjectFromURL('ui://Common/MessageBox') - -- _msg_view = _curren_msg - -- _msg_view:GetChild('btn_ok').onClick:Set( - -- function() - -- _msg_view:Dispose() - -- _msg_view = nil - -- self._gamectr:Entrust(false) - -- end - -- ) - -- _msg_view:GetChild('btn_close').onClick:Set( - -- function() - -- _msg_view:Dispose() - -- _msg_view = nil - -- end - -- ) - - -- _msg_view:GetChild('btn_close1').onClick:Set( - -- function() - -- _msg_view:Dispose() - -- _msg_view = nil - -- end - -- ) - -- local roate = GRoot.inst.width / GRoot.inst.height - -- local num = 100 - -- if roate < 1.9 then - -- num = 250 - -- end - -- com_tuoguan:AddChild(_msg_view) - -- _msg_view:GetChild('tex_message').text = '确定要取消托管吗?' - -- _msg_view.x = (com_tuoguan.width - _msg_view.width) * 0.5 - num - -- _msg_view.y = (com_tuoguan.height - com_tuoguan.y - _msg_view.height) * 0.5 - -- end - -- ) end -- 取消标记自己托管 @@ -393,12 +354,7 @@ function M:OnUpdate() print("witness error") print(result) error(result) - -- self._gamectr = ControllerManager.GetController(GameController) - -- if self._gamectr then - -- self._gamectr:ResetConnect() - -- end end - --func() end end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua index b0dded67..488b68eb 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua @@ -269,6 +269,10 @@ function M:fillResult0(room, peopleNum, result) isMeCtr.selectedIndex = 1 end + if infoList.seat == room.self_player.seat then + isMeCtr.selectedIndex = 1 + end + if infoList.seat == room.banker_seat then isZhuang.selectedIndex = 1 end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua index 92da5863..bc898d8c 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua @@ -59,7 +59,7 @@ function M:FillRoomData(data) for i = 1, #room.player_list do local p = room.player_list[i] local card_info = _player_card_info[self:GetPos(p.seat)] - -- card_info:Clear() + card_info:Clear() table.sort(p.card_list, self.HandCardSortAndJing) card_info:UpdateHandCard(false, true) self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 @@ -103,7 +103,7 @@ function M:ShowStep(index) else info:UpdateOutCardList() end - if step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat then + if (step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat) or step.cmd == Record_Event.Evt_Action then info:UpdateHandCard(true, true) else info:UpdateHandCard(false, true) @@ -141,7 +141,7 @@ function M:ShowStep(index) end if step.cmd == Record_Event.Evt_Result then if not self.result then - self.result = EXClearingView.new(self._root_view, { flag_back = true }) + self.result = EXClearingView.new(self, { flag_back = true }) self.result:InitData(0, self._room, step.result_data) self.result._view.x = (GRoot.inst.width - self.result._view.width) * -0.5 self.result._view.width = GRoot.inst.width @@ -225,6 +225,7 @@ function M:CmdAction(cmd, index) fz.type = cmd.data.type fz.card = cmd.data.card fz.opcard = cmd.data.opcard + fz.from_seat = cmd.data.from_seat local uf = data.player_card_data[cmd.data.from_seat] if fz.type ~= FZType.Gang_An and fz.type ~= FZType.Gang_Peng then table.remove(uf.outcard_list, #uf.outcard_list) diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua index a359b491..316b4688 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua @@ -59,7 +59,7 @@ function M:FillRoomData(data) for i = 1, #room.player_list do local p = room.player_list[i] local card_info = _player_card_info[self:GetPos(p.seat)] - -- card_info:Clear() + card_info:Clear() table.sort(p.card_list, self.HandCardSortAndJing) card_info:UpdateHandCard(false, true) self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 @@ -67,6 +67,7 @@ function M:FillRoomData(data) self:GenerateAllStepData(data) self:UpdateStep(1) + self:Play() -- self:ShowStep(0) end @@ -102,7 +103,7 @@ function M:ShowStep(index) else info:UpdateOutCardList() end - if step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat then + if (step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat) or step.cmd == Record_Event.Evt_Action then info:UpdateHandCard(true, true) else info:UpdateHandCard(false, true) @@ -140,7 +141,7 @@ function M:ShowStep(index) end if step.cmd == Record_Event.Evt_Result then if not self.result then - self.result = EXClearingView.new(self._root_view, { flag_back = true }) + self.result = EXClearingView.new(self, { flag_back = true }) self.result:InitData(0, self._room, step.result_data) self.result._view.x = (GRoot.inst.width - self.result._view.width) * -0.5 self.result._view.width = GRoot.inst.width @@ -224,6 +225,7 @@ function M:CmdAction(cmd, index) fz.type = cmd.data.type fz.card = cmd.data.card fz.opcard = cmd.data.opcard + fz.from_seat = cmd.data.from_seat local uf = data.player_card_data[cmd.data.from_seat] if fz.type ~= FZType.Gang_An and fz.type ~= FZType.Gang_Peng then table.remove(uf.outcard_list, #uf.outcard_list) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua index fd75e955..333e1d3b 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua @@ -60,7 +60,7 @@ function M:FillRoomData(data) for i = 1, #room.player_list do local p = room.player_list[i] local card_info = _player_card_info[self:GetPos(p.seat)] - -- card_info:Clear() + card_info:Clear() table.sort(p.card_list, self.HandCardSortAndJing) card_info:UpdateHandCard(false, true) self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 @@ -101,14 +101,19 @@ function M:ShowStep(index) if step.cmd == Record_Event.Evt_OutCard and i == step.last_out_seat then local card = p.outcard_list[#p.outcard_list] info:UpdateOutCardList(nil, nil, self._cursor) + self:PlayMJSound("chupai.mp3") + self:PlaySound("LiChuan_MJ", p.self_user.sex, tostring(card)) else info:UpdateOutCardList() end - if (step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat) or step.cmd == Record_Event.Evt_Action then + if (step.cmd == Record_Event.Evt_GetCard or step.cmd == Record_Event.Evt_Action) and p.seat == step.current_out_seat then info:UpdateHandCard(true, true) else info:UpdateHandCard(false, true) end + if step.cmd == Record_Event.Evt_Action then + + end end if step.cmd == Record_Event.Evt_Win then self._win_pic = UIPackage.CreateObjectFromURL("ui://Main_Majiang/胡") diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index 89620e25..1b49fd48 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -912,7 +912,7 @@ function M:ReloadRoom(bskip) self._room._reload_flag = true end end - + self:reqResidueCard() self:ShowJing() for i = 1, #room.player_list do local p = room.player_list[i] diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua index 7d00d60e..54ccf012 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua @@ -59,7 +59,7 @@ function M:FillRoomData(data) for i = 1, #room.player_list do local p = room.player_list[i] local card_info = _player_card_info[self:GetPos(p.seat)] - -- card_info:Clear() + card_info:Clear() table.sort(p.card_list, self.HandCardSortAndJing) card_info:UpdateHandCard(false, true) self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 @@ -67,6 +67,7 @@ function M:FillRoomData(data) self:GenerateAllStepData(data) self:UpdateStep(1) + self:Play() -- self:ShowStep(0) end @@ -102,7 +103,7 @@ function M:ShowStep(index) else info:UpdateOutCardList() end - if step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat then + if (step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat) or step.cmd == Record_Event.Evt_Action then info:UpdateHandCard(true, true) else info:UpdateHandCard(false, true) @@ -140,7 +141,7 @@ function M:ShowStep(index) end if step.cmd == Record_Event.Evt_Result then if not self.result then - self.result = EXClearingView.new(self._root_view, { flag_back = true }) + self.result = EXClearingView.new(self, { flag_back = true }) self.result:InitData(0, self._room, step.result_data) self.result._view.x = (GRoot.inst.width - self.result._view.width) * -0.5 self.result._view.width = GRoot.inst.width @@ -224,6 +225,7 @@ function M:CmdAction(cmd, index) fz.type = cmd.data.type fz.card = cmd.data.card fz.opcard = cmd.data.opcard + fz.from_seat = cmd.data.from_seat local uf = data.player_card_data[cmd.data.from_seat] if fz.type ~= FZType.Gang_An and fz.type ~= FZType.Gang_Peng then table.remove(uf.outcard_list, #uf.outcard_list) diff --git a/lua_probject/extend_project/extend/poker/runfast/EXWitnessView.lua b/lua_probject/extend_project/extend/poker/runfast/EXWitnessView.lua new file mode 100644 index 00000000..faaad1c3 --- /dev/null +++ b/lua_probject/extend_project/extend/poker/runfast/EXWitnessView.lua @@ -0,0 +1,724 @@ +local PKMainView = import("main.poker.PKMainView") +local RunFast_PlayerPokerInfoView = import(".RunFast_PlayerPokerInfoView") +local RunFast_PlayerSelfPokerInfoView = import(".RunFast_PlayerSelfPokerInfoView") +local RunFast_GameEvent = import(".RunFast_GameEvent") +local RunFast_ResultView = import(".RunFast_ResultView") +local RunFast_RightPanelView = import(".RunFast_RightPanelView") +local PlayerInfoView = import(".EXPlayerInfoView") +local TableBG = import('Game.Data.TableBG') +local WitnessView = require("main.poker.PKWitnessView") +local RunFast_CardCheck = import(".CardCheck") + +local M = {} + +function M.new() + setmetatable(M, { __index = WitnessView }) + local self = setmetatable({}, { __index = M }) + self.class = "EXMJWitness" + self:init() + + self._gamectr = ControllerManager.GetController(GameController) + return self +end + +function M:InitView(url) + local _room = DataManager.CurrenRoom + self._full = true + UIPackage.AddPackage("extend/poker/runfast/ui/Extend_Poker_RunFastNew") + getmetatable(M).__index.InitView(self, + "ui://Extend_Poker_RunFastNew/RunFast_Main_New_" .. _room.room_config.people_num) + local user_id = DataManager.SelfUser.account_id + + local json_data = Utils.LoadLocalFile(user_id .. _room.game_id .. "pai") + if json_data == nil then + local _gamectr = self._gamectr + self._room.pai = 0 + else + local _data = json.decode(json_data) + local pai = _data["pai"] + self._room.pai = pai + end + + self._player_info = {} + local _player_info = self._player_info + for i = 1, self._room.room_config.people_num do + local tem = self._view:GetChild("player_info" .. i) + _player_info[i] = PlayerInfoView.new(tem, self) + tem.visible = false + end + local list = self._room.player_list + for i = 1, #list do + local p = list[i] + local info = _player_info[self:GetPos(p.seat)] + info._view.visible = true + info:FillData(p) + end + + for i = 1, #self._room.player_list do + if self._room.self_player.seat == self._room.player_list[i].seat and self._room.self_player.self_user.account_id ~= self._room.player_list[i].self_user.account_id then + -- body + local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip") + local _action = self._view:AddChild(ErrorMsgTip) + _action.xy = Vector2((self._view.width - _action.width) / 4, self._view.height / 4) + local text = _action:GetChild("tex_message") + local btn1 = _action:GetChild("btn_connect") + local btn2 = _action:GetChild("btn_back") + text.text = "您来晚了,座位有人,请重新进牌桌" + btn1.visible = false + btn2:Center() + btn2.y = btn2.y + 50 + btn2.onClick:Set(function() + -- body + ErrorMsgTip:Destroy() + ErrorMsgTip = nil + self._gamectr:LevelRoom(function(res) + ViewUtil.CloseModalWait() + NetResetConnectWindow.CloseNetReset() + ControllerManager.ChangeController(LoddyController) + ViewManager.ChangeView(ViewManager.View_Lobby) + end) + end) + end + end + + self.ctr_state = self._view:GetController("state") + self._ctr_action = self._view:GetController("action") + self.ctr_time = self._view:GetController("time") + self.ctr_card_eff = self._view:GetController("card_eff") + self._player_card_info = {} + + local _player_card_info = self._player_card_info + for i = 1, _room.room_config.people_num do + local tem = self._view:GetChild("player_card_info_" .. i) + _player_card_info[i] = self:NewPlayerCardInfoView(tem, i) + end + + if not _room.self_player.ready then + local round = DataManager.CurrenRoom.room_config.config.times or 1 + local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai + if xpconfig then + if round > 1 then + self._ctr_action.selectedIndex = 1 + else + self._ctr_action.selectedIndex = 2 + end + else + self._ctr_action.selectedIndex = 1 + end + else + self._ctr_action.selectedIndex = 0 + end + self._left_time = 0 + self.bgm_index = 1 + self._state.selectedIndex = 4 + + self._view:GetChild("btn_back_jiesan").onClick:Set(function() + if self.dismiss_room_cd_time > 0 then + ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!") + else + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:AskDismissRoom() + end + end) + + self:ChangeBgmMusic() + self:EventInit() + UpdateBeat:Add(self.OnUpdate, self) + + self._text_currenRound = self._view:GetChild('Text_CurrenRound') + self._text_maxRound = self._view:GetChild('Text_MaxMaxRound') + + self._cardCheck = RunFast_CardCheck:InitFlag() + self._gamectr._cardCheck = self._cardCheck + self:UpdateRound(0) + + --按钮功能全部未开放 + self._view:GetChild('Btn_Spectator').onClick:Set(function() + ViewUtil.ErrorMsg(self._view, "", "该功能还未开放") + end) + self._view:GetChild('Btn_Invite').onClick:Set(function() + ViewUtil.ErrorMsg(self._view, "", "该功能还未开放") + end) + + self._view:GetChild('text_roomId').text = self._room.room_id + self._ctr_inClear = self._view:GetController('Inclear') + self._view:GetChild('btn_ready_inClear').onClick:Set(function() + if self.result_view and self.result_view._view then + self._ctr_inClear.selectedIndex = 0 + self.result_view:ClearReady() + else + self.result_view = nil + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:ConformToNextGame() + end + end) + ---------------------------------------------------- + --闹钟倒计时报时 + self._leftTime_xiangling = 5 + self._leftTime_bianhong = true + + -----------如果进入观战时,已经开始游戏,则渲染画面------------ + if _room.curren_round > 0 then + self:UpdateRound(_room.curren_round) + local list = _room.player_list + for i = 1, #list do + local p = list[i] + local head_info = self._player_info[self:GetPos(p.seat)] + if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then + -- body + + if self._room.room_config.showlength == 1 then + -- body + head_info._view:GetController("shengyu").selectedIndex = 1 + else + head_info._view:GetController("shengyu").selectedIndex = 0 + end + + -- body + head_info._view:GetChild("shengyu").text = p.hand_count + end + p:Clear() + head_info:MarkBank(p.seat == _room.banker_seat) + head_info:FillData(p) + local card_info = self._player_card_info[self:GetPos(p.seat)] + card_info:Clear() + head_info:Ready(false) + end + end + ----------- + local rightpanel = self._view:GetChild("right_panel") + if self._rightPanelView ~= nil then + self._rightPanelView:Destroy() + end + + self._rightPanelView = RunFast_RightPanelView.new(self, rightpanel) +end + +function M:ChangeBgmMusic(bgm_index) + if bgm_index == nil then + bgm_index = self.bgm_index + else + self.bgm_index = bgm_index + end + ViewUtil.PlayMuisc("RunFastNew_PK", string.format("extend/poker/runfast/sound/bgm%d.mp3", 1)) +end + +function M:EventInit() + local _gamectr = ControllerManager.GetController(GameController) + getmetatable(M).__index.EventInit(self) + local _player_info = self._player_info + local _player_card_info = self._player_card_info + local _room = self._room + + + _gamectr:AddEventListener(RunFast_GameEvent.EventXiPai, function(...) + printlog("lingmeng pkwitness EventXiPai") + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnMingCard, function(...) + printlog("lingmeng pkwitness OnMingCard") + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnInitCard, function(...) + local arg = { ... } + local round = arg[1] + local cardlist = arg[2] + + if self.result_view ~= nil then + self.result_view:Destroy() + self.result_view = nil + end + + self._player_card_info[1]:HidePiao() + + if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then + -- body + self.MypokerList = cardlist + end + local otherpoker_list = self._view:GetChild("otherpoker_list") + + if otherpoker_list ~= nil then + -- body + otherpoker_list.visible = false + otherpoker_list:RemoveChildrenToPool() + end + self.ctr_card_eff.selectedIndex = 0 + if self.rank_view ~= nil then + self.rank_view:Dispose() + self.rank_view = nil + end + self._ctr_inClear.selectedIndex = 0 + self:UpdateRound(round) + -- ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/fapai.mp3") + local list = _room.player_list + for i = 1, #list do + local p = list[i] + local head_info = self._player_info[self:GetPos(p.seat)] + if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then + -- body + + if self._room.room_config.showlength == 1 then + -- body + head_info._view:GetController("shengyu").selectedIndex = 1 + else + head_info._view:GetController("shengyu").selectedIndex = 0 + end + + -- body + head_info._view:GetChild("shengyu").text = p.hand_count + end + p:Clear() + head_info:MarkBank(p.seat == _room.banker_seat) + head_info:FillData(p) + local card_info = self._player_card_info[self:GetPos(p.seat)] + card_info:Clear() + head_info:Ready(false) + end + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnIndexMove, function(...) + local arg = { ... } + local seat = arg[1] + local isNewBout = arg[2] + local index = self:GetPos(seat) + + + self.ctr_time.selectedIndex = index + -- for i = 1, #self._player_info do + -- if index == i then + -- -- body + -- local head_info = self._player_info[index] + -- head_info:MarkBank(true) + -- else + -- local head_info = self._player_info[i] + -- head_info:MarkBank(false) + -- end + -- end + + -- if index == 1 then + local card_info = self._player_card_info[index] + card_info:SetOutCardInfo(nil, false) + -- if self.MypokerList ~= nil then + -- -- body + -- card_info:Clear() + -- card_info:InitPoker(self.MypokerList, false) + -- self.MypokerList = nil + -- end + -- end + self._leftClock_continue = coroutine.start(function() + coroutine.wait(1) + for i = 1, #self._player_card_info do + local card_info = self._player_card_info[i] + if i == index then + card_info._ctr_time_clock.selectedIndex = 1 + self._tex_leftTime = card_info._view_comp_clock + else + card_info._ctr_time_clock.selectedIndex = 0 + end + -- if self._room.is_new_bout then + -- card_info.ctr_outpoker.selectedIndex = 0 + -- end + end + if self._left_time and self._left_time < 15 then + self._left_time = 15 + end + end) + + + if self._room.ming_card ~= nil then + self._view:GetTransition("t" .. index):Play() + self._room.ming_card = nil + if self.tween ~= nil then + TweenUtils.Kill(self.tween) + self.tween = nil + end + end + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnBombScore, function(...) + printlog("lingmeng pkwitness OnBombScore") + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnPlaySucc, function(...) + ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/playcard_chup.mp3") + self._popEvent = false + local arg = { ... } + local p = arg[1] + local card_number = arg[2] + local cardstype = arg[3] + local num = arg[4] + local otherList = arg[5] + local length = arg[6] + local lastCardList = arg[7] + self.ctr_time.selectedIndex = 0 + local index = self:GetPos(p.seat) + if index == 1 then + self.caozuo = 0 + end + + local head_info = self._player_info[index] + if head_info._view:GetChild("shengyu") ~= nil then + -- body + -- body + if card_number ~= nil then + -- body + head_info._view:GetChild("shengyu").text = card_number + end + end + head_info:SetBaoDan(card_number == 1) + local card_info = self._player_card_info[index] + card_info:SetOutCardInfo(p.out_card_list, false, true) + + for i = 1, #otherList do + local other_seat = otherList[i] + local other_card_info = self._player_card_info[self:GetPos(other_seat)] + other_card_info:SetOutCardBlack() + end + + if index == 1 then + card_info:DeleteHandCards(p.out_card_list) + else + -- card_info:SetRemainCardNumber(card_number == 1) + --card_info:UpdateHandPoker(card_number,false,false) -- todo + end + + -- if self._room.is_new_bout == true then + -- for i = 1, #self._room.player_list do + -- local player = self._room.player_list[i] + -- local card_info_i = self._player_card_info[self:GetPos(player.seat)] + -- if p.seat ~= player.seat then + -- card_info_i:SetOutCardInfo(nil, false) + -- end + -- end + -- self:_Effect(cardstype, p) + -- else + -- if cardstype == 11 and cardstype ~= 12 then + -- self:_Effect(cardstype, p) + -- end + -- end + self:_Effect(self._cardCheck.type, p) + + self:PlaySound(p.self_user.sex, + self:GetSoundFileName(self._cardCheck.type, num, self._room.is_new_bout)) + -- self:PlaySound(p.self_user.sex, self:GetSoundFileName(cardstype, num, self._room.is_new_bout)) + + if card_number == 1 then + --self:ChangeBgmMusic(2) + self:ChangeBgmMusic(1) + if self._cor_sound ~= nil then + coroutine.stop(self._cor_sound) + end + self._cor_sound = nil + self._cor_sound = coroutine.start(function() + self:PlaySound(p.self_user.sex, "card_1") + end) + end + end) + + + _gamectr:AddEventListener(RunFast_GameEvent.OnPassSuccCheckCard, function(...) + self._popEvent = false + local arg = { ... } + local seat = arg[1] + local cards = arg[2] + --self.MypokerList=cards + self.ctr_time.selectedIndex = 0 + local card_info = self._player_card_info[self:GetPos(seat)] + if seat == self._room.self_player.seat then + card_info:ClearCheck() + card_info:InitPoker(cards, false) + end + + self._popEvent = true + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnPassSucc, function(...) + local arg = { ... } + local p = arg[1] + + self.ctr_time.selectedIndex = 0 + local card_info = self._player_card_info[self:GetPos(p.seat)] + + --card_info:SetOutCardInfo(nil, false) + if p.seat == self._room.self_player.seat and self.MypokerList ~= nil then + -- body + card_info:Clear() + card_info:InitPoker(self.MypokerList, false) + self.MypokerList = nil + end + coroutine.stop(self._leftClock_continue) + card_info._ctr_time_clock.selectedIndex = 0 + card_info:SetOutCardInfo(nil, true) + self:PlaySound(p.self_user.sex, "pass_" .. math.random(1, 4)) + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnErrorTip, function(...) + local arg = { ... } + local error_str = arg[1] + self._player_card_info[1]:ErrorTip(error_str) + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnPiaoTips, function(...) + printlog("lingmeng pkwitness OnPiaoTips") + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnPiaoAction, function(...) + printlog("lingmeng pkwitness OnPiaoAction") + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnOptions, function(...) + printlog("lingmeng pkwitness OnOptions") + end) + -- 托管 + _gamectr:AddEventListener(RunFast_GameEvent.Game_TuoGuan, function(...) + printlog("lingmeng pkwitness Game_TuoGuan") + end) + _gamectr:AddEventListener(RunFast_GameEvent.OnResult, function(...) + local arg = { ... } + local over = arg[1] + local info = arg[2] + local win_seat = arg[3] + local remaincards = arg[4] + -- local energyTab = arg[5] + local otherpoker_list = self._view:GetChild("otherpoker_list") + local card_info = self._player_card_info[self:GetPos(self._room.self_player.seat)] + + if self.MypokerList ~= nil then + -- body + card_info:Clear() + card_info:InitPoker(self.MypokerList, false) + self.MypokerList = nil + end + if otherpoker_list ~= nil then + -- body + otherpoker_list:RemoveChildrenToPool() + otherpoker_list.visible = true + end + + if self._cor_sound ~= nil then + coroutine.stop(self._cor_sound) + self._cor_sound = nil + end + + if self.destory_win ~= nil then + coroutine.stop(self.destory_win) + end + + self.destory_win = nil + self.destory_win = coroutine.start(function() + if win_seat == self._room.self_player.seat then + ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3") + else + ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/lose_music.mp3") + end + coroutine.stop(self._leftClock_continue) + for i = 1, #self._player_card_info do + local card_info = self._player_card_info[i] + card_info._ctr_time_clock.selectedIndex = 0 + self._left_time = 0 + end + + for i = 1, #info do + local player = info[i] + local p = self._room:GetPlayerBySeat(player.seat) + local head_info = self._player_info[self:GetPos(player.seat)] + local card_info = self._player_card_info[self:GetPos(player.seat)] + + if player.seat ~= self._room.self_player.seat then + local oneTime = 7 / 60 + + -- card_info:UpdateHandPoker(player.cards, false, true) + + card_info._view_resultOut:RemoveChildrenToPool() + card_info._ctr_resultOut.selectedIndex = 1 + card_info.ctr_outpoker.selectedIndex = 0 + for i = 1, #player.handCards do + local child_card = card_info._view_resultOut:AddItemFromPool() + card_info:FillPoker(child_card, "", nil, player.handCards[i]) + ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/fanCard.mp3") + printlog("lingmeng oneTime", oneTime) + coroutine.wait(oneTime) + end + end + end + for i = 1, #info do + local player = info[i] + local p = self._room:GetPlayerBySeat(player.seat) + local head_info = self._player_info[self:GetPos(player.seat)] + head_info:SetBaoDan(false) + + head_info._view:GetChild('text_jifen').text = player.score + -- head_info:PlayScore(player.winscore, win_seat == player.seat) + head_info:PlayScore(player.card_score, win_seat == player.seat) + end + self:ChangeBgmMusic(1) + coroutine.wait(2) + + self.result_view = RunFast_ResultView.new(self, info, self._room.room_id, over, win_seat, 0, + remaincards) + self.result_view:SetDestroryCallback(function() + for i = 1, #self._player_card_info do + local card_info = self._player_card_info[i] + card_info.ctr_outpoker.selectedIndex = 0 + if card_info._ctr_resultOut then + card_info._ctr_resultOut.selectedIndex = 0 + end + end + end) + ------------观战把准备按钮隐藏了----------- + self._ctr_inClear.selectedIndex = 0 + self.result_view._view:GetChild('btn_nextRound').visible = false + ------------------------ + self.result_view:Show() + if self.WinItem_view ~= nil then + self.WinItem_view:Dispose() + self.WinItem_view = nil + end + if self.rank_view ~= nil then + self.rank_view:Dispose() + self.rank_view = nil + end + + if self._room.self_player.entrust == true then + local btn_confirm = self.result_view._view:GetChild("btn_confirm") + btn_confirm.onClick:Call() + end + ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3") + end) + if over == 1 then + -- body + self:UnmarkSelfTuoguan() + ControllerManager.ChangeController(LoddyController) + end + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnResultByDissolve, function(...) + local arg = { ... } + local over = arg[1] + local info = arg[2] + local winseat = arg[3] + local dissolve = arg[4] + ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3") + for i = 1, #self._player_card_info do + local card_info = self._player_card_info[i] + card_info._ctr_time_clock.selectedIndex = 0 + end + self.result_view = RunFast_ResultView.new(self, info, self._room.room_id, over, winseat, dissolve, nil) + self.result_view:Show() + ControllerManager.ChangeController(LoddyController) + self:UnmarkSelfTuoguan() + end) + + -- 确定开始下一局 成功 + _gamectr:AddEventListener(RunFast_GameEvent.OnConfrimToNextGameSucc, function(...) + local arg = { ... } + local aid = arg[1] + local p = self._room:GetPlayerById(aid) + if p.seat == self._room.self_player.seat then + if self.rank_view ~= nil then + self.rank_view:Dispose() + self.rank_view = nil + end + if self.destory_win ~= nil then + coroutine.stop(self.destory_win) + self.destory_win = nil + end + for _, player in ipairs(self._room.player_list) do + local player_card_info = self._player_card_info[self:GetPos(player.seat)] + local player_head = self._player_info[self:GetPos(player.seat)] + player_card_info:Clear() + local otherpoker_list = self._view:GetChild("otherpoker_list") + if otherpoker_list ~= nil then + -- body + otherpoker_list.visible = false + otherpoker_list:RemoveChildrenToPool() + end + --player_head._view:GetController("Oener").selectedIndex=0 + end + end + local player_info = self._player_info[self:GetPos(p.seat)] + player_info:Ready(true) + end) + + _gamectr:AddEventListener(RunFast_GameEvent.OnBompScoreNew, function(...) + local arg = { ... } + local scoreList = arg[1] + for i = 1, #scoreList do + local score = scoreList[i].pomSore + local player = self._room:GetPlayerBySeat(scoreList[i].seat) + local head_info = self._player_info[self:GetPos(scoreList[i].seat)] + head_info:PlayScore(score, true) + head_info:UpdateScore(player.total_score) + end + end) +end + +function M:NewPlayerCardInfoView(tem, index) + if index == 1 then + return RunFast_PlayerSelfPokerInfoView.new(tem, self) + end + return RunFast_PlayerPokerInfoView.new(tem, self) +end + +function M:GetPos(seat) + return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num) +end + +function M:UpdateRound(round) + local total_round = self._room.room_config.Times + -- self._text_round.text = string.format("%d / %d 局", round, total_round) + if not self._text_currenRound then + self._text_currenRound = self._view:GetChild('Text_CurrenRound') + end + if not self._text_maxRound then + self._text_maxRound = self._view:GetChild('Text_MaxMaxRound') + end + self._text_currenRound.text = round + self._text_maxRound.text = string.format("/%s局", total_round) +end + +function M:_Effect(type1, player) + if type1 == 1 or type1 == 3 or type1 == 7 then + self._popEvent = true + return + end + local info = self._player_card_info[self:GetPos(player.seat)] + info:PlayEffect(type1, function() + self._popEvent = true + end) +end + +function M:GetSoundFileName(type, num, isNewBout) + local fileName + if type == 1 or type == 3 or type == 7 then + local num = self._cardCheck.lastMinCard + if type == 1 then + fileName = string.format("1_%d", num) + elseif type == 3 then + fileName = string.format("2_%d", num) + elseif type == 7 then + fileName = string.format("3_%d", num) + end + else + if not isNewBout and type ~= 6 then + local r = math.random(1, 3) + fileName = "dani_" .. r + else + if type == 8 or type == 12 then + fileName = 5 + else + fileName = type + end + end + end + + return fileName +end + +function M:PlaySound(sex, path) + local sex_path = ViewUtil.Sex_Chat[sex] -- 1 男 2 女 + local sound_path = string.format("extend/poker/runfast/sound/%s/%s.mp3", sex_path, path) + ViewUtil.PlaySound("RunFastNew_PK", sound_path) +end + +return M diff --git a/lua_probject/extend_project/extend/poker/runfast/ExtendConfig.lua b/lua_probject/extend_project/extend/poker/runfast/ExtendConfig.lua index f3389505..4f0331aa 100644 --- a/lua_probject/extend_project/extend/poker/runfast/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/poker/runfast/ExtendConfig.lua @@ -11,6 +11,7 @@ local RunFast_RoomConfig = import(".RunFast_RoomConfig") local RunFast_Player = import(".RunFast_Player") local RunFast_Room = import(".RunFast_Room") local RunFast_PlayerBackView = import(".RunFast_PlayerBackView") +local EXWitnessView = import(".EXWitnessView") local ExtendConfig = {} @@ -25,6 +26,8 @@ function ExtendConfig.new() self._viewMap = {} self._viewMap[ViewManager.View_Main] = RunFast_MainView self._viewMap[ViewManager.View_PlayBack] = RunFast_PlayerBackView + self._viewMap[ViewManager.View_Witness] = EXWitnessView + return self end @@ -252,6 +255,60 @@ function M:FillPlayBackData(pd_data) room.cmdList = pd_data["cmdList"] end +function M:FillWitnessData(pd_data) + print("==========================FillWitnessData1") + local room = DataManager.CurrenRoom + pt(room) + if _ctr_game == nil then + self:GetGameController() + end + + local _tableInfo = pd_data["tableInfo"] + room.xipaiScore = _tableInfo["xipai_score"] + + local _config = _tableInfo["config"] + room.room_config = RunFast_RoomConfig.new(_config) + + room.curren_round = _tableInfo["round"] + + local playerList = _tableInfo["playerData"] + for i = 1, #playerList do + local _jp = playerList[i] + + local p = RunFast_Player.new() + p.seat = _jp["seat"] + local online = _jp["online"] + p.line_state = online + p.ready = _jp["ready"] == 1 and true or false + local pid = _jp["aid"] + if p.seat == 1 then room.self_player = p end + local u = User.new() + u.account_id = pid + p.self_user = u + u.nick_name = _jp["nick"] + u.head_url = _jp["portrait"] + u.sex = _jp["sex"] + p.self_user.location = Location.new(_jp["pos"] or "") + p.self_user.host_ip = _jp["ip"] + p.total_score = _jp["score"] or 0 + if _jp.hp_info then + p.cur_hp = _jp.hp_info.cur_hp + end + p.hp_info = _jp["hp_info"] + + if _jp["entrust"] then + p.entrust = _jp.entrust + end + room:AddPlayer(p) + end + + + + local owner = pd_data["owner"] + room.owner_id = owner + room.game_status = 0 +end + function M:LoadConfigToDetail(data) return data end diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua index 267af82d..f6e04f7c 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua @@ -938,7 +938,7 @@ function M:EventInit() if player.seat ~= self._room.self_player.seat then local oneTime = 7 / 60 - card_info:UpdateHandPoker(player.cards, false, true) + -- card_info:UpdateHandPoker(player.cards, false, true) card_info._view_resultOut:RemoveChildrenToPool() card_info._ctr_resultOut.selectedIndex = 1 @@ -1214,7 +1214,7 @@ function M:ReconnectForClearing() if player.seat == self._room.self_player.seat then player_card_info:InitPoker(player.hand_list, false) else - player_card_info:UpdateHandPoker(player.hand_list, false, true) + -- player_card_info:UpdateHandPoker(player.hand_list, false, true) end if player.out_card_list[1] == 0 then player_card_info:SetOutCardInfo(nil, false) diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua index 3a1c0024..2b4d78f7 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua @@ -44,6 +44,7 @@ function M:InitView(url) UIPackage.AddPackage('extend/poker/runfast/ui/Extend_Poker_RunFastNew') PKPlayBackView.InitView(self, "ui://Extend_Poker_RunFastNew/RunFast_Main_New_" .. room.room_config.people_num, default_bg, bg_config) + self._tex_round = self._view:GetChild('round') self._player_card_info = {} local _player_card_info = self._player_card_info @@ -101,6 +102,7 @@ function M:FillRoomData(data) self._room = DataManager.CurrenRoom local _player_card_info = self._player_card_info local roominfo_panel = self._view:GetChild('roominfo_panel1') + self._room.pai = 0 roominfo_panel:GetChild('tex_roomid').text = data.info.roomid roominfo_panel:GetChild('tex_gametype').text = room.room_config:GetGameName() diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_ResultView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_ResultView.lua index 810057b4..c7dd2a28 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_ResultView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_ResultView.lua @@ -45,7 +45,6 @@ function M:init(url, data, roomid, over, win_seat, dissolve, remaincards) self._view:GetChild('btn_over1Close').onClick:Set(function() if over == 0 then self:Close() - self._root_runFast._ctr_inClear.selectedIndex = 1 else self._view:GetController('over').selectedIndex = 1 end @@ -89,7 +88,7 @@ function M:init(url, data, roomid, over, win_seat, dissolve, remaincards) obj:GetController('chuntian').selectedIndex = info.chuntian and 1 or 0 end over0List.numItems = #data - + self._root_runFast._ctr_inClear.selectedIndex = 1 if over == 1 or (not over and #data == 2) then local bigSeat = 0 diff --git a/lua_probject/main_project/main/majiang/MJPlayBackView.lua b/lua_probject/main_project/main/majiang/MJPlayBackView.lua index 47135982..31ec5a72 100644 --- a/lua_probject/main_project/main/majiang/MJPlayBackView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayBackView.lua @@ -111,7 +111,7 @@ function M:NextRecordPlay() self:RemoveCursor() local result = PlayBackView.NextRecordPlay(self) if not result then return end - self:ChangePlayState(true) + self:ChangePlayState(false) self._speed = 1 self._playFoward = true self:ChangeTextSpeed() @@ -121,7 +121,7 @@ function M:LastRecordPlay() self:RemoveCursor() local result = PlayBackView.LastRecordPlay(self) if not result then return end - self:ChangePlayState(true) + self:ChangePlayState(false) self._speed = 1 self._playFoward = true self:ChangeTextSpeed() @@ -217,6 +217,21 @@ function M:MaxSpeedArriws() self._speed = 30 end +local majiang_asset_path = "base/main_majiang/sound/" +function M:PlayMJSound(path) + ViewUtil.PlaySound(self.asset_group, majiang_asset_path .. path) +end + +function M:PlayMJMusic(path) + ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path) +end + +function M:PlaySound(group, sex, path) + local sex_path = ViewUtil.Sex_Chat[sex] + local path1 = majiang_asset_path .. string.format("%s/%s.mp3", sex_path, path) + ViewUtil.PlaySound(group, path1) +end + function M:OnUpdate() if self._play then if (self._currentStep == #self.cmdList and self._playFoward) then diff --git a/lua_probject/main_project/main/poker/PKMainView.lua b/lua_probject/main_project/main/poker/PKMainView.lua index 10166b80..e0f3aa8a 100644 --- a/lua_probject/main_project/main/poker/PKMainView.lua +++ b/lua_probject/main_project/main/poker/PKMainView.lua @@ -26,46 +26,8 @@ function M:InitView(url, isHideIpAdds, settingViewType, ex_defaultbg, ex_bgconfi local bg_config = ex_bgconfig or pk_bg_config -- 设置界面初始化方法 self.NewSettingView = function(self) - -- -- 根据settingViewType和self._state判断界面按钮功能显示 - -- local stype = 0 - -- local room = DataManager.CurrenRoom - -- local ispanguangzhe = room.self_player.seat == 0 - -- if self._state.selectedIndex == 3 then - -- stype = 0 - -- elseif settingViewType < 2 then - -- stype = settingViewType - -- elseif settingViewType == 2 then - -- if (ispanguangzhe or self._state.selectedIndex == 0) then - -- stype = 2 - -- else - -- stype = 3 - -- end - -- elseif settingViewType == 3 then - -- if not ispanguangzhe and self._state.selectedIndex > 0 then - -- stype = 3 - -- else - -- stype = 2 - -- end - -- end--self._root_view local settingView = PKSettingView.new(self, 0, isHideJiesan, settingUrl, handler(self, self.UpdateCardSize)) - -- 获取MainView界面state控制器选项 - -- settingView.__checkMainViewState = function() - -- return self._state.selectedIndex - -- end - -- -- 设置界面换牌功能回调 - -- if settingViewType == 1 then - -- settingView.__changePokerCallBack = handler(self, self.UpdateCard) - -- settingView.__changePokerSizeCallBack = handler(self, self.UpdateCardSize) - -- end - -- settingView:FillBgSection( - -- function(url) - -- LoadGameBg(url, self._root_view) - -- end, - -- self._room.game_id, - -- default_bg, - -- bg_config - -- ) return settingView end @@ -85,6 +47,8 @@ function M:InitView(url, isHideIpAdds, settingViewType, ex_defaultbg, ex_bgconfi checkG:Show() end) end + + self.com_notice = self._view:GetChild("com_notice") end function M:InitXiPai() @@ -150,6 +114,31 @@ function M:PlayXiPai1(xipaiCallBack) end end +function M:DoNoticeAnimation() + self.noticeIndex = self.noticeIndex or 1 + if not DataManager.GameNotice or #DataManager.GameNotice == 0 then + return + end + + local text_notice = self.com_notice:GetChild("text_notice") + text_notice.text = DataManager.GameNotice[self.noticeIndex] + local speed = 44 + local time = text_notice.width / speed + + text_notice.x = self.com_notice.width + + local tween = text_notice:TweenMove(Vector2(-text_notice.width, text_notice.y), time):OnComplete(function() + self:DoNoticeAnimation() + end) + + tween:SetEase(EaseType.Linear) + + self.noticeIndex = self.noticeIndex + 1 + if self.noticeIndex > #DataManager.GameNotice then + self.noticeIndex = 1 + end +end + -- 设置界面的换牌回调,需要换牌的玩法settingViewType传1,重写这个方法 function M:UpdateCard(index) end @@ -157,6 +146,12 @@ end function M:UpdateCardSize(index) end +function M:Show() + getmetatable(M).__index.Show(self) + ViewUtil.PlaySound("RunFastNew_PK", "base/main_majiang/sound/game_backmusic.mp3") + self:DoNoticeAnimation() +end + function M:Destroy() UIPackage.RemovePackage('base/main_poker/ui/Main_Poker') MainView.Destroy(self) diff --git a/lua_probject/main_project/main/poker/PKSettingView.lua b/lua_probject/main_project/main/poker/PKSettingView.lua index 547f4366..7d2b4815 100644 --- a/lua_probject/main_project/main/poker/PKSettingView.lua +++ b/lua_probject/main_project/main/poker/PKSettingView.lua @@ -35,7 +35,7 @@ function M:Close() BaseWindow.Close(self) end -function PKSettingView.new(blur_view, show_type, isjiesan, url, cardSizeHandle) +function PKSettingView.new(blur_view, show_type, isjiesan, url, cardSizeHandle, flag_witness) setmetatable(SettingView, { __index = BaseWindow }) setmetatable(M, { __index = SettingView }) -- setmetatable(M, { __index = BaseWindow }) diff --git a/lua_probject/main_project/main/poker/PKWitnessView.lua b/lua_probject/main_project/main/poker/PKWitnessView.lua new file mode 100644 index 00000000..1b722261 --- /dev/null +++ b/lua_probject/main_project/main/poker/PKWitnessView.lua @@ -0,0 +1,79 @@ +local WitnessView = require("Game.View.WitnessView") +local PKSettingView = import('.PKSettingView') +local TableBG = require("Game.Data.TableBG") + +local M = {} +setmetatable(M, { __index = WitnessView }) + +local pk_default_bg = 1 +local pk_bg_config = { + { id = 1, url = 'extend/poker/runfast/bg/bg1', thumb = 'ui://Extend_Poker_RunFastNew/table_bg1' }, + { id = 2, url = 'extend/poker/runfast/bg/bg2', thumb = 'ui://Extend_Poker_RunFastNew/table_bg2' }, + { id = 3, url = 'extend/poker/runfast/bg/bg3', thumb = 'ui://Extend_Poker_RunFastNew/table_bg3' } +} + +function M.new() + local self = setmetatable({}, { __index = M }) + self.class = "PKMJWitness" + self:init() + + return self +end + +function M:init() + getmetatable(M).__index.init(self) +end + +function M:InitView(url) + UIPackage.AddPackage('base/main_poker/ui/Main_Poker') + getmetatable(M).__index.InitView(self, url, isHideIpAdds) + + local default_bg = ex_defaultbg or pk_default_bg + local bg_config = ex_bgconfig or pk_bg_config + -- 设置界面初始化方法 + self.NewSettingView = function(self) + local settingView = PKSettingView.new(self, 0, isHideJiesan, settingUrl, + handler(self, self.UpdateCardSize), true) + return settingView + end + + local _view = self._view + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + -- self:InitXiPai() + -- self:InitXiPai1() + + self.com_notice = self._view:GetChild("com_notice") +end + +function M:DoNoticeAnimation() + self.noticeIndex = self.noticeIndex or 1 + if not DataManager.GameNotice or #DataManager.GameNotice == 0 then + return + end + + local text_notice = self.com_notice:GetChild("text_notice") + text_notice.text = DataManager.GameNotice[self.noticeIndex] + local speed = 44 + local time = text_notice.width / speed + + text_notice.x = self.com_notice.width + + local tween = text_notice:TweenMove(Vector2(-text_notice.width, text_notice.y), time):OnComplete(function() + self:DoNoticeAnimation() + end) + + tween:SetEase(EaseType.Linear) + + self.noticeIndex = self.noticeIndex + 1 + if self.noticeIndex > #DataManager.GameNotice then + self.noticeIndex = 1 + end +end + +function M:Show() + getmetatable(M).__index.Show(self) + ViewUtil.PlaySound("RunFastNew_PK", "base/main_majiang/sound/game_backmusic.mp3") + self:DoNoticeAnimation() +end + +return M diff --git a/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Component/Btn_Check.xml b/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Component/Btn_Check.xml index 7d927ea1..784ad3f2 100644 --- a/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Component/Btn_Check.xml +++ b/wb_new_ui/assets/Extend_Poker_RunFastNew/Main_New/Component/Btn_Check.xml @@ -1,10 +1,10 @@ - + -