| 1 | // This file was @generated with LibOVRPlatform/codegen/main. Do not modify it! |
| 2 | |
| 3 | using System.Runtime.CompilerServices; |
| 4 | [assembly: InternalsVisibleTo("Assembly-CSharp-Editor")] |
| 5 | |
| 6 | namespace Oculus.Platform |
| 7 | { |
| 8 | using UnityEngine; |
| 9 | using System; |
| 10 | using System.Collections; |
| 11 | using System.Collections.Generic; |
| 12 | using System.Runtime.InteropServices; |
| 13 | |
| 14 | public sealed class Core { |
| 15 | private static bool IsPlatformInitialized = false; |
| 16 | public static bool IsInitialized() |
| 17 | { |
| 18 | return IsPlatformInitialized; |
| 19 | } |
| 20 | |
| 21 | // If LogMessages is true, then the contents of each request response |
| 22 | // will be printed using Debug.Log. This allocates a lot of heap memory, |
| 23 | // and so should not be called outside of testing and debugging. |
| 24 | public static bool LogMessages = false; |
| 25 | |
| 26 | internal static void ForceInitialized() |
| 27 | { |
| 28 | IsPlatformInitialized = true; |
| 29 | } |
| 30 | |
| 31 | private static string getAppID(string appId = null) { |
| 32 | string configAppID = GetAppIDFromConfig(); |
| 33 | if (String.IsNullOrEmpty(appId)) |
| 34 | { |
| 35 | if (String.IsNullOrEmpty(configAppID)) |
| 36 | { |
| 37 | throw new UnityException("Update your app id by selecting 'Oculus Platform' -> 'Edit Settings'"); |
| 38 | } |
| 39 | appId = configAppID; |
| 40 | } |
| 41 | else |
| 42 | { |
| 43 | if (!String.IsNullOrEmpty(configAppID)) |
| 44 | { |
| 45 | Debug.LogWarningFormat("The 'Oculus App Id ({0})' field in 'Oculus Platform/Edit Settings' is being overridden by the App Id ({1}) that you passed in to Platform.Core.Initialize. You should only specify this in one place. We recommend the menu location.", configAppID, appId); |
| 46 | } |
| 47 | } |
| 48 | return appId; |
| 49 | } |
| 50 | |
| 51 | // Asynchronously Initialize Platform SDK. The result will be put on the message |
| 52 | // queue with the message type: ovrMessage_PlatformInitializeAndroidAsynchronous |
| 53 | // |
| 54 | // While the platform is in an initializing state, it's not fully functional. |
| 55 | // [Requests]: will queue up and run once platform is initialized. |
| 56 | // For example: ovr_User_GetLoggedInUser() can be called immediately after |
| 57 | // asynchronous init and once platform is initialized, this request will run |
| 58 | // [Synchronous Methods]: will return the default value; |
| 59 | // For example: ovr_GetLoggedInUserID() will return 0 until platform is |
| 60 | // fully initialized |
| 61 | public static Request<Models.PlatformInitialize> AsyncInitialize(string appId = null) { |
| 62 | appId = getAppID(appId); |
| 63 | |
| 64 | Request<Models.PlatformInitialize> request; |
| 65 | if (UnityEngine.Application.isEditor && PlatformSettings.UseStandalonePlatform) { |
| 66 | var platform = new StandalonePlatform(); |
| 67 | request = platform.InitializeInEditor(); |
| 68 | } |
| 69 | else if (UnityEngine.Application.platform == RuntimePlatform.WindowsEditor || |
| 70 | UnityEngine.Application.platform == RuntimePlatform.WindowsPlayer) { |
| 71 | var platform = new WindowsPlatform(); |
| 72 | request = platform.AsyncInitialize(appId); |
| 73 | } |
| 74 | else if (UnityEngine.Application.platform == RuntimePlatform.Android) { |
| 75 | var platform = new AndroidPlatform(); |
| 76 | request = platform.AsyncInitialize(appId); |
| 77 | } |
| 78 | else { |
| 79 | throw new NotImplementedException("Oculus platform is not implemented on this platform yet."); |
| 80 | } |
| 81 | |
| 82 | IsPlatformInitialized = (request != null); |
| 83 | |
| 84 | if (!IsPlatformInitialized) |
| 85 | { |
| 86 | throw new UnityException("Oculus Platform failed to initialize."); |
| 87 | } |
| 88 | |
| 89 | if (LogMessages) { |
| 90 | Debug.LogWarning("Oculus.Platform.Core.LogMessages is set to true. This will cause extra heap allocations, and should not be used outside of testing and debugging."); |
| 91 | } |
| 92 | |
| 93 | // Create the GameObject that will run the callbacks |
| 94 | (new GameObject("Oculus.Platform.CallbackRunner")).AddComponent<CallbackRunner>(); |
| 95 | return request; |
| 96 | } |
| 97 | |
| 98 | |
| 99 | public static void Initialize(string appId = null) |
| 100 | { |
| 101 | appId = getAppID(appId); |
| 102 | |
| 103 | if (UnityEngine.Application.isEditor && PlatformSettings.UseStandalonePlatform) { |
| 104 | var platform = new StandalonePlatform(); |
| 105 | IsPlatformInitialized = platform.InitializeInEditor() != null; |
| 106 | } |
| 107 | else if (UnityEngine.Application.platform == RuntimePlatform.WindowsEditor || |
| 108 | UnityEngine.Application.platform == RuntimePlatform.WindowsPlayer) { |
| 109 | var platform = new WindowsPlatform(); |
| 110 | IsPlatformInitialized = platform.Initialize(appId); |
| 111 | } |
| 112 | else if (UnityEngine.Application.platform == RuntimePlatform.Android) { |
| 113 | var platform = new AndroidPlatform(); |
| 114 | IsPlatformInitialized = platform.Initialize(appId); |
| 115 | } |
| 116 | else { |
| 117 | throw new NotImplementedException("Oculus platform is not implemented on this platform yet."); |
| 118 | } |
| 119 | |
| 120 | if (!IsPlatformInitialized) |
| 121 | { |
| 122 | throw new UnityException("Oculus Platform failed to initialize."); |
| 123 | } |
| 124 | |
| 125 | if (LogMessages) { |
| 126 | Debug.LogWarning("Oculus.Platform.Core.LogMessages is set to true. This will cause extra heap allocations, and should not be used outside of testing and debugging."); |
| 127 | } |
| 128 | |
| 129 | // Create the GameObject that will run the callbacks |
| 130 | (new GameObject("Oculus.Platform.CallbackRunner")).AddComponent<CallbackRunner>(); |
| 131 | } |
| 132 | |
| 133 | private static string GetAppIDFromConfig() |
| 134 | { |
| 135 | if (UnityEngine.Application.platform == RuntimePlatform.Android) |
| 136 | { |
| 137 | return PlatformSettings.MobileAppID; |
| 138 | } |
| 139 | else |
| 140 | { |
| 141 | return PlatformSettings.AppID; |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | public static partial class ApplicationLifecycle |
| 147 | { |
| 148 | public static Models.LaunchDetails GetLaunchDetails() { |
| 149 | return new Models.LaunchDetails(CAPI.ovr_ApplicationLifecycle_GetLaunchDetails()); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | public static partial class Rooms |
| 154 | { |
| 155 | |
| 156 | public static Request<Models.Room> UpdateDataStore(UInt64 roomID, Dictionary<string, string> data) |
| 157 | { |
| 158 | if (Core.IsInitialized()) |
| 159 | { |
| 160 | CAPI.ovrKeyValuePair[] kvps = new CAPI.ovrKeyValuePair[data.Count]; |
| 161 | int i=0; |
| 162 | foreach(var item in data) |
| 163 | { |
| 164 | kvps[i++] = new CAPI.ovrKeyValuePair(item.Key, item.Value); |
| 165 | } |
| 166 | |
| 167 | return new Request<Models.Room>(CAPI.ovr_Room_UpdateDataStore(roomID, kvps)); |
| 168 | } |
| 169 | return null; |
| 170 | } |
| 171 | |
| 172 | [Obsolete("Deprecated in favor of SetRoomInviteAcceptedNotificationCallback")] |
| 173 | public static void SetRoomInviteNotificationCallback(Message<string>.Callback callback) |
| 174 | { |
| 175 | SetRoomInviteAcceptedNotificationCallback(callback); |
| 176 | } |
| 177 | |
| 178 | } |
| 179 | |
| 180 | public static partial class Matchmaking |
| 181 | { |
| 182 | public class CustomQuery |
| 183 | { |
| 184 | public Dictionary<string, object> data; |
| 185 | public Criterion[] criteria; |
| 186 | |
| 187 | public struct Criterion |
| 188 | { |
| 189 | public Criterion(string key_, MatchmakingCriterionImportance importance_) |
| 190 | { |
| 191 | key = key_; |
| 192 | importance = importance_; |
| 193 | |
| 194 | parameters = null; |
| 195 | } |
| 196 | |
| 197 | public string key; |
| 198 | public MatchmakingCriterionImportance importance; |
| 199 | public Dictionary<string, object> parameters; |
| 200 | } |
| 201 | |
| 202 | public IntPtr ToUnmanaged() |
| 203 | { |
| 204 | var customQueryUnmanaged = new CAPI.ovrMatchmakingCustomQueryData(); |
| 205 | |
| 206 | if(criteria != null && criteria.Length > 0) |
| 207 | { |
| 208 | customQueryUnmanaged.criterionArrayCount = (uint)criteria.Length; |
| 209 | var temp = new CAPI.ovrMatchmakingCriterion[criteria.Length]; |
| 210 | |
| 211 | for(int i=0; i<criteria.Length; i++) |
| 212 | { |
| 213 | temp[i].importance_ = criteria[i].importance; |
| 214 | temp[i].key_ = criteria[i].key; |
| 215 | |
| 216 | if(criteria[i].parameters != null && criteria[i].parameters.Count > 0) |
| 217 | { |
| 218 | temp[i].parameterArrayCount = (uint)criteria[i].parameters.Count; |
| 219 | temp[i].parameterArray = CAPI.ArrayOfStructsToIntPtr(CAPI.DictionaryToOVRKeyValuePairs(criteria[i].parameters)); |
| 220 | } |
| 221 | else |
| 222 | { |
| 223 | temp[i].parameterArrayCount = 0; |
| 224 | temp[i].parameterArray = IntPtr.Zero; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | customQueryUnmanaged.criterionArray = CAPI.ArrayOfStructsToIntPtr(temp); |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | customQueryUnmanaged.criterionArrayCount = 0; |
| 233 | customQueryUnmanaged.criterionArray = IntPtr.Zero; |
| 234 | } |
| 235 | |
| 236 | |
| 237 | if(data != null && data.Count > 0) |
| 238 | { |
| 239 | customQueryUnmanaged.dataArrayCount = (uint)data.Count; |
| 240 | customQueryUnmanaged.dataArray = CAPI.ArrayOfStructsToIntPtr(CAPI.DictionaryToOVRKeyValuePairs(data)); |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | customQueryUnmanaged.dataArrayCount = 0; |
| 245 | customQueryUnmanaged.dataArray = IntPtr.Zero; |
| 246 | } |
| 247 | |
| 248 | IntPtr res = Marshal.AllocHGlobal(Marshal.SizeOf(customQueryUnmanaged)); |
| 249 | Marshal.StructureToPtr(customQueryUnmanaged, res, true); |
| 250 | return res; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | public static Request ReportResultsInsecure(UInt64 roomID, Dictionary<string, int> data) |
| 255 | { |
| 256 | if(Core.IsInitialized()) |
| 257 | { |
| 258 | CAPI.ovrKeyValuePair[] kvps = new CAPI.ovrKeyValuePair[data.Count]; |
| 259 | int i=0; |
| 260 | foreach(var item in data) |
| 261 | { |
| 262 | kvps[i++] = new CAPI.ovrKeyValuePair(item.Key, item.Value); |
| 263 | } |
| 264 | |
| 265 | return new Request(CAPI.ovr_Matchmaking_ReportResultInsecure(roomID, kvps)); |
| 266 | } |
| 267 | |
| 268 | return null; |
| 269 | } |
| 270 | |
| 271 | public static Request<Models.MatchmakingStats> GetStats(string pool, uint maxLevel, MatchmakingStatApproach approach = MatchmakingStatApproach.Trailing) |
| 272 | { |
| 273 | if (Core.IsInitialized()) |
| 274 | { |
| 275 | return new Request<Models.MatchmakingStats>(CAPI.ovr_Matchmaking_GetStats(pool, maxLevel, approach)); |
| 276 | } |
| 277 | |
| 278 | return null; |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | public static partial class Net |
| 283 | { |
| 284 | public static Packet ReadPacket() |
| 285 | { |
| 286 | if (!Core.IsInitialized()) |
| 287 | { |
| 288 | return null; |
| 289 | } |
| 290 | |
| 291 | var packetHandle = CAPI.ovr_Net_ReadPacket(); |
| 292 | |
| 293 | if(packetHandle == IntPtr.Zero) |
| 294 | { |
| 295 | return null; |
| 296 | } |
| 297 | |
| 298 | return new Packet(packetHandle); |
| 299 | } |
| 300 | |
| 301 | public static bool SendPacket(UInt64 userID, byte[] bytes, SendPolicy policy) |
| 302 | { |
| 303 | if(Core.IsInitialized()) |
| 304 | { |
| 305 | return CAPI.ovr_Net_SendPacket(userID, (UIntPtr)bytes.Length, bytes, policy); |
| 306 | } |
| 307 | |
| 308 | return false; |
| 309 | } |
| 310 | |
| 311 | public static void Connect(UInt64 userID) |
| 312 | { |
| 313 | if (Core.IsInitialized()) |
| 314 | { |
| 315 | CAPI.ovr_Net_Connect(userID); |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | public static void Accept(UInt64 userID) |
| 320 | { |
| 321 | if(Core.IsInitialized()) |
| 322 | { |
| 323 | CAPI.ovr_Net_Accept(userID); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | public static void Close(UInt64 userID) |
| 328 | { |
| 329 | if(Core.IsInitialized()) |
| 330 | { |
| 331 | CAPI.ovr_Net_Close(userID); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | public static bool IsConnected(UInt64 userID) |
| 336 | { |
| 337 | return Core.IsInitialized() && CAPI.ovr_Net_IsConnected(userID); |
| 338 | } |
| 339 | |
| 340 | public static bool SendPacketToCurrentRoom(byte[] bytes, SendPolicy policy) |
| 341 | { |
| 342 | if (Core.IsInitialized()) |
| 343 | { |
| 344 | return CAPI.ovr_Net_SendPacketToCurrentRoom((UIntPtr)bytes.Length, bytes, policy); |
| 345 | } |
| 346 | |
| 347 | return false; |
| 348 | } |
| 349 | |
| 350 | public static bool AcceptForCurrentRoom() |
| 351 | { |
| 352 | if (Core.IsInitialized()) |
| 353 | { |
| 354 | return CAPI.ovr_Net_AcceptForCurrentRoom(); |
| 355 | } |
| 356 | |
| 357 | return false; |
| 358 | } |
| 359 | |
| 360 | public static void CloseForCurrentRoom() |
| 361 | { |
| 362 | if (Core.IsInitialized()) |
| 363 | { |
| 364 | CAPI.ovr_Net_CloseForCurrentRoom(); |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | public static Request<Models.PingResult> Ping(UInt64 userID) |
| 369 | { |
| 370 | if(Core.IsInitialized()) |
| 371 | { |
| 372 | return new Request<Models.PingResult>(CAPI.ovr_Net_Ping(userID)); |
| 373 | } |
| 374 | |
| 375 | return null; |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | public static partial class Leaderboards |
| 380 | { |
| 381 | public static Request<Models.LeaderboardEntryList> GetNextEntries(Models.LeaderboardEntryList list) |
| 382 | { |
| 383 | if (Core.IsInitialized()) |
| 384 | { |
| 385 | return new Request<Models.LeaderboardEntryList>(CAPI.ovr_HTTP_GetWithMessageType(list.NextUrl, (int)Message.MessageType.Leaderboard_GetNextEntries)); |
| 386 | } |
| 387 | |
| 388 | return null; |
| 389 | } |
| 390 | |
| 391 | public static Request<Models.LeaderboardEntryList> GetPreviousEntries(Models.LeaderboardEntryList list) |
| 392 | { |
| 393 | if (Core.IsInitialized()) |
| 394 | { |
| 395 | return new Request<Models.LeaderboardEntryList>(CAPI.ovr_HTTP_GetWithMessageType(list.PreviousUrl, (int)Message.MessageType.Leaderboard_GetPreviousEntries)); |
| 396 | } |
| 397 | |
| 398 | return null; |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | public static partial class Voip |
| 403 | { |
| 404 | public static void Start(UInt64 userID) |
| 405 | { |
| 406 | if (Core.IsInitialized()) |
| 407 | { |
| 408 | CAPI.ovr_Voip_Start(userID); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | public static void Accept(UInt64 userID) |
| 413 | { |
| 414 | if (Core.IsInitialized()) |
| 415 | { |
| 416 | CAPI.ovr_Voip_Accept(userID); |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | public static void Stop(UInt64 userID) |
| 421 | { |
| 422 | if (Core.IsInitialized()) |
| 423 | { |
| 424 | CAPI.ovr_Voip_Stop(userID); |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | public static void SetMicrophoneFilterCallback(CAPI.FilterCallback callback) |
| 429 | { |
| 430 | if (Core.IsInitialized()) |
| 431 | { |
| 432 | CAPI.ovr_Voip_SetMicrophoneFilterCallbackWithFixedSizeBuffer(callback, (UIntPtr)CAPI.VoipFilterBufferSize); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | public static void SetMicrophoneMuted(VoipMuteState state) |
| 437 | { |
| 438 | if (Core.IsInitialized()) |
| 439 | { |
| 440 | CAPI.ovr_Voip_SetMicrophoneMuted(state); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | public static VoipMuteState GetSystemVoipMicrophoneMuted() |
| 445 | { |
| 446 | if (Core.IsInitialized()) |
| 447 | { |
| 448 | return CAPI.ovr_Voip_GetSystemVoipMicrophoneMuted(); |
| 449 | } |
| 450 | return VoipMuteState.Unknown; |
| 451 | } |
| 452 | |
| 453 | public static SystemVoipStatus GetSystemVoipStatus() |
| 454 | { |
| 455 | if (Core.IsInitialized()) |
| 456 | { |
| 457 | return CAPI.ovr_Voip_GetSystemVoipStatus(); |
| 458 | } |
| 459 | return SystemVoipStatus.Unknown; |
| 460 | } |
| 461 | |
| 462 | public static Oculus.Platform.VoipDtxState GetIsConnectionUsingDtx(UInt64 peerID) |
| 463 | { |
| 464 | if (Core.IsInitialized()) |
| 465 | { |
| 466 | return CAPI.ovr_Voip_GetIsConnectionUsingDtx(peerID); |
| 467 | } |
| 468 | return Oculus.Platform.VoipDtxState.Unknown; |
| 469 | } |
| 470 | |
| 471 | public static Oculus.Platform.VoipBitrate GetLocalBitrate(UInt64 peerID) |
| 472 | { |
| 473 | if (Core.IsInitialized()) |
| 474 | { |
| 475 | return CAPI.ovr_Voip_GetLocalBitrate(peerID); |
| 476 | } |
| 477 | return Oculus.Platform.VoipBitrate.Unknown; |
| 478 | } |
| 479 | |
| 480 | public static Oculus.Platform.VoipBitrate GetRemoteBitrate(UInt64 peerID) |
| 481 | { |
| 482 | if (Core.IsInitialized()) |
| 483 | { |
| 484 | return CAPI.ovr_Voip_GetRemoteBitrate(peerID); |
| 485 | } |
| 486 | return Oculus.Platform.VoipBitrate.Unknown; |
| 487 | } |
| 488 | |
| 489 | public static void SetNewConnectionOptions(VoipOptions voipOptions) |
| 490 | { |
| 491 | if (Core.IsInitialized()) |
| 492 | { |
| 493 | CAPI.ovr_Voip_SetNewConnectionOptions((IntPtr)voipOptions); |
| 494 | } |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | public static partial class Achievements |
| 499 | { |
| 500 | /// Add 'count' to the achievement with the given name. This must be a COUNT |
| 501 | /// achievement. The largest number that is supported by this method is the max |
| 502 | /// value of a signed 64-bit integer. If the number is larger than that, it is |
| 503 | /// clamped to that max value before being passed to the servers. |
| 504 | /// |
| 505 | public static Request<Models.AchievementUpdate> AddCount(string name, ulong count) |
| 506 | { |
| 507 | if (Core.IsInitialized()) |
| 508 | { |
| 509 | return new Request<Models.AchievementUpdate>(CAPI.ovr_Achievements_AddCount(name, count)); |
| 510 | } |
| 511 | |
| 512 | return null; |
| 513 | } |
| 514 | |
| 515 | /// Unlock fields of a BITFIELD achievement. |
| 516 | /// \param name The name of the achievement to unlock |
| 517 | /// \param fields A string containing either '0' or '1' characters. Every '1' will unlock the field in the corresponding position. |
| 518 | /// |
| 519 | public static Request<Models.AchievementUpdate> AddFields(string name, string fields) |
| 520 | { |
| 521 | if (Core.IsInitialized()) |
| 522 | { |
| 523 | return new Request<Models.AchievementUpdate>(CAPI.ovr_Achievements_AddFields(name, fields)); |
| 524 | } |
| 525 | |
| 526 | return null; |
| 527 | } |
| 528 | |
| 529 | /// Request all achievement definitions for the app. |
| 530 | /// |
| 531 | public static Request<Models.AchievementDefinitionList> GetAllDefinitions() |
| 532 | { |
| 533 | if (Core.IsInitialized()) |
| 534 | { |
| 535 | return new Request<Models.AchievementDefinitionList>(CAPI.ovr_Achievements_GetAllDefinitions()); |
| 536 | } |
| 537 | |
| 538 | return null; |
| 539 | } |
| 540 | |
| 541 | /// Request the progress for the user on all achievements in the app. |
| 542 | /// |
| 543 | public static Request<Models.AchievementProgressList> GetAllProgress() |
| 544 | { |
| 545 | if (Core.IsInitialized()) |
| 546 | { |
| 547 | return new Request<Models.AchievementProgressList>(CAPI.ovr_Achievements_GetAllProgress()); |
| 548 | } |
| 549 | |
| 550 | return null; |
| 551 | } |
| 552 | |
| 553 | /// Request the achievement definitions that match the specified names. |
| 554 | /// |
| 555 | public static Request<Models.AchievementDefinitionList> GetDefinitionsByName(string[] names) |
| 556 | { |
| 557 | if (Core.IsInitialized()) |
| 558 | { |
| 559 | return new Request<Models.AchievementDefinitionList>(CAPI.ovr_Achievements_GetDefinitionsByName(names, (names != null ? names.Length : 0))); |
| 560 | } |
| 561 | |
| 562 | return null; |
| 563 | } |
| 564 | |
| 565 | /// Request the user's progress on the specified achievements. |
| 566 | /// |
| 567 | public static Request<Models.AchievementProgressList> GetProgressByName(string[] names) |
| 568 | { |
| 569 | if (Core.IsInitialized()) |
| 570 | { |
| 571 | return new Request<Models.AchievementProgressList>(CAPI.ovr_Achievements_GetProgressByName(names, (names != null ? names.Length : 0))); |
| 572 | } |
| 573 | |
| 574 | return null; |
| 575 | } |
| 576 | |
| 577 | /// Unlock the achievement with the given name. This can be of any achievement |
| 578 | /// type. |
| 579 | /// |
| 580 | public static Request<Models.AchievementUpdate> Unlock(string name) |
| 581 | { |
| 582 | if (Core.IsInitialized()) |
| 583 | { |
| 584 | return new Request<Models.AchievementUpdate>(CAPI.ovr_Achievements_Unlock(name)); |
| 585 | } |
| 586 | |
| 587 | return null; |
| 588 | } |
| 589 | |
| 590 | } |
| 591 | |
| 592 | public static partial class Application |
| 593 | { |
| 594 | /// Requests version information, including the currently installed and latest |
| 595 | /// available version name and version code. |
| 596 | /// |
| 597 | public static Request<Models.ApplicationVersion> GetVersion() |
| 598 | { |
| 599 | if (Core.IsInitialized()) |
| 600 | { |
| 601 | return new Request<Models.ApplicationVersion>(CAPI.ovr_Application_GetVersion()); |
| 602 | } |
| 603 | |
| 604 | return null; |
| 605 | } |
| 606 | |
| 607 | /// Launches a different application in the user's library. If the user does |
| 608 | /// not have that application installed, they will be taken to that app's page |
| 609 | /// in the Oculus Store |
| 610 | /// \param appID The ID of the app to launch |
| 611 | /// \param deeplink_options Additional configuration for this requests. Optional. |
| 612 | /// |
| 613 | public static Request<string> LaunchOtherApp(UInt64 appID, ApplicationOptions deeplink_options = null) |
| 614 | { |
| 615 | if (Core.IsInitialized()) |
| 616 | { |
| 617 | return new Request<string>(CAPI.ovr_Application_LaunchOtherApp(appID, (IntPtr)deeplink_options)); |
| 618 | } |
| 619 | |
| 620 | return null; |
| 621 | } |
| 622 | |
| 623 | } |
| 624 | |
| 625 | public static partial class ApplicationLifecycle |
| 626 | { |
| 627 | /// Sent when a launch intent is received (for both cold and warm starts). The |
| 628 | /// payload is the type of the intent. ApplicationLifecycle.GetLaunchDetails() |
| 629 | /// should be called to get the other details. |
| 630 | /// |
| 631 | public static void SetLaunchIntentChangedNotificationCallback(Message<string>.Callback callback) |
| 632 | { |
| 633 | Callback.SetNotificationCallback( |
| 634 | Message.MessageType.Notification_ApplicationLifecycle_LaunchIntentChanged, |
| 635 | callback |
| 636 | ); |
| 637 | } |
| 638 | |
| 639 | } |
| 640 | |
| 641 | public static partial class AssetFile |
| 642 | { |
| 643 | /// DEPRECATED. Use AssetFile.DeleteById() |
| 644 | /// |
| 645 | public static Request<Models.AssetFileDeleteResult> Delete(UInt64 assetFileID) |
| 646 | { |
| 647 | if (Core.IsInitialized()) |
| 648 | { |
| 649 | return new Request<Models.AssetFileDeleteResult>(CAPI.ovr_AssetFile_Delete(assetFileID)); |
| 650 | } |
| 651 | |
| 652 | return null; |
| 653 | } |
| 654 | |
| 655 | /// Removes an previously installed asset file from the device by its ID. |
| 656 | /// Returns an object containing the asset ID and file name, and a success |
| 657 | /// flag. |
| 658 | /// \param assetFileID The asset file ID |
| 659 | /// |
| 660 | public static Request<Models.AssetFileDeleteResult> DeleteById(UInt64 assetFileID) |
| 661 | { |
| 662 | if (Core.IsInitialized()) |
| 663 | { |
| 664 | return new Request<Models.AssetFileDeleteResult>(CAPI.ovr_AssetFile_DeleteById(assetFileID)); |
| 665 | } |
| 666 | |
| 667 | return null; |
| 668 | } |
| 669 | |
| 670 | /// Removes an previously installed asset file from the device by its name. |
| 671 | /// Returns an object containing the asset ID and file name, and a success |
| 672 | /// flag. |
| 673 | /// \param assetFileName The asset file name |
| 674 | /// |
| 675 | public static Request<Models.AssetFileDeleteResult> DeleteByName(string assetFileName) |
| 676 | { |
| 677 | if (Core.IsInitialized()) |
| 678 | { |
| 679 | return new Request<Models.AssetFileDeleteResult>(CAPI.ovr_AssetFile_DeleteByName(assetFileName)); |
| 680 | } |
| 681 | |
| 682 | return null; |
| 683 | } |
| 684 | |
| 685 | /// DEPRECATED. Use AssetFile.DownloadById() |
| 686 | /// |
| 687 | public static Request<Models.AssetFileDownloadResult> Download(UInt64 assetFileID) |
| 688 | { |
| 689 | if (Core.IsInitialized()) |
| 690 | { |
| 691 | return new Request<Models.AssetFileDownloadResult>(CAPI.ovr_AssetFile_Download(assetFileID)); |
| 692 | } |
| 693 | |
| 694 | return null; |
| 695 | } |
| 696 | |
| 697 | /// Downloads an asset file by its ID on demand. Returns an object containing |
| 698 | /// the asset ID and filepath. Sends periodic |
| 699 | /// MessageType.Notification_AssetFile_DownloadUpdate to track the downloads. |
| 700 | /// \param assetFileID The asset file ID |
| 701 | /// |
| 702 | public static Request<Models.AssetFileDownloadResult> DownloadById(UInt64 assetFileID) |
| 703 | { |
| 704 | if (Core.IsInitialized()) |
| 705 | { |
| 706 | return new Request<Models.AssetFileDownloadResult>(CAPI.ovr_AssetFile_DownloadById(assetFileID)); |
| 707 | } |
| 708 | |
| 709 | return null; |
| 710 | } |
| 711 | |
| 712 | /// Downloads an asset file by its name on demand. Returns an object containing |
| 713 | /// the asset ID and filepath. Sends periodic |
| 714 | /// {notifications.asset_file.download_update}} to track the downloads. |
| 715 | /// \param assetFileName The asset file name |
| 716 | /// |
| 717 | public static Request<Models.AssetFileDownloadResult> DownloadByName(string assetFileName) |
| 718 | { |
| 719 | if (Core.IsInitialized()) |
| 720 | { |
| 721 | return new Request<Models.AssetFileDownloadResult>(CAPI.ovr_AssetFile_DownloadByName(assetFileName)); |
| 722 | } |
| 723 | |
| 724 | return null; |
| 725 | } |
| 726 | |
| 727 | /// DEPRECATED. Use AssetFile.DownloadCancelById() |
| 728 | /// |
| 729 | public static Request<Models.AssetFileDownloadCancelResult> DownloadCancel(UInt64 assetFileID) |
| 730 | { |
| 731 | if (Core.IsInitialized()) |
| 732 | { |
| 733 | return new Request<Models.AssetFileDownloadCancelResult>(CAPI.ovr_AssetFile_DownloadCancel(assetFileID)); |
| 734 | } |
| 735 | |
| 736 | return null; |
| 737 | } |
| 738 | |
| 739 | /// Cancels a previously spawned download request for an asset file by its ID. |
| 740 | /// Returns an object containing the asset ID and file path, and a success |
| 741 | /// flag. |
| 742 | /// \param assetFileID The asset file ID |
| 743 | /// |
| 744 | public static Request<Models.AssetFileDownloadCancelResult> DownloadCancelById(UInt64 assetFileID) |
| 745 | { |
| 746 | if (Core.IsInitialized()) |
| 747 | { |
| 748 | return new Request<Models.AssetFileDownloadCancelResult>(CAPI.ovr_AssetFile_DownloadCancelById(assetFileID)); |
| 749 | } |
| 750 | |
| 751 | return null; |
| 752 | } |
| 753 | |
| 754 | /// Cancels a previously spawned download request for an asset file by its |
| 755 | /// name. Returns an object containing the asset ID and file path, and a |
| 756 | /// success flag. |
| 757 | /// \param assetFileName The asset file name |
| 758 | /// |
| 759 | public static Request<Models.AssetFileDownloadCancelResult> DownloadCancelByName(string assetFileName) |
| 760 | { |
| 761 | if (Core.IsInitialized()) |
| 762 | { |
| 763 | return new Request<Models.AssetFileDownloadCancelResult>(CAPI.ovr_AssetFile_DownloadCancelByName(assetFileName)); |
| 764 | } |
| 765 | |
| 766 | return null; |
| 767 | } |
| 768 | |
| 769 | /// Returns an array of objects with asset file names and their associated IDs, |
| 770 | /// and and whether it's currently installed. |
| 771 | /// |
| 772 | public static Request<Models.AssetDetailsList> GetList() |
| 773 | { |
| 774 | if (Core.IsInitialized()) |
| 775 | { |
| 776 | return new Request<Models.AssetDetailsList>(CAPI.ovr_AssetFile_GetList()); |
| 777 | } |
| 778 | |
| 779 | return null; |
| 780 | } |
| 781 | |
| 782 | /// DEPRECATED. Use AssetFile.StatusById() |
| 783 | /// |
| 784 | public static Request<Models.AssetDetails> Status(UInt64 assetFileID) |
| 785 | { |
| 786 | if (Core.IsInitialized()) |
| 787 | { |
| 788 | return new Request<Models.AssetDetails>(CAPI.ovr_AssetFile_Status(assetFileID)); |
| 789 | } |
| 790 | |
| 791 | return null; |
| 792 | } |
| 793 | |
| 794 | /// Returns the details on a single asset: ID, file name, and whether it's |
| 795 | /// currently installed |
| 796 | /// \param assetFileID The asset file ID |
| 797 | /// |
| 798 | public static Request<Models.AssetDetails> StatusById(UInt64 assetFileID) |
| 799 | { |
| 800 | if (Core.IsInitialized()) |
| 801 | { |
| 802 | return new Request<Models.AssetDetails>(CAPI.ovr_AssetFile_StatusById(assetFileID)); |
| 803 | } |
| 804 | |
| 805 | return null; |
| 806 | } |
| 807 | |
| 808 | /// Returns the details on a single asset: ID, file name, and whether it's |
| 809 | /// currently installed |
| 810 | /// \param assetFileName The asset file name |
| 811 | /// |
| 812 | public static Request<Models.AssetDetails> StatusByName(string assetFileName) |
| 813 | { |
| 814 | if (Core.IsInitialized()) |
| 815 | { |
| 816 | return new Request<Models.AssetDetails>(CAPI.ovr_AssetFile_StatusByName(assetFileName)); |
| 817 | } |
| 818 | |
| 819 | return null; |
| 820 | } |
| 821 | |
| 822 | /// Sent to indicate download progress for asset files. |
| 823 | /// |
| 824 | public static void SetDownloadUpdateNotificationCallback(Message<Models.AssetFileDownloadUpdate>.Callback callback) |
| 825 | { |
| 826 | Callback.SetNotificationCallback( |
| 827 | Message.MessageType.Notification_AssetFile_DownloadUpdate, |
| 828 | callback |
| 829 | ); |
| 830 | } |
| 831 | |
| 832 | } |
| 833 | |
| 834 | public static partial class Avatar |
| 835 | { |
| 836 | } |
| 837 | |
| 838 | public static partial class Cal |
| 839 | { |
| 840 | } |
| 841 | |
| 842 | public static partial class CloudStorage |
| 843 | { |
| 844 | /// Deletes the specified save data buffer. Conflicts are handled just like |
| 845 | /// Saves. |
| 846 | /// \param bucket The name of the storage bucket. |
| 847 | /// \param key The name for this saved data. |
| 848 | /// |
| 849 | public static Request<Models.CloudStorageUpdateResponse> Delete(string bucket, string key) |
| 850 | { |
| 851 | if (Core.IsInitialized()) |
| 852 | { |
| 853 | return new Request<Models.CloudStorageUpdateResponse>(CAPI.ovr_CloudStorage_Delete(bucket, key)); |
| 854 | } |
| 855 | |
| 856 | return null; |
| 857 | } |
| 858 | |
| 859 | /// Loads the saved entry for the specified bucket and key. If a conflict |
| 860 | /// exists with the key then an error message is returned. |
| 861 | /// \param bucket The name of the storage bucket. |
| 862 | /// \param key The name for this saved data. |
| 863 | /// |
| 864 | public static Request<Models.CloudStorageData> Load(string bucket, string key) |
| 865 | { |
| 866 | if (Core.IsInitialized()) |
| 867 | { |
| 868 | return new Request<Models.CloudStorageData>(CAPI.ovr_CloudStorage_Load(bucket, key)); |
| 869 | } |
| 870 | |
| 871 | return null; |
| 872 | } |
| 873 | |
| 874 | /// Loads all the metadata for the saves in the specified bucket, including |
| 875 | /// conflicts. |
| 876 | /// \param bucket The name of the storage bucket. |
| 877 | /// |
| 878 | public static Request<Models.CloudStorageMetadataList> LoadBucketMetadata(string bucket) |
| 879 | { |
| 880 | if (Core.IsInitialized()) |
| 881 | { |
| 882 | return new Request<Models.CloudStorageMetadataList>(CAPI.ovr_CloudStorage_LoadBucketMetadata(bucket)); |
| 883 | } |
| 884 | |
| 885 | return null; |
| 886 | } |
| 887 | |
| 888 | /// Loads the metadata for this bucket-key combination that need to be manually |
| 889 | /// resolved. |
| 890 | /// \param bucket The name of the storage bucket |
| 891 | /// \param key The key for this saved data. |
| 892 | /// |
| 893 | public static Request<Models.CloudStorageConflictMetadata> LoadConflictMetadata(string bucket, string key) |
| 894 | { |
| 895 | if (Core.IsInitialized()) |
| 896 | { |
| 897 | return new Request<Models.CloudStorageConflictMetadata>(CAPI.ovr_CloudStorage_LoadConflictMetadata(bucket, key)); |
| 898 | } |
| 899 | |
| 900 | return null; |
| 901 | } |
| 902 | |
| 903 | /// Loads the data specified by the storage handle. |
| 904 | /// |
| 905 | public static Request<Models.CloudStorageData> LoadHandle(string handle) |
| 906 | { |
| 907 | if (Core.IsInitialized()) |
| 908 | { |
| 909 | return new Request<Models.CloudStorageData>(CAPI.ovr_CloudStorage_LoadHandle(handle)); |
| 910 | } |
| 911 | |
| 912 | return null; |
| 913 | } |
| 914 | |
| 915 | /// load the metadata for the specified key |
| 916 | /// \param bucket The name of the storage bucket. |
| 917 | /// \param key The name for this saved data. |
| 918 | /// |
| 919 | public static Request<Models.CloudStorageMetadata> LoadMetadata(string bucket, string key) |
| 920 | { |
| 921 | if (Core.IsInitialized()) |
| 922 | { |
| 923 | return new Request<Models.CloudStorageMetadata>(CAPI.ovr_CloudStorage_LoadMetadata(bucket, key)); |
| 924 | } |
| 925 | |
| 926 | return null; |
| 927 | } |
| 928 | |
| 929 | /// Selects the local save for manual conflict resolution. |
| 930 | /// \param bucket The name of the storage bucket. |
| 931 | /// \param key The name for this saved data. |
| 932 | /// \param remoteHandle The handle of the remote that the local file was resolved against. |
| 933 | /// |
| 934 | public static Request<Models.CloudStorageUpdateResponse> ResolveKeepLocal(string bucket, string key, string remoteHandle) |
| 935 | { |
| 936 | if (Core.IsInitialized()) |
| 937 | { |
| 938 | return new Request<Models.CloudStorageUpdateResponse>(CAPI.ovr_CloudStorage_ResolveKeepLocal(bucket, key, remoteHandle)); |
| 939 | } |
| 940 | |
| 941 | return null; |
| 942 | } |
| 943 | |
| 944 | /// Selects the remote save for manual conflict resolution. |
| 945 | /// \param bucket The name of the storage bucket. |
| 946 | /// \param key The name for this saved data. |
| 947 | /// \param remoteHandle The handle of the remote. |
| 948 | /// |
| 949 | public static Request<Models.CloudStorageUpdateResponse> ResolveKeepRemote(string bucket, string key, string remoteHandle) |
| 950 | { |
| 951 | if (Core.IsInitialized()) |
| 952 | { |
| 953 | return new Request<Models.CloudStorageUpdateResponse>(CAPI.ovr_CloudStorage_ResolveKeepRemote(bucket, key, remoteHandle)); |
| 954 | } |
| 955 | |
| 956 | return null; |
| 957 | } |
| 958 | |
| 959 | /// Note: Cloud Storage is only available for Rift apps. |
| 960 | /// |
| 961 | /// Send a save data buffer to the platform. CloudStorage.Save() passes a |
| 962 | /// pointer to your data in an async call. You need to maintain the save data |
| 963 | /// until you receive the message indicating that the save was successful. |
| 964 | /// |
| 965 | /// If the data is destroyed or modified prior to receiving that message the |
| 966 | /// data will not be saved. |
| 967 | /// \param bucket The name of the storage bucket. |
| 968 | /// \param key The name for this saved data. |
| 969 | /// \param data Start of the data block. |
| 970 | /// \param counter Optional. Counter used for user data or auto-deconfliction. |
| 971 | /// \param extraData Optional. String data that isn't used by the platform. |
| 972 | /// |
| 973 | /// <b>Error codes</b> |
| 974 | /// - \b 100: The stored version has a later timestamp than the data provided. This cloud storage bucket's conflict resolution policy is configured to use the latest timestamp, which is configurable in the developer dashboard. |
| 975 | /// |
| 976 | public static Request<Models.CloudStorageUpdateResponse> Save(string bucket, string key, byte[] data, long counter, string extraData) |
| 977 | { |
| 978 | if (Core.IsInitialized()) |
| 979 | { |
| 980 | return new Request<Models.CloudStorageUpdateResponse>(CAPI.ovr_CloudStorage_Save(bucket, key, data, (uint)(data != null ? data.Length : 0), counter, extraData)); |
| 981 | } |
| 982 | |
| 983 | return null; |
| 984 | } |
| 985 | |
| 986 | } |
| 987 | |
| 988 | public static partial class CloudStorage2 |
| 989 | { |
| 990 | /// Get the directory path for the current user/app pair that will be used |
| 991 | /// during cloud storage synchronization |
| 992 | /// |
| 993 | public static Request<string> GetUserDirectoryPath() |
| 994 | { |
| 995 | if (Core.IsInitialized()) |
| 996 | { |
| 997 | return new Request<string>(CAPI.ovr_CloudStorage2_GetUserDirectoryPath()); |
| 998 | } |
| 999 | |
| 1000 | return null; |
| 1001 | } |
| 1002 | |
| 1003 | } |
| 1004 | |
| 1005 | public static partial class Colocation |
| 1006 | { |
| 1007 | } |
| 1008 | |
| 1009 | public static partial class Entitlements |
| 1010 | { |
| 1011 | /// Returns whether the current user is entitled to the current app. |
| 1012 | /// |
| 1013 | public static Request IsUserEntitledToApplication() |
| 1014 | { |
| 1015 | if (Core.IsInitialized()) |
| 1016 | { |
| 1017 | return new Request(CAPI.ovr_Entitlement_GetIsViewerEntitled()); |
| 1018 | } |
| 1019 | |
| 1020 | return null; |
| 1021 | } |
| 1022 | |
| 1023 | } |
| 1024 | |
| 1025 | public static partial class GraphAPI |
| 1026 | { |
| 1027 | } |
| 1028 | |
| 1029 | public static partial class HTTP |
| 1030 | { |
| 1031 | } |
| 1032 | |
| 1033 | public static partial class IAP |
| 1034 | { |
| 1035 | /// Allow the consumable IAP product to be purchased again. Conceptually, this |
| 1036 | /// indicates that the item was used or consumed. |
| 1037 | /// |
| 1038 | public static Request ConsumePurchase(string sku) |
| 1039 | { |
| 1040 | if (Core.IsInitialized()) |
| 1041 | { |
| 1042 | return new Request(CAPI.ovr_IAP_ConsumePurchase(sku)); |
| 1043 | } |
| 1044 | |
| 1045 | return null; |
| 1046 | } |
| 1047 | |
| 1048 | /// Retrieve a list of IAP products that can be purchased. |
| 1049 | /// \param skus The SKUs of the products to retrieve. |
| 1050 | /// |
| 1051 | public static Request<Models.ProductList> GetProductsBySKU(string[] skus) |
| 1052 | { |
| 1053 | if (Core.IsInitialized()) |
| 1054 | { |
| 1055 | return new Request<Models.ProductList>(CAPI.ovr_IAP_GetProductsBySKU(skus, (skus != null ? skus.Length : 0))); |
| 1056 | } |
| 1057 | |
| 1058 | return null; |
| 1059 | } |
| 1060 | |
| 1061 | /// Retrieve a list of Purchase that the Logged-In-User has made. This list |
| 1062 | /// will also contain consumable purchases that have not been consumed. |
| 1063 | /// |
| 1064 | public static Request<Models.PurchaseList> GetViewerPurchases() |
| 1065 | { |
| 1066 | if (Core.IsInitialized()) |
| 1067 | { |
| 1068 | return new Request<Models.PurchaseList>(CAPI.ovr_IAP_GetViewerPurchases()); |
| 1069 | } |
| 1070 | |
| 1071 | return null; |
| 1072 | } |
| 1073 | |
| 1074 | /// Retrieve a list of Purchase that the Logged-In-User has made. This list |
| 1075 | /// will only contain durable purchase (non-consumable) and is populated from a |
| 1076 | /// device cache. It is recommended in all cases to use |
| 1077 | /// ovr_User_GetViewerPurchases first and only check the cache if that fails. |
| 1078 | /// |
| 1079 | public static Request<Models.PurchaseList> GetViewerPurchasesDurableCache() |
| 1080 | { |
| 1081 | if (Core.IsInitialized()) |
| 1082 | { |
| 1083 | return new Request<Models.PurchaseList>(CAPI.ovr_IAP_GetViewerPurchasesDurableCache()); |
| 1084 | } |
| 1085 | |
| 1086 | return null; |
| 1087 | } |
| 1088 | |
| 1089 | /// Launch the checkout flow to purchase the existing product. Oculus Home |
| 1090 | /// tries handle and fix as many errors as possible. Home returns the |
| 1091 | /// appropriate error message and how to resolveit, if possible. Returns a |
| 1092 | /// purchase on success, empty purchase on cancel, and an error on error. |
| 1093 | /// \param sku IAP sku for the item the user wishes to purchase. |
| 1094 | /// |
| 1095 | public static Request<Models.Purchase> LaunchCheckoutFlow(string sku) |
| 1096 | { |
| 1097 | if (Core.IsInitialized()) |
| 1098 | { |
| 1099 | if (UnityEngine.Application.isEditor) { |
| 1100 | throw new NotImplementedException("LaunchCheckoutFlow() is not implemented in the editor yet."); |
| 1101 | } |
| 1102 | |
| 1103 | return new Request<Models.Purchase>(CAPI.ovr_IAP_LaunchCheckoutFlow(sku)); |
| 1104 | } |
| 1105 | |
| 1106 | return null; |
| 1107 | } |
| 1108 | |
| 1109 | } |
| 1110 | |
| 1111 | public static partial class LanguagePack |
| 1112 | { |
| 1113 | /// Returns currently installed and selected language pack for an app in the |
| 1114 | /// view of the `asset_details`. Use `language` field to extract neeeded |
| 1115 | /// language info. A particular language can be download and installed by a |
| 1116 | /// user from the Oculus app on the application page. |
| 1117 | /// |
| 1118 | public static Request<Models.AssetDetails> GetCurrent() |
| 1119 | { |
| 1120 | if (Core.IsInitialized()) |
| 1121 | { |
| 1122 | return new Request<Models.AssetDetails>(CAPI.ovr_LanguagePack_GetCurrent()); |
| 1123 | } |
| 1124 | |
| 1125 | return null; |
| 1126 | } |
| 1127 | |
| 1128 | /// Sets the current language to specified. The parameter is the BCP47 language |
| 1129 | /// tag. If a language pack is not downloaded yet, spawns automatically the |
| 1130 | /// AssetFile.DownloadByName() request, and sends periodic |
| 1131 | /// MessageType.Notification_AssetFile_DownloadUpdate to track the downloads. |
| 1132 | /// Once the language asset file is downloaded, call LanguagePack.GetCurrent() |
| 1133 | /// to retrive the data, and use the language at runtime. |
| 1134 | /// \param tag BCP47 language tag |
| 1135 | /// |
| 1136 | public static Request<Models.AssetFileDownloadResult> SetCurrent(string tag) |
| 1137 | { |
| 1138 | if (Core.IsInitialized()) |
| 1139 | { |
| 1140 | return new Request<Models.AssetFileDownloadResult>(CAPI.ovr_LanguagePack_SetCurrent(tag)); |
| 1141 | } |
| 1142 | |
| 1143 | return null; |
| 1144 | } |
| 1145 | |
| 1146 | } |
| 1147 | |
| 1148 | public static partial class Leaderboards |
| 1149 | { |
| 1150 | /// Requests a block of Leaderboard Entries. |
| 1151 | /// \param leaderboardName The name of the leaderboard whose entries to return. |
| 1152 | /// \param limit Defines the maximum number of entries to return. |
| 1153 | /// \param filter Allows you to restrict the returned values by friends. |
| 1154 | /// \param startAt Defines whether to center the query on the user or start at the top of the leaderboard. |
| 1155 | /// |
| 1156 | /// <b>Error codes</b> |
| 1157 | /// - \b 12074: You're not yet ranked on this leaderboard. |
| 1158 | /// |
| 1159 | public static Request<Models.LeaderboardEntryList> GetEntries(string leaderboardName, int limit, LeaderboardFilterType filter, LeaderboardStartAt startAt) |
| 1160 | { |
| 1161 | if (Core.IsInitialized()) |
| 1162 | { |
| 1163 | return new Request<Models.LeaderboardEntryList>(CAPI.ovr_Leaderboard_GetEntries(leaderboardName, limit, filter, startAt)); |
| 1164 | } |
| 1165 | |
| 1166 | return null; |
| 1167 | } |
| 1168 | |
| 1169 | /// Requests a block of leaderboard Entries. |
| 1170 | /// \param leaderboardName The name of the leaderboard. |
| 1171 | /// \param limit The maximum number of entries to return. |
| 1172 | /// \param afterRank The position after which to start. For example, 10 returns leaderboard results starting with the 11th user. |
| 1173 | /// |
| 1174 | public static Request<Models.LeaderboardEntryList> GetEntriesAfterRank(string leaderboardName, int limit, ulong afterRank) |
| 1175 | { |
| 1176 | if (Core.IsInitialized()) |
| 1177 | { |
| 1178 | return new Request<Models.LeaderboardEntryList>(CAPI.ovr_Leaderboard_GetEntriesAfterRank(leaderboardName, limit, afterRank)); |
| 1179 | } |
| 1180 | |
| 1181 | return null; |
| 1182 | } |
| 1183 | |
| 1184 | /// Writes a single entry to a leaderboard. |
| 1185 | /// \param leaderboardName The leaderboard for which to write the entry. |
| 1186 | /// \param score The score to write. |
| 1187 | /// \param extraData A 2KB custom data field that is associated with the leaderboard entry. This can be a game replay or anything that provides more detail about the entry to the viewer. |
| 1188 | /// \param forceUpdate If true, the score always updates. This happens even if it is not the user's best score. |
| 1189 | /// |
| 1190 | /// <b>Error codes</b> |
| 1191 | /// - \b 100: Parameter {parameter}: invalid user id: {user_id} |
| 1192 | /// |
| 1193 | public static Request<bool> WriteEntry(string leaderboardName, long score, byte[] extraData = null, bool forceUpdate = false) |
| 1194 | { |
| 1195 | if (Core.IsInitialized()) |
| 1196 | { |
| 1197 | return new Request<bool>(CAPI.ovr_Leaderboard_WriteEntry(leaderboardName, score, extraData, (uint)(extraData != null ? extraData.Length : 0), forceUpdate)); |
| 1198 | } |
| 1199 | |
| 1200 | return null; |
| 1201 | } |
| 1202 | |
| 1203 | } |
| 1204 | |
| 1205 | public static partial class Livestreaming |
| 1206 | { |
| 1207 | /// Return the status of the current livestreaming session if there is one. |
| 1208 | /// |
| 1209 | public static Request<Models.LivestreamingStatus> GetStatus() |
| 1210 | { |
| 1211 | if (Core.IsInitialized()) |
| 1212 | { |
| 1213 | return new Request<Models.LivestreamingStatus>(CAPI.ovr_Livestreaming_GetStatus()); |
| 1214 | } |
| 1215 | |
| 1216 | return null; |
| 1217 | } |
| 1218 | |
| 1219 | /// Pauses the livestreaming session if there is one. NOTE: this function is |
| 1220 | /// safe to call if no session is active. |
| 1221 | /// |
| 1222 | public static Request<Models.LivestreamingStatus> PauseStream() |
| 1223 | { |
| 1224 | if (Core.IsInitialized()) |
| 1225 | { |
| 1226 | return new Request<Models.LivestreamingStatus>(CAPI.ovr_Livestreaming_PauseStream()); |
| 1227 | } |
| 1228 | |
| 1229 | return null; |
| 1230 | } |
| 1231 | |
| 1232 | /// Resumes the livestreaming session if there is one. NOTE: this function is |
| 1233 | /// safe to call if no session is active. |
| 1234 | /// |
| 1235 | public static Request<Models.LivestreamingStatus> ResumeStream() |
| 1236 | { |
| 1237 | if (Core.IsInitialized()) |
| 1238 | { |
| 1239 | return new Request<Models.LivestreamingStatus>(CAPI.ovr_Livestreaming_ResumeStream()); |
| 1240 | } |
| 1241 | |
| 1242 | return null; |
| 1243 | } |
| 1244 | |
| 1245 | /// Indicates that the livestreaming session has been updated. You can use this |
| 1246 | /// information to throttle your game performance or increase CPU/GPU |
| 1247 | /// performance. Use Message.GetLivestreamingStatus() to extract the updated |
| 1248 | /// livestreaming status. |
| 1249 | /// |
| 1250 | public static void SetStatusUpdateNotificationCallback(Message<Models.LivestreamingStatus>.Callback callback) |
| 1251 | { |
| 1252 | Callback.SetNotificationCallback( |
| 1253 | Message.MessageType.Notification_Livestreaming_StatusChange, |
| 1254 | callback |
| 1255 | ); |
| 1256 | } |
| 1257 | |
| 1258 | } |
| 1259 | |
| 1260 | public static partial class Matchmaking |
| 1261 | { |
| 1262 | /// DEPRECATED. Use Browse2. |
| 1263 | /// \param pool A BROWSE type matchmaking pool. |
| 1264 | /// \param customQueryData Optional. Custom query data. |
| 1265 | /// |
| 1266 | /// <b>Error codes</b> |
| 1267 | /// - \b 100: Pool {pool_key} does not contain custom data key {key}. You can configure matchmaking custom data at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1268 | /// - \b 12072: Unknown pool: {pool_key}. You can configure matchmaking pools at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1269 | /// |
| 1270 | public static Request<Models.MatchmakingBrowseResult> Browse(string pool, CustomQuery customQueryData = null) |
| 1271 | { |
| 1272 | if (Core.IsInitialized()) |
| 1273 | { |
| 1274 | return new Request<Models.MatchmakingBrowseResult>(CAPI.ovr_Matchmaking_Browse(pool, customQueryData != null ? customQueryData.ToUnmanaged() : IntPtr.Zero)); |
| 1275 | } |
| 1276 | |
| 1277 | return null; |
| 1278 | } |
| 1279 | |
| 1280 | /// Modes: BROWSE |
| 1281 | /// |
| 1282 | /// See overview documentation above. |
| 1283 | /// |
| 1284 | /// Return a list of matchmaking rooms in the current pool filtered by skill |
| 1285 | /// and ping (if enabled). This also enqueues the user in the matchmaking |
| 1286 | /// queue. When the user has made a selection, call Rooms.Join2() on one of the |
| 1287 | /// rooms that was returned. If the user stops browsing, call |
| 1288 | /// Matchmaking.Cancel(). |
| 1289 | /// |
| 1290 | /// In addition to the list of rooms, enqueue results are also returned. Call |
| 1291 | /// MatchmakingBrowseResult.GetEnqueueResult() to obtain them. See |
| 1292 | /// OVR_MatchmakingEnqueueResult.h for details. |
| 1293 | /// \param pool A BROWSE type matchmaking pool. |
| 1294 | /// \param matchmakingOptions Additional matchmaking configuration for this request. Optional. |
| 1295 | /// |
| 1296 | /// <b>Error codes</b> |
| 1297 | /// - \b 100: Pool {pool_key} does not contain custom data key {key}. You can configure matchmaking custom data at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1298 | /// - \b 12072: Unknown pool: {pool_key}. You can configure matchmaking pools at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1299 | /// |
| 1300 | public static Request<Models.MatchmakingBrowseResult> Browse2(string pool, MatchmakingOptions matchmakingOptions = null) |
| 1301 | { |
| 1302 | if (Core.IsInitialized()) |
| 1303 | { |
| 1304 | return new Request<Models.MatchmakingBrowseResult>(CAPI.ovr_Matchmaking_Browse2(pool, (IntPtr)matchmakingOptions)); |
| 1305 | } |
| 1306 | |
| 1307 | return null; |
| 1308 | } |
| 1309 | |
| 1310 | /// DEPRECATED. Use Cancel2. |
| 1311 | /// \param pool The pool in question. |
| 1312 | /// \param requestHash Used to find your entry in a queue. |
| 1313 | /// |
| 1314 | /// <b>Error codes</b> |
| 1315 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is currently in another room (perhaps on another device), and thus is no longer in this room. Users can only be in one room at a time. If they are active on two different devices at once, there will be undefined behavior. |
| 1316 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not in the room (or any room). Perhaps they already left, or they stopped heartbeating. If this is a test environment, make sure you are not using the deprecated initialization methods ovr_PlatformInitializeStandaloneAccessToken (C++)/StandalonePlatform.Initialize(accessToken) (C#). |
| 1317 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not the owner of the room. |
| 1318 | /// - \b 100: Invalid room_id: {room_id}. Either the ID is not a valid room or the user does not have permission to see or act on the room. |
| 1319 | /// |
| 1320 | public static Request Cancel(string pool, string requestHash) |
| 1321 | { |
| 1322 | if (Core.IsInitialized()) |
| 1323 | { |
| 1324 | return new Request(CAPI.ovr_Matchmaking_Cancel(pool, requestHash)); |
| 1325 | } |
| 1326 | |
| 1327 | return null; |
| 1328 | } |
| 1329 | |
| 1330 | /// Modes: QUICKMATCH, BROWSE |
| 1331 | /// |
| 1332 | /// Makes a best effort to cancel a previous Enqueue request before a match |
| 1333 | /// occurs. Typically triggered when a user gives up waiting. For BROWSE mode, |
| 1334 | /// call this when a user gives up looking through the room list or when the |
| 1335 | /// host of a room wants to stop receiving new users. If you don't cancel but |
| 1336 | /// the user goes offline, the user/room will be timed out of the queue within |
| 1337 | /// 30 seconds. |
| 1338 | /// |
| 1339 | /// <b>Error codes</b> |
| 1340 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is currently in another room (perhaps on another device), and thus is no longer in this room. Users can only be in one room at a time. If they are active on two different devices at once, there will be undefined behavior. |
| 1341 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not in the room (or any room). Perhaps they already left, or they stopped heartbeating. If this is a test environment, make sure you are not using the deprecated initialization methods ovr_PlatformInitializeStandaloneAccessToken (C++)/StandalonePlatform.Initialize(accessToken) (C#). |
| 1342 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not the owner of the room. |
| 1343 | /// - \b 100: Invalid room_id: {room_id}. Either the ID is not a valid room or the user does not have permission to see or act on the room. |
| 1344 | /// |
| 1345 | public static Request Cancel() |
| 1346 | { |
| 1347 | if (Core.IsInitialized()) |
| 1348 | { |
| 1349 | return new Request(CAPI.ovr_Matchmaking_Cancel2()); |
| 1350 | } |
| 1351 | |
| 1352 | return null; |
| 1353 | } |
| 1354 | |
| 1355 | /// DEPRECATED. Use CreateAndEnqueueRoom2. |
| 1356 | /// \param pool The matchmaking pool to use, which is defined for the app. |
| 1357 | /// \param maxUsers Overrides the Max Users value, which is configured in pool settings of the Developer Dashboard. |
| 1358 | /// \param subscribeToUpdates If true, sends a message with type MessageType.Notification_Room_RoomUpdate when the room data changes, such as when users join or leave. |
| 1359 | /// \param customQueryData Optional. See "Custom criteria" section above. |
| 1360 | /// |
| 1361 | /// <b>Error codes</b> |
| 1362 | /// - \b 100: Pool {pool_key} does not contain custom data key {key}. You can configure matchmaking custom data at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1363 | /// - \b 12051: Pool '{pool_key}' is configured for Quickmatch mode. In Quickmatch mode, rooms are created on users' behalf when a match is found. Specify Advanced Quickmatch or Browse mode to use this feature. |
| 1364 | /// - \b 12072: Unknown pool: {pool_key}. You can configure matchmaking pools at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1365 | /// - \b 12089: You have asked to enqueue {num_users} users together, but this must be less than the maximum number of users in a room, {max_users}. |
| 1366 | /// |
| 1367 | public static Request<Models.MatchmakingEnqueueResultAndRoom> CreateAndEnqueueRoom(string pool, uint maxUsers, bool subscribeToUpdates = false, CustomQuery customQueryData = null) |
| 1368 | { |
| 1369 | if (Core.IsInitialized()) |
| 1370 | { |
| 1371 | return new Request<Models.MatchmakingEnqueueResultAndRoom>(CAPI.ovr_Matchmaking_CreateAndEnqueueRoom(pool, maxUsers, subscribeToUpdates, customQueryData != null ? customQueryData.ToUnmanaged() : IntPtr.Zero)); |
| 1372 | } |
| 1373 | |
| 1374 | return null; |
| 1375 | } |
| 1376 | |
| 1377 | /// Modes: BROWSE, QUICKMATCH (Advanced; Can Users Create Rooms = true) |
| 1378 | /// |
| 1379 | /// See overview documentation above. |
| 1380 | /// |
| 1381 | /// Create a matchmaking room, join it, and enqueue it. This is the preferred |
| 1382 | /// method. But, if you do not wish to automatically enqueue the room, you can |
| 1383 | /// call CreateRoom2 instead. |
| 1384 | /// |
| 1385 | /// Visit https://dashboard.oculus.com/application/[YOUR_APP_ID]/matchmaking to |
| 1386 | /// set up pools and queries |
| 1387 | /// \param pool The matchmaking pool to use, which is defined for the app. |
| 1388 | /// \param matchmakingOptions Additional matchmaking configuration for this request. Optional. |
| 1389 | /// |
| 1390 | /// <b>Error codes</b> |
| 1391 | /// - \b 100: Pool {pool_key} does not contain custom data key {key}. You can configure matchmaking custom data at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1392 | /// - \b 12051: Pool '{pool_key}' is configured for Quickmatch mode. In Quickmatch mode, rooms are created on users' behalf when a match is found. Specify Advanced Quickmatch or Browse mode to use this feature. |
| 1393 | /// - \b 12072: Unknown pool: {pool_key}. You can configure matchmaking pools at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1394 | /// - \b 12089: You have asked to enqueue {num_users} users together, but this must be less than the maximum number of users in a room, {max_users}. |
| 1395 | /// |
| 1396 | public static Request<Models.MatchmakingEnqueueResultAndRoom> CreateAndEnqueueRoom2(string pool, MatchmakingOptions matchmakingOptions = null) |
| 1397 | { |
| 1398 | if (Core.IsInitialized()) |
| 1399 | { |
| 1400 | return new Request<Models.MatchmakingEnqueueResultAndRoom>(CAPI.ovr_Matchmaking_CreateAndEnqueueRoom2(pool, (IntPtr)matchmakingOptions)); |
| 1401 | } |
| 1402 | |
| 1403 | return null; |
| 1404 | } |
| 1405 | |
| 1406 | /// DEPRECATED. Use CreateRoom2. |
| 1407 | /// \param pool The matchmaking pool to use, which is defined for the app. |
| 1408 | /// \param maxUsers Overrides the Max Users value, which is configured in pool settings of the Developer Dashboard. |
| 1409 | /// \param subscribeToUpdates If true, sends a message with type MessageType.Notification_Room_RoomUpdate when room data changes, such as when users join or leave. |
| 1410 | /// |
| 1411 | public static Request<Models.Room> CreateRoom(string pool, uint maxUsers, bool subscribeToUpdates = false) |
| 1412 | { |
| 1413 | if (Core.IsInitialized()) |
| 1414 | { |
| 1415 | return new Request<Models.Room>(CAPI.ovr_Matchmaking_CreateRoom(pool, maxUsers, subscribeToUpdates)); |
| 1416 | } |
| 1417 | |
| 1418 | return null; |
| 1419 | } |
| 1420 | |
| 1421 | /// Create a matchmaking room and join it, but do not enqueue the room. After |
| 1422 | /// creation, you can call EnqueueRoom2. However, Oculus recommends using |
| 1423 | /// CreateAndEnqueueRoom2 instead. |
| 1424 | /// |
| 1425 | /// Modes: BROWSE, QUICKMATCH (Advanced; Can Users Create Rooms = true) |
| 1426 | /// |
| 1427 | /// Create a matchmaking room and join it, but do not enqueue the room. After |
| 1428 | /// creation, you can call EnqueueRoom. Consider using CreateAndEnqueueRoom |
| 1429 | /// instead. |
| 1430 | /// |
| 1431 | /// Visit https://dashboard.oculus.com/application/[YOUR_APP_ID]/matchmaking to |
| 1432 | /// set up pools and queries |
| 1433 | /// \param pool The matchmaking pool to use, which is defined for the app. |
| 1434 | /// \param matchmakingOptions Additional matchmaking configuration for this request. Optional. |
| 1435 | /// |
| 1436 | public static Request<Models.Room> CreateRoom2(string pool, MatchmakingOptions matchmakingOptions = null) |
| 1437 | { |
| 1438 | if (Core.IsInitialized()) |
| 1439 | { |
| 1440 | return new Request<Models.Room>(CAPI.ovr_Matchmaking_CreateRoom2(pool, (IntPtr)matchmakingOptions)); |
| 1441 | } |
| 1442 | |
| 1443 | return null; |
| 1444 | } |
| 1445 | |
| 1446 | /// DEPRECATED. Use Enqueue2. |
| 1447 | /// \param pool The pool to enqueue in. |
| 1448 | /// \param customQueryData Optional. See "Custom criteria" section above. |
| 1449 | /// |
| 1450 | /// <b>Error codes</b> |
| 1451 | /// - \b 100: Pool {pool_key} does not contain custom data key {key}. You can configure matchmaking custom data at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1452 | /// - \b 12072: Unknown pool: {pool_key}. You can configure matchmaking pools at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1453 | /// |
| 1454 | public static Request<Models.MatchmakingEnqueueResult> Enqueue(string pool, CustomQuery customQueryData = null) |
| 1455 | { |
| 1456 | if (Core.IsInitialized()) |
| 1457 | { |
| 1458 | return new Request<Models.MatchmakingEnqueueResult>(CAPI.ovr_Matchmaking_Enqueue(pool, customQueryData != null ? customQueryData.ToUnmanaged() : IntPtr.Zero)); |
| 1459 | } |
| 1460 | |
| 1461 | return null; |
| 1462 | } |
| 1463 | |
| 1464 | /// Modes: QUICKMATCH |
| 1465 | /// |
| 1466 | /// See overview documentation above. |
| 1467 | /// |
| 1468 | /// Enqueue yourself to await an available matchmaking room. The platform |
| 1469 | /// returns a MessageType.Notification_Matchmaking_MatchFound message when a |
| 1470 | /// match is found. Call Rooms.Join2() on the returned room. The response |
| 1471 | /// contains useful information to display to the user to set expectations for |
| 1472 | /// how long it will take to get a match. |
| 1473 | /// |
| 1474 | /// If the user stops waiting, call Matchmaking.Cancel(). |
| 1475 | /// \param pool The pool to enqueue in. |
| 1476 | /// \param matchmakingOptions Additional matchmaking configuration for this request. Optional. |
| 1477 | /// |
| 1478 | /// <b>Error codes</b> |
| 1479 | /// - \b 100: Pool {pool_key} does not contain custom data key {key}. You can configure matchmaking custom data at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1480 | /// - \b 12072: Unknown pool: {pool_key}. You can configure matchmaking pools at https://dashboard.oculus.com/application/<app_id>/matchmaking |
| 1481 | /// |
| 1482 | public static Request<Models.MatchmakingEnqueueResult> Enqueue2(string pool, MatchmakingOptions matchmakingOptions = null) |
| 1483 | { |
| 1484 | if (Core.IsInitialized()) |
| 1485 | { |
| 1486 | return new Request<Models.MatchmakingEnqueueResult>(CAPI.ovr_Matchmaking_Enqueue2(pool, (IntPtr)matchmakingOptions)); |
| 1487 | } |
| 1488 | |
| 1489 | return null; |
| 1490 | } |
| 1491 | |
| 1492 | /// DEPRECATED. Please use Matchmaking.EnqueueRoom2() instead. |
| 1493 | /// \param roomID Returned either from MessageType.Notification_Matchmaking_MatchFound or from Matchmaking.CreateRoom(). |
| 1494 | /// \param customQueryData Optional. See the "Custom criteria" section above. |
| 1495 | /// |
| 1496 | /// <b>Error codes</b> |
| 1497 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is currently in another room (perhaps on another device), and thus is no longer in this room. Users can only be in one room at a time. If they are active on two different devices at once, there will be undefined behavior. |
| 1498 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not in the room (or any room). Perhaps they already left, or they stopped heartbeating. If this is a test environment, make sure you are not using the deprecated initialization methods ovr_PlatformInitializeStandaloneAccessToken (C++)/StandalonePlatform.Initialize(accessToken) (C#). |
| 1499 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not the owner of the room. |
| 1500 | /// - \b 100: Invalid room_id: {room_id}. Either the ID is not a valid room or the user does not have permission to see or act on the room. |
| 1501 | /// - \b 12051: Pool '{pool_key}' is configured for Quickmatch mode. In Quickmatch mode, rooms are created on users' behalf when a match is found. Specify Advanced Quickmatch or Browse mode to use this feature. |
| 1502 | /// |
| 1503 | public static Request<Models.MatchmakingEnqueueResult> EnqueueRoom(UInt64 roomID, CustomQuery customQueryData = null) |
| 1504 | { |
| 1505 | if (Core.IsInitialized()) |
| 1506 | { |
| 1507 | return new Request<Models.MatchmakingEnqueueResult>(CAPI.ovr_Matchmaking_EnqueueRoom(roomID, customQueryData != null ? customQueryData.ToUnmanaged() : IntPtr.Zero)); |
| 1508 | } |
| 1509 | |
| 1510 | return null; |
| 1511 | } |
| 1512 | |
| 1513 | /// Modes: BROWSE (for Rooms only), ROOM |
| 1514 | /// |
| 1515 | /// See the overview documentation above. Enqueue yourself to await an |
| 1516 | /// available matchmaking room. MessageType.Notification_Matchmaking_MatchFound |
| 1517 | /// gets enqueued when a match is found. |
| 1518 | /// |
| 1519 | /// The response contains useful information to display to the user to set |
| 1520 | /// expectations for how long it will take to get a match. |
| 1521 | /// |
| 1522 | /// If the user stops waiting, call Matchmaking.Cancel(). |
| 1523 | /// \param roomID Returned either from MessageType.Notification_Matchmaking_MatchFound or from Matchmaking.CreateRoom(). |
| 1524 | /// \param matchmakingOptions Additional matchmaking configuration for this request. Optional. |
| 1525 | /// |
| 1526 | /// <b>Error codes</b> |
| 1527 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is currently in another room (perhaps on another device), and thus is no longer in this room. Users can only be in one room at a time. If they are active on two different devices at once, there will be undefined behavior. |
| 1528 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not in the room (or any room). Perhaps they already left, or they stopped heartbeating. If this is a test environment, make sure you are not using the deprecated initialization methods ovr_PlatformInitializeStandaloneAccessToken (C++)/StandalonePlatform.Initialize(accessToken) (C#). |
| 1529 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not the owner of the room. |
| 1530 | /// - \b 100: Invalid room_id: {room_id}. Either the ID is not a valid room or the user does not have permission to see or act on the room. |
| 1531 | /// - \b 12051: Pool '{pool_key}' is configured for Quickmatch mode. In Quickmatch mode, rooms are created on users' behalf when a match is found. Specify Advanced Quickmatch or Browse mode to use this feature. |
| 1532 | /// |
| 1533 | public static Request<Models.MatchmakingEnqueueResult> EnqueueRoom2(UInt64 roomID, MatchmakingOptions matchmakingOptions = null) |
| 1534 | { |
| 1535 | if (Core.IsInitialized()) |
| 1536 | { |
| 1537 | return new Request<Models.MatchmakingEnqueueResult>(CAPI.ovr_Matchmaking_EnqueueRoom2(roomID, (IntPtr)matchmakingOptions)); |
| 1538 | } |
| 1539 | |
| 1540 | return null; |
| 1541 | } |
| 1542 | |
| 1543 | /// Modes: QUICKMATCH, BROWSE |
| 1544 | /// |
| 1545 | /// Used to debug the state of the current matchmaking pool queue. This is not |
| 1546 | /// intended to be used in production. |
| 1547 | /// |
| 1548 | public static Request<Models.MatchmakingAdminSnapshot> GetAdminSnapshot() |
| 1549 | { |
| 1550 | if (Core.IsInitialized()) |
| 1551 | { |
| 1552 | return new Request<Models.MatchmakingAdminSnapshot>(CAPI.ovr_Matchmaking_GetAdminSnapshot()); |
| 1553 | } |
| 1554 | |
| 1555 | return null; |
| 1556 | } |
| 1557 | |
| 1558 | /// DEPRECATED. Use ovr_Room_Join2. |
| 1559 | /// \param roomID ID of a room previously returned from MessageType.Notification_Matchmaking_MatchFound or Matchmaking.Browse(). |
| 1560 | /// \param subscribeToUpdates If true, sends a message with type MessageType.Notification_Room_RoomUpdate when room data changes, such as when users join or leave. |
| 1561 | /// |
| 1562 | public static Request<Models.Room> JoinRoom(UInt64 roomID, bool subscribeToUpdates = false) |
| 1563 | { |
| 1564 | if (Core.IsInitialized()) |
| 1565 | { |
| 1566 | return new Request<Models.Room>(CAPI.ovr_Matchmaking_JoinRoom(roomID, subscribeToUpdates)); |
| 1567 | } |
| 1568 | |
| 1569 | return null; |
| 1570 | } |
| 1571 | |
| 1572 | /// Modes: QUICKMATCH, BROWSE (+ Skill Pool) |
| 1573 | /// |
| 1574 | /// For pools with skill-based matching. See overview documentation above. |
| 1575 | /// |
| 1576 | /// Call after calling Rooms.Join2() when the players are present to begin a |
| 1577 | /// rated match for which you plan to report the results (using |
| 1578 | /// Matchmaking.ReportResultInsecure()). |
| 1579 | /// |
| 1580 | /// <b>Error codes</b> |
| 1581 | /// - \b 100: There is no active match associated with the room {room_id}. |
| 1582 | /// - \b 100: You can only start matches, report matches, and track skill ratings in matchmaking rooms. {room_id} is a room, but it is not a matchmaking room. |
| 1583 | /// |
| 1584 | public static Request StartMatch(UInt64 roomID) |
| 1585 | { |
| 1586 | if (Core.IsInitialized()) |
| 1587 | { |
| 1588 | return new Request(CAPI.ovr_Matchmaking_StartMatch(roomID)); |
| 1589 | } |
| 1590 | |
| 1591 | return null; |
| 1592 | } |
| 1593 | |
| 1594 | /// Indicates that a match has been found, for example after calling |
| 1595 | /// Matchmaking.Enqueue(). Use Message.GetRoom() to extract the matchmaking |
| 1596 | /// room. |
| 1597 | /// |
| 1598 | public static void SetMatchFoundNotificationCallback(Message<Models.Room>.Callback callback) |
| 1599 | { |
| 1600 | Callback.SetNotificationCallback( |
| 1601 | Message.MessageType.Notification_Matchmaking_MatchFound, |
| 1602 | callback |
| 1603 | ); |
| 1604 | } |
| 1605 | |
| 1606 | } |
| 1607 | |
| 1608 | public static partial class Media |
| 1609 | { |
| 1610 | /// Launch the Share to Facebook modal via a deeplink to Home on Gear VR, |
| 1611 | /// allowing users to share local media files to Facebook. Accepts a |
| 1612 | /// postTextSuggestion string for the default text of the Facebook post. |
| 1613 | /// Requires a filePath string as the path to the image to be shared to |
| 1614 | /// Facebook. This image should be located in your app's internal storage |
| 1615 | /// directory. Requires a contentType indicating the type of media to be shared |
| 1616 | /// (only 'photo' is currently supported.) |
| 1617 | /// \param postTextSuggestion this text will prepopulate the facebook status text-input box within the share modal |
| 1618 | /// \param filePath path to the file to be shared to facebook |
| 1619 | /// \param contentType content type of the media to be shared |
| 1620 | /// |
| 1621 | public static Request<Models.ShareMediaResult> ShareToFacebook(string postTextSuggestion, string filePath, MediaContentType contentType) |
| 1622 | { |
| 1623 | if (Core.IsInitialized()) |
| 1624 | { |
| 1625 | return new Request<Models.ShareMediaResult>(CAPI.ovr_Media_ShareToFacebook(postTextSuggestion, filePath, contentType)); |
| 1626 | } |
| 1627 | |
| 1628 | return null; |
| 1629 | } |
| 1630 | |
| 1631 | } |
| 1632 | |
| 1633 | public static partial class Net |
| 1634 | { |
| 1635 | /// Indicates that a connection has been established or there's been an error. |
| 1636 | /// Use NetworkingPeer.GetState() to get the result; as above, |
| 1637 | /// NetworkingPeer.GetID() returns the ID of the peer this message is for. |
| 1638 | /// |
| 1639 | public static void SetConnectionStateChangedCallback(Message<Models.NetworkingPeer>.Callback callback) |
| 1640 | { |
| 1641 | Callback.SetNotificationCallback( |
| 1642 | Message.MessageType.Notification_Networking_ConnectionStateChange, |
| 1643 | callback |
| 1644 | ); |
| 1645 | } |
| 1646 | |
| 1647 | /// Indicates that another user is attempting to establish a P2P connection |
| 1648 | /// with us. Use NetworkingPeer.GetID() to extract the ID of the peer. |
| 1649 | /// |
| 1650 | public static void SetPeerConnectRequestCallback(Message<Models.NetworkingPeer>.Callback callback) |
| 1651 | { |
| 1652 | Callback.SetNotificationCallback( |
| 1653 | Message.MessageType.Notification_Networking_PeerConnectRequest, |
| 1654 | callback |
| 1655 | ); |
| 1656 | } |
| 1657 | |
| 1658 | /// Generated in response to Net.Ping(). Either contains ping time in |
| 1659 | /// microseconds or indicates that there was a timeout. |
| 1660 | /// |
| 1661 | public static void SetPingResultNotificationCallback(Message<Models.PingResult>.Callback callback) |
| 1662 | { |
| 1663 | Callback.SetNotificationCallback( |
| 1664 | Message.MessageType.Notification_Networking_PingResult, |
| 1665 | callback |
| 1666 | ); |
| 1667 | } |
| 1668 | |
| 1669 | } |
| 1670 | |
| 1671 | public static partial class Notifications |
| 1672 | { |
| 1673 | /// Retrieve a list of all pending room invites for your application (for |
| 1674 | /// example, notifications that may have been sent before the user launched |
| 1675 | /// your game). You can also get push notifications with |
| 1676 | /// MessageType.Notification_Room_InviteReceived. |
| 1677 | /// |
| 1678 | public static Request<Models.RoomInviteNotificationList> GetRoomInviteNotifications() |
| 1679 | { |
| 1680 | if (Core.IsInitialized()) |
| 1681 | { |
| 1682 | return new Request<Models.RoomInviteNotificationList>(CAPI.ovr_Notification_GetRoomInvites()); |
| 1683 | } |
| 1684 | |
| 1685 | return null; |
| 1686 | } |
| 1687 | |
| 1688 | /// Mark a notification as read. This causes it to disappear from the Universal |
| 1689 | /// Menu, the Oculus App, Oculus Home, and in-app retrieval. |
| 1690 | /// |
| 1691 | public static Request MarkAsRead(UInt64 notificationID) |
| 1692 | { |
| 1693 | if (Core.IsInitialized()) |
| 1694 | { |
| 1695 | return new Request(CAPI.ovr_Notification_MarkAsRead(notificationID)); |
| 1696 | } |
| 1697 | |
| 1698 | return null; |
| 1699 | } |
| 1700 | |
| 1701 | } |
| 1702 | |
| 1703 | public static partial class Parties |
| 1704 | { |
| 1705 | /// Load the party the current user is in. |
| 1706 | /// |
| 1707 | public static Request<Models.Party> GetCurrent() |
| 1708 | { |
| 1709 | if (Core.IsInitialized()) |
| 1710 | { |
| 1711 | return new Request<Models.Party>(CAPI.ovr_Party_GetCurrent()); |
| 1712 | } |
| 1713 | |
| 1714 | return null; |
| 1715 | } |
| 1716 | |
| 1717 | /// Indicates that party has been updated |
| 1718 | /// |
| 1719 | public static void SetPartyUpdateNotificationCallback(Message<Models.PartyUpdateNotification>.Callback callback) |
| 1720 | { |
| 1721 | Callback.SetNotificationCallback( |
| 1722 | Message.MessageType.Notification_Party_PartyUpdate, |
| 1723 | callback |
| 1724 | ); |
| 1725 | } |
| 1726 | |
| 1727 | } |
| 1728 | |
| 1729 | public static partial class RichPresence |
| 1730 | { |
| 1731 | /// Clear rich presence for running app |
| 1732 | /// |
| 1733 | public static Request Clear() |
| 1734 | { |
| 1735 | if (Core.IsInitialized()) |
| 1736 | { |
| 1737 | return new Request(CAPI.ovr_RichPresence_Clear()); |
| 1738 | } |
| 1739 | |
| 1740 | return null; |
| 1741 | } |
| 1742 | |
| 1743 | /// Set rich presence for running app |
| 1744 | /// |
| 1745 | public static Request Set(RichPresenceOptions richPresenceOptions) |
| 1746 | { |
| 1747 | if (Core.IsInitialized()) |
| 1748 | { |
| 1749 | return new Request(CAPI.ovr_RichPresence_Set((IntPtr)richPresenceOptions)); |
| 1750 | } |
| 1751 | |
| 1752 | return null; |
| 1753 | } |
| 1754 | |
| 1755 | } |
| 1756 | |
| 1757 | public static partial class Rooms |
| 1758 | { |
| 1759 | /// DEPRECATED. Use CreateAndJoinPrivate2. |
| 1760 | /// \param joinPolicy Specifies who can join the room without an invite. |
| 1761 | /// \param maxUsers The maximum number of users allowed in the room, including the creator. |
| 1762 | /// \param subscribeToUpdates If true, sends a message with type MessageType.Notification_Room_RoomUpdate when room data changes, such as when users join or leave. |
| 1763 | /// |
| 1764 | public static Request<Models.Room> CreateAndJoinPrivate(RoomJoinPolicy joinPolicy, uint maxUsers, bool subscribeToUpdates = false) |
| 1765 | { |
| 1766 | if (Core.IsInitialized()) |
| 1767 | { |
| 1768 | return new Request<Models.Room>(CAPI.ovr_Room_CreateAndJoinPrivate(joinPolicy, maxUsers, subscribeToUpdates)); |
| 1769 | } |
| 1770 | |
| 1771 | return null; |
| 1772 | } |
| 1773 | |
| 1774 | /// Creates a new private (client controlled) room and adds the caller to it. |
| 1775 | /// This type of room is good for matches where the user wants to play with |
| 1776 | /// friends, as they're primarially discoverable by examining which rooms your |
| 1777 | /// friends are in. |
| 1778 | /// \param joinPolicy Specifies who can join the room without an invite. |
| 1779 | /// \param maxUsers The maximum number of users allowed in the room, including the creator. |
| 1780 | /// \param roomOptions Additional room configuration for this request. Optional. |
| 1781 | /// |
| 1782 | public static Request<Models.Room> CreateAndJoinPrivate2(RoomJoinPolicy joinPolicy, uint maxUsers, RoomOptions roomOptions) |
| 1783 | { |
| 1784 | if (Core.IsInitialized()) |
| 1785 | { |
| 1786 | return new Request<Models.Room>(CAPI.ovr_Room_CreateAndJoinPrivate2(joinPolicy, maxUsers, (IntPtr)roomOptions)); |
| 1787 | } |
| 1788 | |
| 1789 | return null; |
| 1790 | } |
| 1791 | |
| 1792 | /// Allows arbitrary rooms for the application to be loaded. |
| 1793 | /// \param roomID The room to load. |
| 1794 | /// |
| 1795 | public static Request<Models.Room> Get(UInt64 roomID) |
| 1796 | { |
| 1797 | if (Core.IsInitialized()) |
| 1798 | { |
| 1799 | return new Request<Models.Room>(CAPI.ovr_Room_Get(roomID)); |
| 1800 | } |
| 1801 | |
| 1802 | return null; |
| 1803 | } |
| 1804 | |
| 1805 | /// Easy loading of the room you're currently in. If you don't want live |
| 1806 | /// updates on your current room (by using subscribeToUpdates), you can use |
| 1807 | /// this to refresh the data. |
| 1808 | /// |
| 1809 | public static Request<Models.Room> GetCurrent() |
| 1810 | { |
| 1811 | if (Core.IsInitialized()) |
| 1812 | { |
| 1813 | return new Request<Models.Room>(CAPI.ovr_Room_GetCurrent()); |
| 1814 | } |
| 1815 | |
| 1816 | return null; |
| 1817 | } |
| 1818 | |
| 1819 | /// Allows the current room for a given user to be loaded. Remember that the |
| 1820 | /// user's privacy settings may not allow their room to be loaded. Because of |
| 1821 | /// this, it's often possible to load the users in a room, but not to take |
| 1822 | /// those users and load their room. |
| 1823 | /// \param userID ID of the user for which to load the room. |
| 1824 | /// |
| 1825 | public static Request<Models.Room> GetCurrentForUser(UInt64 userID) |
| 1826 | { |
| 1827 | if (Core.IsInitialized()) |
| 1828 | { |
| 1829 | return new Request<Models.Room>(CAPI.ovr_Room_GetCurrentForUser(userID)); |
| 1830 | } |
| 1831 | |
| 1832 | return null; |
| 1833 | } |
| 1834 | |
| 1835 | /// DEPRECATED. Use GetInvitableUsers2. |
| 1836 | /// |
| 1837 | public static Request<Models.UserList> GetInvitableUsers() |
| 1838 | { |
| 1839 | if (Core.IsInitialized()) |
| 1840 | { |
| 1841 | return new Request<Models.UserList>(CAPI.ovr_Room_GetInvitableUsers()); |
| 1842 | } |
| 1843 | |
| 1844 | return null; |
| 1845 | } |
| 1846 | |
| 1847 | /// Loads a list of users you can invite to a room. These are pulled from your |
| 1848 | /// friends list and recently met lists and filtered for relevance and |
| 1849 | /// interest. If the room cannot be joined, this list will be empty. By |
| 1850 | /// default, the invitable users returned will be for the user's current room. |
| 1851 | /// |
| 1852 | /// If your application grouping was created after September 9 2017, recently |
| 1853 | /// met users will be included by default. If your application grouping was |
| 1854 | /// created before then, you can go to edit the setting in the "Rooms and |
| 1855 | /// Matchmaking" section of Platform Services at dashboard.oculus.com |
| 1856 | /// |
| 1857 | /// Customization can be done via RoomOptions. Create this object with |
| 1858 | /// RoomOptions(). The params that could be used are: |
| 1859 | /// |
| 1860 | /// 1. RoomOptions.SetRoomId()- will return the invitable users for this room |
| 1861 | /// (instead of the current room). |
| 1862 | /// |
| 1863 | /// 2. RoomOptions.SetOrdering() - returns the list of users in the provided |
| 1864 | /// ordering (see UserOrdering enum). |
| 1865 | /// |
| 1866 | /// 3. RoomOptions.SetRecentlyMetTimeWindow() - how long long ago should we |
| 1867 | /// include users you've recently met in the results? |
| 1868 | /// |
| 1869 | /// 4. RoomOptions.SetMaxUserResults() - we will limit the number of results |
| 1870 | /// returned. By default, the number is unlimited, but the server may choose to |
| 1871 | /// limit results for performance reasons. |
| 1872 | /// |
| 1873 | /// 5. RoomOptions.SetExcludeRecentlyMet() - Don't include users recently in |
| 1874 | /// rooms with this user in the result. Also, see the above comment. |
| 1875 | /// |
| 1876 | /// Example custom C++ usage: |
| 1877 | /// |
| 1878 | /// auto roomOptions = ovr_RoomOptions_Create(); |
| 1879 | /// ovr_RoomOptions_SetOrdering(roomOptions, ovrUserOrdering_PresenceAlphabetical); |
| 1880 | /// ovr_RoomOptions_SetRoomId(roomOptions, roomID); |
| 1881 | /// ovr_Room_GetInvitableUsers2(roomOptions); |
| 1882 | /// ovr_RoomOptions_Destroy(roomOptions); |
| 1883 | /// \param roomOptions Additional configuration for this request. Optional. |
| 1884 | /// |
| 1885 | public static Request<Models.UserList> GetInvitableUsers2(RoomOptions roomOptions = null) |
| 1886 | { |
| 1887 | if (Core.IsInitialized()) |
| 1888 | { |
| 1889 | return new Request<Models.UserList>(CAPI.ovr_Room_GetInvitableUsers2((IntPtr)roomOptions)); |
| 1890 | } |
| 1891 | |
| 1892 | return null; |
| 1893 | } |
| 1894 | |
| 1895 | /// Fetches the list of moderated rooms created for the application. |
| 1896 | /// |
| 1897 | public static Request<Models.RoomList> GetModeratedRooms() |
| 1898 | { |
| 1899 | if (Core.IsInitialized()) |
| 1900 | { |
| 1901 | return new Request<Models.RoomList>(CAPI.ovr_Room_GetModeratedRooms()); |
| 1902 | } |
| 1903 | |
| 1904 | return null; |
| 1905 | } |
| 1906 | |
| 1907 | /// Invites a user to the specified room. They will receive a notification via |
| 1908 | /// MessageType.Notification_Room_InviteReceived if they are in your game, |
| 1909 | /// and/or they can poll for room invites using |
| 1910 | /// Notifications.GetRoomInviteNotifications(). |
| 1911 | /// \param roomID The ID of your current room. |
| 1912 | /// \param inviteToken A user's invite token, returned by Rooms.GetInvitableUsers(). |
| 1913 | /// |
| 1914 | /// <b>Error codes</b> |
| 1915 | /// - \b 100: The invite token has expired, the user will need to be reinvited to the room. |
| 1916 | /// - \b 100: The target user cannot join you in your current experience |
| 1917 | /// - \b 100: You cannot send an invite to a room you are not in |
| 1918 | /// |
| 1919 | public static Request<Models.Room> InviteUser(UInt64 roomID, string inviteToken) |
| 1920 | { |
| 1921 | if (Core.IsInitialized()) |
| 1922 | { |
| 1923 | return new Request<Models.Room>(CAPI.ovr_Room_InviteUser(roomID, inviteToken)); |
| 1924 | } |
| 1925 | |
| 1926 | return null; |
| 1927 | } |
| 1928 | |
| 1929 | /// Joins the target room (leaving the one you're currently in). |
| 1930 | /// \param roomID The room to join. |
| 1931 | /// \param subscribeToUpdates If true, sends a message with type MessageType.Notification_Room_RoomUpdate when room data changes, such as when users join or leave. |
| 1932 | /// |
| 1933 | /// <b>Error codes</b> |
| 1934 | /// - \b 10: The room you're attempting to join is currently locked. Please try again later. |
| 1935 | /// - \b 10: You don't have permission to enter this room. You may need to be invited first. |
| 1936 | /// - \b 100: Invalid room_id: {room_id}. Either the ID is not a valid room or the user does not have permission to see or act on the room. |
| 1937 | /// - \b 100: The room you're attempting to join is full. Please try again later. |
| 1938 | /// - \b 100: This game isn't available. If it already started or was canceled, you can host a new game at any point. |
| 1939 | /// |
| 1940 | public static Request<Models.Room> Join(UInt64 roomID, bool subscribeToUpdates = false) |
| 1941 | { |
| 1942 | if (Core.IsInitialized()) |
| 1943 | { |
| 1944 | return new Request<Models.Room>(CAPI.ovr_Room_Join(roomID, subscribeToUpdates)); |
| 1945 | } |
| 1946 | |
| 1947 | return null; |
| 1948 | } |
| 1949 | |
| 1950 | /// Joins the target room (leaving the one you're currently in). |
| 1951 | /// \param roomID The room to join. |
| 1952 | /// \param roomOptions Additional room configuration for this request. Optional. |
| 1953 | /// |
| 1954 | /// <b>Error codes</b> |
| 1955 | /// - \b 10: The room you're attempting to join is currently locked. Please try again later. |
| 1956 | /// - \b 10: You don't have permission to enter this room. You may need to be invited first. |
| 1957 | /// - \b 100: Invalid room_id: {room_id}. Either the ID is not a valid room or the user does not have permission to see or act on the room. |
| 1958 | /// - \b 100: The room you're attempting to join is full. Please try again later. |
| 1959 | /// - \b 100: This game isn't available. If it already started or was canceled, you can host a new game at any point. |
| 1960 | /// |
| 1961 | public static Request<Models.Room> Join2(UInt64 roomID, RoomOptions roomOptions) |
| 1962 | { |
| 1963 | if (Core.IsInitialized()) |
| 1964 | { |
| 1965 | return new Request<Models.Room>(CAPI.ovr_Room_Join2(roomID, (IntPtr)roomOptions)); |
| 1966 | } |
| 1967 | |
| 1968 | return null; |
| 1969 | } |
| 1970 | |
| 1971 | /// Allows the room owner to kick a user out of the current room. |
| 1972 | /// \param roomID The room that you currently own (check Room.GetOwner()). |
| 1973 | /// \param userID The user to be kicked (cannot be yourself). |
| 1974 | /// \param kickDurationSeconds Length of the ban, in seconds. |
| 1975 | /// |
| 1976 | /// <b>Error codes</b> |
| 1977 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not in the room (or any room). Perhaps they already left, or they stopped heartbeating. If this is a test environment, make sure you are not using the deprecated initialization methods ovr_PlatformInitializeStandaloneAccessToken (C++)/StandalonePlatform.Initialize(accessToken) (C#). |
| 1978 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not the owner of the room. |
| 1979 | /// - \b 100: You cannot remove yourself from room {room_id} |
| 1980 | /// |
| 1981 | public static Request<Models.Room> KickUser(UInt64 roomID, UInt64 userID, int kickDurationSeconds) |
| 1982 | { |
| 1983 | if (Core.IsInitialized()) |
| 1984 | { |
| 1985 | return new Request<Models.Room>(CAPI.ovr_Room_KickUser(roomID, userID, kickDurationSeconds)); |
| 1986 | } |
| 1987 | |
| 1988 | return null; |
| 1989 | } |
| 1990 | |
| 1991 | /// Launch the invitable user flow to invite to the logged in user's current |
| 1992 | /// room. This is intended to be a nice shortcut for developers not wanting to |
| 1993 | /// build out their own Invite UI although it has the same rules as if you |
| 1994 | /// build it yourself. |
| 1995 | /// |
| 1996 | public static Request LaunchInvitableUserFlow(UInt64 roomID) |
| 1997 | { |
| 1998 | if (Core.IsInitialized()) |
| 1999 | { |
| 2000 | return new Request(CAPI.ovr_Room_LaunchInvitableUserFlow(roomID)); |
| 2001 | } |
| 2002 | |
| 2003 | return null; |
| 2004 | } |
| 2005 | |
| 2006 | /// Removes you from your current room. Returns the solo room you are now in if |
| 2007 | /// it succeeds |
| 2008 | /// \param roomID The room you're currently in. |
| 2009 | /// |
| 2010 | public static Request<Models.Room> Leave(UInt64 roomID) |
| 2011 | { |
| 2012 | if (Core.IsInitialized()) |
| 2013 | { |
| 2014 | return new Request<Models.Room>(CAPI.ovr_Room_Leave(roomID)); |
| 2015 | } |
| 2016 | |
| 2017 | return null; |
| 2018 | } |
| 2019 | |
| 2020 | /// Allows the room owner to set the description of their room. |
| 2021 | /// \param roomID The room that you currently own (check Room.GetOwner()). |
| 2022 | /// \param description The new name of the room. |
| 2023 | /// |
| 2024 | /// <b>Error codes</b> |
| 2025 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is currently in another room (perhaps on another device), and thus is no longer in this room. Users can only be in one room at a time. If they are active on two different devices at once, there will be undefined behavior. |
| 2026 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not in the room (or any room). Perhaps they already left, or they stopped heartbeating. If this is a test environment, make sure you are not using the deprecated initialization methods ovr_PlatformInitializeStandaloneAccessToken (C++)/StandalonePlatform.Initialize(accessToken) (C#). |
| 2027 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not the owner of the room. |
| 2028 | /// |
| 2029 | public static Request<Models.Room> SetDescription(UInt64 roomID, string description) |
| 2030 | { |
| 2031 | if (Core.IsInitialized()) |
| 2032 | { |
| 2033 | return new Request<Models.Room>(CAPI.ovr_Room_SetDescription(roomID, description)); |
| 2034 | } |
| 2035 | |
| 2036 | return null; |
| 2037 | } |
| 2038 | |
| 2039 | /// Disallow new members from being able to join the room. This will prevent |
| 2040 | /// joins from Rooms.Join(), invites, 'Join From Home', etc. Users that are in |
| 2041 | /// the room at the time of lockdown WILL be able to rejoin. |
| 2042 | /// \param roomID The room whose membership you want to lock or unlock. |
| 2043 | /// \param membershipLockStatus The new LockStatus for the room |
| 2044 | /// |
| 2045 | /// <b>Error codes</b> |
| 2046 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is currently in another room (perhaps on another device), and thus is no longer in this room. Users can only be in one room at a time. If they are active on two different devices at once, there will be undefined behavior. |
| 2047 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not in the room (or any room). Perhaps they already left, or they stopped heartbeating. If this is a test environment, make sure you are not using the deprecated initialization methods ovr_PlatformInitializeStandaloneAccessToken (C++)/StandalonePlatform.Initialize(accessToken) (C#). |
| 2048 | /// - \b 10: Room {room_id}: The user does not have permission to {cannot_action} because the user is not the owner of the room. |
| 2049 | /// |
| 2050 | public static Request<Models.Room> UpdateMembershipLockStatus(UInt64 roomID, RoomMembershipLockStatus membershipLockStatus) |
| 2051 | { |
| 2052 | if (Core.IsInitialized()) |
| 2053 | { |
| 2054 | return new Request<Models.Room>(CAPI.ovr_Room_UpdateMembershipLockStatus(roomID, membershipLockStatus)); |
| 2055 | } |
| 2056 | |
| 2057 | return null; |
| 2058 | } |
| 2059 | |
| 2060 | /// Allows the room owner to transfer ownership to someone else. |
| 2061 | /// \param roomID The room that the user owns (check Room.GetOwner()). |
| 2062 | /// \param userID The new user to make an owner; the user must be in the room. |
| 2063 | /// |
| 2064 | public static Request UpdateOwner(UInt64 roomID, UInt64 userID) |
| 2065 | { |
| 2066 | if (Core.IsInitialized()) |
| 2067 | { |
| 2068 | return new Request(CAPI.ovr_Room_UpdateOwner(roomID, userID)); |
| 2069 | } |
| 2070 | |
| 2071 | return null; |
| 2072 | } |
| 2073 | |
| 2074 | /// Sets the join policy of the user's private room. |
| 2075 | /// \param roomID The room ID that the user owns (check Room.GetOwner()). |
| 2076 | /// \param newJoinPolicy The new join policy for the room. |
| 2077 | /// |
| 2078 | public static Request<Models.Room> UpdatePrivateRoomJoinPolicy(UInt64 roomID, RoomJoinPolicy newJoinPolicy) |
| 2079 | { |
| 2080 | if (Core.IsInitialized()) |
| 2081 | { |
| 2082 | return new Request<Models.Room>(CAPI.ovr_Room_UpdatePrivateRoomJoinPolicy(roomID, newJoinPolicy)); |
| 2083 | } |
| 2084 | |
| 2085 | return null; |
| 2086 | } |
| 2087 | |
| 2088 | /// Indicates that the user has accepted an invitation, for example in Oculus |
| 2089 | /// Home. Use Message.GetString() to extract the ID of the room that the user |
| 2090 | /// has been inivted to as a string. Then call ovrID_FromString() to parse it |
| 2091 | /// into an ovrID. |
| 2092 | /// |
| 2093 | /// Note that you must call Rooms.Join() if you want to actually join the room. |
| 2094 | /// |
| 2095 | public static void SetRoomInviteAcceptedNotificationCallback(Message<string>.Callback callback) |
| 2096 | { |
| 2097 | Callback.SetNotificationCallback( |
| 2098 | Message.MessageType.Notification_Room_InviteAccepted, |
| 2099 | callback |
| 2100 | ); |
| 2101 | } |
| 2102 | |
| 2103 | /// Handle this to notify the user when they've received an invitation to join |
| 2104 | /// a room in your game. You can use this in lieu of, or in addition to, |
| 2105 | /// polling for room invitations via |
| 2106 | /// Notifications.GetRoomInviteNotifications(). |
| 2107 | /// |
| 2108 | public static void SetRoomInviteReceivedNotificationCallback(Message<Models.RoomInviteNotification>.Callback callback) |
| 2109 | { |
| 2110 | Callback.SetNotificationCallback( |
| 2111 | Message.MessageType.Notification_Room_InviteReceived, |
| 2112 | callback |
| 2113 | ); |
| 2114 | } |
| 2115 | |
| 2116 | /// Indicates that the current room has been updated. Use Message.GetRoom() to |
| 2117 | /// extract the updated room. |
| 2118 | /// |
| 2119 | public static void SetUpdateNotificationCallback(Message<Models.Room>.Callback callback) |
| 2120 | { |
| 2121 | Callback.SetNotificationCallback( |
| 2122 | Message.MessageType.Notification_Room_RoomUpdate, |
| 2123 | callback |
| 2124 | ); |
| 2125 | } |
| 2126 | |
| 2127 | } |
| 2128 | |
| 2129 | public static partial class Users |
| 2130 | { |
| 2131 | /// Retrieve the user with the given ID. This might fail if the ID is invalid |
| 2132 | /// or the user is blocked. |
| 2133 | /// |
| 2134 | /// NOTE: Users will have a unique ID per application. |
| 2135 | /// \param userID User ID retrieved with this application. |
| 2136 | /// |
| 2137 | public static Request<Models.User> Get(UInt64 userID) |
| 2138 | { |
| 2139 | if (Core.IsInitialized()) |
| 2140 | { |
| 2141 | return new Request<Models.User>(CAPI.ovr_User_Get(userID)); |
| 2142 | } |
| 2143 | |
| 2144 | return null; |
| 2145 | } |
| 2146 | |
| 2147 | /// Return an access token for this user, suitable for making REST calls |
| 2148 | /// against graph.oculus.com. |
| 2149 | /// |
| 2150 | public static Request<string> GetAccessToken() |
| 2151 | { |
| 2152 | if (Core.IsInitialized()) |
| 2153 | { |
| 2154 | return new Request<string>(CAPI.ovr_User_GetAccessToken()); |
| 2155 | } |
| 2156 | |
| 2157 | return null; |
| 2158 | } |
| 2159 | |
| 2160 | /// Retrieve the currently signed in user. This call is available offline. |
| 2161 | /// |
| 2162 | /// NOTE: This will not return the user's presence as it should always be |
| 2163 | /// 'online' in your application. |
| 2164 | /// |
| 2165 | /// NOTE: Users will have a unique ID per application. |
| 2166 | /// |
| 2167 | public static Request<Models.User> GetLoggedInUser() |
| 2168 | { |
| 2169 | if (Core.IsInitialized()) |
| 2170 | { |
| 2171 | return new Request<Models.User>(CAPI.ovr_User_GetLoggedInUser()); |
| 2172 | } |
| 2173 | |
| 2174 | return null; |
| 2175 | } |
| 2176 | |
| 2177 | /// Retrieve a list of the logged in user's friends. |
| 2178 | /// |
| 2179 | public static Request<Models.UserList> GetLoggedInUserFriends() |
| 2180 | { |
| 2181 | if (Core.IsInitialized()) |
| 2182 | { |
| 2183 | return new Request<Models.UserList>(CAPI.ovr_User_GetLoggedInUserFriends()); |
| 2184 | } |
| 2185 | |
| 2186 | return null; |
| 2187 | } |
| 2188 | |
| 2189 | /// Retrieve a list of the logged in user's friends and any rooms they might be |
| 2190 | /// in. |
| 2191 | /// |
| 2192 | public static Request<Models.UserAndRoomList> GetLoggedInUserFriendsAndRooms() |
| 2193 | { |
| 2194 | if (Core.IsInitialized()) |
| 2195 | { |
| 2196 | return new Request<Models.UserAndRoomList>(CAPI.ovr_User_GetLoggedInUserFriendsAndRooms()); |
| 2197 | } |
| 2198 | |
| 2199 | return null; |
| 2200 | } |
| 2201 | |
| 2202 | /// Returns a list of users that the logged in user was in a room with |
| 2203 | /// recently, sorted by relevance, along with any rooms they might be in. All |
| 2204 | /// you need to do to use this method is to use our Rooms API, and we will |
| 2205 | /// track the number of times users are together, their most recent encounter, |
| 2206 | /// and the amount of time they spend together. |
| 2207 | /// |
| 2208 | /// Customization can be done via UserOptions. Create this object with |
| 2209 | /// UserOptions(). The params that could be used are: |
| 2210 | /// |
| 2211 | /// 1. UserOptions.SetTimeWindow() - how recently should the users have played? |
| 2212 | /// The default is TimeWindow.ThirtyDays. |
| 2213 | /// |
| 2214 | /// 2. UserOptions.SetMaxUsers() - we will limit the number of results |
| 2215 | /// returned. By default, the number is unlimited, but the server may choose to |
| 2216 | /// limit results for performance reasons. |
| 2217 | /// \param userOptions Additional configuration for this request. Optional. |
| 2218 | /// |
| 2219 | public static Request<Models.UserAndRoomList> GetLoggedInUserRecentlyMetUsersAndRooms(UserOptions userOptions = null) |
| 2220 | { |
| 2221 | if (Core.IsInitialized()) |
| 2222 | { |
| 2223 | return new Request<Models.UserAndRoomList>(CAPI.ovr_User_GetLoggedInUserRecentlyMetUsersAndRooms((IntPtr)userOptions)); |
| 2224 | } |
| 2225 | |
| 2226 | return null; |
| 2227 | } |
| 2228 | |
| 2229 | /// returns an ovrID which is unique per org. allows different apps within the |
| 2230 | /// same org to identify the user. |
| 2231 | /// \param userID to load the org scoped id of |
| 2232 | /// |
| 2233 | public static Request<Models.OrgScopedID> GetOrgScopedID(UInt64 userID) |
| 2234 | { |
| 2235 | if (Core.IsInitialized()) |
| 2236 | { |
| 2237 | return new Request<Models.OrgScopedID>(CAPI.ovr_User_GetOrgScopedID(userID)); |
| 2238 | } |
| 2239 | |
| 2240 | return null; |
| 2241 | } |
| 2242 | |
| 2243 | /// Returns all accounts belonging to this user. Accounts are the Oculus user |
| 2244 | /// and x-users that are linked to this user. |
| 2245 | /// |
| 2246 | public static Request<Models.SdkAccountList> GetSdkAccounts() |
| 2247 | { |
| 2248 | if (Core.IsInitialized()) |
| 2249 | { |
| 2250 | return new Request<Models.SdkAccountList>(CAPI.ovr_User_GetSdkAccounts()); |
| 2251 | } |
| 2252 | |
| 2253 | return null; |
| 2254 | } |
| 2255 | |
| 2256 | /// Part of the scheme to confirm the identity of a particular user in your |
| 2257 | /// backend. You can pass the result of Users.GetUserProof() and a user ID from |
| 2258 | /// Users.Get() to your your backend. Your server can then use our api to |
| 2259 | /// verify identity. 'https://graph.oculus.com/user_nonce_validate?nonce=USER_P |
| 2260 | /// ROOF&user_id=USER_ID&access_token=ACCESS_TOKEN' |
| 2261 | /// |
| 2262 | /// NOTE: The nonce is only good for one check and then it is invalidated. |
| 2263 | /// |
| 2264 | public static Request<Models.UserProof> GetUserProof() |
| 2265 | { |
| 2266 | if (Core.IsInitialized()) |
| 2267 | { |
| 2268 | return new Request<Models.UserProof>(CAPI.ovr_User_GetUserProof()); |
| 2269 | } |
| 2270 | |
| 2271 | return null; |
| 2272 | } |
| 2273 | |
| 2274 | /// Launch the flow for sending a friend request to a user. |
| 2275 | /// \param userID User ID of user to send a friend request to |
| 2276 | /// |
| 2277 | public static Request<Models.LaunchFriendRequestFlowResult> LaunchFriendRequestFlow(UInt64 userID) |
| 2278 | { |
| 2279 | if (Core.IsInitialized()) |
| 2280 | { |
| 2281 | return new Request<Models.LaunchFriendRequestFlowResult>(CAPI.ovr_User_LaunchFriendRequestFlow(userID)); |
| 2282 | } |
| 2283 | |
| 2284 | return null; |
| 2285 | } |
| 2286 | |
| 2287 | /// Launch the profile of the given user. The profile surfaces information |
| 2288 | /// about the user and supports relevant actions that the viewer may take on |
| 2289 | /// that user, e.g. sending a friend request. |
| 2290 | /// \param userID User ID for profile being viewed |
| 2291 | /// |
| 2292 | public static Request LaunchProfile(UInt64 userID) |
| 2293 | { |
| 2294 | if (Core.IsInitialized()) |
| 2295 | { |
| 2296 | return new Request(CAPI.ovr_User_LaunchProfile(userID)); |
| 2297 | } |
| 2298 | |
| 2299 | return null; |
| 2300 | } |
| 2301 | |
| 2302 | } |
| 2303 | |
| 2304 | public static partial class Voip |
| 2305 | { |
| 2306 | /// Sets whether SystemVoip should be suppressed so that this app's Voip can |
| 2307 | /// use the mic and play incoming Voip audio. |
| 2308 | /// |
| 2309 | public static Request<Models.SystemVoipState> SetSystemVoipSuppressed(bool suppressed) |
| 2310 | { |
| 2311 | if (Core.IsInitialized()) |
| 2312 | { |
| 2313 | return new Request<Models.SystemVoipState>(CAPI.ovr_Voip_SetSystemVoipSuppressed(suppressed)); |
| 2314 | } |
| 2315 | |
| 2316 | return null; |
| 2317 | } |
| 2318 | |
| 2319 | /// Sent when another user is attempting to establish a VoIP connection. Use |
| 2320 | /// Message.GetNetworkingPeer() to extract information about the user, and |
| 2321 | /// Voip.Accept() to accept the connection. |
| 2322 | /// |
| 2323 | public static void SetVoipConnectRequestCallback(Message<Models.NetworkingPeer>.Callback callback) |
| 2324 | { |
| 2325 | Callback.SetNotificationCallback( |
| 2326 | Message.MessageType.Notification_Voip_ConnectRequest, |
| 2327 | callback |
| 2328 | ); |
| 2329 | } |
| 2330 | |
| 2331 | /// Sent to indicate that the state of the VoIP connection changed. Use |
| 2332 | /// Message.GetNetworkingPeer() and NetworkingPeer.GetState() to extract the |
| 2333 | /// current state. |
| 2334 | /// |
| 2335 | public static void SetVoipStateChangeCallback(Message<Models.NetworkingPeer>.Callback callback) |
| 2336 | { |
| 2337 | Callback.SetNotificationCallback( |
| 2338 | Message.MessageType.Notification_Voip_StateChange, |
| 2339 | callback |
| 2340 | ); |
| 2341 | } |
| 2342 | |
| 2343 | /// Sent to indicate that some part of the overall state of SystemVoip has |
| 2344 | /// changed. Use Message.GetSystemVoipState() and the properties of |
| 2345 | /// SystemVoipState to extract the state that triggered the notification. |
| 2346 | /// |
| 2347 | /// Note that the state may have changed further since the notification was |
| 2348 | /// generated, and that you may call the `GetSystemVoip...()` family of |
| 2349 | /// functions at any time to get the current state directly. |
| 2350 | /// |
| 2351 | public static void SetSystemVoipStateNotificationCallback(Message<Models.SystemVoipState>.Callback callback) |
| 2352 | { |
| 2353 | Callback.SetNotificationCallback( |
| 2354 | Message.MessageType.Notification_Voip_SystemVoipState, |
| 2355 | callback |
| 2356 | ); |
| 2357 | } |
| 2358 | |
| 2359 | } |
| 2360 | |
| 2361 | |
| 2362 | public static partial class Achievements { |
| 2363 | public static Request<Models.AchievementDefinitionList> GetNextAchievementDefinitionListPage(Models.AchievementDefinitionList list) { |
| 2364 | if (!list.HasNextPage) |
| 2365 | { |
| 2366 | Debug.LogWarning("Oculus.Platform.GetNextAchievementDefinitionListPage: List has no next page"); |
| 2367 | return null; |
| 2368 | } |
| 2369 | |
| 2370 | if (Core.IsInitialized()) |
| 2371 | { |
| 2372 | return new Request<Models.AchievementDefinitionList>( |
| 2373 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2374 | list.NextUrl, |
| 2375 | (int)Message.MessageType.Achievements_GetNextAchievementDefinitionArrayPage |
| 2376 | ) |
| 2377 | ); |
| 2378 | } |
| 2379 | |
| 2380 | return null; |
| 2381 | } |
| 2382 | |
| 2383 | public static Request<Models.AchievementProgressList> GetNextAchievementProgressListPage(Models.AchievementProgressList list) { |
| 2384 | if (!list.HasNextPage) |
| 2385 | { |
| 2386 | Debug.LogWarning("Oculus.Platform.GetNextAchievementProgressListPage: List has no next page"); |
| 2387 | return null; |
| 2388 | } |
| 2389 | |
| 2390 | if (Core.IsInitialized()) |
| 2391 | { |
| 2392 | return new Request<Models.AchievementProgressList>( |
| 2393 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2394 | list.NextUrl, |
| 2395 | (int)Message.MessageType.Achievements_GetNextAchievementProgressArrayPage |
| 2396 | ) |
| 2397 | ); |
| 2398 | } |
| 2399 | |
| 2400 | return null; |
| 2401 | } |
| 2402 | |
| 2403 | } |
| 2404 | |
| 2405 | public static partial class CloudStorage { |
| 2406 | public static Request<Models.CloudStorageMetadataList> GetNextCloudStorageMetadataListPage(Models.CloudStorageMetadataList list) { |
| 2407 | if (!list.HasNextPage) |
| 2408 | { |
| 2409 | Debug.LogWarning("Oculus.Platform.GetNextCloudStorageMetadataListPage: List has no next page"); |
| 2410 | return null; |
| 2411 | } |
| 2412 | |
| 2413 | if (Core.IsInitialized()) |
| 2414 | { |
| 2415 | return new Request<Models.CloudStorageMetadataList>( |
| 2416 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2417 | list.NextUrl, |
| 2418 | (int)Message.MessageType.CloudStorage_GetNextCloudStorageMetadataArrayPage |
| 2419 | ) |
| 2420 | ); |
| 2421 | } |
| 2422 | |
| 2423 | return null; |
| 2424 | } |
| 2425 | |
| 2426 | } |
| 2427 | |
| 2428 | public static partial class IAP { |
| 2429 | public static Request<Models.ProductList> GetNextProductListPage(Models.ProductList list) { |
| 2430 | if (!list.HasNextPage) |
| 2431 | { |
| 2432 | Debug.LogWarning("Oculus.Platform.GetNextProductListPage: List has no next page"); |
| 2433 | return null; |
| 2434 | } |
| 2435 | |
| 2436 | if (Core.IsInitialized()) |
| 2437 | { |
| 2438 | return new Request<Models.ProductList>( |
| 2439 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2440 | list.NextUrl, |
| 2441 | (int)Message.MessageType.IAP_GetNextProductArrayPage |
| 2442 | ) |
| 2443 | ); |
| 2444 | } |
| 2445 | |
| 2446 | return null; |
| 2447 | } |
| 2448 | |
| 2449 | public static Request<Models.PurchaseList> GetNextPurchaseListPage(Models.PurchaseList list) { |
| 2450 | if (!list.HasNextPage) |
| 2451 | { |
| 2452 | Debug.LogWarning("Oculus.Platform.GetNextPurchaseListPage: List has no next page"); |
| 2453 | return null; |
| 2454 | } |
| 2455 | |
| 2456 | if (Core.IsInitialized()) |
| 2457 | { |
| 2458 | return new Request<Models.PurchaseList>( |
| 2459 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2460 | list.NextUrl, |
| 2461 | (int)Message.MessageType.IAP_GetNextPurchaseArrayPage |
| 2462 | ) |
| 2463 | ); |
| 2464 | } |
| 2465 | |
| 2466 | return null; |
| 2467 | } |
| 2468 | |
| 2469 | } |
| 2470 | |
| 2471 | public static partial class Notifications { |
| 2472 | public static Request<Models.RoomInviteNotificationList> GetNextRoomInviteNotificationListPage(Models.RoomInviteNotificationList list) { |
| 2473 | if (!list.HasNextPage) |
| 2474 | { |
| 2475 | Debug.LogWarning("Oculus.Platform.GetNextRoomInviteNotificationListPage: List has no next page"); |
| 2476 | return null; |
| 2477 | } |
| 2478 | |
| 2479 | if (Core.IsInitialized()) |
| 2480 | { |
| 2481 | return new Request<Models.RoomInviteNotificationList>( |
| 2482 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2483 | list.NextUrl, |
| 2484 | (int)Message.MessageType.Notification_GetNextRoomInviteNotificationArrayPage |
| 2485 | ) |
| 2486 | ); |
| 2487 | } |
| 2488 | |
| 2489 | return null; |
| 2490 | } |
| 2491 | |
| 2492 | } |
| 2493 | |
| 2494 | public static partial class Rooms { |
| 2495 | public static Request<Models.RoomList> GetNextRoomListPage(Models.RoomList list) { |
| 2496 | if (!list.HasNextPage) |
| 2497 | { |
| 2498 | Debug.LogWarning("Oculus.Platform.GetNextRoomListPage: List has no next page"); |
| 2499 | return null; |
| 2500 | } |
| 2501 | |
| 2502 | if (Core.IsInitialized()) |
| 2503 | { |
| 2504 | return new Request<Models.RoomList>( |
| 2505 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2506 | list.NextUrl, |
| 2507 | (int)Message.MessageType.Room_GetNextRoomArrayPage |
| 2508 | ) |
| 2509 | ); |
| 2510 | } |
| 2511 | |
| 2512 | return null; |
| 2513 | } |
| 2514 | |
| 2515 | } |
| 2516 | |
| 2517 | public static partial class Users { |
| 2518 | public static Request<Models.UserAndRoomList> GetNextUserAndRoomListPage(Models.UserAndRoomList list) { |
| 2519 | if (!list.HasNextPage) |
| 2520 | { |
| 2521 | Debug.LogWarning("Oculus.Platform.GetNextUserAndRoomListPage: List has no next page"); |
| 2522 | return null; |
| 2523 | } |
| 2524 | |
| 2525 | if (Core.IsInitialized()) |
| 2526 | { |
| 2527 | return new Request<Models.UserAndRoomList>( |
| 2528 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2529 | list.NextUrl, |
| 2530 | (int)Message.MessageType.User_GetNextUserAndRoomArrayPage |
| 2531 | ) |
| 2532 | ); |
| 2533 | } |
| 2534 | |
| 2535 | return null; |
| 2536 | } |
| 2537 | |
| 2538 | public static Request<Models.UserList> GetNextUserListPage(Models.UserList list) { |
| 2539 | if (!list.HasNextPage) |
| 2540 | { |
| 2541 | Debug.LogWarning("Oculus.Platform.GetNextUserListPage: List has no next page"); |
| 2542 | return null; |
| 2543 | } |
| 2544 | |
| 2545 | if (Core.IsInitialized()) |
| 2546 | { |
| 2547 | return new Request<Models.UserList>( |
| 2548 | CAPI.ovr_HTTP_GetWithMessageType( |
| 2549 | list.NextUrl, |
| 2550 | (int)Message.MessageType.User_GetNextUserArrayPage |
| 2551 | ) |
| 2552 | ); |
| 2553 | } |
| 2554 | |
| 2555 | return null; |
| 2556 | } |
| 2557 | |
| 2558 | } |
| 2559 | |
| 2560 | |
| 2561 | } |