BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / Platform / Scripts / Request.cs

Request.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
Request.cs 1.1 KiB Download Raw
1namespace Oculus.Platform
2{
3 public sealed class Request<T> : Request
4 {
5 public Request(ulong requestID) : base (requestID) { }
6
7 public Request<T> OnComplete(Message<T>.Callback callback)
8 {
9 Callback.OnComplete<T>(this, callback);
10 return this;
11 }
12 }
13
14 public class Request
15 {
16 public Request(ulong requestID) {this.RequestID = requestID;}
17 public ulong RequestID {get; set;}
18
19 public Request OnComplete(Message.Callback callback)
20 {
21 Callback.OnComplete(this, callback);
22 return this;
23 }
24
25 /**
26 * This will run callbacks on all messages that returned from the server.
27 * If too many message are coming back at once, then a limit can be passed in
28 * as an arg to limit the number of messages to run callbacks on at a time
29 */
30 public static void RunCallbacks(uint limit = 0)
31 {
32 // default of 0 will run callbacks on all messages on the queue
33 if (limit == 0)
34 {
35 Callback.RunCallbacks();
36 }
37 else
38 {
39 Callback.RunLimitedCallbacks(limit);
40 }
41 }
42 }
43}