Beispiel #1
0
    //Configure the SDK manually
    public void Configure(string host,
                          int port,
                          string accessToken,
                          Action <int> OnPlayerConnect,
                          Action <int> OnPlayerDisconnect,
                          Action <bool> OnReady,
                          Action <RTPacket> OnPacket)
    {
        m_OnPlayerConnect    = OnPlayerConnect;
        m_OnPlayerDisconnect = OnPlayerDisconnect;
        m_OnReady            = OnReady;
        m_OnPacket           = OnPacket;

#if UNITY_WEBGL && !UNITY_EDITOR
        lastSessionId++;

        currSessionId = lastSessionId;

        GSCreateRTSession(instance.name, currSessionId, accessToken, host, port);
#else
        if (session != null)
        {
            session.Stop();
        }

        session = GameSparksRT
                  .SessionBuilder()
                  .SetHost(host)
                  .SetPort(port)
                  .SetConnectToken(accessToken)
                  .SetListener(this)
                  .Build();
#endif
    }
Beispiel #2
0
    //Configure the SDK manually
    public void Configure(string host,
                          int port,
                          string accessToken,
                          Action <int> OnPlayerConnect,
                          Action <int> OnPlayerDisconnect,
                          Action <bool> OnReady,
                          Action <RTPacket> OnPacket)
    {
        m_OnPlayerConnect    = OnPlayerConnect;
        m_OnPlayerDisconnect = OnPlayerDisconnect;
        m_OnReady            = OnReady;
        m_OnPacket           = OnPacket;

        if (session != null)
        {
            session.Stop();
        }

        session = GameSparksRT
                  .SessionBuilder()
                  .SetHost(host)
                  .SetPort(port)
                  .SetConnectToken(accessToken)
                  .SetListener(this)
                  .Build();
    }