Shutdown() public static method

public static Shutdown ( ) : void
return void
Ejemplo n.º 1
0
    public void GameEnd()
    {
        // end game time

        // disconnect clients here
        foreach (var conn in BoltNetwork.connections)
        {
            // create EndGameToken
            EndGameToken endGametoken = new EndGameToken();
            // give it reason: game end
            endGametoken.EndGameReason = "Dis game done, son";

            // figure out who won the game, send that result in a parseable format
            endGametoken.Won = true;
            //conn.DisconnectToken = endGametoken;
            conn.Disconnect(endGametoken);
        }

        // set core gui manager end game state; also, did the server player win the game?
        CoreGUIManager.Instance.SetEndGame(true);

        GameGUIManager.Instance.BoltUnloadGameScene();

        BoltLauncher.Shutdown();

        BoltNetwork.LoadScene(GameManager.Instance.MenuSceneName);
    }
Ejemplo n.º 2
0
    private void OnEnable()
    {
        TheForest.Utils.Input.SetState(InputState.World, false);
        TheForest.Utils.Input.SetState(InputState.Menu, true);
        this.BreadCrumbLevel0();
        CoopSteamNGUI coopSteamNGUI = UnityEngine.Object.FindObjectOfType <CoopSteamNGUI>();

        if (coopSteamNGUI)
        {
            UnityEngine.Object.Destroy(coopSteamNGUI.gameObject);
        }
        if (BoltNetwork.isRunning)
        {
            BoltLauncher.Shutdown();
        }
        if (MenuMain.exiting)
        {
            Application.Quit();
        }
        else
        {
            MenuMain.exitingToMenu = false;
        }
        TheForest.Utils.Input.UnLockMouse();
    }
Ejemplo n.º 3
0
    public void EndSession()
    {
        DestroyPlayer();

        if (BoltNetwork.IsRunning)
        {
            BoltLauncher.Shutdown();
        }

        if (myFpsController != null)
        {
            myFpsController.enabled = true;
        }

        if (fpsController != null)
        {
            fpsController.enabled = true;
        }

        if (viveController != null)
        {
            viveController.enabled = true;
        }

        Time.timeScale = 1;

        SceneManager.LoadScene("DisCo-Lobby");
    }
Ejemplo n.º 4
0
 public void OnClickBackFromJoin()
 {
     joinOnlineGamePanel.SetActive(false);
     mainMenuPanel.SetActive(true);
     BoltLauncher.Shutdown();
     SlowerSun();
 }
Ejemplo n.º 5
0
        private IEnumerator StartServerRoutine(ServerRoomToken serverToken, Action onStartSuccess, Action onStartFail)
        {
            if (BoltNetwork.IsRunning && !BoltNetwork.IsServer)
            {
                BoltLauncher.Shutdown();

                yield return(new WaitUntil(NetworkIsInactive));
            }

            state = State.Starting;

            BoltLauncher.StartServer(config);
            yield return(new WaitUntil(NetworkIsIdle));

            for (int i = 0; i < 3; i++)
            {
                yield return(new WaitForEndOfFrame());
            }

            if (BoltNetwork.IsServer)
            {
                onStartSuccess?.Invoke();

                BoltMatchmaking.CreateSession(Guid.NewGuid().ToString(), serverToken, serverToken.Map);
            }
            else
            {
                onStartFail?.Invoke();
            }
        }
        private IEnumerator StartClientRoutine(Action onStartSuccess, Action onStartFail, bool forceRestart)
        {
            if (BoltNetwork.IsRunning && !BoltNetwork.IsClient || BoltNetwork.IsRunning && forceRestart)
            {
                BoltLauncher.Shutdown();

                yield return(new WaitUntil(NetworkIsInactive));
            }

            if (!BoltNetwork.IsClient)
            {
                state = State.Starting;

                BoltLauncher.StartClient(config);
                yield return(new WaitUntil(NetworkIsIdle));
            }

            if (BoltNetwork.IsClient)
            {
                onStartSuccess?.Invoke();
            }
            else
            {
                onStartFail?.Invoke();
            }
        }
