/** * Clearing the rich presence */ void ClearPresence() { UpdateConsole("Clearing Group Presence..."); GroupPresence.Clear().OnComplete(message => { if (message.IsError) { UpdateConsole(message.GetError().Message); } else { // Clearing the rich presence then fetching the user's presence afterwards Users.Get(LoggedInUserID).OnComplete(message2 => { if (message2.IsError) { UpdateConsole("Group Presence cleared! But rich presence is unknown!"); } else { UpdateConsole("Group Presence cleared!\n" + message2.Data.Presence + "\n"); } }); } }); }
// User has interacted with the roster to leave the current destination / lobby / match void OnLeaveIntentChangeNotif(Message <Oculus.Platform.Models.GroupPresenceLeaveIntent> message) { if (message.IsError) { UpdateConsole(message.GetError().Message); } else { var leaveIntent = message.Data; var destinationApiName = leaveIntent.DestinationApiName; MatchSessionID = leaveIntent.MatchSessionId; LobbySessionID = leaveIntent.LobbySessionId; var detailsString = "-Api Name:\n" + destinationApiName + "\n-Lobby Session Id:\n" + LobbySessionID + "\n-Match Session Id:\n" + MatchSessionID; detailsString += "\n"; UpdateConsole("Clearing presence because user wishes to leave:\n" + detailsString); // User left GroupPresence.Clear(); } }