protected ServerConnectionInformation GetServerConnectionInformation(ServerType serverType) { var connectionInformation = ServicesConfiguration.GetInstance().GetConnectionInformation(serverType); var peerConnectionInformation = NetworkConfiguration.GetInstance().GetPeerConnectionInformation(connectionInformation); return(new ServerConnectionInformation(serverType, peerConnectionInformation)); }
public async Task <ConnectionStatus> Connect(IYield yield, ICoroutinesExecutor coroutinesExecutor, ServerConnectionInformation serverConnectionInformation) { var serverType = serverConnectionInformation.ServerType; if (IsConnected()) { throw new ServerConnectionFailed($"A connection already exists with a {serverType} server."); } ConnectionInformation = serverConnectionInformation; var ip = ConnectionInformation.PeerConnectionInformation.Ip; var port = ConnectionInformation.PeerConnectionInformation.Port; LogUtils.Log($"Connecting to a {serverType} server. IP: {ip} Port: {port}"); var serverConnector = new PhotonServerConnector(() => coroutinesExecutor); var networkConfiguration = NetworkConfiguration.GetInstance(); var connectionDetails = new ConnectionDetails(networkConfiguration.ConnectionProtocol, networkConfiguration.DebugLevel); ServerPeer = await serverConnector.ConnectAsync(yield, ConnectionInformation.PeerConnectionInformation, connectionDetails); if (ServerPeer == null) { return(ConnectionStatus.Failed); } SubscribeToDisconnectionNotifier(); LogUtils.Log($"A {serverType} server has been connected: {ip}:{port}"); serviceConnectionNotifier.Connection(); return(ConnectionStatus.Succeed); }
public void Initialize(IServerPeer peer) { serverPeer = peer; var networkConfiguration = NetworkConfiguration.GetInstance(); operationRequestSender = new OperationRequestSender <TOperationCode>(serverPeer.OperationRequestSender, networkConfiguration.LogOperationsRequest); subscriptionProvider = new OperationResponseSubscriptionProvider <TOperationCode>(serverPeer.OperationResponseNotifier, OnOperationRequestFailed, networkConfiguration.LogOperationsResponse); eventHandlerRegister = new EventHandlerRegister <TEventCode>(serverPeer.EventNotifier, networkConfiguration.LogEvents); }
private void Awake() { var networkConfiguration = NetworkConfiguration.GetInstance(); if (networkConfiguration != null) { var serverData = networkConfiguration.GetServerData(ServerType.Authenticator); url = serverData.Url; } }
private void Start() { var networkConfiguration = NetworkConfiguration.GetInstance(); if (networkConfiguration != null) { if (networkConfiguration.IsDevelopment()) { StartCoroutine(WaitFrameAndStart()); } } }
public static ICharacterProviderApi ProvideCharacterProviderApi() { if (characterProviderApi == null) { var networkConfiguration = NetworkConfiguration.GetInstance(); if (networkConfiguration.IsProduction()) { characterProviderApi = HttpCharacterProviderApi.GetInstance(); } else { characterProviderApi = DummyCharacterProviderApi.GetInstance(); } } return(characterProviderApi); }
public static IGameProviderApi ProvideGameProviderApi() { if (gameProviderApi == null) { var networkConfiguration = NetworkConfiguration.GetInstance(); if (networkConfiguration.IsProduction()) { gameProviderApi = HttpGameProviderApi.GetInstance(); } else { gameProviderApi = DummyGameProviderApi.GetInstance(); } } return(gameProviderApi); }
public static IAuthenticatorApi ProvideAuthenticatorApi() { if (authenticatorApi == null) { var networkConfiguration = NetworkConfiguration.GetInstance(); if (networkConfiguration.IsProduction()) { authenticatorApi = HttpAuthenticatorApi.GetInstance(); } else { authenticatorApi = DummyAuthenticatorApi.GetInstance(); } } return(authenticatorApi); }
private void Awake() { var networkConfiguration = NetworkConfiguration.GetInstance(); if (networkConfiguration != null) { if (networkConfiguration.IsProduction()) { var dummyScene = GameObject.FindGameObjectWithTag(GameTags.DummySceneTag); if (dummyScene != null) { Destroy(dummyScene); } } } Destroy(gameObject); }