From 8f30fc3bd1f6c5865ed11269d7bd630c866a06de Mon Sep 17 00:00:00 2001 From: 1076390229 <1076390229@qq.com> Date: Sun, 27 Jul 2025 02:58:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E8=B7=9F=E8=B8=AA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Game/View/Family/InviteRoomView.lua | 57 +++++++++++ .../extend/Common/EXsettingView.lua | 98 +++++++++++++++++++ .../extend/Common/WitnessView.lua | 14 +++ 3 files changed, 169 insertions(+) create mode 100644 lua_probject/base_project/Game/View/Family/InviteRoomView.lua create mode 100644 lua_probject/extend_project/extend/Common/EXsettingView.lua create mode 100644 lua_probject/extend_project/extend/Common/WitnessView.lua diff --git a/lua_probject/base_project/Game/View/Family/InviteRoomView.lua b/lua_probject/base_project/Game/View/Family/InviteRoomView.lua new file mode 100644 index 00000000..fc51e8ed --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/InviteRoomView.lua @@ -0,0 +1,57 @@ +local InviteRoomView = {} + +local function Cancel(self) + print("不接受邀请") +end + +local function Enter(self) + print("接受邀请") +end + +function InviteRoomView.New() + setmetatable(InviteRoomView, { __index = BaseWindow }) + local inst = setmetatable({}, { __index = InviteRoomView }) + inst._close_destroy = true + BaseWindow.init(inst, "ui://Family/InviteRoom") + inst:Init() + return inst +end + +function InviteRoomView:Show(data) + self:Refalsh(data) + BaseWindow.Show(self) +end + +function InviteRoomView:Refalsh(data) + --local familyName = + --local inviterName = + --local gameName = + --local roomName = + --local game = + + self.tex_familyName.text = familyName + self.tex_inviterName.text = inviterName + self.tex_gameName.text = gameName + self.tex_roomName.text = roomName + self.tex_game.text = game +end + +function InviteRoomView:Init() + self.tex_familyName = self._view:GetChild("tex_familyName") + self.tex_inviterName = self._view:GetChild("tex_inviterName") + self.tex_gameName = self._view:GetChild("tex_gameName") + self.tex_roomName = self._view:GetChild("tex_roomName") + self.tex_game = self._view:GetChild("tex_game") + + self.btn_enter = self._view:GetChild("btn_enter") + self.btn_cancel = self._view:GetChild("btn_cancel") + + self.btn_enter.onClick:Set(function() + Enter(self) + end) + self.btn_cancel.onClick:Set(function() + Cancel(self) + end) +end + +return InviteRoomView \ No newline at end of file diff --git a/lua_probject/extend_project/extend/Common/EXsettingView.lua b/lua_probject/extend_project/extend/Common/EXsettingView.lua new file mode 100644 index 00000000..51905481 --- /dev/null +++ b/lua_probject/extend_project/extend/Common/EXsettingView.lua @@ -0,0 +1,98 @@ +--设置窗口对象 + +local EXSettingView = {} + +local M = EXSettingView +setmetatable(M, { __index = BaseWindow }) + +function EXSettingView:Show(room) + self._room = room + + -- 房主,第一个进房间的人 + local roomOwner = self._room.player_list[1].self_user.account_id + + if roomOwner == DataManager.SelfUser.account_id then + self.cBtn.selectedIndex = 1 + else + self.cBtn.selectedIndex = 0 + end + + BaseWindow.Show(self) +end + +function EXSettingView.new(main_view, flag_witness) + local self = setmetatable({}, { __index = M }) + self.class = 'EXSettingView' + self._close_destroy = true + self._mainView = main_view + self._flag_witness = flag_witness + self:init('ui://Main_Majiang/Setting') + return self +end + +function M:init(url) + BaseWindow.init(self, url) + + local view = self._view + local slider_sound = view:GetChild('slider_vedio_sound') + local slider_music = view:GetChild('slider_vedio_music') + local btn_music = view:GetChild('btn_vedio_music') + local btn_sound = view:GetChild('btn_vedio_sound') + + self.cBtn = self._view:GetController('cBtn') + + -- slider_sound.value = GameApplication.Instance.SoundValue + -- slider_music.value = GameApplication.Instance.MusicValue + + slider_music.onChanged:Add(function() + -- GameApplication.Instance.MusicValue = slider_music.value + -- btn_music.selected = false + -- GameApplication.Instance.MusicMute = false; + end) + + slider_sound.onChanged:Add(function() + -- GameApplication.Instance.SoundValue = slider_sound.value + -- btn_sound.selected = false + -- GameApplication.Instance.SoundMute = false; + end) + + btn_sound.onClick:Add(function() + -- GameApplication.Instance.SoundMute = btn_sound.selected; + end) + + btn_music.onClick:Add(function() + -- GameApplication.Instance.MusicMute = btn_music.selected; + end) + + local _btn_logout = self._view:GetChild('btn_cancelRoom') + _btn_logout.onClick:Set(function() + if self._flag_witness then + local _room = DataManager.CurrenRoom + pt(_room) + self._mainView._gamectr:ExitWitnessGame(_room.play_id, _room.game_id, + _room.room_id) + ViewManager.ChangeView(ViewManager.View_Family) + else + if self._mainView.dismiss_room_cd_time > 0 then + ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!") + else + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:AskDismissRoom() + end + end + end) + + self._view:GetChild("btn_closeRoom").onClick:Set(function() + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:LevelRoom(function(res) + print("退出房间") + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode) + return + end + ViewManager.ChangeView(ViewManager.View_Family) + end) + end) +end + +return M diff --git a/lua_probject/extend_project/extend/Common/WitnessView.lua b/lua_probject/extend_project/extend/Common/WitnessView.lua new file mode 100644 index 00000000..9a693db3 --- /dev/null +++ b/lua_probject/extend_project/extend/Common/WitnessView.lua @@ -0,0 +1,14 @@ +local MJSettingView = require("main.majiang.MJSettingViewNew") + +local WitnessView = {} +setmetatable(WitnessView, { __index = BaseView }) +function WitnessView:init() + self.btn_setting = self._view:GetChild("btn_setting") + + self.btn_setting.onClick:Set(function() + local view = MJSettingView.new(self, true) + view:Show() + end) +end + +return WitnessView \ No newline at end of file