Ejemplo n.º 7
0
        public void CountDownTask()
        {
            _nextStop--;

            ModAPI.Log.Write($"nextStop: {_nextStop}");

            if (_conf.getCountdownMessage(_nextStop) != String.Empty)
            {
                string msg = _conf.getCountdownMessage(_nextStop);
                if (msg != String.Empty)
                {
                    msg = msg.Replace("%typ", _conf.getString(_conf.getString("action")));
                    ModAPI.Log.Write(msg);
                    SendChatMessage(msg);
                }
            }
            else if (_nextStop == 0)
            {
                BoltLauncher.Shutdown();
                System.Threading.Thread.Sleep(5000);
                CoopSteamServer.Shutdown();
                CoopSteamClient.Shutdown();
                CoopTreeGrid.Clear();
                if (_conf.getString("action").Contains("restart"))
                {
                    System.Threading.Thread.Sleep(5000);
                    SceneManager.LoadScene("SteamDedicatedBootstrapScene", LoadSceneMode.Single);
                }
                else
                {
                    Application.Quit();
                }
            }
        }
Ejemplo n.º 8
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         BoltLauncher.Shutdown();
         SceneManager.LoadSceneAsync("Menu");
     }
 }
Ejemplo n.º 9
0
 public void OnClickBackFromHost()
 {
     GameObject.FindWithTag("NewRoomNameInputField").GetComponent <TMP_InputField>().text = "";
     hostOnlineGamePanel.SetActive(false);
     mainMenuPanel.SetActive(true);
     BoltLauncher.Shutdown();
     SlowerSun();
 }
 public void StartServer()
 {
     if (BoltNetwork.IsRunning)
     {
         BoltLauncher.Shutdown();
     }
     BoltLauncher.StartServer();
 }
Ejemplo n.º 11
0
 public void OnExitClick()
 {
     if (BoltNetwork.IsRunning && !GameObjectManager.Instance.IsGameOver() && GameObjectManager.Instance.IsOwnedPlayerAlive())
     {
         EventManager.Instance.SendPlayerDiedEvent(GameObjectManager.Instance.GetOwnedPlayerId());
     }
     SceneManager.LoadScene("Start");
     BoltLauncher.Shutdown();
 }
Ejemplo n.º 12
0
        private IEnumerator Retry()
        {
            loadingPanel.SetActive(true);
            yield return(new WaitForSeconds(waitTime));

            BoltLauncher.Shutdown();
            loadingPanel.SetActive(false);
            timeOutPanel.SetActive(true);
        }
Ejemplo n.º 13
0
 private void ReturnFromLobbyToMenu()
 {
     BoltLauncher.Shutdown();
     SwitchMenu(lobbyWindow, mainMenuWindow);
     foreach (Transform session in listOfSessions)
     {
         Destroy(session.gameObject);
     }
 }
Ejemplo n.º 14
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log(BoltNetwork.connections);
        Debug.Log(BoltNetwork.clients);

        if (Input.GetKeyDown(KeyCode.E))
        {
            BoltLauncher.Shutdown();
        }
    }
Ejemplo n.º 15
0
    public void ShutdownBolt()
    {
        if (isShuttingDown)
        {
            return;
        }

        isShuttingDown = true;
        App.shared.Log("ShutdownBolt", this);
        BoltLauncher.Shutdown();
    }
Ejemplo n.º 16
0
 private void OnApplicationQuit()
 {
     if (BoltNetwork.isRunning)
     {
         if (BoltNetwork.isClient)
         {
             BoltNetwork.server.Disconnect();
         }
         BoltLauncher.Shutdown();
     }
 }
Ejemplo n.º 17
0
    public void NavigateToMainMenu()
    {
        if (clientMenu.activeSelf)
        {
            BoltLauncher.Shutdown();
        }

        hostMenu.SetActive(false);
        clientMenu.SetActive(false);
        mainMenu.SetActive(true);
    }
Ejemplo n.º 18
0
 public void QuitGame()
 {
     if (BoltNetwork.IsServer)
     {
         UnityEngine.SceneManagement.SceneManager.LoadScene(0);
     }
     else
     {
         UnityEngine.SceneManagement.SceneManager.LoadScene(0);      // go to main menu;
     }
     BoltLauncher.Shutdown();
 }
Ejemplo n.º 19
0
    IEnumerator Start()
    {
        BoltLauncher.StartServer(UdpKit.UdpEndPoint.Parse("0.0.0.0:27000"));

        yield return(new WaitForSeconds(2f));

        BoltLauncher.Shutdown();

        yield return(null);

        BoltLauncher.StartServer(UdpKit.UdpEndPoint.Parse("0.0.0.0:27000"));
    }
