diff --git a/lua_probject/base_project/Game/Controller/GameController.lua b/lua_probject/base_project/Game/Controller/GameController.lua index 4f55536f..fe52013c 100644 --- a/lua_probject/base_project/Game/Controller/GameController.lua +++ b/lua_probject/base_project/Game/Controller/GameController.lua @@ -32,6 +32,12 @@ GameEvent = { --翻字 FangziAnimation = "FangziAnimation", + + --加减分 + AddScore = "AddScore", + + --推送道具互动 + MISSILE = "MISSILE" } --- Base GameController @@ -81,6 +87,7 @@ function M:init(name) self._eventmap[Protocol.GAME_EVT_Exit_WITNESS_ROOM] = self.OnEvtExieWitness self._eventmap[Protocol.GAME_GANGFEN] = self.OnEvtGANGFEN + self._eventmap[Protocol.GAME_MISSILE] = self.OnEvtMISSILE --self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips end @@ -231,6 +238,12 @@ function M:SendGPS(str) _client:send(Protocol.GAME_SEND_GPS, _data) end +function M:SendMissile(_) + local _client = ControllerManager.GameNetClinet + local _data = {} + _client:send(Protocol.GAME_SENDMISSILE, _data) +end + --------------------事件----------------------------------- -- 房主退出 房间解散 @@ -636,10 +649,12 @@ end function M:OnEvtGANGFEN(msg) print("有人得分了") - local detSeat = msg["detSeat"] - local formSeat = msg["formSeat"] - local score = msg["score"] - DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, false, t) + DispatchEvent(self._dispatcher, GameEvent.AddScore, nil, msg) +end + +function M:OnEvtMISSILE(msg) + print("有人扔番茄了") + DispatchEvent(self._dispatcher, GameEvent.MISSILE, nil, msg) end function M:DispatchEventTuoGuan(p, isShow, t) diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index a7335832..e36d7795 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -503,5 +503,11 @@ Protocol = { GAME_AUTO_CARD = "1303", --开启游戏托管 --加分显示 - GAME_GANGFEN = "gangfen", + GAME_GANGFEN = "999", + + --推送道具互动 + GAME_MISSILE = "?", + + --发送道具互动 + GAME_SENDMISSILE = "?", } diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 83dea5ee..99f6d9fb 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -320,9 +320,9 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type) list_familyNumber:SetVirtual() fgCtr:FG_GroupMembers12(group_id, limit, num, 2, 2, function(res) local members = self._group.members - -- print("==========================res.Data.members") + print("FG_GroupMembers12") pt(self._group.members) - ViewUtil:CloseModalWait() + --ViewUtil:CloseModalWait() if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败") else @@ -557,7 +557,6 @@ function M:UpdateFamilyRoom(fgCtr, id) end function M:ConnetFamily(index, groups, isCreate) - if self._group then FamilyOffline(self._group.id, self) end @@ -673,11 +672,18 @@ function M:OnUpdate() local HeartbeatTime = 30 if newTime - self.lastTime > HeartbeatTime then + fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res) + print(res) + end) + + self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false, 1) + --[[ fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res) self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false, 1) pt(res) end) + ]] self.lastTime = newTime end end diff --git a/lua_probject/base_project/Game/View/MainView.lua b/lua_probject/base_project/Game/View/MainView.lua index 8e33af71..291a85f0 100644 --- a/lua_probject/base_project/Game/View/MainView.lua +++ b/lua_probject/base_project/Game/View/MainView.lua @@ -27,6 +27,15 @@ local function RefalshBtnClose(self) end end +local function GetPlayer(self, playerId) + for _, p in pairs(self._room.player_list) do + if playerId == p.self_user.account_id then + return p + end + end + return nil +end + --lingmeng新全局标记 lingmengxin = false @@ -515,7 +524,7 @@ function M:InitView(url, isHideIpAdds) self:ShowWitnessPlayer() end) end - + RefalshBtnClose(self) ------------------------------------------------------------ end @@ -726,7 +735,9 @@ function M:EventInit() _gamectr:AddEventListener(GameEvent.PlayerReady, handler(self, self.OnPlayerReady)) - _gamectr:AddEventListener(GameEvent.FangziAnimation, handler(self, self.OnFangziAnimation)) + _gamectr:AddEventListener(GameEvent.AddScore, handler(self, self.OnAddScoreAnimation)) + + _gamectr:AddEventListener(GameEvent.MISSILE, handler(self, self.)) _gamectr:AddEventListener( GameEvent.DeskBreak, @@ -1013,29 +1024,47 @@ function M:OnPlayerReady(...) end -- 飘字 -function M:OnFangziAnimation(...) - print("OnFangziAnimation") +function M:OnAddScoreAnimation(...) + print("OnAddScoreAnimation") local arg = { ... } + local totalScoreList = arg[2].totalScoreList + local playerList = arg[2].playerList + local addScoreList = arg[2].addScoreList pt(arg) - local fz = arg[1] - local playerid = arg[1].playerid - local fromPlayer = arg[1].from_seat - local type = arg[1].type - local gang = arg[1].opengang - local room = self._room + local scoreData = {} + for i = 1, #totalScoreList do + local p = {} - if gang then - local playerView = self:GetPlayerInfo(playerid) - playerView:ScoreAnimation(4) - local player = self:GetPlayer(playerid) - --playerView._view:GetChild('text_jifen').text = playerView._view:GetChild('text_jifen').text + 4 + p.totalScore = totalScoreList[i] + p.player = playerList[i] + p.addScore = addScoreList[i] - local fplayerView = self._player_info[self:GetPos(fromPlayer)] - --local nplayer = self:GetPlayer(playerid) - fplayerView:ScoreAnimation(-4) - --playerView._view:GetChild('text_jifen').text = playerView._view:GetChild('text_jifen').text - 4 + scoreData[#scoreData + 1] = p end + + for _, p in pairs(scoreData) do + local infoView = self:GetPlayerInfo(p.player) + local player = GetPlayer(self, p.player) + 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 + +function M:OnMissile(...) + local arg = {...} + print("OnMissile 有人发表情了") + pt(arg) + + --self:Missile() end function M:OnUpdateInfo(...) diff --git a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView_jaingxi.lua b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView_jaingxi.lua index 7f26998f..51c39173 100644 --- a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView_jaingxi.lua +++ b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView_jaingxi.lua @@ -109,6 +109,8 @@ function M:FillGameData() local tex_name = self._view:GetChild("tex_name") tex_name.text = self.play.name end + + self._view:GetChild("tex_times").text = self.play.hp_times / 1000 end local tuoguanTimeList = { 10, 30, 60, 120, 180, 240, 300 } diff --git a/lua_probject/base_project/Game/View/playerDetailView.lua b/lua_probject/base_project/Game/View/playerDetailView.lua index 6d0cd861..b9048ee2 100644 --- a/lua_probject/base_project/Game/View/playerDetailView.lua +++ b/lua_probject/base_project/Game/View/playerDetailView.lua @@ -10,8 +10,10 @@ function playerDetailView.New() end function playerDetailView:Refalsh(player) - local p = player - + self.player = player + self.tex_name.text = player.self_user.nick_name + self.tex_ip.text = "网络:" .. player.self_user.host_ip + self.tex_id.text = "编号:" .. player.self_user.account_id ImageLoad.Load(player.self_user.head_url, self.loader_icon) end @@ -21,6 +23,7 @@ function playerDetailView:Show(player) end function playerDetailView:Init() + local selfUser = DataManager.SelfUser self.tex_name = self._view:GetChild("tex_name") self.tex_ip = self._view:GetChild("tex_ip") self.tex_id = self._view:GetChild("tex_id") @@ -36,28 +39,28 @@ function playerDetailView:Init() self.btn_boom.onClick:Set(function() local mainView = BaseView.FindView("MainView") if mainView then - mainView:Missile(1, 2, "ui://Common/boom", "ui://Main_Majiang/Missile_boom") + mainView:Missile(1, self.player.seat, "ui://Common/boom", "ui://Main_Majiang/Missile_boom") end end) self.btn_egg.onClick:Set(function() local mainView = BaseView.FindView("MainView") if mainView then - mainView:Missile(1, 2, "ui://Common/egg", "ui://Main_Majiang/Missile_egg") + mainView:Missile(1, self.player.seat, "ui://Common/egg", "ui://Main_Majiang/Missile_egg") end end) self.btn_ring.onClick:Set(function() local mainView = BaseView.FindView("MainView") if mainView then - mainView:Missile(1, 2, "ui://Common/diamo", "ui://Main_Majiang/Missile_diamo") + mainView:Missile(1, self.player.seat, "ui://Common/diamo", "ui://Main_Majiang/Missile_diamo") end end) self.btn_flower.onClick:Set(function() local mainView = BaseView.FindView("MainView") if mainView then - mainView:Missile(1, 2, "ui://Common/flower", "ui://Main_Majiang/Missile_flower") + mainView:Missile(1, self.player.seat, "ui://Common/flower", "ui://Main_Majiang/Missile_flower") end end) end diff --git a/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml b/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml index c958126f..68e85651 100644 --- a/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml +++ b/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml @@ -21,7 +21,13 @@ - + + + + + + + @@ -37,29 +43,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/wb_new_ui/assets/NewGroup/mgr/View_GroupGameSetting.xml b/wb_new_ui/assets/NewGroup/mgr/View_GroupGameSetting.xml index 53c78b16..a4e23b1b 100644 --- a/wb_new_ui/assets/NewGroup/mgr/View_GroupGameSetting.xml +++ b/wb_new_ui/assets/NewGroup/mgr/View_GroupGameSetting.xml @@ -17,7 +17,7 @@ - + diff --git a/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes b/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes index b59910a6..5e18a817 100644 Binary files a/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes and b/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes differ diff --git a/wb_unity_pro/Assets/ART/base/newgroup/ui/NewGroup_fui.bytes b/wb_unity_pro/Assets/ART/base/newgroup/ui/NewGroup_fui.bytes index 0f420372..04166449 100644 Binary files a/wb_unity_pro/Assets/ART/base/newgroup/ui/NewGroup_fui.bytes and b/wb_unity_pro/Assets/ART/base/newgroup/ui/NewGroup_fui.bytes differ