Ejemplo n.º 1
0
    new void Awake()
    {
        Debug.Log("*** HOST ***");

        Assert.IsNotNull(context);

        // IMPORTANT: the host is *always* client 0

        for (int i = 0; i < Constants.MaxClients; ++i)
        {
            client[i].Reset();
        }

        context.Initialize(0);

        context.SetResetSequence(100);

        InitializePlatformSDK(GetEntitlementCallback);

        Rooms.SetUpdateNotificationCallback(RoomUpdatedCallback);

        Net.SetConnectionStateChangedCallback(ConnectionStateChangedCallback);

        Voip.SetVoipConnectRequestCallback((Message <NetworkingPeer> msg) =>
        {
            Voip.Accept(msg.Data.ID);
        });

        Voip.SetVoipStateChangeCallback((Message <NetworkingPeer> msg) =>
        {
            Debug.LogFormat("Voice state changed to {1} for user {0}", msg.Data.ID, msg.Data.State);
        });
    }
Ejemplo n.º 2
0
    new void Awake()
    {
        Debug.Log("*** GUEST ***");

        Assert.IsNotNull(context);

        state = GuestState.LoggingIn;

        InitializePlatformSDK(GetEntitlementCallback);

        Matchmaking.SetMatchFoundNotificationCallback(MatchFoundCallback);

        Rooms.SetUpdateNotificationCallback(RoomUpdatedCallback);

        Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);

        Net.SetPeerConnectRequestCallback(PeerConnectRequestCallback);

        Net.SetConnectionStateChangedCallback(ConnectionStateChangedCallback);

        Voip.SetVoipConnectRequestCallback((Message <NetworkingPeer> msg) =>
        {
            Debug.Log("Accepting voice connection from " + msg.Data.ID);
            Voip.Accept(msg.Data.ID);
        });

        Voip.SetVoipStateChangeCallback((Message <NetworkingPeer> msg) =>
        {
            Debug.LogFormat("Voice state changed to {1} for user {0}", msg.Data.ID, msg.Data.State);
        });
    }
Ejemplo n.º 3
0
    void VoipConnectRequestCallback(Message <NetworkingPeer> msg)
    {
        Debug.LogFormat("Voip request from {0}, authorized is {1}", msg.Data.ID, m_remoteID);

        if (msg.Data.ID == m_remoteID)
        {
            Voip.Accept(msg.Data.ID);
        }
    }
Ejemplo n.º 4
0
    void VoipConnectRequestCallback(Message<NetworkingPeer> msg)
    {
       PlatformManager.LogOutput("Voip request from " + msg.Data.ID):

       RemotePlayer remote = PlatformManager.GetRemoteUser(msg.Data.ID):
       if (remote != null)
       {
            PlatformManager.LogOutput("Voip request accepted from " + msg.Data.ID):
            Voip.Accept(msg.Data.ID):
        }
    }
Ejemplo n.º 5
0
    void VoipConnectRequestCallback(Message <Oculus.Platform.Models.NetworkingPeer> msg)
    {
        SocialPlatformManager.LogOutput("Voip request from " + msg.Data.ID);

        RemotePlayer remote = SocialPlatformManager.GetRemoteUser(msg.Data.ID);

        if (remote != null)
        {
            SocialPlatformManager.LogOutput("Voip request accepted from " + msg.Data.ID);
            Voip.Accept(msg.Data.ID);
        }
    }
Ejemplo n.º 6
0
    void OnVoipConnectRequestCallback(Message <NetworkingPeer> msg)
    {
        if (msg.IsError)
        {
            Debug.LogError("Voip connecton error - " + msg.GetError().Message);
        }
        else
        {
            var peer = msg.GetNetworkingPeer();

            if (!remoteConnectionStates.ContainsKey(peer.ID))
            {
                remoteConnectionStates.Add(peer.ID, new ConnectionStates());
            }

            UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Voip accept of " + peer.ID.ToString() +
                                                      ".  State was " + remoteConnectionStates[peer.ID].voipState.ToString());

            Voip.Accept(peer.ID);
            remoteConnectionStates[peer.ID].voipState    = ConnectionState.Connecting;
            remoteConnectionStates[peer.ID].voipTimeouts = 0;
        }
    }
    new void Awake()
    {
        Log("*** HOST ***");
        IsNotNull(context);

        for (int i = 0; i < MaxClients; ++i) //IMPORTANT: the host is *always* client 0
        {
            clients[i].Reset();
        }

        context.Init(0);
        context.resetId = 100;
        InitializePlatformSDK(CheckEntitlement);
        Rooms.SetUpdateNotificationCallback(ConnectClients);
        Net.SetConnectionStateChangedCallback(CheckClientConnection);

        Voip.SetVoipConnectRequestCallback((Message <NetworkingPeer> message) => {
            Voip.Accept(message.Data.ID);
        });

        Voip.SetVoipStateChangeCallback((Message <NetworkingPeer> message) => {
            LogFormat("Voice state changed to {1} for user {0}", message.Data.ID, message.Data.State);
        });
    }