コード例 #1
0
ファイル: BoltDebugStart.cs プロジェクト: ahvonenj/TheForest
    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)
        {
        }
    }
コード例 #2
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");
        }
    }
コード例 #3
0
ファイル: BoltDebugStart.cs プロジェクト: nixjoe/NetworkTest
    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

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

        BoltConfig cfg;

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

        if (string.IsNullOrEmpty(BoltRuntimeSettings.instance.debugStartMapName) == false)
        {
            if (BoltDebugStartSettings.startServer)
            {
                BoltLauncher.StartServer(_serverEndPoint, cfg);
                BoltNetwork.LoadScene(BoltRuntimeSettings.instance.debugStartMapName);
            }
            else if (BoltDebugStartSettings.startClient)
            {
                BoltLauncher.StartClient(_clientEndPoint, cfg);
                BoltNetwork.Connect(_serverEndPoint);
            }

            BoltDebugStartSettings.PositionWindow();
        }
        else
        {
            BoltLog.Error("No map found to start from");
        }

        if (!BoltNetwork.isClient && !BoltNetwork.isServer)
        {
            BoltLog.Error("failed to start debug mode");
        }
    }