Esempio n. 1
0
    public static void Main(string[] args)
    {
        string peerServer = "ws://localhost:8080/ws";

        if (args.Length == 1)
        {
            peerServer = args[0];
        }
        TestPeer app = new TestPeer();

        if (!HumbleNet.Init())
        {
            Console.WriteLine("Failed to startup");
            return;
        }

        HumbleNet.P2P.Initialize(peerServer, "client_token", "client_secret", null);

        app.Start();

        while (app.Run())
        {
        }

        app.Stop();

        HumbleNet.Shutdown();
    }
Esempio n. 2
0
    static public void Shutdown()
    {
#if !UNITY_WEBGL && USE_THREAD
        Poller.Shutdown();
#endif
        if (_isInitialized)
        {
            HumbleNet.Shutdown();
            _isInitialized = false;
            _isConnected   = false;
            _myPeer        = HumbleNet.PeerId.Invalid;
        }
    }
Esempio n. 3
0
    // Use this for initialization
    static public void Init(string server)
    {
        if (!_isInitialized)
        {
            _myPeer = HumbleNet.PeerId.Invalid;
            if (!HumbleNet.Init())
            {
                throw new System.DllNotFoundException(string.Format("Could not locate HumbleNet! : {0}", HumbleNet.getError()));
            }
            HumbleNet.P2P.Initialize(server, "WebGLRoller", "<WebGLRoller secret>", null);
            HumbleNet.P2P.Wait(0);

#if !UNITY_WEBGL && USE_THREAD
            Poller.Init();
#endif
            _isInitialized = true;
        }
    }