StartSinglePlayer() public static method

public static StartSinglePlayer ( ) : void
return void
示例#1
0
        private void OnGUI()
        {
            if (!_showGui)
            {
                return;
            }

            GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20));

            if (GUILayout.Button("Start Single Player", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                // START SINGLE PLAYER
                BoltLauncher.StartSinglePlayer();
            }

            if (GUILayout.Button("Start Server", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                // START SERVER
                BoltLauncher.StartServer();
            }

            if (GUILayout.Button("Start Client", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                // START CLIENT
                BoltLauncher.StartClient();
            }

            GUILayout.EndArea();
        }
示例#2
0
        void OnGUI()
        {
            GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20));

            if (GUILayout.Button("Single Player", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                BoltLauncher.StartSinglePlayer();
            }

            if (GUILayout.Button("Start Server", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                // START SERVER. Configures this peer as the host of the game.
                // When Bolt is ready, we utilise its callback to create a game room
                // somewhere in Photons cloud for client peers to join.
                BoltLauncher.StartServer();
            }

            if (GUILayout.Button("Start Client", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                // START CLIENT. Configures this peer as a client that can join games.
                // When Bolt is ready, it will automatically connect to Photons servers and
                // pull information about any visible room that has been registered on the cloud.
                BoltLauncher.StartClient();
            }

            GUILayout.EndArea();
        }
示例#3
0
    void Start()
    {
#if UNITY_EDITOR_OSX
        Process p = new Process();
        p.StartInfo.FileName  = "osascript";
        p.StartInfo.Arguments =

            @"-e 'tell application """ + UnityEditor.PlayerSettings.productName + @"""
  activate
end tell'";

        p.Start();
#endif

        BoltRuntimeSettings settings = BoltRuntimeSettings.instance;

        _serverEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, (ushort)settings.debugStartPort);
        _clientEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, 0);

        BoltConfig cfg;

        cfg = settings.GetConfigCopy();
        cfg.connectionTimeout         = 60000000;
        cfg.connectionRequestTimeout  = 500;
        cfg.connectionRequestAttempts = 1000;

        if (string.IsNullOrEmpty(settings.debugStartMapName) == false)
        {
            if (BoltDebugStartSettings.DebugStartIsServer)
            {
                BoltLog.Warn("Starting as SERVER");

                BoltLauncher.StartServer(_serverEndPoint, cfg);
            }
            else if (BoltDebugStartSettings.DebugStartIsClient)
            {
                BoltLog.Warn("Starting as CLIENT");

                BoltLauncher.StartClient(_clientEndPoint, cfg);
            }
            else if (BoltDebugStartSettings.DebugStartIsSinglePlayer)
            {
                BoltLog.Warn("Starting as SINGLE PLAYER");

                BoltLauncher.StartSinglePlayer(cfg);
            }

            BoltDebugStartSettings.PositionWindow();
        }
        else
        {
            BoltLog.Error("No map found to start from");
        }
    }
        private IEnumerator StartServerRoutine(ServerRoomToken serverToken, bool singlePlayer, Action onStartSuccess, Action onStartFail)
        {
            if (BoltNetwork.IsRunning && !BoltNetwork.IsServer)
            {
                BoltLauncher.Shutdown();

                yield return(new WaitUntil(NetworkIsInactive));
            }

            state = State.Starting;

            if (singlePlayer)
            {
                BoltLauncher.StartSinglePlayer(config);
            }
            else
            {
                BoltLauncher.StartServer(config);
            }

            yield return(new WaitUntil(NetworkIsIdle));

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

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

                if (!singlePlayer)
                {
                    BoltMatchmaking.CreateSession(Guid.NewGuid().ToString(), serverToken);
                }

                BoltNetwork.LoadScene(serverToken.Map, serverToken);
            }
            else
            {
                onStartFail?.Invoke();
            }
        }
 void State_StartSinglePlayer()
 {
     BoltLauncher.StartSinglePlayer();
     state = State.Started;
 }
示例#6
0
 public void StartSinglePlayer()
 {
     BoltLauncher.StartSinglePlayer();
     offlineMode = true;
 }
示例#7
0
 public static void StartSinglePlayer()
 {
     BoltLauncher.StartSinglePlayer(BoltRuntimeSettings.instance.GetConfigCopy());
 }