StartServer() public static method

public static StartServer ( ) : void
return void
        public override void OnEnter()
        {
            UdpEndPoint endpoint = new UdpEndPoint(UdpIPv4Address.Parse(host.Value), (ushort)port.Value);

            BoltLauncher.StartServer(endpoint);
            Finish();
        }
 public void StartServer(string levelName)
 {
     //TODO: Ensure we're not already in a game or hosting
     BoltLauncher.StartServer(UdpKit.UdpEndPoint.Any);
     SceneManager.Instance.GoToScene(levelName, true, OnServerLevelLoaded);
     currentLevel = levelName;
 }
示例#3
0
 private void Awake()
 {
     if (!BoltNetwork.IsConnected)
     {
         BoltLauncher.StartServer();
     }
 }
    private IEnumerator Start()
    {
        PlayerPrefs.Save();
        CoopTreeGrid.Init();
        LoadSave.OnGameStart += this.OnGameStart;
        yield return(CoopPeerStarter.PrefabDbResource);

        if (!CoopPeerStarter.Dedicated)
        {
            CoopLobby.Instance.SetServer(SteamGameServer.GetSteamID());
        }
        BoltConfig config = base.GetConfig();

        config.serverConnectionLimit = ((!CoopPeerStarter.Dedicated) ? (CoopLobby.Instance.Info.MemberLimit - 1) : SteamDSConfig.ServerPlayers);
        if (CoopPeerStarter.Dedicated)
        {
            BoltLauncher.SetUdpPlatform(new DotNetPlatform());
            BoltLauncher.StartServer(SteamDSConfig.EndPoint, config);
        }
        else
        {
            BoltLauncher.StartServer(SteamGameServer.GetSteamID().ToEndPoint(), config);
        }
        try
        {
            BoltNetwork.AddGlobalEventListener(CoopAckChecker.Instance);
        }
        catch
        {
        }
        yield break;
    }
示例#5
0
    // Use this for initialization
    void Start()
    {
        // Get custom arguments from command line
        Map      = GetArg("-m", "-map") ?? Map;
        GameType = GetArg("-t", "-gameType") ?? GameType; // ex: get game type from command line
        RoomID   = GetArg("-r", "-room") ?? RoomID;

        // Validate the requested Level
        var validMap = false;

        foreach (string value in BoltScenes.AllScenes)
        {
            if (SceneManager.GetActiveScene().name != value)
            {
                if (Map == value)
                {
                    validMap = true;
                    break;
                }
            }
        }

        if (!validMap)
        {
            Debug.LogError("Invalid configuration: please verify level name");
            Application.Quit();
        }

        // Start the Server
        BoltLauncher.StartServer();
        DontDestroyOnLoad(this);
    }
示例#6
0
        private void OnGUI()
        {
            if (IsHeadlessMode() == true)
            {
                return;
            }

            if (BoltNetwork.IsRunning == false)
            {
                GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20));

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

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

                GUILayout.EndArea();
            }

            if (BoltNetwork.IsClient)
            {
                State_SelectRoom();
            }
        }
示例#7
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();
        }
示例#8
0
 public override void BoltShutdownBegin(AddCallback registerDoneCallback, UdpConnectionDisconnectReason disconnectReason)
 {
     registerDoneCallback(() =>
     {
         BoltLauncher.StartServer();
     });
 }
示例#9
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();
            }
        }
示例#10
0
 public override void BoltShutdownBegin(AddCallback registerDoneCallback)
 {
     registerDoneCallback(() =>
     {
         BoltLauncher.StartServer();
     });
 }
 public void CreateServer()
 {
     if (IsValidSessionId(startServerSessionIdInputField.text))
     {
         BoltLauncher.StartServer();
     }
 }
示例#12
0
    private void Start()
    {
        this._serverEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, (ushort)BoltRuntimeSettings.instance.debugStartPort);
        this._clientEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, 0);
        BoltConfig configCopy = BoltRuntimeSettings.instance.GetConfigCopy();

        configCopy.connectionTimeout         = 60000000;
        configCopy.connectionRequestTimeout  = 500;
        configCopy.connectionRequestAttempts = 1000;
        if (!string.IsNullOrEmpty(BoltRuntimeSettings.instance.debugStartMapName))
        {
            if (BoltDebugStartSettings.startServer)
            {
                BoltLauncher.StartServer(this._serverEndPoint, configCopy);
            }
            else if (BoltDebugStartSettings.startClient)
            {
                BoltLauncher.StartClient(this._clientEndPoint, configCopy);
            }
            BoltDebugStartSettings.PositionWindow();
        }
        if (BoltNetwork.isClient || !BoltNetwork.isServer)
        {
        }
    }
示例#13
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();
        }
 public void StartServer()
 {
     if (BoltNetwork.IsRunning)
     {
         BoltLauncher.Shutdown();
     }
     BoltLauncher.StartServer();
 }
示例#15
0
    void State_StartServer()
    {
        BoltConfig config = BoltRuntimeSettings.instance.GetConfigCopy();

        // config.EnableIPv6 = true;

        BoltLauncher.StartServer(new UdpEndPoint(UdpIPv4Address.Any, (ushort)serverPort), config);
        state = State.Started;
    }
示例#16
0
 public static void StartServer(int port)
 {
     if (port >= 0 && port <= 65535)
     {
         BoltLauncher.StartServer(new UdpEndPoint(UdpIPv4Address.Any, (ushort)port));
         return;
     }
     throw new ArgumentOutOfRangeException(string.Format("'port' must be >= 0 and <= {0}", ushort.MaxValue));
 }
