//玩家上线 public static void PlayerOnLine(this MatchRoom matchRoom, long userId, long sessionActorId) { MatchPlayerInfo playerInfo = matchRoom.GetPlayerInfo(userId); if (playerInfo == null) { Log.Error(matchRoom.RoomId + "房间没有玩家" + userId); } playerInfo.SessionActorId = sessionActorId; playerInfo.User.GetComponent <UserGateActorIdComponent>().ActorId = sessionActorId; playerInfo.User.IsOnLine = true; matchRoom.BroadcastActorMessage(new Actor_UserOnLine() { UserId = userId }); }
protected override void Run(Session session, C2M_GetReconnectionRoomInfo message, Action <M2C_GetReconnectionRoomInfo> reply) { M2C_GetReconnectionRoomInfo response = new M2C_GetReconnectionRoomInfo(); try { MatchRoom matchRoom = MatchRoomComponent.Ins.GetRoomUserIdIn(message.UserId); if (matchRoom == null) { response.IsGameBeing = false; response.Message = "房间已经结算"; reply(response); return; } response.IsGameBeing = true; if (matchRoom.IsGameBeing) { Actor_UserRequestReconnectionRoom m2SUserRequest = new Actor_UserRequestReconnectionRoom(); m2SUserRequest.UserId = message.UserId; m2SUserRequest.UserActorId = matchRoom.GetPlayerInfo(message.UserId).SessionActorId; ActorHelp.SendeActor(matchRoom.GameServeRoomActorId, m2SUserRequest); if (matchRoom.IsVoteDissolveIn)//如果正在投票解散中 补发一条投票结果消息 { ActorHelp.SendeActor(m2SUserRequest.UserActorId, matchRoom.VoteDissolveResult); } } else { response.RoomInfos = RoomInfoFactory.Creator(matchRoom); } reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }