diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index 525bec4b..39e58fd1 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -90,49 +90,47 @@ function M:InitView(url) showNextList.selectedIndex = -1 self._showNextName = nil end) - if self._room.room_config.people_num == 2 then - local btn_closeRoom = self._view:GetChild("btn_setting") + local btn_closeRoom = self._view:GetChild("btn_setting") - self._view:GetChild('btn_closeRoom').onClick:Set(function() - ---[[ - --旧 - local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)' - local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分) - local tipStr = '' - if self._room.agent then - tipStr = '您是否退出房间?' - else - tipStr = self._room.owner_id == self._room.self_player.self_user.account_id and tip_owner or tip - end - local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel) - _curren_msg.onOk:Add( - function() - if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then - ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。') - else - ViewUtil.ShowModalWait(self._root_view) - self._gamectr:LevelRoom( - function(res) - ViewUtil.CloseModalWait() - if res.ReturnCode == 0 then - ViewManager.ChangeView(ViewManager.View_Family) - else - ViewUtil.ErrorTip(res.ReturnCode) - end + self._view:GetChild('btn_closeRoom').onClick:Set(function() + ---[[ + --旧 + local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)' + local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分) + local tipStr = '' + if self._room.agent then + tipStr = '您是否退出房间?' + else + tipStr = self._room.owner_id == self._room.self_player.self_user.account_id and tip_owner or tip + end + local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel) + _curren_msg.onOk:Add( + function() + if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then + ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。') + else + ViewUtil.ShowModalWait(self._root_view) + self._gamectr:LevelRoom( + function(res) + ViewUtil.CloseModalWait() + if res.ReturnCode == 0 then + ViewManager.ChangeView(ViewManager.View_Family) + else + ViewUtil.ErrorTip(res.ReturnCode) end - ) - end + end + ) end - ) - _curren_msg:Show() - --]] - end) + end + ) + _curren_msg:Show() + --]] + end) - btn_closeRoom.onClick:Add(handler(self, function() - local settingView = SettingView.new(self) - settingView:Show() - end)) - end + btn_closeRoom.onClick:Add(handler(self, function() + local settingView = SettingView.new(self) + settingView:Show() + end)) -------- self:PlayerChangeLineState() @@ -192,13 +190,8 @@ function M:IsShowGangZi(btn, isShow) end function M:UpdateRound() - 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 + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) end function M:ShowJing()