diff --git a/lua_probject/base_project/Game/Controller/GameController.lua b/lua_probject/base_project/Game/Controller/GameController.lua index 7f32e760..2966187e 100644 --- a/lua_probject/base_project/Game/Controller/GameController.lua +++ b/lua_probject/base_project/Game/Controller/GameController.lua @@ -647,6 +647,7 @@ function M:OnEnter() end function M:OnExit() + printlog("lingmeng code OnExit") if (debug_print) then -- print(self._name .. ' 离开Game控制器') end diff --git a/lua_probject/base_project/Game/Controller/LoddyController.lua b/lua_probject/base_project/Game/Controller/LoddyController.lua index bc284997..d0887a2b 100644 --- a/lua_probject/base_project/Game/Controller/LoddyController.lua +++ b/lua_probject/base_project/Game/Controller/LoddyController.lua @@ -381,9 +381,6 @@ function M:RequestPlayBack(_data, callback, game_info) room.game_id = info.game_id DataManager.CurrenRoom = room extend:FillPlayBackData(data) - if not room.self_player then - room.self_player = room:GetPlayerBySeat(1) - end callback(res.ReturnCode, data) else callback(res.ReturnCode, nil) @@ -442,9 +439,38 @@ function M:GiftDiamond(data, callback) local _data = {} _data.tagId = data.tagId or 0 _data.diamo = data.diamo or 0 + _data.tagNick = data.tagNick or "" _client:send(Protocol.WEB_RECHARGE_DIAMO, _data, function(res) if (callback ~= nil) then callback(res) end end) end + +--代理获取个人名字和头像 +function M:GetUserInfoByDaili(data, callback) + --不走登录逻辑 + local _client = ControllerManager.WebClient + local _data = {} + _data.tagId = data.tagId or 0 + _client:send(Protocol.ACC_GET_USERINFO, _data, function(res) + if (callback ~= nil) then + callback(res) + end + end) +end + +--代理获取战绩记录 +function M:GetGiftDiamondRecord(data, callback) + --不走登录逻辑 + local _client = ControllerManager.WebClient + local _data = {} + _data.pageSize = data.pageSize or 4 -- 默认约定一页只有四条数据 + _data.pageNo = data.pageNo or 0 + _data.changeType = data.changeType or 0 -- 0:转入记录 1:转出记录 + _client:send(Protocol.ACC_GET_DIAMONDRECORD, _data, function(res) + if (callback ~= nil) then + callback(res) + end + end) +end diff --git a/lua_probject/base_project/Game/Controller/RoomController.lua b/lua_probject/base_project/Game/Controller/RoomController.lua index 1b83a0ea..09224ae8 100644 --- a/lua_probject/base_project/Game/Controller/RoomController.lua +++ b/lua_probject/base_project/Game/Controller/RoomController.lua @@ -16,11 +16,14 @@ local function __ConntectGameServer(cmd, room, host, _data, callback) _data["session"] = room.session local _game_client = NetClient.new(host, "game") _game_client:connect() + print("lingmeng SetGameNetClient code", _game_client) ControllerManager.SetGameNetClient(_game_client) _game_client.onconnect:Add(function(code) + print("lingmeng clent code", code) if (code == SocketCode.Connect) then _game_client:send(cmd, _data, function(response) + print("lingmeng clent code2", cmd, response.ReturnCode) if (response.ReturnCode == 0) then _game_client.onconnect:Clear() _game_client.onconnect:Add(ControllerManager.OnConnect) @@ -155,6 +158,9 @@ function M:PublicJoinRoom(cmd, roomid, tem, callback, group_id, pid) end end _data["pos"] = pos + if ControllerManager.GameNetClinet then + return + end elseif cmd == Protocol.WEB_FG_QUEUE_ROOM then _data["is_null"] = tem _data["room_id"] = roomid diff --git a/lua_probject/base_project/Game/ControllerManager.lua b/lua_probject/base_project/Game/ControllerManager.lua index fe029dd4..9c04c5d8 100644 --- a/lua_probject/base_project/Game/ControllerManager.lua +++ b/lua_probject/base_project/Game/ControllerManager.lua @@ -38,10 +38,15 @@ function ControllerManager.Init() end function ControllerManager.ChangeController(type) - if (_currenController ~= nil) then + printlog("lingmeng code ChangeController", _currenController, type) + pt("lingmeng code ChangeController", _currenController, type) + printlog("lingmeng code ChangeController", _currenController ~= nil) + if (_currenController ~= nil and not string.find(_currenController.class, "GameController")) then _currenController:OnExit() end _currenController = ControllerManager.GetController(type) + printlog("lingmeng code ChangeController2", _currenController, type) + pt("lingmeng code ChangeController2", _currenController, type) _currenController:OnEnter() return _currenController end @@ -66,6 +71,7 @@ function ControllerManager.GetController(cls) end function ControllerManager.SetGameNetClient(client) + print("lingmeng code GameNetClinet", ControllerManager.GameNetClinet, client) if (ControllerManager.GameNetClinet ~= nil) then ControllerManager.GameNetClinet:destroy() end @@ -76,6 +82,7 @@ function ControllerManager.SetGameNetClient(client) end function ControllerManager.OnConnect(code) + print("lingmeng code OnConnect", code) if (code ~= SocketCode.Connect) then ControllerManager.SetGameNetClient(nil) if code ~= SocketCode.DisconnectByServer then diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index 25ba6b95..d9da503b 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -41,8 +41,12 @@ Protocol = { WEB_SET_GROUP_INVITATED = "acc/set_group_invitation", ---赠送房卡 WEB_RECHARGE_DIAMO = "acc/recharge_diamo", - ---赠送房卡 + ---获得客服信息 WEB_GET_SERVICES = "acc/get_services", + ---代理获取个人昵称和头像 + ACC_GET_USERINFO = "acc/get_change_user_info", + ---代理获取赠送房卡记录 + ACC_GET_DIAMONDRECORD = "acc/get_recharge_diamo_list", ----index---- -- 获取公告 WEB_UPDATE_NOTICE = "index/get_notice", diff --git a/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua index 3279f4c8..b25bcec9 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua @@ -148,6 +148,9 @@ function FamilyNumberRecord.New(root, page) if self.ctr_numberRecord.selectedIndex == 0 then self._viewText_titleRecord.text = string.format("%s 成员记录", self._text_groupTitle) self._view:GetChild('text_timeRecord').text = os.date('%Y-%m-%d %H:%M:%S', os.time()) + self:ResetRecords() + self._viewList_numberRankRead:RefreshVirtualList() + self._viewList_numberRankUnRead:RefreshVirtualList() elseif self.ctr_numberRecord.selectedIndex == 1 then self._viewText_titleRecord.text = string.format("%s 个人记录", self._text_groupTitle) self._view:GetChild('text_numberRecordTime').text = os.date('%Y-%m-%d %H:%M:%S', os.time()) @@ -618,11 +621,13 @@ function M:OnClickNumberRank(groupId, uid, round) end function M:RecursionGetNumberRecord(fgCtr, groupId, uid, index) + ViewUtil:ShowModalWait2(0.1) fgCtr:FG_GetGroupRecordSpe(groupId, GetPlatform(), uid, 0, index * 100, 100, self._data_myleftTime, self._data_myrightTime, 0, function(res) pt(res) if res.ReturnCode ~= 0 then + ViewUtil.CloseModalWait2() ViewUtil.ErrorTip(res.ReturnCode, "获取查看个人战绩失败") self.ctr_numberRecord.selectedIndex = 0 else @@ -653,6 +658,7 @@ function M:RecursionGetNumberRecord(fgCtr, groupId, uid, index) end self:RecursionGetNumberRecord(fgCtr, groupId, uid, index + 1) else + ViewUtil.CloseModalWait2() self._viewList_numberRankRead:RefreshVirtualList() self._viewList_numberRankUnRead:RefreshVirtualList() self._tagId = uid diff --git a/lua_probject/base_project/Game/View/Family/FamilyRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyRecord.lua index 3b8530b2..55ff3f35 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyRecord.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyRecord.lua @@ -284,7 +284,7 @@ function M:RecordItemRenderer(data, obj) resultDetailList.itemRenderer = function(index, obj) local resultInfo = data.totalScore[index + 1] ImageLoad.Load(resultInfo.portrait, obj:GetChild('btn_head')._iconObject) - obj:GetChild('text_name').text = resultInfo.nick + obj:GetChild('text_name').text = ViewUtil.stringEllipsis(resultInfo.nick) obj:GetChild('text_score').text = string.format("%s%s", resultInfo.score >= 0 and "+" or "", resultInfo.score) obj:GetController('colour').selectedIndex = resultInfo.score >= 0 and 1 or 0 end diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 51f21289..38cccc1e 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -660,18 +660,21 @@ function M:UpdateFamilyRoom(fgCtr, id) obj:GetChild('Label_joinPlayers').text = insertName obj:GetChild('text_playerNum').text = string.format("%s/%s", #plist, playInfo.maxPlayers) obj:GetChild('btn_joinGame').onClick:Set(function() + ViewUtil.ShowModalWait2(0.01) roomCtr:PublicJoinRoom( Protocol.WEB_FG_JOIN_ROOM, readyRoom[newIndex].id, id, function(response) if (response.ReturnCode == -1) then + ViewUtil.CloseModalWait2() ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, 'response.ReturnCode == -1') -- RestartGame() return end if response.ReturnCode ~= 0 then + ViewUtil.CloseModalWait2() if response.ReturnCode == 10 then self:EnterWitnesss(id, readyRoom[newIndex].id, playInfo.gameId, readyRoom[newIndex].pid) return @@ -682,6 +685,7 @@ function M:UpdateFamilyRoom(fgCtr, id) UpdateBeat:Remove(self.OnUpdate, self) FamilyView.lastId = self._group.id ViewManager.ChangeView(ViewManager.View_Main, playInfo.gameId, { _flag_showTip = true }) + ViewUtil.CloseModalWait2() end end, id, @@ -726,18 +730,24 @@ function M:UpdateFamilyRoom(fgCtr, id) --ImageLoad.Load("ui://Family/btn_mainGameNumberHead", obj:GetChild(string.format("player%d", i))._iconObject) end obj:GetChild('btn_joinGame').onClick:Set(function() + ViewUtil.ShowModalWait2(0.01) + roomCtr:PublicJoinRoom( Protocol.WEB_FG_MATCH_ROOM, "", false, function(response) if (response.ReturnCode == -1) then + ViewUtil.CloseModalWait2() + ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, 'response.ReturnCode == -1') -- RestartGame() return end if response.ReturnCode ~= 0 then + ViewUtil.CloseModalWait2() + ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间失败') -- ViewManager.ChangeView(ViewManager.View_Lobby) return @@ -746,6 +756,7 @@ function M:UpdateFamilyRoom(fgCtr, id) FamilyView.lastId = self._group.id ViewManager.ChangeView(ViewManager.View_Main, playList[newIndex].gameId, { _flag_showTip = true }) + ViewUtil.CloseModalWait2() end end, id, diff --git a/lua_probject/base_project/Game/View/Lobby/LobbyGiftDiamond.lua b/lua_probject/base_project/Game/View/Lobby/LobbyGiftDiamond.lua index 4bcb229c..c68f516d 100644 --- a/lua_probject/base_project/Game/View/Lobby/LobbyGiftDiamond.lua +++ b/lua_probject/base_project/Game/View/Lobby/LobbyGiftDiamond.lua @@ -1,6 +1,4 @@ -local LobbyGiftDiamond = { - sendPage = 1 -} +local LobbyGiftDiamond = {} local M = LobbyGiftDiamond @@ -22,26 +20,55 @@ function M:init(url) local input_id = self._view:GetChild('input_id') + input_id.onClick:Set(function() + self._view:GetChild('text_name').text = "" + self._view:GetChild('btn_head').url = "" + end) + input_id.onFocusOut:Set(function() --发送查找用户的协议 - printlog("lingmeng send find", input_id.text) + local lobbyCtr = ControllerManager.GetController(LoddyController) + lobbyCtr:GetUserInfoByDaili({ tagId = tonumber(input_id.text) }, function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "没有该用户") + else + if res.Data.nick == "" and res.Data.portrait == "" then + ViewUtil.ErrorTip(res.ReturnCode, "没有该用户") + else + self._view:GetChild('text_name').text = res.Data.nick + ImageLoad.Load(res.Data.portrait, self._view:GetChild('btn_head')) + end + end + end) end) self._view:GetChild('btn_center').onClick:Set(function() local text_id = input_id.text local text_num = self._view:GetChild('input_num').text - - local lobbyCtr = ControllerManager.GetController(LoddyController) - lobbyCtr:GiftDiamond({ tagId = tonumber(text_id), diamo = tonumber(text_num) }, function(res) - if res.ReturnCode == 0 then - DataManager.SelfUser.diamo = DataManager.SelfUser.diamo - text_num - self._callback() - self:Destroy() - ViewUtil.ErrorTip(-1, "赠送房卡成功") - else - ViewUtil.ErrorTip(res.ReturnCode, "赠送房卡失败") - end + if self._view:GetChild('text_name').text == "" then + ViewUtil.ErrorTip(-1, "请输入正确的用户ID") + return + end + local _curren_msg = MsgWindow.new(self._root_view, + string.format("是否要赠送%s房卡给用户:%s(%d)", text_num, self._view:GetChild('text_name').text, text_id), + MsgWindow.MsgMode.OkAndCancel) + _curren_msg.onOk:Add(function() + local lobbyCtr = ControllerManager.GetController(LoddyController) + lobbyCtr:GiftDiamond( + { tagId = tonumber(text_id), diamo = tonumber(text_num), tagNick = self._view:GetChild('text_name').text }, + function(res) + if res.ReturnCode == 0 then + DataManager.SelfUser.diamo = DataManager.SelfUser.diamo - text_num + self._callback() + self._view:GetChild('input_num').text = "" + -- self:Destroy() + ViewUtil.ErrorTip(-1, "赠送房卡成功") + else + ViewUtil.ErrorTip(res.ReturnCode, "赠送房卡失败") + end + end) end) + _curren_msg:Show() end) local ctr_page = self._view:GetController('page') @@ -52,14 +79,105 @@ function M:init(url) self._view:GetChild('text_name').text = "" self._view:GetChild('btn_head').url = "" elseif ctr_page.selectedIndex == 1 then - + self._data_sendPage = 0 + self._data_GetPage = 0 + self:FillRecord(1) end end) + local crt_detail = self._view:GetController('detail') + crt_detail.onChanged:Set(function() + self:FillRecord(1 - crt_detail.selectedIndex) + end) + self._list_list = self._view:GetChild('list') self._list_list.itemRenderer = function(index, obj) - + local info = self._data_resList[index + 1] + if self._changeType == 1 then + obj:GetChild('name1').text = ViewUtil.stringEllipsis(info.user_nick) + obj:GetChild('id1').text = ViewUtil.stringEllipsis(info.uid) + obj:GetChild('name2').text = ViewUtil.stringEllipsis(info.operator_name) + obj:GetChild('id2').text = ViewUtil.stringEllipsis(info.operator) + else + obj:GetChild('name2').text = ViewUtil.stringEllipsis(info.user_nick) + obj:GetChild('id2').text = ViewUtil.stringEllipsis(info.uid) + obj:GetChild('name1').text = ViewUtil.stringEllipsis(info.operator_name) + obj:GetChild('id1').text = ViewUtil.stringEllipsis(info.operator) + end + obj:GetChild('time').text = os.date("%Y-%m-%d", info.time) + obj:GetChild('num').text = info.diamo end + + self._btn_lastPage = self._view:GetChild('btn_lastPage') + self._btn_lastPage.onClick:Set(function() + if self._changeType == 0 then + self._data_GetPage = self._data_GetPage - 1 + else + self._data_sendPage = self._data_sendPage - 1 + end + local pageNum = self._changeType == 0 and self._data_GetPage or self._data_sendPage + if pageNum == 0 then + self._btn_lastPage:GetController('donTouch').selectedIndex = 1. + self._btn_lastPage.touchable = false + else + self._btn_lastPage:GetController('donTouch').selectedIndex = 0 + self._btn_lastPage.touchable = true + end + self:FillRecord(self._changeType or 0) + end) + + self._btn_nextPage = self._view:GetChild('btn_nextPage') + self._btn_nextPage.onClick:Set(function() + if self._changeType == 0 then + self._data_GetPage = self._data_GetPage + 1 + else + self._data_sendPage = self._data_sendPage + 1 + end + local pageNum = self._changeType == 0 and self._data_GetPage or self._data_sendPage + if (pageNum + 1) * 4 >= self._list_list.numItems then + self._btn_nextPage:GetController('donTouch').selectedIndex = 1. + self._btn_nextPage.touchable = false + else + self._btn_nextPage:GetController('donTouch').selectedIndex = 0 + self._btn_nextPage.touchable = true + end + self:FillRecord(self._changeType or 0) + end) +end + +function M:FillRecord(type) + --type 0:转入记录 1:转出记录 + --发送请求填充记录并渲染数据,默认约定一页只有四条数据 + self._changeType = type + local pageNum = type == 0 and self._data_GetPage or self._data_sendPage + ViewUtil:ShowModalWait2(0.1) + local lobbyCtr = ControllerManager.GetController(LoddyController) + lobbyCtr:GetGiftDiamondRecord( + { pageNo = pageNum * 4, changeType = type }, function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "没有记录啦") + else + if pageNum == 0 then + self._btn_lastPage:GetController('donTouch').selectedIndex = 1. + self._btn_lastPage.touchable = false + else + self._btn_lastPage:GetController('donTouch').selectedIndex = 0 + self._btn_lastPage.touchable = true + end + if (pageNum + 1) * 4 >= res.Data.count then + self._btn_nextPage:GetController('donTouch').selectedIndex = 1. + self._btn_nextPage.touchable = false + else + self._btn_nextPage:GetController('donTouch').selectedIndex = 0 + self._btn_nextPage.touchable = true + end + self._view:GetChild('text_pageNum').text = string.format("%s/%s", pageNum + 1, + math.ceil(res.Data.count / 4)) + self._data_resList = res.Data.rechargeDimoList + self._list_list.numItems = #self._data_resList + ViewUtil.CloseModalWait2() + end + end) end return M diff --git a/lua_probject/base_project/Game/View/PlayBackView.lua b/lua_probject/base_project/Game/View/PlayBackView.lua index c3e97fa3..229d3c38 100644 --- a/lua_probject/base_project/Game/View/PlayBackView.lua +++ b/lua_probject/base_project/Game/View/PlayBackView.lua @@ -234,6 +234,13 @@ function M:NextRecordPlay() DataManager.CurrenRoom = room self._room = DataManager.CurrenRoom extend:FillPlayBackData(DataManager.SelfUser.playback[self._currentId][self._currentRound]) + local PlayerList = DataManager.CurrenRoom.player_list + for i = 1, #PlayerList do + local p = PlayerList[i] + if DataManager.SelfUser.account_id == p.self_user.account_id then + room.self_player = p + end + end if not room.self_player then room.self_player = room:GetPlayerBySeat(1) end @@ -262,6 +269,13 @@ function M:NextRecordPlay() DataManager.CurrenRoom = room self._room = DataManager.CurrenRoom extend:FillPlayBackData(data) + local PlayerList = DataManager.CurrenRoom.player_list + for i = 1, #PlayerList do + local p = PlayerList[i] + if DataManager.SelfUser.account_id == p.self_user.account_id then + room.self_player = p + end + end if not room.self_player then room.self_player = room:GetPlayerBySeat(1) end diff --git a/lua_probject/base_project/Game/View/ViewUtil.lua b/lua_probject/base_project/Game/View/ViewUtil.lua index 39b12113..81bf2c50 100644 --- a/lua_probject/base_project/Game/View/ViewUtil.lua +++ b/lua_probject/base_project/Game/View/ViewUtil.lua @@ -59,10 +59,16 @@ function ViewUtil.ShowModalWait2(blur_view, time) ViewUtil.CloseModalWait2() ViewUtil.continue = coroutine.start( function() - coroutine.wait(time or 1) + coroutine.wait(time or 0.5) ModalWaitingWindow2.ShowModal() end ) + ViewUtil.autoCloseContinue = coroutine.start( + function() + coroutine.wait(5) + ModalWaitingWindow2.CloseModal() + end + ) end function ViewUtil.CloseModalWait2() @@ -70,6 +76,10 @@ function ViewUtil.CloseModalWait2() coroutine.stop(ViewUtil.continue) ViewUtil.continue = nil end + if ViewUtil.autoCloseContinue then + coroutine.stop(ViewUtil.autoCloseContinue) + ViewUtil.autoCloseContinue = nil + end ModalWaitingWindow2.CloseModal() end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua index 5a55141a..cfc671d0 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua @@ -11,6 +11,8 @@ local HuCardImg = import(".HuCardImg") local M = {} --- Create a new ZZ_MainView + + function M.new() setmetatable(M, { __index = MJMainView }) local self = setmetatable({}, { __index = M }) diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua index ad252d7a..75b4a34a 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua @@ -2,6 +2,7 @@ local MJPlayBackView = require("main.majiang.MJPlayBackView") local EXRoomConfig = import(".EXRoomConfig") local EXClearingView = import(".EXClearingView") local HuCardImg = import(".HuCardImg") +local FZTipList = require("main.majiang.FZData") local Record_Event = import(".RecordEvent") @@ -44,6 +45,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._cmdmap[Record_Event.Evt_FZTip] = self.CmdFZTip + self._cmdmap[Record_Event.Evt_GangScore] = self.GangScore self.com_logocType.selectedIndex = 0 end @@ -152,58 +155,95 @@ function M:ShowStep(index) ----多人胡的时候,同时显示胡 if step.cmd == Record_Event.Evt_Result then --所有都显示胡吧,暂时没做胡和自摸的判断 - if step.result_data.info_list[i].is_win then - local info2 = self._player_card_info[self:GetPos(step.result_data.info_list[i].seat)] - local loader_HuEffect = info2._viewLoader_selfHuCardEffect - local isZiMo = false - DataManager.CurrenRoom.isZiMoHu = isZiMo - local hu_sound = isZiMo and ("zimo") or ("hu") - printlog("声音====>>>", hu_sound) - self:PlaySound(self.asset_group, p.self_user.sex, hu_sound) + if not self.result then + if step.result_data.info_list[i].is_win then + local info2 = self._player_card_info[self:GetPos(step.result_data.info_list[i].seat)] + local loader_HuEffect = info2._viewLoader_selfHuCardEffect + local isZiMo = false + DataManager.CurrenRoom.isZiMoHu = isZiMo + local hu_sound = isZiMo and ("zimo") or ("hu") + printlog("声音====>>>", hu_sound) + self:PlaySound(self.asset_group, p.self_user.sex, hu_sound) - local effects = isZiMo and ("tile_zimo") or ("tile_hu") - loader_HuEffect.visible = true - loader_HuEffect.url = "ui://Main_Majiang/" .. effects - loader_HuEffect:SetScale(2, 2) - local hu_tween = loader_HuEffect:TweenScale(Vector2(1, 1), 0.3) - hu_tween:SetEase(EaseType.QuartOut) - hu_tween:OnComplete(function() - loader_HuEffect.visible = false - end) + local effects = isZiMo and ("tile_zimo") or ("tile_hu") + loader_HuEffect.visible = true + loader_HuEffect.url = "ui://Main_Majiang/" .. effects + loader_HuEffect:SetScale(2, 2) + local hu_tween = loader_HuEffect:TweenScale(Vector2(1, 1), 0.3) + hu_tween:SetEase(EaseType.QuartOut) + hu_tween:OnComplete(function() + loader_HuEffect.visible = false + end) + end end end + ---显示提示按钮 + local _ctr_tips = info._view:GetController('tip2') + local _lit_fanzi = info._view:GetChild("Comp_Back_FZTips") + if step.cmd == Record_Event.Evt_FZTip then + if p.seat == step.seat then + local tip = step.tiplist + local _tlist = tip.tip_sortList + _lit_fanzi.itemRenderer = function(index, obj) + local type = obj:GetController('type') + if index == tip.tip_num then + type.selectedIndex = 0 + else + index = index + 1 + if _tlist[index].type == FZType.HU then + type.selectedIndex = 4 + obj:GetChild('btn_Card1').icon = string.format('ui://Main_Majiang/b202_%d', + _tlist[index].card) + elseif _tlist[index].type == FZType.Chi then + type.selectedIndex = FZType.Chi + for i = 1, 3 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].opcard[i]) + end + elseif _tlist[index].type == FZType.Peng then + type.selectedIndex = FZType.Peng + for i = 1, 3 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].card) + end + else + for i = 1, 4 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].card) + end + type.selectedIndex = FZType.Gang + if _tlist[index].type == FZType.Gang_An then + obj:GetChild('btn_Card4').icon = 'ui://Main_Majiang/b202_00' + end + end + end + end + _ctr_tips.selectedIndex = 1 + _lit_fanzi.numItems = tip.tip_num + 1 + end + else + _ctr_tips.selectedIndex = 0 + _lit_fanzi.numItems = 0 + end end + + --统一在大结算时显示 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() else if self._win_pic then self._win_pic:Dispose() end end + --统一在大结算时显示 if step.cmd == Record_Event.Evt_Niao then local niao_list = step.niao - self._niao = UIPackage.CreateObjectFromURL("ui://Extend_MJ_FuZhou/Panel_Birds") - local list = self._niao:GetChild("Lst_birds") - list:RemoveChildrenToPool() - for i = 1, #niao_list do - local item = list:AddItemFromPool() - item.icon = UIPackage.GetItemURL("Main_Majiang", "b201_" .. niao_list[i].card) - if niao_list[i].score > 0 then - item:GetController("bg").selectedIndex = 2 - end - end - self._view:AddChild(self._niao) - self._view:AddChild(self._view:GetChild("panel_record")) - self._niao:Center() else - if self._niao then - self._niao:Dispose() - end end if step.cmd == Record_Event.Evt_Result then + print("lingmeng playerback", self.result) if not self.result then local result = step.result_data self.result = EXClearingView.new(self, { flag_back = true }) @@ -301,6 +341,28 @@ function M:ShowStep(index) end end + --展示摸鸟 + local niao_list = result.niao + self._niao = UIPackage.CreateObject("Extend_MJ_FuZhou", "Panel_Birds") + self._view:GetChild('jiangma_show'):AddChild(self._niao) + self._niao:Center() + local list_niao_card = self._niao:GetChild("Lst_birds") + list_niao_card:RemoveChildrenToPool() + for i = 1, #niao_list do + --顯示正面 + local item = list_niao_card:AddItemFromPool() + local card = niao_list[i].card + item.icon = UIPackage.GetItemURL("Main_Majiang", "b202_" .. card) + if niao_list[i].score > 0 then + item:GetController("select").selectedIndex = 1 + else + item:GetController("select").selectedIndex = 0 + end + coroutine.wait(2 / #niao_list) + end + coroutine.wait(0.3) + self._niao:Dispose() + --统一显示弹出分数 for i = 1, #result.info_list do local hu_info = result.info_list[i] @@ -322,7 +384,38 @@ function M:ShowStep(index) self.result._view.visible = true end) else - self.result._view.visible = true + -- self.result._view.visible = true + end + end + --显示杠分 + if step.cmd == Record_Event.Evt_GangScore then + local totalScoreList = step.totalScoreList + local playerList = step.playerList + local addScoreList = step.addScoreList + local scoreData = {} + for i = 1, #totalScoreList do + local p = {} + + p.totalScore = totalScoreList[i] + p.player = playerList[i] + p.addScore = addScoreList[i] + + scoreData[#scoreData + 1] = p + end + + for _, p in pairs(scoreData) do + local player = self._room:GetPlayerById(p.player) + local infoView = self._player_info[self:GetPos(player.seat)] + player.cur_hp = p.totalScore + + if p.addScore ~= 0 then + infoView:ScoreAnimation(p.addScore) + if player.cur_hp >= 0 then + infoView._view:GetChild("text_jifen").text = "+" .. player.cur_hp + else + infoView._view:GetChild("text_jifen").text = player.cur_hp + end + end end end end @@ -426,6 +519,39 @@ function M:CmdPiao(cmd, index) data.player_card_data[cmd.seat].piao_niao = cmd.data.num end +function M:CmdFZTip(cmd, index) + local data = self:CopyLastStep(index) + data.cmd = cmd.cmd + data.seat = cmd.seat + local tiplist = FZTipList.new() + local list = cmd.data.tip_list + for i = 1, #list do + local dtip = list[i] + local tip = {} + tip.id = dtip["id"] + tip.weight = dtip["weight"] + tip.card = dtip["card"] + tip.type = dtip["type"] + tip.opcard = dtip["opcard"] + tiplist:AddTip(tip) + end + --排序规则,胡杠碰 + tiplist:SortList(function(a, b) + return a.type < b.type + end) + data.tiplist = tiplist + data.weight = cmd.data.weight +end + +function M:GangScore(cmd, index) + local data = self:CopyLastStep(index) + data.cmd = cmd.cmd + data.seat = cmd.seat + data.totalScoreList = cmd.data.totalScoreList + data.playerList = cmd.data.playerList + data.addScoreList = cmd.data.addScoreList +end + function M:CmdResult(cmd, index) local data = self:CopyLastStep(index) data.cmd = cmd.cmd diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/fuzhou/ExtendConfig.lua index f25cd473..0d77fa79 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/ExtendConfig.lua @@ -157,7 +157,7 @@ function M:FillPlayBackData(pd_data) -- room.self_player = p -- p.self_user = DataManager.SelfUser -- else - if p.seat == 1 then room.self_player = p end + -- if p.seat == 1 then room.self_player = p end local u = User.new() u.account_id = pid p.self_user = u @@ -179,6 +179,16 @@ function M:FillPlayBackData(pd_data) room:AddPlayer(p) end + local PlayerList = room.player_list + for i = 1, #PlayerList do + local p = PlayerList[i] + if DataManager.SelfUser.account_id == p.self_user.account_id then + room.self_player = p + end + end + if not room.self_player then + room.self_player = room:GetPlayerBySeat(1) + end room.cmdList = pd_data["cmdList"] end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/RecordEvent.lua b/lua_probject/extend_project/extend/majiang/fuzhou/RecordEvent.lua index 09748550..719af8f5 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/RecordEvent.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/RecordEvent.lua @@ -6,6 +6,8 @@ local Record_Event = { Evt_Niao = "Niao", Evt_Piao = "PiaoNiao", Evt_Result = "Result", + Evt_FZTip = "FizTip", + Evt_GangScore = "GangScore", } -return Record_Event \ No newline at end of file +return Record_Event diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua index f07675cf..95ea7633 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua @@ -2,6 +2,7 @@ local MJPlayBackView = require("main.majiang.MJPlayBackView") local EXRoomConfig = import(".EXRoomConfig") local EXClearingView = import(".EXClearingView") local HuCardImg = import(".HuCardImg") +local FZTipList = require("main.majiang.FZData") local Record_Event = import(".RecordEvent") @@ -44,6 +45,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._cmdmap[Record_Event.Evt_FZTip] = self.CmdFZTip + self._cmdmap[Record_Event.Evt_GangScore] = self.GangScore self.com_logocType.selectedIndex = 3 end @@ -152,6 +155,7 @@ function M:ShowStep(index) ----多人胡的时候,同时显示胡 if step.cmd == Record_Event.Evt_Result then --所有都显示胡吧,暂时没做胡和自摸的判断 + if not self.result then if step.result_data.info_list[i].is_win then local info2 = self._player_card_info[self:GetPos(step.result_data.info_list[i].seat)] local loader_HuEffect = info2._viewLoader_selfHuCardEffect @@ -161,60 +165,96 @@ function M:ShowStep(index) printlog("声音====>>>", hu_sound) self:PlaySound(self.asset_group, p.self_user.sex, hu_sound) - local effects = isZiMo and ("tile_zimo") or ("tile_hu") - loader_HuEffect.visible = true - loader_HuEffect.url = "ui://Main_Majiang/" .. effects - loader_HuEffect:SetScale(2, 2) - local hu_tween = loader_HuEffect:TweenScale(Vector2(1, 1), 0.3) - hu_tween:SetEase(EaseType.QuartOut) - hu_tween:OnComplete(function() - loader_HuEffect.visible = false - end) - end - end - end - 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() - else - if self._win_pic then - self._win_pic:Dispose() - end - end - if step.cmd == Record_Event.Evt_Niao then - local niao_list = step.niao - self._niao = UIPackage.CreateObjectFromURL("ui://Extend_MJ_JinXi/Panel_Birds") - local list = self._niao:GetChild("Lst_birds") - list:RemoveChildrenToPool() - for i = 1, #niao_list do - local item = list:AddItemFromPool() - item.icon = UIPackage.GetItemURL("Main_Majiang", "b201_" .. niao_list[i].card) - if niao_list[i].score > 0 then - item:GetController("bg").selectedIndex = 2 - end - end - self._view:AddChild(self._niao) - self._view:AddChild(self._view:GetChild("panel_record")) - self._niao:Center() - else - if self._niao then - self._niao:Dispose() - end - end - if step.cmd == Record_Event.Evt_Result then - if not self.result then - local result = step.result_data - self.result = EXClearingView.new(self, { flag_back = true }) - self.result:InitData(0, self._room, result) - 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._anchor:AddChild(self.result._view) - self.result._view.visible = false - self.result._view.x = self._anchor.x * -1 - self.result._view.y = self._anchor.y * -1 + local effects = isZiMo and ("tile_zimo") or ("tile_hu") + loader_HuEffect.visible = true + loader_HuEffect.url = "ui://Main_Majiang/" .. effects + loader_HuEffect:SetScale(2, 2) + local hu_tween = loader_HuEffect:TweenScale(Vector2(1, 1), 0.3) + hu_tween:SetEase(EaseType.QuartOut) + hu_tween:OnComplete(function() + loader_HuEffect.visible = false + end) + end + end + end + ---显示提示按钮 + local _ctr_tips = info._view:GetController('tip2') + local _lit_fanzi = info._view:GetChild("Comp_Back_FZTips") + if step.cmd == Record_Event.Evt_FZTip then + if p.seat == step.seat then + local tip = step.tiplist + local _tlist = tip.tip_sortList + _lit_fanzi.itemRenderer = function(index, obj) + local type = obj:GetController('type') + if index == tip.tip_num then + type.selectedIndex = 0 + else + index = index + 1 + if _tlist[index].type == FZType.HU then + type.selectedIndex = 4 + obj:GetChild('btn_Card1').icon = string.format('ui://Main_Majiang/b202_%d', + _tlist[index].card) + elseif _tlist[index].type == FZType.Chi then + type.selectedIndex = FZType.Chi + for i = 1, 3 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].opcard[i]) + end + elseif _tlist[index].type == FZType.Peng then + type.selectedIndex = FZType.Peng + for i = 1, 3 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].card) + end + else + for i = 1, 4 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].card) + end + type.selectedIndex = FZType.Gang + if _tlist[index].type == FZType.Gang_An then + obj:GetChild('btn_Card4').icon = 'ui://Main_Majiang/b202_00' + end + end + end + end + _ctr_tips.selectedIndex = 1 + _lit_fanzi.numItems = tip.tip_num + 1 + end + else + _ctr_tips.selectedIndex = 0 + _lit_fanzi.numItems = 0 + end + end + + --统一在大结算时显示 + if step.cmd == Record_Event.Evt_Win then + else + if self._win_pic then + self._win_pic:Dispose() + end + end + --统一在大结算时显示 + if step.cmd == Record_Event.Evt_Niao then + local niao_list = step.niao + else + end + if step.cmd == Record_Event.Evt_Result then + print("lingmeng playerback", self.result) + if not self.result then + local result = step.result_data + self.result = EXClearingView.new(self, { flag_back = true }) + self.result:InitData(0, self._room, result) + 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._anchor:AddChild(self.result._view) + self.result._view.visible = false + self.result._view.x = self._anchor.x * -1 + self.result._view.y = self._anchor.y * -1 local liuju = result and result.liuju or nil coroutine.start(function() @@ -301,30 +341,83 @@ function M:ShowStep(index) end end - --统一显示弹出分数 - for i = 1, #result.info_list do - local hu_info = result.info_list[i] - local head_info = self._player_info[self:GetPos(hu_info.seat)] + --展示摸鸟 + local niao_list = result.niao + self._niao = UIPackage.CreateObject("Extend_MJ_FuZhou", "Panel_Birds") + self._view:GetChild('jiangma_show'):AddChild(self._niao) + self._niao:Center() + local list_niao_card = self._niao:GetChild("Lst_birds") + list_niao_card:RemoveChildrenToPool() + for i = 1, #niao_list do + --顯示正面 + local item = list_niao_card:AddItemFromPool() + local card = niao_list[i].card + item.icon = UIPackage.GetItemURL("Main_Majiang", "b202_" .. card) + if niao_list[i].score > 0 then + item:GetController("select").selectedIndex = 1 + else + item:GetController("select").selectedIndex = 0 + end + coroutine.wait(2 / #niao_list) + end + coroutine.wait(0.3) + self._niao:Dispose() + + --统一显示弹出分数 + for i = 1, #result.info_list do + local hu_info = result.info_list[i] + local head_info = self._player_info[self:GetPos(hu_info.seat)] -- 扣分动画 head_info:UpdateScore(hu_info.total_score, true) end coroutine.wait(0.3) - if liuju then - self:PlayMJSound("liuju.mp3") - coroutine.wait(3) - self:PlayMJSound("end_music.mp3") - else - self:PlayMJSound("end_music.mp3") - end - coroutine.wait(0.5) - self.result._view.visible = true - end) - else - self.result._view.visible = true - end - end + if liuju then + self:PlayMJSound("liuju.mp3") + coroutine.wait(3) + self:PlayMJSound("end_music.mp3") + else + self:PlayMJSound("end_music.mp3") + end + coroutine.wait(0.5) + self.result._view.visible = true + end) + else + -- self.result._view.visible = true + end + end + --显示杠分 + if step.cmd == Record_Event.Evt_GangScore then + local totalScoreList = step.totalScoreList + local playerList = step.playerList + local addScoreList = step.addScoreList + local scoreData = {} + for i = 1, #totalScoreList do + local p = {} + + p.totalScore = totalScoreList[i] + p.player = playerList[i] + p.addScore = addScoreList[i] + + scoreData[#scoreData + 1] = p + end + + for _, p in pairs(scoreData) do + local player = self._room:GetPlayerById(p.player) + local infoView = self._player_info[self:GetPos(player.seat)] + player.cur_hp = p.totalScore + + if p.addScore ~= 0 then + infoView:ScoreAnimation(p.addScore) + if player.cur_hp >= 0 then + infoView._view:GetChild("text_jifen").text = "+" .. player.cur_hp + else + infoView._view:GetChild("text_jifen").text = player.cur_hp + end + end + end + end end function M:GenerateAllStepData(data) @@ -426,6 +519,39 @@ function M:CmdPiao(cmd, index) data.player_card_data[cmd.seat].piao_niao = cmd.data.num end +function M:CmdFZTip(cmd, index) + local data = self:CopyLastStep(index) + data.cmd = cmd.cmd + data.seat = cmd.seat + local tiplist = FZTipList.new() + local list = cmd.data.tip_list + for i = 1, #list do + local dtip = list[i] + local tip = {} + tip.id = dtip["id"] + tip.weight = dtip["weight"] + tip.card = dtip["card"] + tip.type = dtip["type"] + tip.opcard = dtip["opcard"] + tiplist:AddTip(tip) + end + --排序规则,胡杠碰 + tiplist:SortList(function(a, b) + return a.type < b.type + end) + data.tiplist = tiplist + data.weight = cmd.data.weight +end + +function M:GangScore(cmd, index) + local data = self:CopyLastStep(index) + data.cmd = cmd.cmd + data.seat = cmd.seat + data.totalScoreList = cmd.data.totalScoreList + data.playerList = cmd.data.playerList + data.addScoreList = cmd.data.addScoreList +end + function M:CmdResult(cmd, index) local data = self:CopyLastStep(index) data.cmd = cmd.cmd diff --git a/lua_probject/extend_project/extend/majiang/jinxi/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/jinxi/ExtendConfig.lua index c173be96..59278399 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/ExtendConfig.lua @@ -166,7 +166,7 @@ function M:FillPlayBackData(pd_data) -- room.self_player = p -- p.self_user = DataManager.SelfUser -- else - if p.seat == 1 then room.self_player = p end + -- if p.seat == 1 then room.self_player = p end local u = User.new() u.account_id = pid p.self_user = u @@ -188,6 +188,16 @@ function M:FillPlayBackData(pd_data) room:AddPlayer(p) end + local PlayerList = room.player_list + for i = 1, #PlayerList do + local p = PlayerList[i] + if DataManager.SelfUser.account_id == p.self_user.account_id then + room.self_player = p + end + end + if not room.self_player then + room.self_player = room:GetPlayerBySeat(1) + end room.cmdList = pd_data["cmdList"] end diff --git a/lua_probject/extend_project/extend/majiang/jinxi/RecordEvent.lua b/lua_probject/extend_project/extend/majiang/jinxi/RecordEvent.lua index 09748550..719af8f5 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/RecordEvent.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/RecordEvent.lua @@ -6,6 +6,8 @@ local Record_Event = { Evt_Niao = "Niao", Evt_Piao = "PiaoNiao", Evt_Result = "Result", + Evt_FZTip = "FizTip", + Evt_GangScore = "GangScore", } -return Record_Event \ No newline at end of file +return Record_Event diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua index 86503d58..2943050c 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua @@ -2,6 +2,7 @@ local MJPlayBackView = require("main.majiang.MJPlayBackView") local EXRoomConfig = import(".EXRoomConfig") local EXClearingView = import(".EXClearingView") local HuCardImg = import(".HuCardImg") +local FZTipList = require("main.majiang.FZData") local Record_Event = import(".RecordEvent") @@ -44,6 +45,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._cmdmap[Record_Event.Evt_FZTip] = self.CmdFZTip + self._cmdmap[Record_Event.Evt_GangScore] = self.GangScore self.com_logocType.selectedIndex = 2 end @@ -126,95 +129,132 @@ function M:ShowStep(index) effects = "clip_peng" elseif fz.type == FZType.Chi then - else - self:PlaySound("Main_Majiang", p.self_user.sex, "gang") - effects = "clip_gang" - end - local clip = UIPackage.CreateObjectFromURL(string.format("ui://Main_Majiang/%s", effects)) - clip:SetSize(loader_HuEffect.width, loader_HuEffect.height) - loader_HuEffect:AddChild(clip) - clip:SetPlaySettings(0, -1, 1, -1) - clip.onPlayEnd:Add(function() - if clip.parent then - clip.parent:RemoveChild(clip) - end - clip:Dispose() - end) - clip.playing = true - coroutine.start(function() - coroutine.wait(0.3) - self._popEvent = true - end) - end - else - info:UpdateHandCard(false, true) - end - ----多人胡的时候,同时显示胡 - if step.cmd == Record_Event.Evt_Result then - --所有都显示胡吧,暂时没做胡和自摸的判断 - if step.result_data.info_list[i].is_win then - local info2 = self._player_card_info[self:GetPos(step.result_data.info_list[i].seat)] - local loader_HuEffect = info2._viewLoader_selfHuCardEffect - local isZiMo = false - DataManager.CurrenRoom.isZiMoHu = isZiMo - local hu_sound = isZiMo and ("zimo") or ("hu") - printlog("声音====>>>", hu_sound) - self:PlaySound(self.asset_group, p.self_user.sex, hu_sound) + else + self:PlaySound("Main_Majiang", p.self_user.sex, "gang") + effects = "clip_gang" + end + local clip = UIPackage.CreateObjectFromURL(string.format("ui://Main_Majiang/%s", effects)) + clip:SetSize(loader_HuEffect.width, loader_HuEffect.height) + loader_HuEffect:AddChild(clip) + clip:SetPlaySettings(0, -1, 1, -1) + clip.onPlayEnd:Add(function() + if clip.parent then + clip.parent:RemoveChild(clip) + end + clip:Dispose() + end) + clip.playing = true + coroutine.start(function() + coroutine.wait(0.3) + self._popEvent = true + end) + end + else + info:UpdateHandCard(false, true) + end + ----多人胡的时候,同时显示胡 + if step.cmd == Record_Event.Evt_Result then + --所有都显示胡吧,暂时没做胡和自摸的判断 + if not self.result then + if step.result_data.info_list[i].is_win then + local info2 = self._player_card_info[self:GetPos(step.result_data.info_list[i].seat)] + local loader_HuEffect = info2._viewLoader_selfHuCardEffect + local isZiMo = false + DataManager.CurrenRoom.isZiMoHu = isZiMo + local hu_sound = isZiMo and ("zimo") or ("hu") + printlog("声音====>>>", hu_sound) + self:PlaySound(self.asset_group, p.self_user.sex, hu_sound) - local effects = isZiMo and ("tile_zimo") or ("tile_hu") - loader_HuEffect.visible = true - loader_HuEffect.url = "ui://Main_Majiang/" .. effects - loader_HuEffect:SetScale(2, 2) - local hu_tween = loader_HuEffect:TweenScale(Vector2(1, 1), 0.3) - hu_tween:SetEase(EaseType.QuartOut) - hu_tween:OnComplete(function() - loader_HuEffect.visible = false - end) - end - end - end - 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() - else - if self._win_pic then - self._win_pic:Dispose() - end - end - if step.cmd == Record_Event.Evt_Niao then - local niao_list = step.niao - self._niao = UIPackage.CreateObjectFromURL("ui://Extend_MJ_LiChuan/Panel_Birds") - local list = self._niao:GetChild("Lst_birds") - list:RemoveChildrenToPool() - for i = 1, #niao_list do - local item = list:AddItemFromPool() - item.icon = UIPackage.GetItemURL("Main_Majiang", "b201_" .. niao_list[i].card) - if niao_list[i].score > 0 then - item:GetController("bg").selectedIndex = 2 - end - end - self._view:AddChild(self._niao) - self._view:AddChild(self._view:GetChild("panel_record")) - self._niao:Center() - else - if self._niao then - self._niao:Dispose() - end - end - if step.cmd == Record_Event.Evt_Result then - if not self.result then - local result = step.result_data - self.result = EXClearingView.new(self, { flag_back = true }) - self.result:InitData(0, self._room, result) - 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._anchor:AddChild(self.result._view) - self.result._view.visible = false - self.result._view.x = self._anchor.x * -1 - self.result._view.y = self._anchor.y * -1 + local effects = isZiMo and ("tile_zimo") or ("tile_hu") + loader_HuEffect.visible = true + loader_HuEffect.url = "ui://Main_Majiang/" .. effects + loader_HuEffect:SetScale(2, 2) + local hu_tween = loader_HuEffect:TweenScale(Vector2(1, 1), 0.3) + hu_tween:SetEase(EaseType.QuartOut) + hu_tween:OnComplete(function() + loader_HuEffect.visible = false + end) + end + end + end + ---显示提示按钮 + local _ctr_tips = info._view:GetController('tip2') + local _lit_fanzi = info._view:GetChild("Comp_Back_FZTips") + if step.cmd == Record_Event.Evt_FZTip then + if p.seat == step.seat then + local tip = step.tiplist + local _tlist = tip.tip_sortList + _lit_fanzi.itemRenderer = function(index, obj) + local type = obj:GetController('type') + if index == tip.tip_num then + type.selectedIndex = 0 + else + index = index + 1 + if _tlist[index].type == FZType.HU then + type.selectedIndex = 4 + obj:GetChild('btn_Card1').icon = string.format('ui://Main_Majiang/b202_%d', + _tlist[index].card) + elseif _tlist[index].type == FZType.Chi then + type.selectedIndex = FZType.Chi + for i = 1, 3 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].opcard[i]) + end + elseif _tlist[index].type == FZType.Peng then + type.selectedIndex = FZType.Peng + for i = 1, 3 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].card) + end + else + for i = 1, 4 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].card) + end + type.selectedIndex = FZType.Gang + if _tlist[index].type == FZType.Gang_An then + obj:GetChild('btn_Card4').icon = 'ui://Main_Majiang/b202_00' + end + end + end + end + _ctr_tips.selectedIndex = 1 + _lit_fanzi.numItems = tip.tip_num + 1 + end + else + _ctr_tips.selectedIndex = 0 + _lit_fanzi.numItems = 0 + end + end + + --统一在大结算时显示 + if step.cmd == Record_Event.Evt_Win then + else + if self._win_pic then + self._win_pic:Dispose() + end + end + --统一在大结算时显示 + if step.cmd == Record_Event.Evt_Niao then + local niao_list = step.niao + else + end + if step.cmd == Record_Event.Evt_Result then + print("lingmeng playerback", self.result) + if not self.result then + local result = step.result_data + self.result = EXClearingView.new(self, { flag_back = true }) + self.result:InitData(0, self._room, result) + 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._anchor:AddChild(self.result._view) + self.result._view.visible = false + self.result._view.x = self._anchor.x * -1 + self.result._view.y = self._anchor.y * -1 local liuju = result and result.liuju or nil coroutine.start(function() @@ -301,30 +341,83 @@ function M:ShowStep(index) end end - --统一显示弹出分数 - for i = 1, #result.info_list do - local hu_info = result.info_list[i] - local head_info = self._player_info[self:GetPos(hu_info.seat)] + --展示摸鸟 + local niao_list = result.niao + self._niao = UIPackage.CreateObject("Extend_MJ_FuZhou", "Panel_Birds") + self._view:GetChild('jiangma_show'):AddChild(self._niao) + self._niao:Center() + local list_niao_card = self._niao:GetChild("Lst_birds") + list_niao_card:RemoveChildrenToPool() + for i = 1, #niao_list do + --顯示正面 + local item = list_niao_card:AddItemFromPool() + local card = niao_list[i].card + item.icon = UIPackage.GetItemURL("Main_Majiang", "b202_" .. card) + if niao_list[i].score > 0 then + item:GetController("select").selectedIndex = 1 + else + item:GetController("select").selectedIndex = 0 + end + coroutine.wait(2 / #niao_list) + end + coroutine.wait(0.3) + self._niao:Dispose() + + --统一显示弹出分数 + for i = 1, #result.info_list do + local hu_info = result.info_list[i] + local head_info = self._player_info[self:GetPos(hu_info.seat)] -- 扣分动画 head_info:UpdateScore(hu_info.total_score, true) end coroutine.wait(0.3) - if liuju then - self:PlayMJSound("liuju.mp3") - coroutine.wait(3) - self:PlayMJSound("end_music.mp3") - else - self:PlayMJSound("end_music.mp3") - end - coroutine.wait(0.5) - self.result._view.visible = true - end) - else - self.result._view.visible = true - end - end + if liuju then + self:PlayMJSound("liuju.mp3") + coroutine.wait(3) + self:PlayMJSound("end_music.mp3") + else + self:PlayMJSound("end_music.mp3") + end + coroutine.wait(0.5) + self.result._view.visible = true + end) + else + -- self.result._view.visible = true + end + end + --显示杠分 + if step.cmd == Record_Event.Evt_GangScore then + local totalScoreList = step.totalScoreList + local playerList = step.playerList + local addScoreList = step.addScoreList + local scoreData = {} + for i = 1, #totalScoreList do + local p = {} + + p.totalScore = totalScoreList[i] + p.player = playerList[i] + p.addScore = addScoreList[i] + + scoreData[#scoreData + 1] = p + end + + for _, p in pairs(scoreData) do + local player = self._room:GetPlayerById(p.player) + local infoView = self._player_info[self:GetPos(player.seat)] + player.cur_hp = p.totalScore + + if p.addScore ~= 0 then + infoView:ScoreAnimation(p.addScore) + if player.cur_hp >= 0 then + infoView._view:GetChild("text_jifen").text = "+" .. player.cur_hp + else + infoView._view:GetChild("text_jifen").text = player.cur_hp + end + end + end + end end function M:GenerateAllStepData(data) @@ -426,6 +519,39 @@ function M:CmdPiao(cmd, index) data.player_card_data[cmd.seat].piao_niao = cmd.data.num end +function M:CmdFZTip(cmd, index) + local data = self:CopyLastStep(index) + data.cmd = cmd.cmd + data.seat = cmd.seat + local tiplist = FZTipList.new() + local list = cmd.data.tip_list + for i = 1, #list do + local dtip = list[i] + local tip = {} + tip.id = dtip["id"] + tip.weight = dtip["weight"] + tip.card = dtip["card"] + tip.type = dtip["type"] + tip.opcard = dtip["opcard"] + tiplist:AddTip(tip) + end + --排序规则,胡杠碰 + tiplist:SortList(function(a, b) + return a.type < b.type + end) + data.tiplist = tiplist + data.weight = cmd.data.weight +end + +function M:GangScore(cmd, index) + local data = self:CopyLastStep(index) + data.cmd = cmd.cmd + data.seat = cmd.seat + data.totalScoreList = cmd.data.totalScoreList + data.playerList = cmd.data.playerList + data.addScoreList = cmd.data.addScoreList +end + function M:CmdResult(cmd, index) local data = self:CopyLastStep(index) data.cmd = cmd.cmd diff --git a/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua index 807e9a66..088885a4 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua @@ -167,7 +167,7 @@ function M:FillPlayBackData(pd_data) -- room.self_player = p -- p.self_user = DataManager.SelfUser -- else - if p.seat == 1 then room.self_player = p end + -- if p.seat == 1 then room.self_player = p end local u = User.new() u.account_id = pid p.self_user = u @@ -189,6 +189,16 @@ function M:FillPlayBackData(pd_data) room:AddPlayer(p) end + local PlayerList = room.player_list + for i = 1, #PlayerList do + local p = PlayerList[i] + if DataManager.SelfUser.account_id == p.self_user.account_id then + room.self_player = p + end + end + if not room.self_player then + room.self_player = room:GetPlayerBySeat(1) + end room.cmdList = pd_data["cmdList"] end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/RecordEvent.lua b/lua_probject/extend_project/extend/majiang/lichuan/RecordEvent.lua index 09748550..719af8f5 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/RecordEvent.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/RecordEvent.lua @@ -6,6 +6,8 @@ local Record_Event = { Evt_Niao = "Niao", Evt_Piao = "PiaoNiao", Evt_Result = "Result", + Evt_FZTip = "FizTip", + Evt_GangScore = "GangScore", } -return Record_Event \ No newline at end of file +return Record_Event diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua index 3a5d7b4b..fe642ae7 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua @@ -2,6 +2,7 @@ local MJPlayBackView = require("main.majiang.MJPlayBackView") local EXRoomConfig = import(".EXRoomConfig") local EXClearingView = import(".EXClearingView") local HuCardImg = import(".HuCardImg") +local FZTipList = require("main.majiang.FZData") local Record_Event = import(".RecordEvent") @@ -44,6 +45,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._cmdmap[Record_Event.Evt_FZTip] = self.CmdFZTip + self._cmdmap[Record_Event.Evt_GangScore] = self.GangScore self.com_logocType.selectedIndex = 1 end @@ -126,95 +129,132 @@ function M:ShowStep(index) effects = "clip_peng" elseif fz.type == FZType.Chi then - else - self:PlaySound("Main_Majiang", p.self_user.sex, "gang") - effects = "clip_gang" - end - local clip = UIPackage.CreateObjectFromURL(string.format("ui://Main_Majiang/%s", effects)) - clip:SetSize(loader_HuEffect.width, loader_HuEffect.height) - loader_HuEffect:AddChild(clip) - clip:SetPlaySettings(0, -1, 1, -1) - clip.onPlayEnd:Add(function() - if clip.parent then - clip.parent:RemoveChild(clip) - end - clip:Dispose() - end) - clip.playing = true - coroutine.start(function() - coroutine.wait(0.3) - self._popEvent = true - end) - end - else - info:UpdateHandCard(false, true) - end - ----多人胡的时候,同时显示胡 - if step.cmd == Record_Event.Evt_Result then - --所有都显示胡吧,暂时没做胡和自摸的判断 - if step.result_data.info_list[i].is_win then - local info2 = self._player_card_info[self:GetPos(step.result_data.info_list[i].seat)] - local loader_HuEffect = info2._viewLoader_selfHuCardEffect - local isZiMo = false - DataManager.CurrenRoom.isZiMoHu = isZiMo - local hu_sound = isZiMo and ("zimo") or ("hu") - printlog("声音====>>>", hu_sound) - self:PlaySound(self.asset_group, p.self_user.sex, hu_sound) + else + self:PlaySound("Main_Majiang", p.self_user.sex, "gang") + effects = "clip_gang" + end + local clip = UIPackage.CreateObjectFromURL(string.format("ui://Main_Majiang/%s", effects)) + clip:SetSize(loader_HuEffect.width, loader_HuEffect.height) + loader_HuEffect:AddChild(clip) + clip:SetPlaySettings(0, -1, 1, -1) + clip.onPlayEnd:Add(function() + if clip.parent then + clip.parent:RemoveChild(clip) + end + clip:Dispose() + end) + clip.playing = true + coroutine.start(function() + coroutine.wait(0.3) + self._popEvent = true + end) + end + else + info:UpdateHandCard(false, true) + end + ----多人胡的时候,同时显示胡 + if step.cmd == Record_Event.Evt_Result then + --所有都显示胡吧,暂时没做胡和自摸的判断 + if not self.result then + if step.result_data.info_list[i].is_win then + local info2 = self._player_card_info[self:GetPos(step.result_data.info_list[i].seat)] + local loader_HuEffect = info2._viewLoader_selfHuCardEffect + local isZiMo = false + DataManager.CurrenRoom.isZiMoHu = isZiMo + local hu_sound = isZiMo and ("zimo") or ("hu") + printlog("声音====>>>", hu_sound) + self:PlaySound(self.asset_group, p.self_user.sex, hu_sound) - local effects = isZiMo and ("tile_zimo") or ("tile_hu") - loader_HuEffect.visible = true - loader_HuEffect.url = "ui://Main_Majiang/" .. effects - loader_HuEffect:SetScale(2, 2) - local hu_tween = loader_HuEffect:TweenScale(Vector2(1, 1), 0.3) - hu_tween:SetEase(EaseType.QuartOut) - hu_tween:OnComplete(function() - loader_HuEffect.visible = false - end) - end - end - end - 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() - else - if self._win_pic then - self._win_pic:Dispose() - end - end - if step.cmd == Record_Event.Evt_Niao then - local niao_list = step.niao - self._niao = UIPackage.CreateObjectFromURL("ui://Extend_MJ_NanCheng/Panel_Birds") - local list = self._niao:GetChild("Lst_birds") - list:RemoveChildrenToPool() - for i = 1, #niao_list do - local item = list:AddItemFromPool() - item.icon = UIPackage.GetItemURL("Main_Majiang", "b201_" .. niao_list[i].card) - if niao_list[i].score > 0 then - item:GetController("bg").selectedIndex = 2 - end - end - self._view:AddChild(self._niao) - self._view:AddChild(self._view:GetChild("panel_record")) - self._niao:Center() - else - if self._niao then - self._niao:Dispose() - end - end - if step.cmd == Record_Event.Evt_Result then - if not self.result then - local result = step.result_data - self.result = EXClearingView.new(self, { flag_back = true }) - self.result:InitData(0, self._room, result) - 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._anchor:AddChild(self.result._view) - self.result._view.visible = false - self.result._view.x = self._anchor.x * -1 - self.result._view.y = self._anchor.y * -1 + local effects = isZiMo and ("tile_zimo") or ("tile_hu") + loader_HuEffect.visible = true + loader_HuEffect.url = "ui://Main_Majiang/" .. effects + loader_HuEffect:SetScale(2, 2) + local hu_tween = loader_HuEffect:TweenScale(Vector2(1, 1), 0.3) + hu_tween:SetEase(EaseType.QuartOut) + hu_tween:OnComplete(function() + loader_HuEffect.visible = false + end) + end + end + end + ---显示提示按钮 + local _ctr_tips = info._view:GetController('tip2') + local _lit_fanzi = info._view:GetChild("Comp_Back_FZTips") + if step.cmd == Record_Event.Evt_FZTip then + if p.seat == step.seat then + local tip = step.tiplist + local _tlist = tip.tip_sortList + _lit_fanzi.itemRenderer = function(index, obj) + local type = obj:GetController('type') + if index == tip.tip_num then + type.selectedIndex = 0 + else + index = index + 1 + if _tlist[index].type == FZType.HU then + type.selectedIndex = 4 + obj:GetChild('btn_Card1').icon = string.format('ui://Main_Majiang/b202_%d', + _tlist[index].card) + elseif _tlist[index].type == FZType.Chi then + type.selectedIndex = FZType.Chi + for i = 1, 3 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].opcard[i]) + end + elseif _tlist[index].type == FZType.Peng then + type.selectedIndex = FZType.Peng + for i = 1, 3 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].card) + end + else + for i = 1, 4 do + obj:GetChild(string.format('btn_Card%d', i)).icon = string.format( + 'ui://Main_Majiang/b202_%d', + _tlist[index].card) + end + type.selectedIndex = FZType.Gang + if _tlist[index].type == FZType.Gang_An then + obj:GetChild('btn_Card4').icon = 'ui://Main_Majiang/b202_00' + end + end + end + end + _ctr_tips.selectedIndex = 1 + _lit_fanzi.numItems = tip.tip_num + 1 + end + else + _ctr_tips.selectedIndex = 0 + _lit_fanzi.numItems = 0 + end + end + + --统一在大结算时显示 + if step.cmd == Record_Event.Evt_Win then + else + if self._win_pic then + self._win_pic:Dispose() + end + end + --统一在大结算时显示 + if step.cmd == Record_Event.Evt_Niao then + local niao_list = step.niao + else + end + if step.cmd == Record_Event.Evt_Result then + print("lingmeng playerback", self.result) + if not self.result then + local result = step.result_data + self.result = EXClearingView.new(self, { flag_back = true }) + self.result:InitData(0, self._room, result) + 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._anchor:AddChild(self.result._view) + self.result._view.visible = false + self.result._view.x = self._anchor.x * -1 + self.result._view.y = self._anchor.y * -1 local liuju = result and result.liuju or nil coroutine.start(function() @@ -301,30 +341,83 @@ function M:ShowStep(index) end end - --统一显示弹出分数 - for i = 1, #result.info_list do - local hu_info = result.info_list[i] - local head_info = self._player_info[self:GetPos(hu_info.seat)] + --展示摸鸟 + local niao_list = result.niao + self._niao = UIPackage.CreateObject("Extend_MJ_FuZhou", "Panel_Birds") + self._view:GetChild('jiangma_show'):AddChild(self._niao) + self._niao:Center() + local list_niao_card = self._niao:GetChild("Lst_birds") + list_niao_card:RemoveChildrenToPool() + for i = 1, #niao_list do + --顯示正面 + local item = list_niao_card:AddItemFromPool() + local card = niao_list[i].card + item.icon = UIPackage.GetItemURL("Main_Majiang", "b202_" .. card) + if niao_list[i].score > 0 then + item:GetController("select").selectedIndex = 1 + else + item:GetController("select").selectedIndex = 0 + end + coroutine.wait(2 / #niao_list) + end + coroutine.wait(0.3) + self._niao:Dispose() + + --统一显示弹出分数 + for i = 1, #result.info_list do + local hu_info = result.info_list[i] + local head_info = self._player_info[self:GetPos(hu_info.seat)] -- 扣分动画 head_info:UpdateScore(hu_info.total_score, true) end coroutine.wait(0.3) - if liuju then - self:PlayMJSound("liuju.mp3") - coroutine.wait(3) - self:PlayMJSound("end_music.mp3") - else - self:PlayMJSound("end_music.mp3") - end - coroutine.wait(0.5) - self.result._view.visible = true - end) - else - self.result._view.visible = true - end - end + if liuju then + self:PlayMJSound("liuju.mp3") + coroutine.wait(3) + self:PlayMJSound("end_music.mp3") + else + self:PlayMJSound("end_music.mp3") + end + coroutine.wait(0.5) + self.result._view.visible = true + end) + else + -- self.result._view.visible = true + end + end + --显示杠分 + if step.cmd == Record_Event.Evt_GangScore then + local totalScoreList = step.totalScoreList + local playerList = step.playerList + local addScoreList = step.addScoreList + local scoreData = {} + for i = 1, #totalScoreList do + local p = {} + + p.totalScore = totalScoreList[i] + p.player = playerList[i] + p.addScore = addScoreList[i] + + scoreData[#scoreData + 1] = p + end + + for _, p in pairs(scoreData) do + local player = self._room:GetPlayerById(p.player) + local infoView = self._player_info[self:GetPos(player.seat)] + player.cur_hp = p.totalScore + + if p.addScore ~= 0 then + infoView:ScoreAnimation(p.addScore) + if player.cur_hp >= 0 then + infoView._view:GetChild("text_jifen").text = "+" .. player.cur_hp + else + infoView._view:GetChild("text_jifen").text = player.cur_hp + end + end + end + end end function M:GenerateAllStepData(data) @@ -426,6 +519,39 @@ function M:CmdPiao(cmd, index) data.player_card_data[cmd.seat].piao_niao = cmd.data.num end +function M:CmdFZTip(cmd, index) + local data = self:CopyLastStep(index) + data.cmd = cmd.cmd + data.seat = cmd.seat + local tiplist = FZTipList.new() + local list = cmd.data.tip_list + for i = 1, #list do + local dtip = list[i] + local tip = {} + tip.id = dtip["id"] + tip.weight = dtip["weight"] + tip.card = dtip["card"] + tip.type = dtip["type"] + tip.opcard = dtip["opcard"] + tiplist:AddTip(tip) + end + --排序规则,胡杠碰 + tiplist:SortList(function(a, b) + return a.type < b.type + end) + data.tiplist = tiplist + data.weight = cmd.data.weight +end + +function M:GangScore(cmd, index) + local data = self:CopyLastStep(index) + data.cmd = cmd.cmd + data.seat = cmd.seat + data.totalScoreList = cmd.data.totalScoreList + data.playerList = cmd.data.playerList + data.addScoreList = cmd.data.addScoreList +end + function M:CmdResult(cmd, index) local data = self:CopyLastStep(index) data.cmd = cmd.cmd diff --git a/lua_probject/extend_project/extend/majiang/nancheng/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/nancheng/ExtendConfig.lua index 42ddd73d..c70eb79b 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/ExtendConfig.lua @@ -158,7 +158,7 @@ function M:FillPlayBackData(pd_data) -- room.self_player = p -- p.self_user = DataManager.SelfUser -- else - if p.seat == 1 then room.self_player = p end + -- if p.seat == 1 then room.self_player = p end local u = User.new() u.account_id = pid p.self_user = u @@ -180,6 +180,16 @@ function M:FillPlayBackData(pd_data) room:AddPlayer(p) end + local PlayerList = room.player_list + for i = 1, #PlayerList do + local p = PlayerList[i] + if DataManager.SelfUser.account_id == p.self_user.account_id then + room.self_player = p + end + end + if not room.self_player then + room.self_player = room:GetPlayerBySeat(1) + end room.cmdList = pd_data["cmdList"] end diff --git a/lua_probject/extend_project/extend/majiang/nancheng/RecordEvent.lua b/lua_probject/extend_project/extend/majiang/nancheng/RecordEvent.lua index 09748550..719af8f5 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/RecordEvent.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/RecordEvent.lua @@ -6,6 +6,8 @@ local Record_Event = { Evt_Niao = "Niao", Evt_Piao = "PiaoNiao", Evt_Result = "Result", + Evt_FZTip = "FizTip", + Evt_GangScore = "GangScore", } -return Record_Event \ No newline at end of file +return Record_Event diff --git a/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua b/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua index 06f2290e..99a79232 100644 --- a/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua +++ b/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua @@ -122,7 +122,7 @@ function M:InitLastCard(cardList, mustPutMaxCard) return end if self.type == 0 then - ViewUtil.ErrorTip(-1, "上一份牌型判断错误") + -- ViewUtil.ErrorTip(-1, "上一份牌型判断错误") end end diff --git a/lua_probject/extend_project/extend/poker/runfast/EXGameInfo.lua b/lua_probject/extend_project/extend/poker/runfast/EXGameInfo.lua index b6ea6122..1bc9e548 100644 --- a/lua_probject/extend_project/extend/poker/runfast/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/poker/runfast/EXGameInfo.lua @@ -305,32 +305,60 @@ function M:LoadConfigToDetail(data, hpdata) returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) if configData.leaf then - returnString = string.format("%s,%s", returnString, configData.leaf == 1 and "十五张手牌" or "十六张手牌") + returnString = string.format("%s,%s", returnString, configData.leaf == 1 and "15张手牌" or "16张手牌") + end + if configData.showlength then + returnString = string.format("%s,%s", returnString, configData.showlength == 0 and "不显示牌数" or "显示牌数") + end + if configData.planeNoBelt and configData.threeNoBelt then + if configData.planeNoBelt == 0 and configData.threeNoBelt == 0 then + returnString = string.format("%s,%s", returnString, "三张、飞机必带") + elseif configData.planeNoBelt == 0 then + returnString = string.format("%s,%s", returnString, "三张必带、飞机可不带") + elseif configData.threeNoBelt == 0 then + returnString = string.format("%s,%s", returnString, "三张可不带、飞机必带") + else + returnString = string.format("%s,%s", returnString, "三张、飞机可不带") + end + else + if configData.planeNoBelt then + returnString = string.format("%s%s", returnString, configData.planeNoBelt == 0 and "" or ",飞机可不带") + end + if configData.threeNoBelt then + returnString = string.format("%s%s", returnString, configData.threeNoBelt == 0 and "" or ",三张可不带") + end + end + + if configData.planelack and configData.threelack then + if configData.planelack == 0 and configData.threelack == 0 then + returnString = string.format("%s,%s", returnString, "三张、飞机不可少带接完") + elseif configData.planelack == 0 then + returnString = string.format("%s,%s", returnString, "三张不可少带接完、飞机可少带接完") + elseif configData.threelack == 0 then + returnString = string.format("%s,%s", returnString, "三张可少带接完、飞机不可少带接完") + else + returnString = string.format("%s,%s", returnString, "三张、飞机可少带接完") + end + else + if configData.planelack then + returnString = string.format("%s%s", returnString, configData.planelack == 0 and "" or ",飞机可少带") + end + if configData.threelack then + returnString = string.format("%s%s", returnString, configData.threelack == 0 and "" or ",三张可少带") + end + end + if configData.fourDaiThree then + returnString = string.format("%s%s", returnString, configData.fourDaiThree and ",四带三" or "") + end + if configData.heartten then + returnString = string.format("%s%s", returnString, configData.heartten == 1 and "" or ",红桃10扎鸟") end if configData.rule then returnString = string.format("%s%s", returnString, - configData.rule == 1 and ",黑桃三必出" or "") - end - if configData.planeNoBelt then - returnString = string.format("%s%s", returnString, configData.planeNoBelt == 0 and "" or ",飞机可不带") - end - if configData.threeNoBelt then - returnString = string.format("%s%s", returnString, configData.threeNoBelt == 0 and "" or ",三张可不带") - end - if configData.planelack then - returnString = string.format("%s%s", returnString, configData.planelack == 0 and "" or ",飞机可少带") - end - if configData.threelack then - returnString = string.format("%s%s", returnString, configData.threelack == 0 and "" or ",三张可少带") - end - if configData.fourDaiThree then - returnString = string.format("%s%s", returnString, configData.fourDaiThree and "" or ",四带三") - end - if configData.heartten then - returnString = string.format("%s%s", returnString, configData.heartten == 1 and "" or ",红桃扎鸟") + configData.rule == 1 and ",首局黑桃三必出" or "") end if configData.specilAdd then - returnString = string.format("%s%s", returnString, configData.specilAdd == 0 and "" or ",特殊加分") + returnString = string.format("%s%s", returnString, configData.specilAdd == 0 and "" or ",只出一张加扣10分,出2-3张加扣5分") end returnString = returnString .. IGameInfo.LoadConfigToDetail(self, configData, hpData) diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_GameController.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_GameController.lua index 9aef4187..a5f831e1 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_GameController.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_GameController.lua @@ -243,9 +243,9 @@ function M:OnPlaySuccCheck(evt_data) local player = self._room:GetPlayerBySeat(seat) local out_card_list = self:ChangeCodeByFrom(cards, true) player.hand_count = remain - if remain ~= 0 then - self._cardCheck:InitLastCard(out_card_list) - end + -- if remain ~= 0 then + self._cardCheck:InitLastCard(out_card_list) + -- end local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list) player.out_card_list = self:GetSortOutCardList(out_card_list, card_type, number, plan_three_count) DispatchEvent(self._dispatcher, RunFast_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList, diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua index 1ed2e78a..870719c0 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua @@ -664,6 +664,7 @@ function M:EventInit() if index == 1 then self.caozuo = 0 end + coroutine.stop(self._leftClock_continue) local head_info = self._player_info[index] if head_info._view:GetChild("shengyu") ~= nil then @@ -707,7 +708,7 @@ function M:EventInit() -- end -- end self:_Effect(self._cardCheck.type, p) - + print("lingmeng end _Effect", self._cardCheck.type) self:PlaySound(p.self_user.sex, self:GetSoundFileName(self._cardCheck.type, num, self._room.is_new_bout)) -- self:PlaySound(p.self_user.sex, self:GetSoundFileName(cardstype, num, self._room.is_new_bout)) diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_ResultView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_ResultView.lua index 45eb1d95..953c9820 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_ResultView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_ResultView.lua @@ -109,6 +109,7 @@ function M:init(url, data, roomid, over, win_seat, dissolve, remaincards) self._view:GetChild('text_roomID').text = room.room_id self._view:GetChild('text_time').text = os.date('%m-%d %H:%M', os.time()) self._view:GetChild('text_groupID').text = room.group_id or 0 + self._view:GetController('num').selectedIndex = #data == 2 and 0 or 1 for i = 1, #data do local info = data[i] local playerInfo = room:GetPlayerBySeat(info.seat) diff --git a/wb_new_ui/assets/Common/component/head/VoiceMask2.xml b/wb_new_ui/assets/Common/component/head/VoiceMask2.xml new file mode 100644 index 00000000..0f861159 --- /dev/null +++ b/wb_new_ui/assets/Common/component/head/VoiceMask2.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + +