示例#1
0
    private IEnumerator Start()
    {
        var c = WakeNetConfig.Default;

        c.LogLevel = NetworkLogLevel.Full;
        WakeNet.Init(c);

        while (!WakeNet.Initialized)
        {
            yield return(new WaitForEndOfFrame());
        }

        _discovery = WakeNet.CreateDiscovery(_port, _key, _version, _subversion);
        _discovery.Search();
    }
示例#2
0
    // Use this for initialization
    IEnumerator Start()
    {
        var c = WakeNetConfig.Default;

        c.LogLevel = NetworkLogLevel.Full;
        WakeNet.Init(c);

        while (!WakeNet.Initialized)
        {
            yield return(new WaitForEndOfFrame());
        }

        _discovery = WakeNet.CreateDiscovery(_port, _key, _version, _subversion);
        _discovery.Broadcast(ColorUtility.ToHtmlStringRGBA(_broadcastColor), _serverPort);

        GetComponent <Image>().color = _broadcastColor;
    }
示例#3
0
    IEnumerator Start()
    {
        var c = WakeNetConfig.Default;

        c.LogLevel = NetworkLogLevel.Full;
        WakeNet.Init(c);

        while (!WakeNet.Initialized)
        {
            yield return(new WaitForEndOfFrame());
        }

        _server = WakeNet.CreateServer(_serverMaxConnections, _serverPort);
        _server.ClientConnected += OnClientConnected;

        _proxy = _server.AddProxy <ChatMessagePacket, ChatMessagePacket>("msg", 0);

        _proxy.Received += OnMessageReceived;
    }