private static void HandlePingLobbyFeedback(byte[] data) { PingLobbyS2C feedback = ProtobufUtils.Deserialize <PingLobbyS2C>(data); if (feedback.result) { if (isDisconnect) { isDisconnect = false; MatchC2S message = new MatchC2S(); BattleType bType = DataManager.GetInstance().GetBattleType(); if (bType == BattleType.BattleP1vsP1) { message.matchType = MatchType.P1vsP1; } if (bType == BattleType.BattleP2vsP2) { message.matchType = MatchType.P2vsP2; } else { message.matchType = MatchType.Peace; } message.playerName = DataManager.GetInstance().GetPlayerNickName(); message.type = MatchClientMessageType.Applying; byte[] data1 = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(MsgCode.MatchMessage, data1); } } }
public static void PingServer(ServerType type) { if (NetworkManager.IsClientConnected(type)) { if (type == ServerType.GameServer) { PingGameC2S message = new PingGameC2S(); byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(type, MsgCode.PingGameMessage, data); } else if (type == ServerType.LobbyServer) { PingLobbyC2S message = new PingLobbyC2S(); byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(type, MsgCode.PingLobbyMessage, data); } else if (type == ServerType.SocialServer) { PingSocialC2S message = new PingSocialC2S(); byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(ServerType.SocialServer, MsgCode.PingSocialServer, data); } else { } } }