diff --git a/lua_probject/base_project/Game/Controller/GameController.lua b/lua_probject/base_project/Game/Controller/GameController.lua index 0b4ca5c4..3941199d 100644 --- a/lua_probject/base_project/Game/Controller/GameController.lua +++ b/lua_probject/base_project/Game/Controller/GameController.lua @@ -119,6 +119,21 @@ function M:StartGame() _client:send(Protocol.GAME_START) end +--临时 +--观战进入房间 +function M:WitnessGame(group_id, player_id, room_id) + local _client = ControllerManager.GameNetClinet + print("lingmeng game_client", _client) + if not _client then + return + end + local _data = {} + _data["group_id"] = 0 + _data["player_id"] = 0 + _data["room_id"] = 0 + _client:send(Protocol.GAME_WITNESS_ROOM, _data) +end + --聊天 -- --1表情 2固定语音 3语音 4文本 5互动 diff --git a/lua_probject/base_project/Game/Controller/RoomController.lua b/lua_probject/base_project/Game/Controller/RoomController.lua index 4a03d33a..a50bef37 100644 --- a/lua_probject/base_project/Game/Controller/RoomController.lua +++ b/lua_probject/base_project/Game/Controller/RoomController.lua @@ -225,9 +225,9 @@ local witness_room_frame = 0 function M:PublicWitnessRoom(cmd, roomid, group_id, callback) printlog("公共观战房间接口=============PublicWitnessRoom") -- 同一帧不重复调用 - local last_frame = join_room_frame - join_room_frame = Time.frameCount - if join_room_frame == last_frame then + local last_frame = witness_room_frame + witness_room_frame = Time.frameCount + if witness_room_frame == last_frame then return end -- 防止游戏没有离开控制器 @@ -281,33 +281,33 @@ function M:PublicWitnessRoom(cmd, roomid, group_id, callback) end j_data["pos"] = DataManager.SelfUser.location:Location2String() printlog("++++++++++++++++++++++++++++++++++++++++++") - __ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(res1) - printlog("===============================-------------") - pt(res1) - ControllerManager.IsSendCard = false - if (res1.ReturnCode ~= 0) then - if (callback) then callback(res1) end - else - ControllerManager.enterPlayerData = res1.Data.tableInfo.playerData - local _s2croom = res1.Data - room.owner_id = _s2croom["owner"] - if _s2croom.createTime then - room.create_time = _s2croom["createTime"] - end - if _s2croom.manor then - room.banker_seat = _s2croom.manor - end - room.agent = _s2croom.agent == 1 and true or false - -- ControllerManager.SetGameNetClient(game_net) - local extend = ExtendManager.GetExtendConfig(room.game_id) - extend:FillRoomData(_s2croom) - ControllerManager.ChangeController(GameController) - local gamectr = ControllerManager.GetCurrenController() - gamectr.tmpRoomID = room.room_id - gamectr.tmpGroupID = room.group_id - if callback then callback(res1) end - end - end) + -- __ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(res1) + -- printlog("===============================-------------") + -- pt(res1) + -- ControllerManager.IsSendCard = false + -- if (res1.ReturnCode ~= 0) then + -- if (callback) then callback(res1) end + -- else + -- -- ControllerManager.enterPlayerData = res1.Data.tableInfo.playerData + -- -- local _s2croom = res1.Data + -- -- room.owner_id = _s2croom["owner"] + -- -- if _s2croom.createTime then + -- -- room.create_time = _s2croom["createTime"] + -- -- end + -- -- if _s2croom.manor then + -- -- room.banker_seat = _s2croom.manor + -- -- end + -- -- room.agent = _s2croom.agent == 1 and true or false + -- -- -- ControllerManager.SetGameNetClient(game_net) + -- -- local extend = ExtendManager.GetExtendConfig(room.game_id) + -- -- extend:FillRoomData(_s2croom) + -- -- ControllerManager.ChangeController(GameController) + -- -- local gamectr = ControllerManager.GetCurrenController() + -- -- gamectr.tmpRoomID = room.room_id + -- -- gamectr.tmpGroupID = room.group_id + -- -- if callback then callback(res1) end + -- end + -- end) else if callback then callback(res) end end diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index ccb8052f..686a6217 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -376,6 +376,8 @@ Protocol = { -------------------Game ---------------------------- -- 进入房间 + GAME_WITNESS_ROOM = "3013", + -- 进入房间 GAME_JOIN_ROOM = "1002", -- 玩家进入房间 diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index a01c1136..19484c2c 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -263,6 +263,8 @@ function M:UpdateFamilyRoom(fgCtr, id) end end ) + -- self._gamectr = ControllerManager.GetController(GameController) + -- self._gamectr:WitnessGame(DataManager.SelfUser.account_id, id, roomList[newIndex].id) end) else local newIndex = index - #roomList + 1 diff --git a/wb_new_ui/assets/Chat/Main.xml b/wb_new_ui/assets/Chat/Main.xml index 31162770..2fc74b77 100644 --- a/wb_new_ui/assets/Chat/Main.xml +++ b/wb_new_ui/assets/Chat/Main.xml @@ -65,12 +65,22 @@