diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index e5872659..bdb837c3 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -710,7 +710,7 @@ function M:UpdateFamilyRoom(fgCtr, id) obj:GetChild('btn_watch').onClick:Set(function() roomCtr:PublicWitnessRoom( Protocol.WEB_FG_Witness_ROOM, - roomList[newIndex].id, + startRoom[newIndex].id, id, function(response) if (response.ReturnCode == -1) then @@ -730,9 +730,39 @@ function M:UpdateFamilyRoom(fgCtr, id) end end, playInfo.gameId, - roomList[newIndex].pid + startRoom[newIndex].pid ) end) + obj:GetChild('btn_jiesan').onClick:Set(function() + local _curren_msg = + MsgWindow.new( + self._root_view, + '确定要解散该房间吗?', + MsgWindow.MsgMode.OkAndCancel + ) + _curren_msg.onOk:Add( + function() + ViewUtil.ShowModalWait(self._root_view) + local fgCtr = ControllerManager.GetController(NewGroupController) + + fgCtr:FG_RemoveRoom( + id, + startRoom[newIndex].id, + function(res) + if self._is_destroy then + return + end + ViewUtil.CloseModalWait() + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, '删除房间失败!') + return + end + end + ) + end + ) + _curren_msg:Show() + end) else local newIndex = index - #readyRoom + 1 local playInfo = playList[newIndex] @@ -771,6 +801,7 @@ function M:UpdateFamilyRoom(fgCtr, id) ) end) obj:GetChild('btn_watch').onClick:Clear() + obj:GetChild('btn_jiesan').onClick:Clear() end end -- print("=================================================list_room", list_room, list_room.numItems, all_num) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXSettingView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXSettingView.lua index 51905481..8574f66f 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXSettingView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXSettingView.lua @@ -41,27 +41,27 @@ function M:init(url) self.cBtn = self._view:GetController('cBtn') - -- slider_sound.value = GameApplication.Instance.SoundValue - -- slider_music.value = GameApplication.Instance.MusicValue + 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; + 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; + 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; + GameApplication.Instance.SoundMute = btn_sound.selected; end) btn_music.onClick:Add(function() - -- GameApplication.Instance.MusicMute = btn_music.selected; + GameApplication.Instance.MusicMute = btn_music.selected; end) local _btn_logout = self._view:GetChild('btn_cancelRoom') @@ -93,6 +93,18 @@ function M:init(url) ViewManager.ChangeView(ViewManager.View_Family) 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/majiang/lichuan/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua index 98eee8e4..bb993fef 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua @@ -70,19 +70,19 @@ function M:InitView(url) self._text_remined = self._view:GetChild('remaining_card') self._text_round = self._view:GetChild('text_round') self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj") - self._state.onChanged:Add(function() - self:UpdatePlayerInfoView() - end) + -- self._state.onChanged:Add(function() + -- self:UpdatePlayerInfoView() + -- end) self:UpdateRound() - -- self:InitPlayerInfoView() + self:InitPlayerInfoView() self._player_card_info = {} local _player_card_info = self._player_card_info for i = 1, #room.player_list do local p = room.player_list[i] local index = self:GetPos(p.seat) print("lingmeng index", index) - -- local info = self._player_info[index] + local info = self._player_info[index] local tem = self._view:GetChild("player_card_info" .. index) _player_card_info[index] = self:NewMJPlayerCardInfoView(tem, index) local cardInfo = _player_card_info[index] @@ -92,8 +92,8 @@ function M:InitView(url) for i = 1, #p.fz_list do cardInfo:UpdateFzList(p.fz_list[i], -1) end - -- info:FillData(p) - -- info._view.visible = true + info:FillData(p) + info._view.visible = true end local btn_rule = self._view:GetChild('btn_rule') @@ -154,8 +154,14 @@ function M:EventInit() local _gamectr = self._gamectr _gamectr:AddEventListener(GameEvent.PlayerEnter, function(...) + self:PlayMJSound("user_enter.mp3") local arg = { ... } - print("lingmeng witness PlayerEnter") + local p = arg[1] + local info = self._player_info[self:GetPos(p.seat)] + info:FillData(p) + info._view.visible = true + info:SetPlayer(p) + info:FillData() end) _gamectr:AddEventListener(GameEvent.WitnessPlayerEnter, function(...) @@ -307,7 +313,6 @@ function M:EventInit() -- if #niao == 0 then self._view:GetChild("n13").visible = false end self._clearingView:InitData(0, _room, result, nil, function(...) DataManager.CurrenRoom.self_player.card_list = {} - self._state.selectedIndex = 2 self._clearingView = nil end) end @@ -350,7 +355,7 @@ function M:InitPlayerInfoView() self._player_info = {} local _player_info = self._player_info for i = 1, self._room.room_config.people_num do - local tem = self._view:GetChild(string.format("player_info%d_%d", i, (self._state.selectedIndex % 2) + 1)) + local tem = self._view:GetChild(string.format("player_info%d_2", i)) _player_info[i] = PlayerInfoView.new(tem, self) tem.visible = false end @@ -427,20 +432,20 @@ function M:ShowJing() end end -function M:UpdatePlayerInfoView() - self._player_info = {} - local _player_info = self._player_info - local list = self._room.player_list +-- function M:UpdatePlayerInfoView() +-- self._player_info = {} +-- local _player_info = self._player_info +-- local list = self._room.player_list - for i = 1, self._room.room_config.people_num do - local seat = self:GetPos(list[i].seat) - local tem = self._view:GetChild(string.format("player_info%d_%d", seat, - (self._state.selectedIndex == 4 and 1 or 0) + 1)) - _player_info[seat] = PlayerInfoView.new(tem, self) - _player_info[seat]:FillData(list[i]) - printlog("lingmeng _player_info", tem, seat, list[i].self_user.nick_name) - end -end +-- for i = 1, self._room.room_config.people_num do +-- local seat = self:GetPos(list[i].seat) +-- local tem = self._view:GetChild(string.format("player_info%d_%d", seat, +-- (self._state.selectedIndex == 4 and 1 or 0) + 1)) +-- _player_info[seat] = PlayerInfoView.new(tem, self) +-- _player_info[seat]:FillData(list[i]) +-- printlog("lingmeng _player_info", tem, seat, list[i].self_user.nick_name) +-- end +-- end function M:OnUpdate() if (self._popEvent) then diff --git a/lua_probject/main_project/main/majiang/MJSettingViewNew.lua b/lua_probject/main_project/main/majiang/MJSettingViewNew.lua index 8b5d889f..2df23cf1 100644 --- a/lua_probject/main_project/main/majiang/MJSettingViewNew.lua +++ b/lua_probject/main_project/main/majiang/MJSettingViewNew.lua @@ -157,6 +157,17 @@ function M:init(url) ViewManager.ChangeView(ViewManager.View_Family) end) end) + + --游戏内解散房间功能 + self._view:GetController('lev').selectedIndex = 0 + self.btn_closeRoom.onClick:Set(function() + if self._flag_witness then + local _room = DataManager.CurrenRoom + self._mainView._gamectr:ExitWitnessGame(_room.play_id, _room.game_id, _room.room_id) + ViewManager.ChangeView(ViewManager.View_Family) + return + end + end) end --[[ diff --git a/wb_new_ui/assets/Main_Majiang/Main_new/Setting/Setting.xml b/wb_new_ui/assets/Main_Majiang/Main_new/Setting/Setting.xml index fb503bad..7921c8f6 100644 --- a/wb_new_ui/assets/Main_Majiang/Main_new/Setting/Setting.xml +++ b/wb_new_ui/assets/Main_Majiang/Main_new/Setting/Setting.xml @@ -5,6 +5,9 @@ + + + @@ -37,7 +40,9 @@ - + + + \ No newline at end of file diff --git a/wb_unity_pro/Assets/ART/base/main_majiang/ui/Main_Majiang_fui.bytes b/wb_unity_pro/Assets/ART/base/main_majiang/ui/Main_Majiang_fui.bytes index 107aebf2..310d0de6 100644 Binary files a/wb_unity_pro/Assets/ART/base/main_majiang/ui/Main_Majiang_fui.bytes and b/wb_unity_pro/Assets/ART/base/main_majiang/ui/Main_Majiang_fui.bytes differ