Ejemplo n.º 20
0
        // PUBLIC

        public void QuitMatch()
        {
            if (BoltNetwork.IsServer)
            {
                SendAllToMenuEvent();
                StartCoroutine(HostDisconectLastSecurity());
            }
            else if (BoltNetwork.IsClient)
            {
                BoltLauncher.Shutdown();
            }
        }
Ejemplo n.º 21
0
    /// <summary>
    /// Initial setup.
    /// </summary>
    void Start()
    {
        if (this.ipInputField == null)
        {
            Debug.LogError("SetupGameMenuActions.ipInputField cannot be null.");
        }

        if (this.lobbyPasswordInputField == null)
        {
            Debug.LogError("SetupGameMenuActions.lobbyPasswordInputField cannot be null.");
        }

        if (this.screenNameInputField == null)
        {
            Debug.LogError("SetupGameMenuActions.screenNameInputField cannot be null.");
        }

        if (this.lobbyButton == null)
        {
            Debug.LogError("SetupGameMenuActions.launchButton cannot be null.");
        }

        // Setup input validation. Deactivate launch button if the input values are bad.
        var validateAction = new UnityEngine.Events.UnityAction <string>((newValue) =>
        {
            this.ValidateInputs();
        });

        this.ipInputField.onValueChange.AddListener(validateAction);
        this.lobbyPasswordInputField.onValueChange.AddListener(validateAction);
        this.screenNameInputField.onValueChange.AddListener(validateAction);

        // Add click listener for the launch button.
        // Animations to waiting scene are done in the editor so we don't have to do lookups.
        // We could do this in the editor but we scripted everything else.
        // Might as well do it here too.
        this.lobbyButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() =>
        {
            GameManager.instance.CurrentUserName = this.screenNameInputField.text;

            // We validate this on edit, we shouldn't need to again.
            var addressComponents = this.ipInputField.text.Split(':');
            var port = int.Parse(addressComponents[1]);

            if (BoltNetwork.isRunning && BoltNetwork.isServer)
            {
                BoltLauncher.Shutdown();
            }

            connect = true;
        }));
    }
    IEnumerator _quitBolt()
    {
        yield return(new WaitForSeconds(0.5f));

        try
        {
            BoltLauncher.Shutdown();
        }
        catch (Exception e)
        {
            UnityEngine.Debug.LogException(e);
        }
    }
Ejemplo n.º 23
0
 private void Awake()
 {
     if (!isServer)
     {
         return;
     }
     if (BoltNetwork.IsRunning)
     {
         BoltLauncher.Shutdown();
     }
     BoltLauncher.StartServer();
     Debug.LogWarning("start server~~");
 }
Ejemplo n.º 24
0
    /// <summary>
    /// Initial setup.
    /// </summary>
    void Start()
    {
        if (this.portInputField == null)
        {
            Debug.LogError("SetupGameMenuActions.portInputField cannot be null.");
        }

        if (this.lobbyPasswordInputField == null)
        {
            Debug.LogError("SetupGameMenuActions.lobbyPasswordInputField cannot be null.");
        }

        if (this.screenNameInputField == null)
        {
            Debug.LogError("SetupGameMenuActions.screenNameInputField cannot be null.");
        }

        if (this.launchButton == null)
        {
            Debug.LogError("SetupGameMenuActions.launchButton cannot be null.");
        }

        // Setup input validation. Deactivate launch button if the input values are bad.
        var validateAction = new UnityEngine.Events.UnityAction <string>((newValue) =>
        {
            this.ValidateInputs();
        });

        this.portInputField.onValueChange.AddListener(validateAction);
        this.lobbyPasswordInputField.onValueChange.AddListener(validateAction);
        this.screenNameInputField.onValueChange.AddListener(validateAction);

        // Add click listener for the launch button.
        // Animations to waiting scene are done in the editor so we don't have to do lookups.
        // We could do this in the editor but we scripted everything else.
        // Might as well do it here too.
        this.launchButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() =>
        {
            GameManager.instance.CurrentUserName = this.screenNameInputField.text;
            GameManager.instance.gameMode        = new TeamDeathmatchMode();
            ServerSideData.Password = this.lobbyPasswordInputField.text;
            Cursor.visible          = false;
            if (BoltNetwork.isRunning && BoltNetwork.isClient)
            {
                BoltLauncher.Shutdown();
            }

            // We validate this on edit, we shouldn't need to again.
            BoltLauncher.StartServer(int.Parse(this.portInputField.text));
        }));
    }
