diff --git a/lua_probject/base_project/Game/Controller/GameController.lua b/lua_probject/base_project/Game/Controller/GameController.lua index 73512dc5..725af097 100644 --- a/lua_probject/base_project/Game/Controller/GameController.lua +++ b/lua_probject/base_project/Game/Controller/GameController.lua @@ -530,7 +530,12 @@ end function M:PopEvent() local _cacheEvent = self._cacheEvent if (_cacheEvent:Count() > 0) then - return _cacheEvent:Dequeue() + local rawFunc = _cacheEvent:Dequeue() + return function(...) + return xpcall(rawFunc, function(e) + return debug.traceback("Lua Error: " .. tostring(e), 2) + end, ...) + end end end diff --git a/lua_probject/base_project/Game/IGameInfo.lua b/lua_probject/base_project/Game/IGameInfo.lua index a5e2ff59..5ff784a2 100644 --- a/lua_probject/base_project/Game/IGameInfo.lua +++ b/lua_probject/base_project/Game/IGameInfo.lua @@ -17,11 +17,11 @@ IGameInfo = { local M = IGameInfo function M:SelectedCardNum() - return 0 + return 0 end function M:SelectedConfigData() - return {} + return {} end function M:FillData() @@ -42,14 +42,14 @@ end function M:OnChangeOption(ctype) self:ShowRoomPrice(ctype) local round = self._config:GetController("round") - round.onChanged:Set(function () - self:ShowVariablePrice(ctype) - end) + round.onChanged:Set(function() + self:ShowVariablePrice(ctype) + end) end function M:ShowVariablePrice(ctype) -- 显示回合数后面的价格,tex_price1、tex_price2 - + for i = 1, self._roundChoice do local price = "0" price = self._game_data[string.format("pay%s_%s", i, self._maxPlayer)] @@ -72,18 +72,31 @@ function M:SetDefault() end -function M:LoadConfigToDetail(data) - - local returnString = '' - - local configData = data - if type(data) == 'string' then - configData = json.decode(data) - end - - pt(configData) +function M:LoadConfigToDetail(configData, hpData) + local returnString = "" + if configData.GPSDetection then + returnString = string.format("%s%s", returnString, + configData.GPSDetection == 0 and ",距离不限制" or string.format(",距离限制%s米", configData.GPSDetection)) + end + if configData.tuoguan_active_time then + returnString = string.format("%s%s", returnString, + configData.tuoguan_active_time == 0 and ",不自动托管" or string.format(",%s秒托管", configData.tuoguan_active_time)) + end + if hpData then + if hpData.JieShan then + returnString = string.format("%s%s", returnString, + hpData.JieShan == 1 and ",托管结束后不解散" or + string.format(",托管%s结束后强制解散", hpData.JieShan == 2 and "当局" or string.format("%s局", hpData.JieShan - 1))) + end + if hpData.BanChat then + returnString = string.format("%s%s", returnString, hpData.BanChat == 1 and ",不允许快捷聊天" or "") + end + if hpData.BanMissile then + returnString = string.format("%s%s", returnString, hpData.BanMissile == 1 and ",关闭互动表情" or "") + end + end return returnString end -return M \ No newline at end of file +return M diff --git a/lua_probject/base_project/Game/View/Family/FamilyEventView.lua b/lua_probject/base_project/Game/View/Family/FamilyEventView.lua index 744a152b..44877983 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyEventView.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyEventView.lua @@ -75,7 +75,6 @@ end function M:_evtDelPlay(...) local arg = { ... } - print("family event _evtDelPlay") local view = ViewManager.GetCurrenView() if view.class ~= "FamilyMainView" then diff --git a/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua b/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua index 25821f8a..ee3f2f77 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua @@ -12,25 +12,25 @@ local function charge(num, self) local _curren_msg = MsgWindow.new( self._root_view, - '确定要将房卡重置在改亲友圈?', + string.format('确定要向该亲友圈里充值%d房卡?', num), MsgWindow.MsgMode.OkAndCancel ) _curren_msg.onOk:Add( function() local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_Recharge_Diamo(self.groupId, num, function(res) - print("收到充值房卡回调") - pt(res) if res.ReturnCode ~= 0 then - ViewUtil.ErrorTip(res.ReturnCode, "操作失败") + ViewUtil.ErrorTip(res.ReturnCode, "重置房卡操作失败") return end + ViewUtil.ErrorTip(-1, "房卡充值成功") local groupDiamo = res.Data.groupDiamo local playerDiamo = res.Data.userDiamo self.tex_curCard.text = "当前帐号房卡:" .. playerDiamo self.tex_famliyCard.text = "亲友圈房卡:" .. groupDiamo self.group.groupDiamo = groupDiamo DataManager.SelfUser.diamo = playerDiamo + self:Destroy() end) end ) @@ -67,7 +67,27 @@ function FamilyRoomCard.New() obj:GetController("cColor").selectedIndex = data[_idx].colorIndex obj.onClick:Set(function() - charge(num, Instance) + if Instance.group and Instance.group ~= 1 then + local _curren_msg = + MsgWindow.new( + Instance._root_view, + "只有管理员可以充值", + MsgWindow.MsgMode.OnlyOk + ) + _curren_msg:Show() + return + end + if DataManager.SelfUser.diamo < num then + local _curren_msg = + MsgWindow.new( + Instance._root_view, + "您的房卡不足", + MsgWindow.MsgMode.OnlyOk + ) + _curren_msg:Show() + else + charge(num, Instance) + end end) end diff --git a/lua_probject/base_project/Game/View/Family/PlayEditView.lua b/lua_probject/base_project/Game/View/Family/PlayEditView.lua index 52ff69be..85e2754d 100644 --- a/lua_probject/base_project/Game/View/Family/PlayEditView.lua +++ b/lua_probject/base_project/Game/View/Family/PlayEditView.lua @@ -61,54 +61,56 @@ function PlayEditView:Init() group:addPlay(play) -- self:FillView() UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId) - self:Refalsh(self.groupId) + -- self:Refalsh(self.groupId) printlog("刷新玩法===>>>>") group.update_play = true end) tem:Show() end) - return - end - obj:GetChild('text_title').text = playList[index].game_name - local mode = ExtendManager.GetExtendConfig(playList[index].gameId):GetGameInfo() - local pId = playList[index].id - -- times倍数 - local times = json.decode(playList[index].hpData).times - obj:GetChild('Label_details'):GetChild('title').text = times / 1000 .. - "倍," .. mode:LoadConfigToDetail(playList[index].config, playList[index].hpData) - obj:GetChild('text_playName').emojies = EmojiDitc.EmojiesDitc - obj:GetChild('text_playName').text = Utils.TextOmit(playList[index].name, 6, "...") - obj:GetController('type').selectedIndex = 1 - obj:GetChild('btn_del').onClick:Set(function() - ViewUtil.ShowTwoChooose("是否要删除该玩法", function() - local fgCtr = ControllerManager.GetController(NewGroupController) - fgCtr:FG_DelPlay(self.groupId, playList[index].id, function(res) - if res.ReturnCode ~= 0 then - local msg = Table_Error_code_Map[res.ReturnCode] or {} - msg = msg.note or "操作失败" - ViewUtil.ShowBannerOnScreenCenter(msg) - return - end + else + obj:GetChild('text_title').text = playList[index].game_name + local mode = ExtendManager.GetExtendConfig(playList[index].gameId):GetGameInfo() + local pId = playList[index].id + -- times倍数 + local times = json.decode(playList[index].hpData).times + obj:GetChild('Label_details'):GetChild('title').text = mode:LoadConfigToDetail(playList[index].config, + playList[index].hpData) + obj:GetChild('text_playName').emojies = EmojiDitc.EmojiesDitc + obj:GetChild('text_playName').text = Utils.TextOmit(playList[index].name, 6, "...") + obj:GetController('type').selectedIndex = 1 + obj:GetChild('btn_del').onClick:Set(function() + ViewUtil.ShowTwoChooose("是否要删除该玩法", function() + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_DelPlay(self.groupId, playList[index].id, function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "删除玩法操作失败") + return + end - UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId) - self:Refalsh(self.groupId) + UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId) + -- self:Refalsh(self.groupId) + end) end) end) - end) - obj:GetChild("btn_edit").onClick:Set(function() - local tem = GroupGameSettingView.new(self.blur_view, self.groupId, pId, playList[index], - function(play) - local group = DataManager.groups:get(self.groupId) - group:addPlay(play) - -- self:FillView() - UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId) - self:Refalsh(self.groupId) - printlog("刷新玩法===>>>>") - group.update_play = true - end) - tem:Show() - end) + obj:GetChild("btn_edit").onClick:Set(function() + local tem = GroupGameSettingView.new(self.blur_view, self.groupId, pId, playList[index], + function(play) + local group = DataManager.groups:get(self.groupId) + group:addPlay(play) + -- self:FillView() + UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId) + -- self:Refalsh(self.groupId) + printlog("刷新玩法===>>>>") + group.update_play = true + end) + tem:Show() + end) + end end end +function PlayEditView:Destroy() + BaseWindow.Destroy(self) +end + return PlayEditView diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index e6883925..f5e2985f 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -315,8 +315,6 @@ function M:SetIsOpenChatRoom() if self._group.isOpenChatRoom == 1 then mgr_ctr:FG_CLOSE_ISOPEN_CHATROOM(self._group.id, function(res) - print("不允许成员可以查看聊天室") - pt(res) if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode) return @@ -326,8 +324,6 @@ function M:SetIsOpenChatRoom() end) elseif self._group.isOpenChatRoom == 0 then mgr_ctr:FG_OPEN_ISOPEN_CHATROOM(self._group.id, function(res) - print("允许成员可以查看聊天室") - pt(res) if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode) return @@ -390,10 +386,8 @@ function M:JoinFamily(frist) end function M:PlayEdit() - --self.familyType.selectedIndex = 2 - --self.lastType = 1 - local view = PlayEditView.New() - view:Show(self._group.id) + self._view_PlayEditView = PlayEditView.New() + self._view_PlayEditView:Show(self._group.id) end function M:OpenMyFamily(groupId) @@ -539,7 +533,13 @@ end function M:EnterGroup(fgCtr, id) fgCtr:FG_EnterGroup(id, function(res) ViewUtil:CloseModalWait() + ViewUtil:CloseModalWait2() if res.ReturnCode ~= 0 then + if res.ReturnCode == 101 then + ViewUtil:ShowModalWait2(0.01) + self:EnterGroup(fgCtr, id) + return + end ViewUtil.ErrorTip(res.ReturnCode, "获取房间列表列表失败") else self:OnEnterGroupCallBack() @@ -590,8 +590,6 @@ end function M:UpdateFamilyRoom(fgCtr, id) local list_room = self._view:GetChild('list_room') list_room:SetVirtual() - --local list_gamePlay = self._view:GetChild('list_gamePlay') - --list_gamePlay:SetVirtual() local playList = self._group.playList local roomList = self._group.rooms self._view:GetChild('n364').text = string.format("已开启%s桌游戏", #roomList) @@ -728,6 +726,10 @@ function M:UpdateFamilyRoom(fgCtr, id) else list_room.numItems = all_num end + --如果在编辑玩法页面则此处调用刷新 + if self._view_PlayEditView then + self._view_PlayEditView:Refalsh(self._group.id) + end end --房间渲染 diff --git a/lua_probject/base_project/Game/View/Lobby/CreateRoomView.lua b/lua_probject/base_project/Game/View/Lobby/CreateRoomView.lua index 1d600074..09ca5193 100644 --- a/lua_probject/base_project/Game/View/Lobby/CreateRoomView.lua +++ b/lua_probject/base_project/Game/View/Lobby/CreateRoomView.lua @@ -25,9 +25,9 @@ end function M:init(url) BaseWindow.init(self, url) - self.gl_view = GameListView.new(self._view, self.selectedIndex, nil, function(mode_data) + self.gl_view = GameListView.new(self._view, 1, 1, nil, function(mode_data) self:OnCreateRoom(mode_data) - end, true) + end, true, { _lobby_create = true }) --self.gl_view.IsHallGame=true end diff --git a/lua_probject/base_project/Game/View/Lobby/GameListView.lua b/lua_probject/base_project/Game/View/Lobby/GameListView.lua index 1cf77464..c105b256 100644 --- a/lua_probject/base_project/Game/View/Lobby/GameListView.lua +++ b/lua_probject/base_project/Game/View/Lobby/GameListView.lua @@ -4,9 +4,8 @@ local GameListView = {} local M = GameListView -function GameListView.new(view, index, page, room_config, callback, isHall) +function GameListView.new(view, index, page, room_config, callback, isHall, data) local self = {} - pt("lingmeng GameListView", view, index, page, room_config, callback, isHall) setmetatable(self, { __index = M }) self._view = view self._modeMap = {} @@ -15,6 +14,10 @@ function GameListView.new(view, index, page, room_config, callback, isHall) self.room_config = room_config self.IsHallGame = isHall or false self._callback = callback + if data then + self._data = data + self._lobby_create = data._lobby_create + end self:init() return self end @@ -30,6 +33,12 @@ function M:init() end end) + if self._lobby_create then + self._view:GetChild("Lobby_create").visible = true + else + self._view:GetChild("Lobby_create").visible = false + end + self.tempGame = { {}, {}, {} } local games = DataManager.SelfUser.games for k, v in ipairs(games) do diff --git a/lua_probject/base_project/Game/View/Lobby/GamePlayDetail.lua b/lua_probject/base_project/Game/View/Lobby/GamePlayDetail.lua index 5da993d4..991f1ce7 100644 --- a/lua_probject/base_project/Game/View/Lobby/GamePlayDetail.lua +++ b/lua_probject/base_project/Game/View/Lobby/GamePlayDetail.lua @@ -7,25 +7,25 @@ local gamePlayDetail = { --麻将 { { - icon0 = "lichuan0", - icon1 = "lichuan1", - detail = "lichuanDetail" + icon0 = "fuzhou0", + icon1 = "fuzhou1", + detail = "fuzhouDetail" }, { icon0 = "jinxi0", icon1 = "jinxi1", detail = "jinxiDetail" }, - { - icon0 = "fuzhou0", - icon1 = "fuzhou1", - detail = "fuzhouDetail" - }, { icon0 = "nancheng0", icon1 = "nancheng1", detail = "nanchengDetail" }, + { + icon0 = "lichuan0", + icon1 = "lichuan1", + detail = "lichuanDetail" + }, }, --扑克 { diff --git a/lua_probject/base_project/Game/View/Lobby/LobbySettingView.lua b/lua_probject/base_project/Game/View/Lobby/LobbySettingView.lua index 6a740e09..56b9c85a 100644 --- a/lua_probject/base_project/Game/View/Lobby/LobbySettingView.lua +++ b/lua_probject/base_project/Game/View/Lobby/LobbySettingView.lua @@ -28,15 +28,27 @@ function M:init(url) btn_music.selected = GameApplication.Instance.MusicMute slider_music.onChanged:Add(function() - GameApplication.Instance.MusicValue = slider_music.value - btn_music.selected = false - GameApplication.Instance.MusicMute = false; + local value = math.floor(slider_music.value) + if value > 0 then + btn_music.selected = false + GameApplication.Instance.MusicMute = false; + else + btn_music.selected = true + GameApplication.Instance.MusicMute = true; + end + GameApplication.Instance.MusicValue = value end) slider_sound.onChanged:Add(function() - GameApplication.Instance.SoundValue = slider_sound.value - btn_sound.selected = false - GameApplication.Instance.SoundMute = false; + local value = math.floor(slider_sound.value) + if value > 0 then + btn_sound.selected = false + GameApplication.Instance.SoundMute = false; + else + btn_sound.selected = true + GameApplication.Instance.SoundMute = true; + end + GameApplication.Instance.SoundValue = value end) btn_sound.onClick:Add(function() diff --git a/lua_probject/base_project/Game/View/LobbyView.lua b/lua_probject/base_project/Game/View/LobbyView.lua index ccec945a..8c30ccab 100644 --- a/lua_probject/base_project/Game/View/LobbyView.lua +++ b/lua_probject/base_project/Game/View/LobbyView.lua @@ -103,6 +103,7 @@ function M:InitView(url) -- clickTime = clickTime + 1 -- return -- end + local user = DataManager.SelfUser if user.group_id ~= 0 then self:ReconnectRoom(user.group_id) @@ -148,9 +149,9 @@ function M:InitView(url) end) local btn_diamo = self._view:GetChild("btn_diamo") - btn_diamo.onClick:Add(function() - ViewUtil.ErrorTip(self._view, string.format("当前房卡一共%s张", DataManager.SelfUser.diamo)) - end) + -- btn_diamo.onClick:Add(function() + -- ViewUtil.ErrorTip(self._view, string.format("当前房卡一共%s张", DataManager.SelfUser.diamo)) + -- end) local btn_customerService = self._view:GetChild("btn_customerService") btn_customerService.onClick:Add(function() @@ -510,18 +511,8 @@ function M:GetPlayerInfoData() self:ShowPlayerInfo(data.raffle, data.diamo, data.newMail) if data.group_id ~= 0 then -- 重连,确保头像加载成功才能重连 - -- ViewUtil.ShowModalWait2(self._root_view) - -- coroutine.start(function() - -- local waitTimes = 0 - -- while not self._flag_loadImageSucces do - -- if waitTimes > 10 then - -- break - -- end - -- coroutine.wait(0.2) - -- end - -- ViewUtil.CloseModalWait() + self:ReconnectRoom(data.groupId) - -- end) end end end) diff --git a/lua_probject/base_project/Game/View/LoginView.lua b/lua_probject/base_project/Game/View/LoginView.lua index 3dd63dc5..9c233cda 100644 --- a/lua_probject/base_project/Game/View/LoginView.lua +++ b/lua_probject/base_project/Game/View/LoginView.lua @@ -162,11 +162,31 @@ local function __login_response(self, response) ViewUtil.ShowModalWait(self._root_view, "正在加入房间...") __join_room(roomid, response) return + else + self:ReconnectRoom(user.group_id) + return end end __goto_lobby(response) end + --把拿取跑马灯信息放在这里 + local lobbyCtr1 = ControllerManager.GetController(LoddyController) + lobbyCtr1:UpdateNotice(DataManager.SelfUser.account_id, function(result, data) + if result then + if not data or not data.notice_list then + self._mesList = "" + else + local mesl = {} + for i = 1, #data.notice_list do + mesl[i] = data.notice_list[i] --.informContent + end + self._mesList = mesl + DataManager.GameNotice = mesl + end + end + end) + if user.update ~= 0 then ExtendHotupdate.UpdateGameList(user.games, f_enterLobby) else @@ -270,6 +290,49 @@ function M:LoginCallBack(result, data) end) end +--在进入前重连房间,如果有 +function M:ReconnectRoom(groupId) + local roomId = DataManager.SelfUser.room_id + print("===============================ReconnectRoom", roomId, 1) + if roomId and #roomId > 0 then + local roomCtr = ControllerManager.GetController(RoomController) + roomCtr:PublicJoinRoom( + Protocol.WEB_FG_JOIN_ROOM, + roomId, + false, + function(response) + if (response.ReturnCode == -1) then + ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, 'response.ReturnCode == -1') + RestartGame() + return + end + + if response.ReturnCode ~= 0 then + ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间失败') + FamilyView.lastId = groupId + ViewManager.ChangeView(ViewManager.View_Family) + return + else + UIPackage.AddPackage("base/lobby/ui/Lobby") + FamilyView.lastId = groupId + DataManager.SelfUser.room_id = "" + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_GroupList(function(res) + print("获取所有圈信息") + pt(res) + + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "重连获取亲友圈信息失败") + end + end) + ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id) + end + end, + groupId + ) + end +end + function M:Destroy() BaseView.Destroy(self) -- UIPackage.RemovePackage("base/embed/ui/Hotupdate") diff --git a/lua_probject/base_project/Game/View/MainView.lua b/lua_probject/base_project/Game/View/MainView.lua index 30b2894e..7fa7e190 100644 --- a/lua_probject/base_project/Game/View/MainView.lua +++ b/lua_probject/base_project/Game/View/MainView.lua @@ -334,6 +334,7 @@ function M:InitView(url, isHideIpAdds) self._chat_Talk.onTouchEnd:Set(self.__RecordTouchEnd, self) self._chat_Talk.onTouchMove:Set(handler(self, self.__RecordTouchMove)) Voice.BeginRecord() + self._record_view_ctr.selectedIndex = 0 self._ctr_voice.selectedIndex = 1 -- self.__runwait_record = nil -- self.__runwait_record = coroutine.start(self.__WaitRecord, self) @@ -702,7 +703,7 @@ function M:NewSettingView() end function M:__RecordTouchMove(context) - if Mathf.Abs(context.inputEvent.x - self._record_pos.x) >= 50 or Mathf.Abs(context.inputEvent.y - self._record_pos.y) >= 50 then + if Mathf.Abs(context.inputEvent.x - self._record_pos.x) >= 67 or Mathf.Abs(context.inputEvent.y - self._record_pos.y) >= 67 then self._record_view_ctr.selectedIndex = 1 else self._record_view_ctr.selectedIndex = 0 @@ -1198,39 +1199,39 @@ function M:MarkSelfTuoguan() 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 - ) + -- 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:Center() - _msg_view:GetChild('tex_message').text = '确定要取消托管吗?' + -- _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:Center() + -- _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 @@ -1334,7 +1335,7 @@ function M:OnUpdate() if result then else - error(resultInfo) + print("error", resultInfo) self._gamectr = ControllerManager.GetController(GameController) if self._gamectr then self._gamectr:ResetConnect() @@ -1513,6 +1514,7 @@ function M:Destroy() self:UnmarkSelfTuoguan() self:DestroyPlayerInfo() DSTweenManager.ClearTween() + MissileSender.Clear() NetResetConnectWindow.CloseNetReset() Voice.CrealRecord() diff --git a/lua_probject/base_project/Game/View/MissileSender.lua b/lua_probject/base_project/Game/View/MissileSender.lua index 931400d5..3b767d0f 100644 --- a/lua_probject/base_project/Game/View/MissileSender.lua +++ b/lua_probject/base_project/Game/View/MissileSender.lua @@ -90,4 +90,11 @@ function MissileSender.Animation(target, animUrl, view) e.xy = target.xy end +function MissileSender.Clear() + MissileSender = {} + pool = {} + curView = {} + MovieClipPool = {} +end + return MissileSender diff --git a/lua_probject/base_project/Game/View/ViewUtil.lua b/lua_probject/base_project/Game/View/ViewUtil.lua index 9a1a3f71..1f844024 100644 --- a/lua_probject/base_project/Game/View/ViewUtil.lua +++ b/lua_probject/base_project/Game/View/ViewUtil.lua @@ -55,7 +55,7 @@ function ViewUtil.CloseModalWait() ModalWaitingWindow.CloseModal() end -function ViewUtil.ShowModalWait2(blur_view, title, time) +function ViewUtil.ShowModalWait2(blur_view, time) ViewUtil.CloseModalWait2() ViewUtil.continue = coroutine.start( function() diff --git a/lua_probject/base_project/Game/View/WitnessView.lua b/lua_probject/base_project/Game/View/WitnessView.lua index 7df4147e..e238cb28 100644 --- a/lua_probject/base_project/Game/View/WitnessView.lua +++ b/lua_probject/base_project/Game/View/WitnessView.lua @@ -25,6 +25,15 @@ end -- 语音是否禁止 local record_baned = 0 +local function GetPlayer(self, playerId) + for _, p in pairs(self._room.player_list) do + if playerId == p.self_user.account_id then + return p + end + end + return nil +end + function M:InitView(url) local room = self._room BaseView.InitView(self, url) @@ -432,6 +441,7 @@ function M:Destroy() self:UnmarkSelfTuoguan() self:DestroyPlayerInfo() DSTweenManager.ClearTween() + MissileSender.Clear() NetResetConnectWindow.CloseNetReset() Voice.CrealRecord() diff --git a/lua_probject/base_project/table/Table_Error_code.lua b/lua_probject/base_project/table/Table_Error_code.lua index 2139302b..e1e19328 100644 --- a/lua_probject/base_project/table/Table_Error_code.lua +++ b/lua_probject/base_project/table/Table_Error_code.lua @@ -19,7 +19,7 @@ Table_Error_code_Map = { [4] = { id = 4, note = "" }, [5] = { id = 5, note = "玩法不可用" }, [6] = { id = 6, note = "游戏已停用" }, - [7] = { id = 7, note = "房卡不足" }, + [7] = { id = 7, note = "该亲友圈房卡不足,请联系亲友圈管理员!" }, [8] = { id = 8, note = "已经在亲友圈中" }, [9] = { id = 9, note = "邀请码无效" }, [10] = { id = 10, note = "房间已满" }, @@ -36,7 +36,7 @@ Table_Error_code_Map = { [26] = { id = 26, note = "创建房间数达到上限" }, [27] = { id = 27, note = "正在游戏中,删除房间失败" }, [28] = { id = 28, note = "多次登录失败,禁止登录,请过段时间再次尝试" }, - [101] = { id = 101, note = "请检查您的网络设置" }, + -- [101] = { id = 101, note = "请检查您的网络设置" }, --请检查您的网络设置,暂时注释 [102] = { id = 102, note = "网络连接超时" }, [500] = { id = 500, note = "" }, [999] = { id = 999, note = "未知错误" }, diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua index 005574c5..0c821a10 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua @@ -86,14 +86,17 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne end self:DestroyWithCallback() else - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + if over == 0 then + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:PlayerReady() + self:DestroyWithCallback() + else + mainCtr.selectedIndex = 1 + _overCtr.selectedIndex = 1 + end end end) - - endRound.onClick:Set(function() ViewManager.ChangeView(ViewManager.View_Family) end) @@ -115,15 +118,15 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne end end) elseif over == 1 then - mainCtr.selectedIndex = 1 - showBtnTypeCtr.selectedIndex = 1 self:fillResult1(room, peopleNum, total_result) if result then + _overCtr.selectedIndex = 0 self:fillResult0(room, peopleNum, result) nextRoundBtn2.onClick:Set(function() _overCtr.selectedIndex = 1 end) else + showBtnTypeCtr.selectedIndex = 1 _overCtr.selectedIndex = 1 end else --解散房间如果没有开局直接退出不显示结算界面,over=2 diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXGameInfo.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXGameInfo.lua index bfd7961d..e868e094 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXGameInfo.lua @@ -176,7 +176,7 @@ function M:LoadConfigData(data) self._config:GetChild("n93").text = string.format("奖%s马", data.jiangma * 2) end -function M:LoadConfigToDetail(data, hpdata) +function M:LoadConfigToDetailOnlyPlay(data, hpdata) local configData = data if type(data) == 'string' then configData = json.decode(data) @@ -184,7 +184,11 @@ function M:LoadConfigToDetail(data, hpdata) local hpData = configData.hpData or hpdata if type(hpData) == 'string' then - hpData = json.decode(hpData) + if hpData == "null" then + hpData = nil + else + hpData = json.decode(hpData) + end end local returnString = "" @@ -193,54 +197,57 @@ function M:LoadConfigToDetail(data, hpdata) end returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) - if configData.jiangma then - returnString = string.format("%s,%s马", returnString, - configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2)) - end if configData.zimo then returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") end if configData.shaozhuang then - returnString = string.format("%s%s", returnString, configData.shaozhuang == 0 and "" or ",有烧庄") + returnString = string.format("%s%s", returnString, configData.shaozhuang == 0 and ",不烧庄" or ",烧庄") end if configData.fengding then local matString = "%s%s" if configData.fengding == 0 then returnString = string.format(matString, returnString, ",封顶20炮") + else + returnString = string.format(matString, returnString, ",不封顶") end end if configData.TianDiHu then - returnString = string.format("%s%s", returnString, configData.TianDiHu == 0 and ",有天地胡" or "") + returnString = string.format("%s%s", returnString, configData.TianDiHu == 0 and ",天地胡玩法" or ",没有天地胡") + end + if configData.jiangma then + returnString = string.format("%s,%s马", returnString, + configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2)) end if configData.zikechengshun then - returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",有字可成顺" or "") + returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",字可成顺" or ",字不可成顺") end - if configData.zuangfenfanbei then - returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",庄家积分翻倍" or "") + if configData.zhuangfenfanbei then + returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",庄家积分翻倍" or ",庄家积分不翻倍") end - if configData.GPSDetection then - returnString = string.format("%s%s", returnString, - configData.GPSDetection == 0 and ",距离不限制" or string.format(",距离限制%s米", configData.GPSDetection)) + + return returnString +end + +function M:LoadConfigToDetail(data, hpdata) + local configData = data + if type(data) == 'string' then + configData = json.decode(data) end - if configData.tuoguan_active_time then - returnString = string.format("%s%s", returnString, - configData.tuoguan_active_time == 0 and ",不自动托管" or string.format(",%s秒托管", configData.tuoguan_active_time)) - end - if hpData then - if hpData.JieShan then - returnString = string.format("%s%s", returnString, - hpData.JieShan == 1 and ",托管结束后不解散" or - string.format(",托管%s结束后强制解散", hpData.JieShan == 2 and "当局" or string.format("%s局", hpData.JieShan - 1))) - end - if hpData.BanChat then - returnString = string.format("%s%s", returnString, hpData.BanChat == 1 and ",不允许快捷聊天" or "") - end - if hpData.BanMissile then - returnString = string.format("%s%s", returnString, hpData.BanMissile == 1 and ",关闭互动表情" or "") + + local hpData = configData.hpData or hpdata + if type(hpData) == 'string' then + if hpData == "null" then + hpData = nil + else + hpData = json.decode(hpData) end end - returnString = returnString .. IGameInfo.LoadConfigToDetail(self, data, hpdata) + local returnString = "" + + returnString = returnString .. self:LoadConfigToDetailOnlyPlay(data, hpdata) + + returnString = returnString .. IGameInfo.LoadConfigToDetail(self, configData, hpData) return returnString end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua index cf64d730..1db50640 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua @@ -57,11 +57,6 @@ function M:InitView(url) --[[ MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num) --]] - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), - json.encode(room.room_config.config.hpData)) - self._view:GetChild('wanfa_text').text = gamePlay self.jing = self._view:GetChild('jing') @@ -573,14 +568,14 @@ function M:OutCard(card) self:RemoveCursor() info:UpdateHandCard() - info:UpdateOutCardList(nil, card, self._cursor) - info._ctr_tip.selectedIndex = 0 - info._ctr_showGuoHu.selectedIndex = 0 - self:markOutCards(false, card) - self:PlaySound("FuZhou_MJ", self._room.self_player.self_user.sex, tostring(card)) - self:PlayMJSound("chupai.mp3") - -- self:ShowHuTip() - end) + info:UpdateOutCardList(nil, card, self._cursor) + info._ctr_tip.selectedIndex = 0 + info._ctr_showGuoHu.selectedIndex = 0 + self:markOutCards(false, card) + self:PlaySound("FuZhou_MJ", self._room.self_player.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") + -- self:ShowHuTip() + end) else printlog("鬼牌不能出===>>>" .. card) end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua index 552e6904..b6fb0525 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua @@ -20,17 +20,13 @@ end function M:InitView(url) local room = self._room UIPackage.AddPackage("extend/majiang/fuzhou/ui/Extend_MJ_FuZhou") - MJPlayBackView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) + MJPlayBackView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) local _cardbox = self._view:GetChild("cardbox") --self._view:GetChild("panel_record"):GetChild("btn_LastStep").enabled = false self._ctr_cardbox = _cardbox:GetController("c1") self._tex_round = self._view:GetChild("tex_round") self._tex_LeftCard = self._view:GetChild("remaining_card") self._anchor = self._view:GetChild("mask_tips") - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) - self._view:GetChild('wanfa_text').text = gamePlay self._eventmap = {} self._cmdmap = {} @@ -41,7 +37,7 @@ function M:InitView(url) self._cmdmap[Record_Event.Evt_Niao] = self.CmdNiao self._cmdmap[Record_Event.Evt_Piao] = self.CmdPiao self._cmdmap[Record_Event.Evt_Result] = self.CmdResult - self.com_logocType.selectedIndex = 0 + self.com_logocType.selectedIndex = 0 end function M:FillRoomData(data) @@ -60,14 +56,14 @@ function M:FillRoomData(data) roominfo_panel:GetChild("tex_roomid").text = room.room_id roominfo_panel:GetChild("tex_gametype").text = room.room_config:GetGameName() - 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() - table.sort(p.card_list, self.HandCardSortAndJing) - card_info:UpdateHandCard(false, true) - self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 - end + 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() + table.sort(p.card_list, self.HandCardSortAndJing) + card_info:UpdateHandCard(false, true) + self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 + end self:GenerateAllStepData(data) self:UpdateStep(1) @@ -115,8 +111,8 @@ function M:ShowStep(index) if step.cmd == Record_Event.Evt_Win then self._win_pic = UIPackage.CreateObjectFromURL("ui://Main_Majiang/胡") local info = self._player_card_info[self:GetPos(step.win)] - info._view:AddChild(self._win_pic) - self._win_pic:Center() + info._view:AddChild(self._win_pic) + self._win_pic:Center() else if self._win_pic then self._win_pic:Dispose() @@ -129,7 +125,7 @@ function M:ShowStep(index) list:RemoveChildrenToPool() for i = 1, #niao_list do local item = list:AddItemFromPool() - item.icon = UIPackage.GetItemURL("Main_Majiang", "b201_" .. niao_list[i].card) + item.icon = UIPackage.GetItemURL("Main_Majiang", "b201_" .. niao_list[i].card) if niao_list[i].score > 0 then item:GetController("bg").selectedIndex = 2 end @@ -143,25 +139,25 @@ function M:ShowStep(index) end 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: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 - self.result._view.height = GRoot.inst.height - -- self.result._view:GetChild("btn_confirm").visible = false - self._anchor:AddChild(self.result._view) - self.result._view.x = self._anchor.x * -1 - self.result._view.y = self._anchor.y * -1 - else - self.result._view.visible = true - end - -- self.result._view:Center() - -- else - -- if self.result then - -- self.result._view.visible = false - -- end - end + if not self.result then + self.result = EXClearingView.new(self._root_view, { 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 + self.result._view.height = GRoot.inst.height + -- self.result._view:GetChild("btn_confirm").visible = false + self._anchor:AddChild(self.result._view) + self.result._view.x = self._anchor.x * -1 + self.result._view.y = self._anchor.y * -1 + else + self.result._view.visible = true + end + -- self.result._view:Center() + -- else + -- if self.result then + -- self.result._view.visible = false + -- end + end end function M:GenerateAllStepData(data) @@ -292,8 +288,8 @@ function M:UpdateCardBox(seat) end function M:UpdateRound() - self._view:GetChild("text_round").text = string.format("局数:%d /%d", self._room.curren_round, - self._room.room_config.round) + self._view:GetChild("text_round").text = string.format("局数:%d /%d", self._room.curren_round, + self._room.room_config.round) end function M:UpdateStep(step) diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua index c1948322..069683ad 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua @@ -46,13 +46,9 @@ function M:InitView() self._anchor = self._view:GetChild("mask_tips") ------------------渲染桌面信息-------------------------- - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) self._view:GetChild('text_time').text = os.date("%H:%M", os.time()) self._view:GetChild('text_roomId').text = room.room_id - self._view:GetChild('wanfa_text').text = gamePlay self._state = self._view:GetController("state") self._text_remined = self._view:GetChild('remaining_card') @@ -352,7 +348,7 @@ function M:EventInit() info._view:GetController("text_color").selectedIndex = 1 info._view:GetChild("text_jifen").text = num end - + info._view:GetChild("mask_piao").title = "" info._view:GetController("piao_niao").selectedIndex = 0 p.fz_list = {} @@ -396,17 +392,17 @@ function M:EventInit() print("lingmeng witness EventResidueCard") end) - --替换mianview的事件 - _gamectr:AddEventListener( - GameEvent.PlayerState, - function(...) - printlog("lingmeng OnEventOnlineState") - local arg = { ... } - local p = arg[1] - local info = self._player_info[self:GetPos(p.seat)] - info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0 - end - ) + --替换mianview的事件 + _gamectr:AddEventListener( + GameEvent.PlayerState, + function(...) + printlog("lingmeng OnEventOnlineState") + local arg = { ... } + local p = arg[1] + local info = self._player_info[self:GetPos(p.seat)] + info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0 + end + ) end function M:InitPlayerInfoView() @@ -414,7 +410,7 @@ function M:InitPlayerInfoView() 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_2", i)) - _player_info[i] = PlayerInfoView.new(tem, self,true) + _player_info[i] = PlayerInfoView.new(tem, self, true) tem.visible = false end end diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua index 79977615..ffded275 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua @@ -86,9 +86,14 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne end self:DestroyWithCallback() else - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + if over == 0 then + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:PlayerReady() + self:DestroyWithCallback() + else + mainCtr.selectedIndex = 1 + _overCtr.selectedIndex = 1 + end end end) @@ -115,15 +120,15 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne end end) elseif over == 1 then - mainCtr.selectedIndex = 1 - showBtnTypeCtr.selectedIndex = 1 self:fillResult1(room, peopleNum, total_result) if result then + _overCtr.selectedIndex = 0 self:fillResult0(room, peopleNum, result) nextRoundBtn2.onClick:Set(function() _overCtr.selectedIndex = 1 end) else + showBtnTypeCtr.selectedIndex = 1 _overCtr.selectedIndex = 1 end else --解散房间如果没有开局直接退出不显示结算界面,over=2 diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXGameInfo.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXGameInfo.lua index ebca9907..c227e998 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXGameInfo.lua @@ -172,16 +172,19 @@ function M:LoadConfigData(data) self._config:GetChild("n93").text = string.format("奖%s马", data.jiangma * 2) end -function M:LoadConfigToDetail(data, hpdata) +function M:LoadConfigToDetailOnlyPlay(data, hpdata) local configData = data if type(data) == 'string' then configData = json.decode(data) end - pt("lingemng", data) local hpData = configData.hpData or hpdata if type(hpData) == 'string' then - hpData = json.decode(hpData) + if hpData == "null" then + hpData = nil + else + hpData = json.decode(hpData) + end end local returnString = "" @@ -190,58 +193,56 @@ function M:LoadConfigToDetail(data, hpdata) end returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) - if configData.jiangma then - returnString = string.format("%s,%s马", returnString, - configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2)) - end if configData.zimo then returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") end - if configData.shaozhuang then - returnString = string.format("%s%s", returnString, configData.shaozhuang == 0 and "" or ",有烧庄") - end if configData.fengding then local matString = "%s,%s" if configData.fengding == 0 then returnString = string.format(matString, returnString, "封顶20炮") elseif configData.fengding == 1 then returnString = string.format(matString, returnString, "封顶10炮") + else + returnString = string.format(matString, returnString, "不封顶") end end - if configData.TianDiHu then - returnString = string.format("%s%s", returnString, configData.TianDiHu == 0 and ",有天地胡" or "") - end - if configData.zikechengshun then - returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",有字可成顺" or "") + if configData.jiangma then + returnString = string.format("%s,%s马", returnString, + configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2)) end if configData.gangjiangma then - returnString = string.format("%s%s", returnString, configData.gangjiangma == 0 and ",杠算奖马" or "") + returnString = string.format("%s%s", returnString, configData.gangjiangma == 0 and ",杠算奖马" or ",杠不算奖马") end if configData.sanjingjiangma then - returnString = string.format("%s%s", returnString, configData.sanjingjiangma == 0 and ",三精算奖马" or "") + returnString = string.format("%s%s", returnString, configData.sanjingjiangma == 0 and ",三精算奖马" or ",三精不算奖马") end - if configData.GPSDetection then - returnString = string.format("%s%s", returnString, - configData.GPSDetection == 0 and ",距离不限制" or string.format(",距离限制%s米", configData.GPSDetection)) + if configData.zikechengshun then + returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",字可成顺" or ",字不可成顺") end - if configData.tuoguan_active_time then - returnString = string.format("%s%s", returnString, - configData.tuoguan_active_time == 0 and ",不自动托管" or string.format(",%s秒托管", configData.tuoguan_active_time)) + + return returnString +end + +function M:LoadConfigToDetail(data, hpdata) + local configData = data + if type(data) == 'string' then + configData = json.decode(data) end - if hpData then - if hpData.JieShan then - returnString = string.format("%s%s", returnString, - hpData.JieShan == 1 and ",托管结束后不解散" or - string.format(",托管%s结束后强制解散", hpData.JieShan == 2 and "当局" or string.format("%s局", hpData.JieShan - 1))) - end - if hpData.BanChat then - returnString = string.format("%s%s", returnString, hpData.BanChat == 1 and ",不允许快捷聊天" or "") - end - if hpData.BanMissile then - returnString = string.format("%s%s", returnString, hpData.BanMissile == 1 and ",关闭互动表情" or "") + + local hpData = configData.hpData or hpdata + if type(hpData) == 'string' then + if hpData == "null" then + hpData = nil + else + hpData = json.decode(hpData) end end - returnString = returnString .. IGameInfo.LoadConfigToDetail(self, data, hpData) + + local returnString = "" + + returnString = returnString .. self:LoadConfigToDetailOnlyPlay(data, hpdata) + + returnString = returnString .. IGameInfo.LoadConfigToDetail(self, configData, hpData) return returnString end diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua index c341edee..e4be8474 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua @@ -57,10 +57,6 @@ function M:InitView(url) --[[ MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num) --]] - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) - self._view:GetChild('wanfa_text').text = gamePlay self.jing = self._view:GetChild('jing') self._state.onChanged:Add(function() @@ -265,9 +261,9 @@ function M:EventInit() info:UpdateHandCard() local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url) info:UpdateOutCardList(outcard, card, self._cursor) - + self:PlayMJSound("chupai.mp3") -self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card)) + self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 end @@ -574,14 +570,14 @@ function M:OutCard(card) self:RemoveCursor() info:UpdateHandCard() - info:UpdateOutCardList(nil, card, self._cursor) - info._ctr_tip.selectedIndex = 0 - info._ctr_showGuoHu.selectedIndex = 0 - self:markOutCards(false, card) - self:PlaySound("JinXi_MJ", self._room.self_player.self_user.sex, tostring(card)) - self:PlayMJSound("chupai.mp3") - -- self:ShowHuTip() - end) + info:UpdateOutCardList(nil, card, self._cursor) + info._ctr_tip.selectedIndex = 0 + info._ctr_showGuoHu.selectedIndex = 0 + self:markOutCards(false, card) + self:PlaySound("JinXi_MJ", self._room.self_player.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") + -- self:ShowHuTip() + end) else printlog("鬼牌不能出===>>>" .. card) end diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua index ef2d47b8..a359b491 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua @@ -27,10 +27,6 @@ function M:InitView(url) self._tex_round = self._view:GetChild("tex_round") self._tex_LeftCard = self._view:GetChild("remaining_card") self._anchor = self._view:GetChild("mask_tips") - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) - self._view:GetChild('wanfa_text').text = gamePlay self._eventmap = {} self._cmdmap = {} @@ -41,7 +37,7 @@ function M:InitView(url) self._cmdmap[Record_Event.Evt_Niao] = self.CmdNiao self._cmdmap[Record_Event.Evt_Piao] = self.CmdPiao self._cmdmap[Record_Event.Evt_Result] = self.CmdResult - self.com_logocType.selectedIndex = 3 + self.com_logocType.selectedIndex = 3 end function M:FillRoomData(data) @@ -60,14 +56,14 @@ function M:FillRoomData(data) roominfo_panel:GetChild("tex_roomid").text = room.room_id roominfo_panel:GetChild("tex_gametype").text = room.room_config:GetGameName() - 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() - table.sort(p.card_list, self.HandCardSortAndJing) - card_info:UpdateHandCard(false, true) - self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 - end + 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() + table.sort(p.card_list, self.HandCardSortAndJing) + card_info:UpdateHandCard(false, true) + self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 + end self:GenerateAllStepData(data) self:UpdateStep(1) @@ -115,7 +111,7 @@ function M:ShowStep(index) if step.cmd == Record_Event.Evt_Win then self._win_pic = UIPackage.CreateObjectFromURL("ui://Main_Majiang/胡") local info = self._player_card_info[self:GetPos(step.win)] - info._view:AddChild(self._win_pic) + info._view:AddChild(self._win_pic) self._win_pic:Center() else if self._win_pic then @@ -129,7 +125,7 @@ function M:ShowStep(index) list:RemoveChildrenToPool() for i = 1, #niao_list do local item = list:AddItemFromPool() - item.icon = UIPackage.GetItemURL("Main_Majiang", "b201_" .. niao_list[i].card) + item.icon = UIPackage.GetItemURL("Main_Majiang", "b201_" .. niao_list[i].card) if niao_list[i].score > 0 then item:GetController("bg").selectedIndex = 2 end @@ -144,24 +140,24 @@ 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: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 - self.result._view.height = GRoot.inst.height - -- self.result._view:GetChild("btn_confirm").visible = false - self._anchor:AddChild(self.result._view) - self.result._view.x = self._anchor.x * -1 - self.result._view.y = self._anchor.y * -1 - else - self.result._view.visible = true - end - -- self.result._view:Center() - -- else - -- if self.result then - -- self.result._view.visible = false - -- end - end + self.result = EXClearingView.new(self._root_view, { 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 + self.result._view.height = GRoot.inst.height + -- self.result._view:GetChild("btn_confirm").visible = false + self._anchor:AddChild(self.result._view) + self.result._view.x = self._anchor.x * -1 + self.result._view.y = self._anchor.y * -1 + else + self.result._view.visible = true + end + -- self.result._view:Center() + -- else + -- if self.result then + -- self.result._view.visible = false + -- end + end end function M:GenerateAllStepData(data) @@ -292,8 +288,8 @@ function M:UpdateCardBox(seat) end function M:UpdateRound() - self._view:GetChild("text_round").text = string.format("局数:%d /%d", self._room.curren_round, - self._room.room_config.round) + self._view:GetChild("text_round").text = string.format("局数:%d /%d", self._room.curren_round, + self._room.room_config.round) end function M:UpdateStep(step) diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua index d7d7b5de..d5250149 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua @@ -46,13 +46,9 @@ function M:InitView(url) self._anchor = self._view:GetChild("mask_tips") ------------------渲染桌面信息-------------------------- - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) self._view:GetChild('text_time').text = os.date("%H:%M", os.time()) self._view:GetChild('text_roomId').text = room.room_id - self._view:GetChild('wanfa_text').text = gamePlay self._state = self._view:GetController("state") self._text_remined = self._view:GetChild('remaining_card') @@ -352,7 +348,7 @@ function M:EventInit() info._view:GetController("text_color").selectedIndex = 1 info._view:GetChild("text_jifen").text = num end - + info._view:GetChild("mask_piao").title = "" info._view:GetController("piao_niao").selectedIndex = 0 p.fz_list = {} @@ -396,17 +392,17 @@ function M:EventInit() print("lingmeng witness EventResidueCard") end) - --替换mianview的事件 - _gamectr:AddEventListener( - GameEvent.PlayerState, - function(...) - printlog("lingmeng OnEventOnlineState") - local arg = { ... } - local p = arg[1] - local info = self._player_info[self:GetPos(p.seat)] - info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0 - end - ) + --替换mianview的事件 + _gamectr:AddEventListener( + GameEvent.PlayerState, + function(...) + printlog("lingmeng OnEventOnlineState") + local arg = { ... } + local p = arg[1] + local info = self._player_info[self:GetPos(p.seat)] + info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0 + end + ) end function M:InitPlayerInfoView() @@ -414,7 +410,7 @@ function M:InitPlayerInfoView() 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_2", i)) - _player_info[i] = PlayerInfoView.new(tem, self,true) + _player_info[i] = PlayerInfoView.new(tem, self, true) tem.visible = false end end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua index c4e095af..b40c4444 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua @@ -87,9 +87,14 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne end self:DestroyWithCallback() else - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + if over == 0 then + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:PlayerReady() + self:DestroyWithCallback() + else + mainCtr.selectedIndex = 1 + _overCtr.selectedIndex = 1 + end end end) @@ -114,15 +119,15 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne end end) elseif over == 1 then - mainCtr.selectedIndex = 1 - showBtnTypeCtr.selectedIndex = 1 self:fillResult1(room, peopleNum, total_result) if result then + _overCtr.selectedIndex = 0 self:fillResult0(room, peopleNum, result) nextRoundBtn2.onClick:Set(function() _overCtr.selectedIndex = 1 end) else + showBtnTypeCtr.selectedIndex = 1 _overCtr.selectedIndex = 1 end else --解散房间如果没有开局直接退出不显示结算界面,over=2 diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua index 85543df9..dcaa35e8 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua @@ -307,7 +307,7 @@ function M:OnEventFzAction(evt_data) end p.hand_left_count = p.hand_left_count - remove_num - if from_seat ~= p.seat then + if from_seat ~= p.seat and ftype ~= FZType.Gang_Peng then -- if (fz.Type == FZType.Chi) then card = actice_card end local fp = _room:GetPlayerBySeat(from_seat) table.remove(fp.outcard_list, #fp.outcard_list) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXGameInfo.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXGameInfo.lua index 7ead374c..c47d5e22 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXGameInfo.lua @@ -157,16 +157,19 @@ function M:LoadConfigData(data) _config:GetController("jingbibo").selectedIndex = 1 - data.jingbibo end -function M:LoadConfigToDetail(data, hpdata) +function M:LoadConfigToDetailOnlyPlay(data, hpdata) local configData = data if type(data) == 'string' then configData = json.decode(data) end - pt("lingemng", data) local hpData = configData.hpData or hpdata if type(hpData) == 'string' then - hpData = json.decode(hpData) + if hpData == "null" then + hpData = nil + else + hpData = json.decode(hpData) + end end local returnString = "" @@ -176,33 +179,36 @@ function M:LoadConfigToDetail(data, hpdata) returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) - returnString = string.format("%s,%s,%s,%s", returnString, - configData.zimo == 0 and "可点炮,可自摸" or "必须自摸", - configData.tuoguan == 0 and string.format("%d秒后自动托管", configData.tuoguan_active_time) or "不能托管", - configData.jingbibo == 1 and "有精必博" or "有精可胡") + if configData.zimo then + returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") + end + if configData.jingbibo then + returnString = string.format("%s,%s", returnString, configData.jingbibo == 1 and "有精必博" or "有精可胡") + end - if configData.GPSDetection then - returnString = string.format("%s%s", returnString, - configData.GPSDetection == 0 and ",距离不限制" or string.format(",距离限制%s米", configData.GPSDetection)) + return returnString +end + +function M:LoadConfigToDetail(data, hpdata) + local configData = data + if type(data) == 'string' then + configData = json.decode(data) end - if configData.tuoguan_active_time then - returnString = string.format("%s%s", returnString, - configData.tuoguan_active_time == 0 and ",不自动托管" or string.format(",%s秒托管", configData.tuoguan_active_time)) - end - if hpData then - if hpData.JieShan then - returnString = string.format("%s%s", returnString, - hpData.JieShan == 1 and ",托管结束后不解散" or - string.format(",托管%s结束后强制解散", hpData.JieShan == 2 and "当局" or string.format("%s局", hpData.JieShan - 1))) - end - if hpData.BanChat then - returnString = string.format("%s%s", returnString, hpData.BanChat == 1 and ",不允许快捷聊天" or "") - end - if hpData.BanMissile then - returnString = string.format("%s%s", returnString, hpData.BanMissile == 1 and ",关闭互动表情" or "") + + local hpData = configData.hpData or hpdata + if type(hpData) == 'string' then + if hpData == "null" then + hpData = nil + else + hpData = json.decode(hpData) end end - returnString = returnString .. IGameInfo.LoadConfigToDetail(self, data, hpData) + + local returnString = "" + + returnString = returnString .. self:LoadConfigToDetailOnlyPlay(data, hpdata) + + returnString = returnString .. IGameInfo.LoadConfigToDetail(self, configData, hpData) return returnString end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua index 324f4574..9f7594fc 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua @@ -57,10 +57,6 @@ function M:InitView(url) --[[ MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num) --]] - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) - self._view:GetChild('wanfa_text').text = gamePlay self.jing = self._view:GetChild('jing') @@ -481,9 +477,6 @@ function M:EventInit() local total_result = arg[2] local result = arg[1] local over = arg[3] - -- if over < 2 or _room.curren_round > 0 then - -- self:PlayMJSound("end_music.mp3") - -- end self._clearingView = EXClearingView.new() coroutine.start(function() coroutine.wait(0.5) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua index 0ce88f8f..27036030 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua @@ -27,10 +27,6 @@ function M:InitView(url) self._tex_round = self._view:GetChild("tex_round") self._tex_LeftCard = self._view:GetChild("remaining_card") self._anchor = self._view:GetChild("mask_tips") - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) - self._view:GetChild('wanfa_text').text = gamePlay self._eventmap = {} self._cmdmap = {} @@ -41,8 +37,8 @@ function M:InitView(url) self._cmdmap[Record_Event.Evt_Niao] = self.CmdNiao self._cmdmap[Record_Event.Evt_Piao] = self.CmdPiao self._cmdmap[Record_Event.Evt_Result] = self.CmdResult - - self.com_logocType.selectedIndex = 2 + + self.com_logocType.selectedIndex = 2 end function M:FillRoomData(data) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua index 36422360..1c6f9244 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua @@ -47,13 +47,9 @@ function M:InitView() self._anchor = self._view:GetChild("mask_tips") ------------------渲染桌面信息-------------------------- - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) self._view:GetChild('text_time').text = os.date("%H:%M", os.time()) self._view:GetChild('text_roomId').text = room.room_id - self._view:GetChild('wanfa_text').text = gamePlay self._state = self._view:GetController("state") self._text_remined = self._view:GetChild('remaining_card') diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua index d0162685..1c980af7 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua @@ -86,9 +86,14 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne end self:DestroyWithCallback() else - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + if over == 0 then + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:PlayerReady() + self:DestroyWithCallback() + else + mainCtr.selectedIndex = 1 + _overCtr.selectedIndex = 1 + end end end) @@ -113,15 +118,15 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne end end) elseif over == 1 then - mainCtr.selectedIndex = 1 - showBtnTypeCtr.selectedIndex = 1 self:fillResult1(room, peopleNum, total_result) if result then + _overCtr.selectedIndex = 0 self:fillResult0(room, peopleNum, result) nextRoundBtn2.onClick:Set(function() _overCtr.selectedIndex = 1 end) else + showBtnTypeCtr.selectedIndex = 1 _overCtr.selectedIndex = 1 end else --解散房间如果没有开局直接退出不显示结算界面,over=2 diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXGameInfo.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXGameInfo.lua index 2734c94b..ed30f9a3 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXGameInfo.lua @@ -185,16 +185,19 @@ function M:LoadConfigData(data) -- end end -function M:LoadConfigToDetail(data, hpdata) +function M:LoadConfigToDetailOnlyPlay(data, hpdata) local configData = data if type(data) == 'string' then configData = json.decode(data) end - pt("lingemng", data) local hpData = configData.hpData or hpdata if type(hpData) == 'string' then - hpData = json.decode(hpData) + if hpData == "null" then + hpData = nil + else + hpData = json.decode(hpData) + end end local returnString = "" @@ -204,37 +207,55 @@ function M:LoadConfigToDetail(data, hpdata) returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) - returnString = string.format("%s,%s马%s%s%s%s%s%s,%s", returnString, - configData.jiangma and string.format("奖%d", configData.jiangma * 2) or "不奖", - configData.shaozhuang == 1 and ",有烧庄" or "", - configData.zuoma == 0 and ",庄家坐马" or "", - configData.zimo == 0 and ",可点炮,可自摸" or ",必须自摸", - configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or ",不能托管", - configData.jiahu == 0 and ",可以假胡" or "", configData.fengding == 0 and ",封顶20炮" or "", - configData.zhuanwan == 0 and "大转弯" or "小转弯") + if configData.zimo then + returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") + end + if configData.shaozhuang then + returnString = string.format("%s,%s", returnString, configData.shaozhuang == 0 and "不烧庄" or "烧庄") + end + if configData.fengding then + local matString = "%s,%s" + if configData.fengding == 0 then + returnString = string.format(matString, returnString, "封顶20炮") + else + returnString = string.format(matString, returnString, "不封顶") + end + end + if configData.jiangma then + returnString = string.format("%s,%s马", returnString, + configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2)) + end + if configData.zuoma then + returnString = string.format("%s,%s", returnString, configData.zuoma == 0 and "庄家坐马" or "庄家不坐马") + end + if configData.tuoguan then + returnString = string.format("%s,%s", returnString, configData.zhuanwan == 0 and "大转弯" or "小转弯") + end + if configData.jiahu then + returnString = string.format("%s,%s", returnString, configData.jiahu == 0 and "算假胡" or "不算假胡") + end + return returnString +end - if configData.GPSDetection then - returnString = string.format("%s%s", returnString, - configData.GPSDetection == 0 and ",距离不限制" or string.format(",距离限制%s米", configData.GPSDetection)) +function M:LoadConfigToDetail(data, hpdata) + local configData = data + if type(data) == 'string' then + configData = json.decode(data) end - if configData.tuoguan_active_time then - returnString = string.format("%s%s", returnString, - configData.tuoguan_active_time == 0 and ",不自动托管" or string.format(",%s秒托管", configData.tuoguan_active_time)) - end - if hpData then - if hpData.JieShan then - returnString = string.format("%s%s", returnString, - hpData.JieShan == 1 and ",托管结束后不解散" or - string.format(",托管%s结束后强制解散", hpData.JieShan == 2 and "当局" or string.format("%s局", hpData.JieShan - 1))) - end - if hpData.BanChat then - returnString = string.format("%s%s", returnString, hpData.BanChat == 1 and ",不允许快捷聊天" or "") - end - if hpData.BanMissile then - returnString = string.format("%s%s", returnString, hpData.BanMissile == 1 and ",关闭互动表情" or "") + + local hpData = configData.hpData or hpdata + if type(hpData) == 'string' then + if hpData == "null" then + hpData = nil + else + hpData = json.decode(hpData) end end - returnString = returnString .. IGameInfo.LoadConfigToDetail(self, data, hpData) + local returnString = "" + + returnString = returnString .. self:LoadConfigToDetailOnlyPlay(data, hpdata) + + returnString = returnString .. IGameInfo.LoadConfigToDetail(self, configData, hpData) return returnString end diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index 57dff025..1090d607 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -56,10 +56,6 @@ function M:InitView(url) --[[ MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num) --]] - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) - self._view:GetChild('wanfa_text').text = gamePlay self.jing = self._view:GetChild('jing') self._state.onChanged:Add(function() @@ -573,14 +569,14 @@ function M:OutCard(card) self:RemoveCursor() info:UpdateHandCard() - info:UpdateOutCardList(nil, card, self._cursor) - info._ctr_tip.selectedIndex = 0 - info._ctr_showGuoHu.selectedIndex = 0 - self:markOutCards(false, card) - self:PlaySound("NanCheng_MJ", self._room.self_player.self_user.sex, tostring(card)) - self:PlayMJSound("chupai.mp3") - -- self:ShowHuTip() - end) + info:UpdateOutCardList(nil, card, self._cursor) + info._ctr_tip.selectedIndex = 0 + info._ctr_showGuoHu.selectedIndex = 0 + self:markOutCards(false, card) + self:PlaySound("NanCheng_MJ", self._room.self_player.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") + -- self:ShowHuTip() + end) else printlog("鬼牌不能出===>>>" .. card) end diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua index eff22ffe..7d00d60e 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua @@ -27,11 +27,6 @@ function M:InitView(url) self._tex_round = self._view:GetChild("tex_round") self._tex_LeftCard = self._view:GetChild("remaining_card") self._anchor = self._view:GetChild("mask_tips") - - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) - self._view:GetChild('wanfa_text').text = gamePlay self._eventmap = {} self._cmdmap = {} @@ -42,7 +37,7 @@ function M:InitView(url) self._cmdmap[Record_Event.Evt_Niao] = self.CmdNiao self._cmdmap[Record_Event.Evt_Piao] = self.CmdPiao self._cmdmap[Record_Event.Evt_Result] = self.CmdResult - self.com_logocType.selectedIndex = 1 + self.com_logocType.selectedIndex = 1 end function M:FillRoomData(data) diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua index fa64eaed..5e540f31 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua @@ -46,13 +46,9 @@ function M:InitView() self._anchor = self._view:GetChild("mask_tips") ------------------渲染桌面信息-------------------------- - local config = ExtendManager.GetExtendConfig(room.game_id) - local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) self._view:GetChild('text_time').text = os.date("%H:%M", os.time()) self._view:GetChild('text_roomId').text = room.room_id - self._view:GetChild('wanfa_text').text = gamePlay self._state = self._view:GetController("state") self._text_remined = self._view:GetChild('remaining_card') @@ -352,7 +348,7 @@ function M:EventInit() info._view:GetController("text_color").selectedIndex = 1 info._view:GetChild("text_jifen").text = num end - + info._view:GetChild("mask_piao").title = "" info._view:GetController("piao_niao").selectedIndex = 0 p.fz_list = {} @@ -396,17 +392,17 @@ function M:EventInit() print("lingmeng witness EventResidueCard") end) - --替换mianview的事件 - _gamectr:AddEventListener( - GameEvent.PlayerState, - function(...) - printlog("lingmeng OnEventOnlineState") - local arg = { ... } - local p = arg[1] - local info = self._player_info[self:GetPos(p.seat)] - info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0 - end - ) + --替换mianview的事件 + _gamectr:AddEventListener( + GameEvent.PlayerState, + function(...) + printlog("lingmeng OnEventOnlineState") + local arg = { ... } + local p = arg[1] + local info = self._player_info[self:GetPos(p.seat)] + info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0 + end + ) end function M:InitPlayerInfoView() @@ -414,7 +410,7 @@ function M:InitPlayerInfoView() 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_2", i)) - _player_info[i] = PlayerInfoView.new(tem, self,true) + _player_info[i] = PlayerInfoView.new(tem, self, true) tem.visible = false end end diff --git a/lua_probject/main_project/main/majiang/MJMainView.lua b/lua_probject/main_project/main/majiang/MJMainView.lua index 1811605e..969fdc18 100644 --- a/lua_probject/main_project/main/majiang/MJMainView.lua +++ b/lua_probject/main_project/main/majiang/MJMainView.lua @@ -218,6 +218,12 @@ function M:InitView(url, use_custom_bg, custom_bg_config) self:InitXiPai1() self.btn_setting.onClick:Set(handler(self, self.ClickSetting)) + + local config = ExtendManager.GetExtendConfig(_room.game_id) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetailOnlyPlay(json.encode(_room.room_config.config), + json.encode(_room.room_config.config.hpData)) + self._view:GetChild('wanfa_text').text = gamePlay end function M:ClickSetting() @@ -831,7 +837,7 @@ function M:OnHuCard(...) end) coroutine.start(function() - coroutine.wait(0.5) + coroutine.wait(0.3) loader_HuEffect.visible = false local Effects = {} @@ -874,6 +880,13 @@ function M:OnHuCard(...) end end + --小于四个字段时动态调整胡特效 + if info._viewText_cardInfo["huEffet_columnGap"] and #Effects < 4 then + list_HuCardEffect.columnGap = tonumber(info._viewText_cardInfo["huEffet_columnGap"]) + else + list_HuCardEffect.columnGap = 0 + end + -- ↓↓↓播放动画 for _, imgObj in pairs(Effects) do imgObj.visible = true @@ -893,13 +906,15 @@ function M:OnHuCard(...) coroutine.wait(0.5) end + --根据字段动态调整间距 + -- 扣分动画 for _, pScore in pairs(scoreData) do local infoView = self._player_info[self:GetPos(pScore.seat)] infoView:UpdateScore(pScore.total_score, true) end - coroutine.wait(0.5) + coroutine.wait(0.3) self._popEvent = true list_HuCardEffect:RemoveChildrenToPool() @@ -942,8 +957,8 @@ function M:OnFangziAction(...) self._popEvent = true end) - self:RemoveCursor() - if (player.seat ~= fz.from_seat) then + if (player.seat ~= fz.from_seat and fz.type ~= FZType.Gang_Peng) then + self:RemoveCursor() local fs_info = _player_card_info[self:GetPos(fz.from_seat)] fs_info:UpdateOutCardList() end @@ -970,7 +985,7 @@ function M:Show() local win = GameInfoWindow.New() win:Show(self._room) end - self:PlayMJSound("game_backmusic.mp3") + self:PlayMJMusic("game_backmusic.mp3") self:DoNoticeAnimation() end diff --git a/lua_probject/main_project/main/majiang/MJPlayBackView.lua b/lua_probject/main_project/main/majiang/MJPlayBackView.lua index 953941f1..db5ad84d 100644 --- a/lua_probject/main_project/main/majiang/MJPlayBackView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayBackView.lua @@ -51,7 +51,8 @@ function M:FillRoomData() local config = ExtendManager.GetExtendConfig(_room.game_id) local mode = config:GetGameInfo() - local gamePlay = mode:LoadConfigToDetail(json.encode(_room.room_config.config), json.encode(_room.room_config.hpData)) + local gamePlay = mode:LoadConfigToDetailOnlyPlay(json.encode(_room.room_config.config), + json.encode(_room.room_config.config.hpData)) self._view:GetChild('wanfa_text').text = gamePlay end diff --git a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua index ad2cc0fb..f450ec4f 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua @@ -49,6 +49,7 @@ end function M:init() local CardInfo = self._view:GetChild('Text_CardInfo') + printlog("lingmeng json text", CardInfo.text) self._viewText_cardInfo = json.decode(CardInfo.text) self._view_handCardList = self._view:GetChild('List_HandCard') @@ -509,6 +510,13 @@ function M:ShowHand(cards) list:RemoveChildren(0, -1, true) --list:RemoveChildren() local passcard = false + if self._mainView:GetPos(self._player.seat) == 2 or self._mainView:GetPos(self._player.seat) == 3 then + local tem = {} + for i = #cards, 1, -1 do + table.insert(tem, cards[i]) + end + cards = tem + end for _, card in pairs(cards) do if self.winCard == cards and passcard == false then passcard = true diff --git a/lua_probject/main_project/main/majiang/MJSettingViewNew.lua b/lua_probject/main_project/main/majiang/MJSettingViewNew.lua index 17b64fb0..53a2eff3 100644 --- a/lua_probject/main_project/main/majiang/MJSettingViewNew.lua +++ b/lua_probject/main_project/main/majiang/MJSettingViewNew.lua @@ -107,25 +107,42 @@ function M:init(url) end end) + self.slider_sound.value = GameApplication.Instance.SoundValue + self.slider_music.value = GameApplication.Instance.MusicValue + self.btn_sound.selected = GameApplication.Instance.SoundMute + self.btn_music.selected = GameApplication.Instance.MusicMute + self.slider_music.onChanged:Add(function() - GameApplication.Instance.MusicValue = self.slider_music.value - self.btn_music.selected = false - GameApplication.Instance.MusicMute = false; + local value = math.floor(self.slider_music.value) + if value > 0 then + self.btn_music.selected = false + GameApplication.Instance.MusicMute = false; + else + self.btn_music.selected = true + GameApplication.Instance.MusicMute = true; + end + GameApplication.Instance.MusicValue = value end) self.slider_sound.onChanged:Add(function() - GameApplication.Instance.SoundValue = self.slider_sound.value - self.btn_sound.selected = false - GameApplication.Instance.SoundMute = false; + local value = math.floor(self.slider_sound.value) + if value > 0 then + self.btn_sound.selected = false + GameApplication.Instance.SoundMute = false; + else + self.btn_sound.selected = true + GameApplication.Instance.SoundMute = true; + end + GameApplication.Instance.SoundValue = value end) self.btn_sound.onClick:Add(function() - self.slider_sound.value = 0 GameApplication.Instance.SoundMute = self.btn_sound.selected; + self.slider_sound.value = 0 + GameApplication.Instance.SoundValue = 0 end) self.btn_music.onClick:Add(function() - self.slider_music.value = 0 GameApplication.Instance.MusicMute = self.btn_music.selected; end) diff --git a/lua_probject/main_project/main/majiang/MJWitnessView.lua b/lua_probject/main_project/main/majiang/MJWitnessView.lua index 5b576573..48d55d03 100644 --- a/lua_probject/main_project/main/majiang/MJWitnessView.lua +++ b/lua_probject/main_project/main/majiang/MJWitnessView.lua @@ -12,7 +12,6 @@ local bg_config = { { id = 3, url = "base/main_majiang/bg/bg4", thumb = "ui://Main_Majiang/b04" } } - local M = {} setmetatable(M, { __index = WitnessView }) M.HuCardImg = HuCardImg @@ -52,6 +51,12 @@ function M:InitView() self.btn_setting = self._view:GetChild("btn_setting") self.btn_setting.onClick:Set(handler(self, self.ClickSetting)) self._view_clearingFather = self._view:GetChild('clearing_show') + + local config = ExtendManager.GetExtendConfig(room.game_id) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetailOnlyPlay(json.encode(room.room_config.config), + json.encode(room.room_config.config.hpData)) + self._view:GetChild('wanfa_text').text = gamePlay end function M:ClickSetting() @@ -61,7 +66,7 @@ end function M:Show() getmetatable(M).__index.Show(self) - self:PlayMJSound("game_backmusic.mp3") + self:PlayMJMusic("game_backmusic.mp3") end local majiang_asset_path = "base/main_majiang/sound/" @@ -79,6 +84,14 @@ function M:PlaySound(group, sex, path) ViewUtil.PlaySound(group, path1) end +function M:GetPlayerInfo(playId) + for _, info in pairs(self._player_info) do + if info._player.self_user.account_id == playId then + return info + end + end +end + function M:EventInit() getmetatable(M).__index.EventInit(self) local _gamectr = self._gamectr diff --git a/wb_new_ui/assets/Common/MessageBox1.xml b/wb_new_ui/assets/Common/MessageBox1.xml index e7814732..414e1449 100644 --- a/wb_new_ui/assets/Common/MessageBox1.xml +++ b/wb_new_ui/assets/Common/MessageBox1.xml @@ -5,7 +5,7 @@ - +