示例#17
0
    private void Start()
    {
        GameEventManager.Subscribe <object>(AnnounceEvent);

        if (!BoltNetwork.IsRunning)
        {
            BoltLauncher.StartServer();
        }
    }
示例#18
0
        IEnumerator StartServerRoutine()
        {
            while (_isShutingDown)
            {
                yield return(null);
            }

            BoltLauncher.StartServer(_config);
        }
        private void Start()
        {
            AdvancedTutorial.ServerCallbacks.ListenServer = false;

            // Start listening on IP + Port provided by zeuz, and load the Map received as command line argument (can be different for each profile defined in zeuz dashboard)

            BoltLauncher.StartServer(new UdpEndPoint(UdpIPv4Address.Parse(Zeuz.IP), (ushort)Zeuz.GamePort), m_Map);
            DontDestroyOnLoad(this);
        }
示例#20
0
    public void OnClickHost()
    {
        hostIsCreating = true;
        GameObject.Find("HostButton").GetComponent <Button>().interactable = false;
        GameObject.FindWithTag("NewRoomNameInputField").GetComponent <TMP_InputField>().interactable = false;

        FasterSun();
        BoltLauncher.StartServer();
    }
示例#21
0
    IEnumerator Test0()
    {
        if (staticData.boltFree == true)
        {
            BoltLauncher.SetUdpPlatform(new PhotonPlatform());
        }
        BoltLauncher.StartServer(listeningPort);

        yield return(null);
    }
示例#22
0
        // CORE

        private void Awake()
        {
            _gameStarted.Value = false;
            _playerSettings    = Resources.Load <PlayerSettings>(Constants.Resources.PlayerSettings);
            _gameSettings      = Resources.Load <GameSettings>(Constants.Resources.GameSettings);

            if (!BoltNetwork.IsConnected) // Used for In-Editor tests
            {
                BoltLauncher.StartServer();
            }
        }
示例#23
0
 void BoltShutdownCallback()
 {
     if (isMyHost)
     {
         BoltLauncher.StartServer();
     }
     else
     {
         BoltLauncher.StartClient();
     }
 }
示例#24
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");
        }
    }
示例#25
0
    void OnGUI()
    {
        switch (_state)
        {
        // starting Bolt is the same regardless of the transport layer
        case State.SelectMode:
            if (GUILayout.Button("Start Client"))
            {
                BoltLauncher.StartClient();
                _state = State.ModeClient;
            }

            if (GUILayout.Button("Start Server"))
            {
                BoltLauncher.StartServer();
                _state = State.ModeServer;
            }

            break;

        // Publishing a session into the matchmaking server
        case State.ModeServer:
            if (BoltNetwork.isRunning && BoltNetwork.isServer)
            {
                if (GUILayout.Button("Publish HostInfo And Load Map"))
                {
                    BoltNetwork.SetHostInfo("MyPhotonGame", new RoomProtocolToken {
                        ArbitraryData = "(MyCustomData)"
                    });
                    BoltNetwork.LoadScene("NetworkedPhysicsTest");
                }
            }
            break;

        // for the client, after Bolt is innitialized, we should see the list
        // of available sessions and join one of them
        case State.ModeClient:

            if (BoltNetwork.isRunning && BoltNetwork.isClient)
            {
                GUILayout.Label("Session List");

                foreach (var session in BoltNetwork.SessionList)
                {
                    var token = session.Value.GetProtocolToken() as RoomProtocolToken;
                    if (GUILayout.Button(session.Value.Source + " / " + session.Value.HostName + " (" + session.Value.Id + ")" + (token != null ? token.ArbitraryData : "")))
                    {
                        BoltNetwork.Connect(session.Value);
                    }
                }
            }
            break;
        }
    }
示例#26
0
    public void StartServer()
    {
        string playerName = createPlayerName.GetComponent <UnityEngine.UI.Text>().text;

        if (string.IsNullOrWhiteSpace(lobbyname.GetComponent <UnityEngine.UI.Text>().text) || string.IsNullOrWhiteSpace(playerName))
        {
            return;
        }

        NetworkCallbacks.playerName = playerName;
        BoltLauncher.StartServer();
    }
示例#27
0
        public override void LaunchServer(OperationResultDelegate onComplete)
        {
            if (State != NetworkState.Stopped)
            {
                throw new Exception("Cannot launch server when state is not 'Stopped'.");
            }

            _operationCallbackLaunch = onComplete;
            State = NetworkState.Launching;
            Log.Info(LogChannel, "[PhotonNetworkInterface] LaunchServer...");
            BoltLauncher.StartServer(GameBoltConfig.GetConfig());
        }
示例#28
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"));
    }
示例#29
0
 public static void CreateLobby()
 {
     if (!BoltNetwork.IsRunning && !BoltNetwork.IsServer)
     {
         BoltLauncher.StartServer();
         Debug.Log("Starting Bolt as server...");
     }
     else
     {
         Debug.LogWarning("Can't create a lobby if you are already a server.");
     }
 }
示例#30
0
 private void Awake()
 {
     if (!isServer)
     {
         return;
     }
     if (BoltNetwork.IsRunning)
     {
         BoltLauncher.Shutdown();
     }
     BoltLauncher.StartServer();
     Debug.LogWarning("start server~~");
 }