diff --git a/lua_probject/base_project/Game/Controller/GameController.lua b/lua_probject/base_project/Game/Controller/GameController.lua index d8e837f5..696d0432 100644 --- a/lua_probject/base_project/Game/Controller/GameController.lua +++ b/lua_probject/base_project/Game/Controller/GameController.lua @@ -166,7 +166,7 @@ function M:ExitWitnessGame(pid, gid, rid) _data["room_id"] = rid -- _data["session"] = _client:getSession() _client:send(Protocol.GAME_Exit_WITNESS_ROOM, _data) - -- _client:destroy() + _client:destroy() end --聊天 diff --git a/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua b/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua index fb6bc709..af3e2681 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua @@ -23,7 +23,7 @@ local function list_players_Renderer(index, obj, players, self) tex_name.text = player.nick tex_id.text = player.accId - tex_score.text = player.score + tex_score.text = string.format("%s%s", player.score >= 0 and "+" or "", player.score) obj:GetController('cCouler').selectedIndex = player.score >= 0 and 0 or 1 ImageLoad.Load(player.portrait, loader_icon) @@ -38,7 +38,6 @@ local function ChatItemRenderer(index, obj, self) --local data = self.ChatRoomData.records[index + 1] local record = self.group.records[index + 1] local group = DataManager.groups:get(record.groupId) - local play = group:getPlay(record.pid) --local totalScore = json.decode(data.totalScore) --local hpData = json.decode(record.hpData) SetBigWiller(record.players) @@ -49,7 +48,7 @@ local function ChatItemRenderer(index, obj, self) local tex_roomIdRound = obj:GetChild("tex_roomIdRound") tex_time.text = os.date("游戏结算:%m月%d号 %X", record.create_time) --data.create_time - tex_name.text = play.game_name --record.game_info.name + tex_name.text = record.game_info.name local roundTex = record.round .. "/" .. record.maxRound tex_roomIdRound.text = record.room_id .. "\n" .. roundTex diff --git a/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua index ecd80f9c..efbf9493 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua @@ -267,7 +267,7 @@ function FamilyNumberRecord.New(root, page) self._view:GetChild('text_residueDiamond').text = res_data.diamo text_allRound.text = res_data.round text_winNum.text = res_data.win_count - text_useDiamond.text = res_data.diamo_cost + text_useDiamond.text = res_data.diamo_cost / 100 self.MJScore = tonumber(res.Data.mj_score) self.PKScore = tonumber(res.Data.pk_score) self.text_score_majiang.text = 0 - self.MJScore @@ -324,7 +324,7 @@ function M:NumverRecordRenderer() local info = self.records[index + 1][2] obj:GetChild('text_gameType').text = index == 0 and "麻将" or "扑克" obj:GetChild('text_round').text = info.childNum - obj:GetChild('text_score').text = info.totalScore + obj:GetChild('text_score').text = string.format("%s%s", info.totalScore >= 0 and "+" or "", info.totalScore) obj:GetChild('text_winNum').text = info.winNum obj:GetChild('btn_lookRecord').touchable = info.childNum ~= 0 obj:GetChild('btn_lookRecord'):GetController('cColor').selectedIndex = info.childNum ~= 0 and 0 or 1 @@ -348,7 +348,7 @@ function M:NumverRecordRenderer() local info = self.records[index + 1][1] obj:GetChild('text_gameType').text = index == 0 and "麻将" or "扑克" obj:GetChild('text_round').text = info.childNum - obj:GetChild('text_score').text = info.totalScore + obj:GetChild('text_score').text = string.format("%s%s", info.totalScore >= 0 and "+" or "", info.totalScore) obj:GetChild('text_winNum').text = info.winNum obj:GetChild('btn_lookRecord').touchable = info.childNum ~= 0 obj:GetChild('btn_lookRecord'):GetController('cColor').selectedIndex = info.childNum ~= 0 and 0 or 1 @@ -376,7 +376,7 @@ function M:NumberRecordDetailRender() obj:GetChild('text_gameName').text = info.game_info.name obj:GetChild('text_time').text = os.date('%Y-%m-%d\n%H:%M', info.create_time) obj:GetChild('text_roomID').text = info.room_id - obj:GetChild('text_userDiamond').text = info.valid_diamo + obj:GetChild('text_userDiamond').text = info.valid_diamo / 100 obj:GetChild('text_playName').emojies = EmojiDitc.EmojiesDitc obj:GetChild('text_playName').text = info.pname obj:GetChild('btn_lookRecord').onClick:Set(function() @@ -416,7 +416,8 @@ function M:NumberRecordDetailRender() local resultInfo = info.totalScore[index + 1] ImageLoad.Load(resultInfo.portrait, obj:GetChild('btn_head')._iconObject) obj:GetChild('text_name').text = resultInfo.nick - obj:GetChild('text_score').text = resultInfo.score + 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 resultDetailList.numItems = #info.totalScore @@ -506,7 +507,8 @@ function M:NumverRankRenderer(groupId) ImageLoad.Load(info.portrait, obj:GetChild('btn_head')._iconObject) obj:GetChild('text_ID').text = info.uid obj:GetChild('text_nick').text = info.nick - obj:GetChild('text_score').text = tonumber(info.score) + obj:GetChild('text_score').text = string.format("%s%s", tonumber(info.score) >= 0 and "+" or "", + tonumber(info.score)) obj:GetChild('btn_lookRecord').onClick:Set(function() self.ctr_numberRecord.selectedIndex = 1 self:OnClickNumberRank(groupId, info.uid, info.round) diff --git a/lua_probject/base_project/Game/View/Family/FamilyRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyRecord.lua index b771a446..dc25e318 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyRecord.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyRecord.lua @@ -169,7 +169,7 @@ function M:RecordItemRenderer(data, obj) obj:GetChild('text_gameName').text = data.game_info.name obj:GetChild('text_time').text = os.date("%Y-%m-%d\n%H:%M:%S", tonumber(data.create_time)) obj:GetChild('text_roomId').text = data.room_id - obj:GetChild('text_useDiamond').text = data.valid_diamo + obj:GetChild('text_useDiamond').text = data.valid_diamo / 100 obj:GetChild('btn_detail').onClick:Set(function() self._viewList_recordDetail:RemoveChildrenToPool() for i = 1, tonumber(data.round) do @@ -191,7 +191,7 @@ function M:RecordItemRenderer(data, 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_score').text = resultInfo.score + 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 for i = 1, #data.totalScore do diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 03128af8..f525bfc4 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -604,9 +604,14 @@ function M:UpdateFamilyRoom(fgCtr, id) self:FillSameRoomInfo(obj, 1, playInfo) local plist = readyRoom[newIndex].plist local insertName = "" - for i = 1, #plist do - ImageLoad.Load(plist[i].portrait, obj:GetChild(string.format("player%d", i))._iconObject) - insertName = string.format("%s、%s", plist[i].nick, insertName) + for i = 1, 4 do + if i <= #plist then + ImageLoad.Load(plist[i].portrait, obj:GetChild(string.format("player%d", i))._iconObject) + insertName = string.format("%s、%s", plist[i].nick, insertName) + else + local btn = obj:GetChild(string.format("player%d", i)) + btn:GetChild("icon").url = "ui://Family/btn_mainGameNumberHead" + end end obj:GetChild('Label_joinPlayers').text = insertName obj:GetChild('text_playerNum').text = string.format("%s/%s", #plist, playInfo.maxPlayers) @@ -623,9 +628,12 @@ function M:UpdateFamilyRoom(fgCtr, id) end if response.ReturnCode ~= 0 then + if response.ReturnCode == 10 then + self:EnterWitnesss(id, roomList[newIndex].id, playInfo.gameId, roomList[newIndex].pid) + return + end ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间失败') -- ViewManager.ChangeView(ViewManager.View_Lobby) - return else UpdateBeat:Remove(self.OnUpdate, self) FamilyView.lastId = self._group.id @@ -637,60 +645,10 @@ function M:UpdateFamilyRoom(fgCtr, id) ) end) obj:GetChild('btn_watch').onClick:Set(function() - roomCtr:PublicWitnessRoom( - Protocol.WEB_FG_Witness_ROOM, - roomList[newIndex].id, - id, - 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, '进入房间失败') - -- ViewManager.ChangeView(ViewManager.View_Lobby) - return - else - UpdateBeat:Remove(self.OnUpdate, self) - FamilyView.lastId = self._group.id - ViewManager.ChangeView(ViewManager.View_Witness, playInfo.gameId) - end - end, - playInfo.gameId, - roomList[newIndex].pid - ) + self:EnterWitnesss(id, readyRoom[newIndex].id, playInfo.gameId, readyRoom[newIndex].pid) end) obj:GetChild('btn_jiesan').onClick:Set(function() - local _curren_msg = - MsgWindow.new( - self._root_view, - '确定要解散该房间吗?', - MsgWindow.MsgMode.OkAndCancel - ) - _curren_msg.onOk:Add( - function() - ViewUtil.ShowModalWait(self._root_view) - local fgCtr = ControllerManager.GetController(NewGroupController) - - fgCtr:FG_RemoveRoom( - id, - readyRoom[newIndex].id, - function(res) - if self._is_destroy then - return - end - ViewUtil.CloseModalWait() - if res.ReturnCode ~= 0 then - ViewUtil.ErrorTip(res.ReturnCode, '删除房间失败!') - return - end - end - ) - end - ) - _curren_msg:Show() + self:JieSanRomm(id, readyRoom[newIndex].id) end) elseif index >= all_num - #startRoom then local newIndex = index - #readyRoom - #playList + 1 @@ -708,60 +666,10 @@ function M:UpdateFamilyRoom(fgCtr, id) startRoom[newIndex].times) obj:GetChild('btn_joinGame').onClick:Clear() obj:GetChild('btn_watch').onClick:Set(function() - roomCtr:PublicWitnessRoom( - Protocol.WEB_FG_Witness_ROOM, - startRoom[newIndex].id, - id, - 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, '进入房间失败') - -- ViewManager.ChangeView(ViewManager.View_Lobby) - return - else - UpdateBeat:Remove(self.OnUpdate, self) - FamilyView.lastId = self._group.id - ViewManager.ChangeView(ViewManager.View_Witness, playInfo.gameId) - end - end, - playInfo.gameId, - startRoom[newIndex].pid - ) + self:EnterWitnesss(id, startRoom[newIndex].id, playInfo.gameId, startRoom[newIndex].pid) end) obj:GetChild('btn_jiesan').onClick:Set(function() - local _curren_msg = - MsgWindow.new( - self._root_view, - '确定要解散该房间吗?', - MsgWindow.MsgMode.OkAndCancel - ) - _curren_msg.onOk:Add( - function() - ViewUtil.ShowModalWait(self._root_view) - local fgCtr = ControllerManager.GetController(NewGroupController) - - fgCtr:FG_RemoveRoom( - id, - startRoom[newIndex].id, - function(res) - if self._is_destroy then - return - end - ViewUtil.CloseModalWait() - if res.ReturnCode ~= 0 then - ViewUtil.ErrorTip(res.ReturnCode, '删除房间失败!') - return - end - end - ) - end - ) - _curren_msg:Show() + self:JieSanRomm(id, readyRoom[newIndex].id) end) else local newIndex = index - #readyRoom + 1 @@ -829,11 +737,73 @@ function M:FillSameRoomInfo(obj, type, playInfo) obj:GetChild('game_type').emojies = EmojiDitc.EmojiesDitc obj:GetChild('game_type').text = string.format("(%s)%s", playInfo.game_name, roomName) obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = type + obj:GetChild('btn_watch').visible = self._group.isWatch and self._group.isWatch == 1 + obj:GetChild('btn_jiesan').visible = self._group.lev < 3 obj:GetController('type').selectedIndex = type - obj:GetController('isWatch').selectedIndex = (self._group.isWatch and self._group.isWatch == 1) and type or 0 obj:GetController('num').selectedIndex = playInfo.maxPlayers - 2 end +--点击进入观战 +function M:EnterWitnesss(groupId, roomId, gameId, pid) + local roomCtr = ControllerManager.GetController(RoomController) + roomCtr:PublicWitnessRoom( + Protocol.WEB_FG_Witness_ROOM, + roomId, + groupId, + 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, '进入房间失败') + -- ViewManager.ChangeView(ViewManager.View_Lobby) + return + else + UpdateBeat:Remove(self.OnUpdate, self) + FamilyView.lastId = self._group.id + ViewManager.ChangeView(ViewManager.View_Witness, gameId) + end + end, + gameId, + pid + ) +end + +--点击解散房间 +function M:JieSanRomm(groupId, roomId) + local _curren_msg = + MsgWindow.new( + self._root_view, + '确定要解散该房间吗?', + MsgWindow.MsgMode.OkAndCancel + ) + _curren_msg.onOk:Add( + function() + ViewUtil.ShowModalWait(self._root_view) + local fgCtr = ControllerManager.GetController(NewGroupController) + + fgCtr:FG_RemoveRoom( + groupId, + roomId, + function(res) + if self._is_destroy then + return + end + ViewUtil.CloseModalWait() + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, '删除房间失败!') + return + end + end + ) + end + ) + _curren_msg:Show() +end + function M:ReflashFamilyList() local list_family = self._view:GetChild('list_family') list_family.numItems = #DataManager.groups.groupList diff --git a/lua_probject/base_project/Game/View/MainView.lua b/lua_probject/base_project/Game/View/MainView.lua index 718661e5..340f0463 100644 --- a/lua_probject/base_project/Game/View/MainView.lua +++ b/lua_probject/base_project/Game/View/MainView.lua @@ -1282,23 +1282,23 @@ function M:Missile(seat, targetSeat, Missile) local animUrl = "" local url = "" if Missile == "boom" then - animUrl = "ui://Main_Majiang/Missile_boom" + animUrl = "ui://Main_Majiang/bomb" url = "ui://Common/boom" elseif Missile == "egg" then - animUrl = "ui://Main_Majiang/Missile_egg" + animUrl = "ui://Main_Majiang/egg" url = "ui://Common/egg" elseif Missile == "diamo" then - animUrl = "ui://Main_Majiang/Missile_diamo" + animUrl = "ui://Main_Majiang/jiezhi" url = "ui://Common/diamo" elseif Missile == "flower" then - animUrl = "ui://Main_Majiang/Missile_flower" + animUrl = "ui://Main_Majiang/flower" url = "ui://Common/flower" end local send = self._player_info[self:GetPos(seat)] local target = self._player_info[self:GetPos(targetSeat)] - MissileSender.Send(url, send._view, target._view, self._view, animUrl, 5, 1) + MissileSender.Send(url, send, target, self, animUrl, Missile, 5, 1) end -- 获取消息使用的语言、序号 diff --git a/lua_probject/base_project/Game/View/MissileSender.lua b/lua_probject/base_project/Game/View/MissileSender.lua index 1b9057c9..931400d5 100644 --- a/lua_probject/base_project/Game/View/MissileSender.lua +++ b/lua_probject/base_project/Game/View/MissileSender.lua @@ -42,31 +42,36 @@ local function BackMovieClip(obj, url) obj.visible = false end -function MissileSender.Send(url, send, target, view, animUrl, num, time) - if curView ~= view then - pool = {} - end - - curView = view - - local sendPos = send.xy --Vector2.New(send.x + send.width/2, send.y + send.height/2) - local targetPos = target.xy --Vector2.New(target.x + target.width/2, target.y + target.height/2) +function MissileSender.Send(url, send, target, root, animUrl, Missile, num, time) + local sendPos = send._view.xy --Vector2.New(send.x + send.width/2, send.y + send.height/2) + local targetPos = target._view.xy --Vector2.New(target.x + target.width/2, target.y + target.height/2) + local clipFather = target._view:GetChild('comp_hudon') for i = 1, num do local obj = GetObj() obj:GetChild("loader").url = url - view:AddChild(obj) - obj.width = send.width - obj.height = send.height + root._view:AddChild(obj) + obj.width = send._view.width + obj.height = send._view.height obj.xy = sendPos -- 间隔 obj:TweenMove(obj.xy, i * 0.1):OnComplete(function() obj:TweenMove(targetPos, time):OnComplete(function() BackObj(obj) - if i == num then - MissileSender.Animation(target, animUrl, view) - end + --动画击中头像后播放击中的音效和动画 + root:PlayMJSound(string.format("%s.mp3", Missile)) + local clip = UIPackage.CreateObjectFromURL(string.format("ui://Main_Majiang/%s", Missile)) + clip:SetSize(clipFather.width, clipFather.height) + clipFather: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 end) end) end diff --git a/lua_probject/base_project/Game/View/ViewUtil.lua b/lua_probject/base_project/Game/View/ViewUtil.lua index 2432c43b..587fd221 100644 --- a/lua_probject/base_project/Game/View/ViewUtil.lua +++ b/lua_probject/base_project/Game/View/ViewUtil.lua @@ -355,6 +355,7 @@ function ViewUtil.ShowOneInput(data, callback) pop_oneInput:GetChild('title').text = data.titleText or "" pop_oneInput:GetChild('label_detial').text = data.showText or "" pop_oneInput:GetChild('input_oneInput').promptText = data.promptText or "" + pop_oneInput:GetChild('input_oneInput').text = data.text or "" GRoot.inst:AddChild(pop_oneInput) pop_oneInput:Center() local btn_center = pop_oneInput:GetChild('btn_center') diff --git a/lua_probject/base_project/Game/View/WitnessView.lua b/lua_probject/base_project/Game/View/WitnessView.lua index 75826cad..f8bf49e0 100644 --- a/lua_probject/base_project/Game/View/WitnessView.lua +++ b/lua_probject/base_project/Game/View/WitnessView.lua @@ -1,21 +1,30 @@ local MJSettingView = require("main.majiang.MJSettingViewNew") -local TableBG = require("Game.Data.TableBG") local MJMainView = require("main.majiang.MJMainView") -local bg_config = { - { id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01" }, - { id = 2, url = "base/main_majiang/bg/bg2", thumb = "ui://Main_Majiang/b02" }, - { id = 3, url = "base/main_majiang/bg/bg3", thumb = "ui://Main_Majiang/b03" }, - { id = 3, url = "base/main_majiang/bg/bg4", thumb = "ui://Main_Majiang/b04" } -} - local WitnessView = {} -setmetatable(WitnessView, { __index = BaseView }) -function WitnessView:init() +local M = WitnessView +setmetatable(M, { __index = BaseView }) +function M:init() + self._gamectr = ControllerManager.GetController(GameController) + self._room = DataManager.CurrenRoom + self._room.Witness = true + + UIPackage.AddPackage('base/chat/ui/Chat') + + self._eventmap = {} + self._put_map = false + self._new_hide = false + self._queue = false + self._style = 1 + self._popEvent = true + self:InitView() end -function WitnessView:InitView() +function M:InitView(url) + local room = self._room + BaseView.InitView(self, url) + self.btn_setting = self._view:GetChild("btn_setting") self.com_logocType = self._view:GetChild("com_logo"):GetController("cType") @@ -24,19 +33,15 @@ function WitnessView:InitView() local view = MJSettingView.new(self, true) view:Show() end) - - local default_bg = 1 - TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) - self.com_notice = self._view:GetChild("com_notice") end -function WitnessView:Show() +function M:Show() getmetatable(WitnessView).__index.Show(self) self:DoNoticeAnimation() end -function WitnessView:DoNoticeAnimation() +function M:DoNoticeAnimation() self.noticeIndex = self.noticeIndex or 1 if not DataManager.GameNotice or #DataManager.GameNotice == 0 then return @@ -64,4 +69,4 @@ function WitnessView:DoNoticeAnimation() self._room.card_type = 1 end -return WitnessView +return M diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua index 7f934003..06b2d30e 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua @@ -219,6 +219,7 @@ function M:EventInit() -- self:ShowHuTip() --self._viewText_testName.text = 0 self:UpdateRound() + self:RemoveCursor() self._state.selectedIndex = 1 self:ShowJing() local list = _room.player_list diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua index b59c479c..ac74d71b 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua @@ -4,11 +4,7 @@ local PlayerInfoView2 = require("Game.View.PlayerInfoView2") local M = {} function M.new(view, mainView) - if mainView._room.room_config.people_num == 2 then - setmetatable(M, { __index = PlayerInfoView2 }) - else - setmetatable(M, { __index = PlayerInfoView }) - end + setmetatable(M, { __index = PlayerInfoView2 }) local self = setmetatable({}, { __index = M }) self._view = view self._main_view = mainView diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua index bb993fef..99b19cbb 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua @@ -6,8 +6,9 @@ local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView") local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView") local SettingView = import(".EXSettingView") local TableBG = require("Game.Data.TableBG") -local WitnessView = require("Game.View.WitnessView") +local WitnessView = require("main.majiang.MJWitnessView") local MJMainView = require("main.majiang.MJMainView") +local HuCardImg = import(".HuCardImg") local Record_Event = import(".RecordEvent") @@ -25,30 +26,18 @@ function M.new() end function M:init() - self._gamectr = ControllerManager.GetController(GameController) - self._room = DataManager.CurrenRoom - self._room.Witness = true - UIPackage.AddPackage('base/chat/ui/Chat') - UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang") - self._eventmap = {} - -- self._full = true - self._put_map = false - self._new_hide = false - self._queue = false - self._style = 1 - self._popEvent = true - self:InitView() - WitnessView.init(self) + getmetatable(M).__index.init(self) end -function M:InitView(url) +function M:InitView() local room = self._room + getmetatable(M).__index.InitView(self) + UIPackage.AddPackage("extend/majiang/lichuan/ui/Extend_MJ_LiChuan") - BaseView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) self:EventInit() UpdateBeat:Add(self.OnUpdate, self) - WitnessView.InitView(self) + self.HuCardImg = setmetatable(HuCardImg, { __index = self.HuCardImg }) local centerBox = self._view:GetChild("Comp_ConterBox") self._ctr_cardbox = centerBox:GetController("seat") @@ -203,6 +192,7 @@ function M:EventInit() self._clearingView = nil end self:UpdateRound() + self:RemoveCursor() self._state.selectedIndex = 4 local list = _room.player_list for i = 1, #list do @@ -252,8 +242,8 @@ function M:EventInit() info:UpdateOutCardList(nil, nil, self._cursor) print("ling 2zhihouq") - -- self:PlaySound("LiChuan_MJ", p.self_user.sex, tostring(card)) - -- self:PlayMJSound("chupai.mp3") + self:PlaySound("LiChuan_MJ", p.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") print("ling 2zhihou") if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 @@ -271,7 +261,105 @@ function M:EventInit() _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction)) _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) - print("lingmeng witness ZPHuCard") + self._left_time = 0 + self:UpdateCardBox(0) + local arg = { ... } + local win_seat = arg[1] + local lose_seat = arg[2] + local win_card = arg[3] + local cards = arg[4] + local win_list = arg[5] + local scoreData = arg[6] + local index = self:GetPos(win_seat) + local info = self._player_card_info[index] + local player = self._room:GetPlayerBySeat(win_seat) + info:ShowHuCard(win_card, index == 1) + + -- self.cHuCardEffect.selectedIndex = 1 + + local loader_HuEffect = info._viewLoader_selfHuCardEffect + local list_HuCardEffect = info._viewList_HuEffect + + --- + local isZiMo = win_seat == lose_seat + DataManager.CurrenRoom.isZiMoHu = isZiMo + local hu_sound = isZiMo and ("zimo") or ("hu") + printlog("声音====>>>", hu_sound) + self:PlaySound(self.asset_group, player.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) + loader_HuEffect:TweenScale(Vector2(1, 1), 0.3):SetEase(EaseType.QuartOut) + + --观战暂时把这个特效去了,现在这个特效位置也不对 + -- self.effect_ZiMo.xy = loader_HuEffect.xy + -- self.effect_ZiMo:SetPlaySettings(0, -1, 1, -1); + -- self.effect_ZiMo.visible = true + -- self.effect_ZiMo.playing = true + -- self.effect_ZiMo.onPlayEnd:Set(function() + -- self.effect_ZiMo.visible = false + -- end) + + coroutine.start(function() + coroutine.wait(0.5) + + loader_HuEffect.visible = false + local Effects = {} + for i = 1, #win_list do + local HuMsg = win_list[i] + + -- ↓↓↓先排列好特效图片 + if HuMsg.type > 2 and HuMsg.type < 32 then + -- local sound_name = string.format(self.Sound_path .. "%s/%s.mp3", + -- ViewUtil.Sex_Chat[player.self_user.sex], + -- "he" .. HuMsg.type) + -- ViewUtil.PlaySound(self.asset_group, sound_name) + self:PlaySound(self.asset_group, player.self_user.sex, "he" .. HuMsg.type) + local imgList = self.HuCardImg[HuMsg.type] + for _, img in pairs(imgList) do + local imgPath = "ui://Main_Majiang/" .. img + local imgObj = list_HuCardEffect:AddItemFromPool() + local imgLoader = imgObj:GetChild("loader_img") + imgLoader.url = imgPath + imgObj.visible = false + Effects[#Effects + 1] = imgObj + end + end + end + + -- ↓↓↓播放动画 + for _, imgObj in pairs(Effects) do + imgObj.visible = true + + local effect_xingxing = imgObj:GetChild("effect_xingxing") + effect_xingxing:SetPlaySettings(0, -1, 1, -1); + effect_xingxing.visible = true + effect_xingxing.playing = true + effect_xingxing.onPlayEnd:Set(function() + effect_xingxing.visible = false + end) + + local imgLoader = imgObj:GetChild("loader_img") + imgLoader:SetScale(2, 2) + imgLoader:Center() + imgLoader:TweenScale(Vector2(1, 1), 0.3) + 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) + self._popEvent = true + list_HuCardEffect:RemoveChildrenToPool() + + -- self.cHuCardEffect.selectedIndex = 0 + end) end) _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) @@ -299,7 +387,7 @@ function M:EventInit() -- le:Dispose() -- end) -- end - self:RemoveCursor() + -- self:RemoveCursor() if self._clearingView == nil then self._clearingView = EXClearingView.new(self._root_view) coroutine.start(function() @@ -418,6 +506,12 @@ function M:PlayMJSound(path) ViewUtil.PlaySound(self.asset_group, majiang_asset_path .. path) end +function M:PlaySound(group, sex, path) + local sex_path = ViewUtil.Sex_Chat[sex] + local path1 = majiang_asset_path .. string.format("%s/%s.mp3", sex_path, path) + ViewUtil.PlaySound(group, path1) +end + function M:UpdateRound() self._view:GetChild("text_round").text = string.format("局数:%d /%d", self._room.curren_round, self._room.room_config.round) diff --git a/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua index 4fccee69..3efa15c3 100644 --- a/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua @@ -11,6 +11,13 @@ function M.new(view, mainView) return self end +function M:init() + getmetatable(M).__index.init(self) + + --互动表情的父类 + self._hudon = self._view:GetChild('comp_hudon') +end + function M:FillData(player) PlayerInfoView.FillData(self, player) -- if player.cur_hp ~= nil then 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 ecac3d92..56d8c4a1 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_MainView.lua @@ -886,10 +886,10 @@ function M:EventInit() local num = player.hp_info.total_hp if num > 0 then head_info._view:GetController('text_color').selectedIndex = 0 - head_info._view:GetChild('text_score').text = "+" .. d2ad(player.hp_info.total_hp) + head_info._view:GetChild('text_jifen').text = "+" .. d2ad(player.hp_info.total_hp) else head_info._view:GetController('text_color').selectedIndex = 1 - head_info._view:GetChild('text_score').text = d2ad(player.hp_info.total_hp) + head_info._view:GetChild('text_jifen').text = d2ad(player.hp_info.total_hp) end card_info:PlayScore(d2ad(player.hp_info.round_actual_hp), false, win_seat == player.seat) else @@ -1032,10 +1032,10 @@ function M:ReConnectForStart() local num = player.hp_info.total_hp if num > 0 then head_info._view:GetController('text_color').selectedIndex = 0 - head_info._view:GetChild('text_score').text = '+' .. d2ad(player.hp_info.total_hp) + head_info._view:GetChild('text_jifen').text = '+' .. d2ad(player.hp_info.total_hp) else head_info._view:GetController('text_color').selectedIndex = 1 - head_info._view:GetChild('text_score').text = d2ad(player.hp_info.total_hp) + head_info._view:GetChild('text_jifen').text = d2ad(player.hp_info.total_hp) end else local rt = 1 @@ -1104,10 +1104,10 @@ function M:ReconnectForClearing() local num = player.hp_info.total_hp if num > 0 then head_info._view:GetController('text_color').selectedIndex = 0 - head_info._view:GetChild('text_score').text = '+' .. d2ad(player.hp_info.total_hp) + head_info._view:GetChild('text_jifen').text = '+' .. d2ad(player.hp_info.total_hp) else head_info._view:GetController('text_color').selectedIndex = 1 - head_info._view:GetChild('text_score').text = d2ad(player.hp_info.total_hp) + head_info._view:GetChild('text_jifen').text = d2ad(player.hp_info.total_hp) end -- player_card_info:PlayScore(d2ad(player.hp_info.round_actual_hp)) else diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua index 35f7d78e..e82785d8 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua @@ -116,7 +116,7 @@ function M:FillRoomData(data) if room.hpOnOff == 1 or room:checkHpNonnegative() then head_info._view:GetChild('zhanji').visible = true - head_info._view:GetChild('text_score').text = d2ad(p.total_hp) + head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp) end end head_info:FillData(p) diff --git a/lua_probject/main_project/main/majiang/MJMainView.lua b/lua_probject/main_project/main/majiang/MJMainView.lua index cdeb1e01..a7b48370 100644 --- a/lua_probject/main_project/main/majiang/MJMainView.lua +++ b/lua_probject/main_project/main/majiang/MJMainView.lua @@ -49,7 +49,7 @@ function M:InitView(url, use_custom_bg, custom_bg_config) self.loader_otherHuCardEffect = self._view:GetChild("loader_otherHuCardEffect") self.loader_selfHuCardEffect = self._view:GetChild("loader_selfHuCardEffect") self.cHuCardEffect = self._view:GetController("cHuCardEffect") - self.effect_ZiMo = self._view:GetChild("effect_ZiMo") + -- self.effect_ZiMo = self._view:GetChild("effect_ZiMo") self.com_notice = self._view:GetChild("com_notice") @@ -697,7 +697,7 @@ function M:OnResult1(...) -- le:Dispose() -- end) -- end - self:RemoveCursor() + -- self:RemoveCursor() self._clearingView = self.EXClearingViewClass.new(self._root_view) coroutine.start(function() coroutine.wait(0.5) @@ -755,7 +755,7 @@ function M:OnHuCard(...) local index = self:GetPos(win_seat) local info = self._player_card_info[index] local player = self._room:GetPlayerBySeat(win_seat) - self:RemoveCursor() + -- self:RemoveCursor() --info:UpdateHandCard(false, false) info:ShowHuCard(win_card, index == 1) @@ -787,7 +787,7 @@ function M:OnHuCard(...) loader_HuEffect:SetScale(2, 2) loader_HuEffect:TweenScale(Vector2(1, 1), 0.3):SetEase(EaseType.QuartOut) - self.effect_ZiMo.xy = loader_HuEffect.xy + self.effect_ZiMo = info._viewClip_effect_ZiMo self.effect_ZiMo:SetPlaySettings(0, -1, 1, -1); self.effect_ZiMo.visible = true self.effect_ZiMo.playing = true diff --git a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua index 49b2a50b..a861e2eb 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua @@ -56,6 +56,7 @@ function M:init() self._view_outCardList = self._view:GetChild('List_OutCard') self._viewList_HuEffect = self._view:GetChild("list_HuEffect") self._viewLoader_selfHuCardEffect = self._view:GetChild("loader_selfHuCardEffect") + self._viewClip_effect_ZiMo = self._view:GetChild("effect_ZiMo") self._view_getCard = self._view:GetChild('Btn_HandCard') self._ctr_getCard = self._view:GetController('getCard') diff --git a/lua_probject/main_project/main/majiang/MJWitnessView.lua b/lua_probject/main_project/main/majiang/MJWitnessView.lua new file mode 100644 index 00000000..59fe18f7 --- /dev/null +++ b/lua_probject/main_project/main/majiang/MJWitnessView.lua @@ -0,0 +1,50 @@ +local WitnessView = require("Game.View.WitnessView") +local TableBG = require("Game.Data.TableBG") + + +local bg_config = { + { id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01" }, + { id = 2, url = "base/main_majiang/bg/bg2", thumb = "ui://Main_Majiang/b02" }, + { id = 3, url = "base/main_majiang/bg/bg3", thumb = "ui://Main_Majiang/b03" }, + { id = 3, url = "base/main_majiang/bg/bg4", thumb = "ui://Main_Majiang/b04" } +} + + +local M = {} +setmetatable(M, { __index = WitnessView }) + +--- Create a new +function M.new() + local self = setmetatable({}, { __index = M }) + self.class = "MJMJWitness" + self:init() + + return self +end + +function M:init() + getmetatable(M).__index.init(self) + + UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang") +end + +function M:InitView() + local room = self._room + + UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang") + getmetatable(M).__index.InitView(self, + string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) + + --切换桌布功能 + local default_bg = 1 + local changeTable = self._view:GetChild('btn_change') + if changeTable then + changeTable.onClick:Set(function() + default_bg = default_bg + 1 > #bg_config and 1 or default_bg + 1 + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + end) + end + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) +end + +return M diff --git a/wb_new_ui/assets/Family/ChatRoom/Component/Slice 1.png b/wb_new_ui/assets/Family/ChatRoom/Component/Slice 1.png new file mode 100644 index 00000000..704c9d35 Binary files /dev/null and b/wb_new_ui/assets/Family/ChatRoom/Component/Slice 1.png differ diff --git a/wb_new_ui/assets/Family/ChatRoom/Component/item_player.xml b/wb_new_ui/assets/Family/ChatRoom/Component/item_player.xml index df791cff..e20c4f66 100644 --- a/wb_new_ui/assets/Family/ChatRoom/Component/item_player.xml +++ b/wb_new_ui/assets/Family/ChatRoom/Component/item_player.xml @@ -1,5 +1,5 @@ - + @@ -8,14 +8,14 @@ - - - - - + + + + + - + diff --git a/wb_new_ui/assets/Family/ChatRoom/Component/item_record.xml b/wb_new_ui/assets/Family/ChatRoom/Component/item_record.xml index f0fb5603..9ebd3461 100644 --- a/wb_new_ui/assets/Family/ChatRoom/Component/item_record.xml +++ b/wb_new_ui/assets/Family/ChatRoom/Component/item_record.xml @@ -1,11 +1,11 @@ - + - - - - - + + + + + diff --git a/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml b/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml index 1f93ef7a..1a3f3d01 100644 --- a/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml +++ b/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml @@ -10,7 +10,7 @@ - + diff --git a/wb_new_ui/assets/Family/Main.xml b/wb_new_ui/assets/Family/Main.xml index c5b167b6..2feaad86 100644 --- a/wb_new_ui/assets/Family/Main.xml +++ b/wb_new_ui/assets/Family/Main.xml @@ -10,7 +10,7 @@ - + diff --git a/wb_new_ui/assets/Family/Main/Component/btn_person_record.xml b/wb_new_ui/assets/Family/Main/Component/btn_person_record.xml index 5c2f1b1f..8bacc692 100644 --- a/wb_new_ui/assets/Family/Main/Component/btn_person_record.xml +++ b/wb_new_ui/assets/Family/Main/Component/btn_person_record.xml @@ -1,10 +1,10 @@ - + -