예제 #1
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();
            }
        }
        public void StartSinglePlayer(ServerRoomToken serverToken, Action onStartSuccess, Action onStartFail)
        {
            StopAllCoroutines();

            networkingMode      = NetworkingMode.Both;
            serverToken.Version = Version;

            StartCoroutine(StartServerRoutine(serverToken, true, onStartSuccess, onStartFail));
        }
        public void StartServer(ServerRoomToken serverToken, bool withClientLogic, Action onStartSuccess, Action onStartFail)
        {
            StopAllCoroutines();

            networkingMode      = withClientLogic ? NetworkingMode.Both : NetworkingMode.Server;
            serverToken.Version = Version;

            StartCoroutine(StartServerRoutine(serverToken, false, onStartSuccess, onStartFail));
        }
 public void StartSinglePlayer(ServerRoomToken serverToken, Action onStartSuccess, Action onStartFail)
 {
     underlyingController.StartSinglePlayer(serverToken, onStartSuccess, onStartFail);
 }
 public void StartServer(ServerRoomToken serverToken, bool withClientLogic, Action onStartSuccess, Action onStartFail)
 {
     underlyingController.StartServer(serverToken, withClientLogic, onStartSuccess, onStartFail);
 }