public TransformDetails GetCharacterSpawnDetails(Maps map) { var hasPosition = charactersSpawnDetails.TryGetValue(map, out var spawnPosition); LogUtils.Assert(hasPosition, MessageBuilder.Trace($"There is no spawn details on map {map}")); return(spawnPosition); }
private string GetSecretKey() { LogUtils.Assert(Config.Global.UserProfileService, MessageBuilder.Trace("Could not find a configuration for the UserProfile service.")); var secretKey = (string)Config.Global.UserProfileService.SecretKey; return(secretKey); }
private string GetSecretKey() { LogUtils.Assert(Config.Global.SecretKey, MessageBuilder.Trace("Could not find a configured secret key.")); var secretKey = (string)Config.Global.SecretKey.Key; return(secretKey); }
protected override PeerConnectionInformation GetPeerConnectionInformation() { LogUtils.Assert(Config.Global.UserProfileService, MessageBuilder.Trace("Could not find a configuration for the UserProfile service.")); var ip = (string)Config.Global.UserProfileService.IP; var port = (int)Config.Global.UserProfileService.Port; return(new PeerConnectionInformation(ip, port)); }
protected override PeerConnectionInformation GetPeerConnectionInformation() { LogUtils.Assert(Config.Global.Server2, MessageBuilder.Trace("Could not find a connection info for the Server2 server.")); var ip = (string)Config.Global.Server2.IP; var port = (int)Config.Global.Server2.Port; return(new PeerConnectionInformation(ip, port)); }
public void Connect() { const string APPLICATION_NAME = "Empty"; var serverAddress = serverConnectionInformation.Ip + ":" + serverConnectionInformation.Port; var isConnecting = RawPeer.Connect(serverAddress, APPLICATION_NAME); LogUtils.Assert(isConnecting, new TraceMessage("Could not begin connection with: " + serverAddress + " <" + APPLICATION_NAME + ">")); }
private RegisterGameServerRequestParameters GetGameServerDetailsParameters() { LogUtils.Assert(Config.Global.ConnectionDetails, MessageBuilder.Trace("Could not find a connection details for the Game server.")); var name = (string)Config.Global.ConnectionDetails.Name; var ip = (string)Config.Global.ConnectionDetails.IP; var port = (int)Config.Global.ConnectionDetails.Port; var maxConnections = (int)Config.Global.ConnectionDetails.MaxConnections; return(new RegisterGameServerRequestParameters(name, ip, port, connections, maxConnections)); }
public static string GetConnectionString() { LogUtils.Assert(Config.Global.Database, MessageBuilder.Trace("Could not find a configuration for the database.")); var ip = (string)Config.Global.Database.Ip; var port = (int)Config.Global.Database.Port; var userName = (string)Config.Global.Database.Username; var password = (string)Config.Global.Database.Password; var table = (string)Config.Global.Database.Table; return(string.Format($"Host={ip};Port={port};User ID={userName};Password={password};KeepAlive=30;Initial Catalog=\'{table}\';")); }
public void Initialize() { LogUtils.Assert(Config.Global.Log, MessageBuilder.Trace("Could not find a log configuration.")); var logOperationsRequest = (bool)Config.Global.Log.OperationsRequest; var logOperationsResponse = (bool)Config.Global.Log.OperationsResponse; var logEvents = (bool)Config.Global.Log.Events; operationRequestSender = new OperationRequestSender <TOperationCode>(outboundServerPeer.OperationRequestSender, logOperationsRequest); subscriptionProvider = new OperationResponseSubscriptionProvider <TOperationCode>(outboundServerPeer.OperationResponseNotifier, OnOperationRequestFailed, logOperationsResponse); eventHandlerRegister = new EventHandlerRegister <TEventCode>(outboundServerPeer.EventNotifier, logEvents); OnInitialized(); }
public short Send <TParam>(MessageData <TParam> data, MessageSendOptions sendOptions) where TParam : struct, IParameters { if (sendOptions.Flush) { LogUtils.Log(MessageBuilder.Trace("sendOptions::Flush is not supported!"), LogMessageType.Warning); } var currentRequestId = requestId++; var operationRequest = Utils.ToPhotonOperationRequest(data, currentRequestId); var result = RawPeer.OpCustom(operationRequest, sendOptions.Reliable, sendOptions.ChannelId, sendOptions.Encrypted); LogUtils.Assert(result, "Could not send operation request"); return(currentRequestId); }
public override void OnConnected(IClientPeer clientPeer) { base.OnConnected(clientPeer); LogUtils.Assert(Config.Global.ConnectionInfo, MessageBuilder.Trace("Could not find an connection info for the server.")); var udpPort = (int)Config.Global.ConnectionInfo.UdpPort; var tcpPort = (int)Config.Global.ConnectionInfo.TcpPort; var clientConnectionInfo = clientPeer.ConnectionInformation; if (clientConnectionInfo.Port == udpPort) { WrapClientPeer(clientPeer, new ClientPeerLogic()); } else if (clientConnectionInfo.Port == tcpPort) { WrapClientPeer(clientPeer, new ServerPeerLogic()); } else { LogUtils.Log($"No handler found for peer: {clientConnectionInfo.Ip}:{clientConnectionInfo.Port}"); } }