Ejemplo n.º 25
0
    private IEnumerator WaitForBoltShutdown(Action postBoltShutdownAction)
    {
        yield return(null);

        yield return(YieldPresets.WaitPointFiveSeconds);

        if (CoopLobby.IsInLobby)
        {
            if (CoopLobby.Instance.Info.IsOwner)
            {
                CoopLobby.Instance.Destroy();
            }
            CoopLobby.LeaveActive();
        }
        if (BoltNetwork.isRunning)
        {
            if (BoltNetwork.isClient)
            {
                BoltNetwork.server.Disconnect();
                Debug.Log("DISCONNECT FROM SERVER");
                if (SteamClientDSConfig.isDedicatedClient)
                {
                    SteamUser.TerminateGameConnection(SteamClientDSConfig.EndPoint.Address.Packed, SteamClientDSConfig.EndPoint.Port);
                }
            }
            else
            {
                BoltLauncher.Shutdown();
            }
            int   loopCount = 0;
            float timer     = Time.realtimeSinceStartup;
            while (BoltNetwork.isRunning)
            {
                loopCount++;
                yield return(null);
            }
            Debug.Log(string.Concat(new object[]
            {
                "BoltShutdown took (",
                loopCount,
                " frames) ",
                Time.realtimeSinceStartup - timer,
                "s"
            }));
        }
        if (postBoltShutdownAction != null)
        {
            postBoltShutdownAction();
        }
        yield break;
    }
Ejemplo n.º 26
0
 public override void Disconnected(BoltConnection connection)
 {
     if (BoltNetwork.isClient && CoopClientCallbacks.OnDisconnected == null)
     {
         if (CoopLobby.IsInLobby)
         {
             SteamMatchmaking.LeaveLobby(CoopLobby.Instance.Info.LobbyId);
         }
         CoopPlayerCallbacks._allTrees = null;
         CoopPlayerCallbacks.WasDisconnectedFromServer = true;
         BoltLauncher.Shutdown();
         Application.LoadLevel("TitleScene");
     }
 }
Ejemplo n.º 27
0
    private IEnumerator Start()
    {
        CoopSteamClientStarter.IsAdmin = false;
        PlayerPrefs.Save();
        Debug.Log("CoopSteamServerStarter");
        yield return(CoopPeerStarter.PrefabDbResource);

        this._connectionAttempts = 1;
        if (BoltNetwork.isRunning)
        {
            BoltLauncher.Shutdown();
            yield return(null);
        }
        this.InitBolt();
        yield break;
    }
Ejemplo n.º 28
0
    private IEnumerator RetryConnectingRoutine()
    {
        if (!CoopSteamClientStarter.Retrying)
        {
            CoopSteamClientStarter.Retrying = true;
            this._connectionAttempts++;
            BoltLauncher.Shutdown();
            yield return(null);

            yield return(null);

            this.InitBolt();
            CoopSteamClientStarter.Retrying = false;
        }
        yield break;
    }
Ejemplo n.º 29
0
 public void OnDisconnected()
 {
     base.CancelInvoke("OnDisconnected");
     CoopClientCallbacks.OnDisconnected = null;
     if (this._connectionAttempts <= 3)
     {
         Debug.Log("Client connection attempt #" + this._connectionAttempts);
         base.StartCoroutine(this.RetryConnectingRoutine());
     }
     else
     {
         CoopPlayerCallbacks.WasDisconnectedFromServer = true;
         BoltLauncher.Shutdown();
         UnityEngine.Object.Destroy(base.gameObject);
         SceneManager.LoadScene("TitleScene", LoadSceneMode.Single);
     }
 }
Ejemplo n.º 30
0
 public override void ConnectFailed(UdpEndPoint endpoint, IProtocolToken token)
 {
     if (this.gui)
     {
         this.gui.SetErrorText("Could not connect to server (attempt " + this._connectionAttempts + "/3)");
     }
     else
     {
         Debug.LogError("could not connect to dedicated server: " + SteamClientDSConfig.serverAddress);
     }
     this._connectionAttempts                      = 3;
     CoopClientCallbacks.OnDisconnected            = null;
     CoopPlayerCallbacks.WasDisconnectedFromServer = true;
     BoltLauncher.Shutdown();
     SteamClientConfig.KickMessage = ((!SteamClientDSConfig.isDedicatedClient) ? "Server timeout. Could not connect to this server." : "Server does not seem to be set up correctly");
     UnityEngine.Object.Destroy(base.gameObject);
     SceneManager.LoadScene("TitleScene", LoadSceneMode.Single);
 }