Exemple #1
0
        private static void Launch(string mapName, Action callback, Action <Error> error, IProgressIndicator progress, IGameServer server, IGlobalSettings gSettings)
        {
            server.SetReadyToLaunch(gSettings.ClientId, true, (readyToLaunchError, room) =>
            {
                if (server.HasError(readyToLaunchError))
                {
                    error(readyToLaunchError);
                    //progress.IsVisible = false;
                    return;
                }

                server.Launch(gSettings.ClientId, (e5, serverUrl) =>
                {
                    if (server.HasError(e5))
                    {
                        error(e5);
                        //progress.IsVisible = false;
                        return;
                    }

                    //progress.IsVisible = false;

                    gSettings.MatchServerUrl = serverUrl;

                    IMatchServer remoteMatchServer = Dependencies.RemoteMatchServer;
                    IMatchServer localMatchServer  = Dependencies.LocalMatchServer;

                    if (Dependencies.RemoteGameServer != null && Dependencies.RemoteGameServer.IsConnected)
                    {
                        remoteMatchServer.Activate();
                    }
                    else
                    {
                        localMatchServer.Activate();
                    }

                    IVoxelInputManager inputManager = Dependencies.InputManager;
                    if (inputManager != null)
                    {
                        inputManager.ActivateAll();
                    }

                    if (mapName != "Default")
                    {
                        PlayerPrefs.SetString("lastmap", mapName);
                    }

                    callback();
                });
            });
        }