![]() |
CotC C# SDK for Unity
v1.4.0.1
Making social games is easy !
|
This class is responsible for polling the server waiting for new events. You should instantiate one and manage its lifecycle as the state of the application changes.
A loop is typically managed through the Gamer.StartEventLoop method (loops are always running as an authenticated gamer) and should be started once the gamer is logged in, and stopped at logout. The loop is automatically paused by the system when the user leaves the application, and automatically restarted as well.
Properties | |
String | Domain [get] |
The domain on which this loop is listening. More... | |
Gamer | Gamer [get] |
EventLoopHandler | ReceivedEvent |
This event is raised when an event is received. More... | |
Public Member Functions | |
DomainEventLoop (Gamer gamer, String domain=Common.PrivateDomain, int iterationDuration=590) | |
You need valid credentials in order to instantiate this class. Use Cloud.Login* methods for that purpose. Once the object is created, you need to start the coroutine, please look at the other methods available. More... | |
DomainEventLoop | Start () |
Starts the coroutine. Call this upon initialization. More... | |
DomainEventLoop | Stop () |
Will stop the event coroutine. Might take some time until the current request finishes. You should not use this object for other purposes later on. In particular, do not start it again. More... | |
DomainEventLoop | Suspend () |
Suspends the event coroutine. More... | |
DomainEventLoop | Resume () |
Resumes a suspended event coroutine. More... | |
Public Attributes | |
bool | Stopped = false |
int | LoopIterationDuration |
const float | PopEventDelayCoroutineHold = 3f |
CotcSdk.DomainEventLoop.DomainEventLoop | ( | Gamer | gamer, |
String | domain = Common.PrivateDomain , |
||
int | iterationDuration = 590 |
||
) |
You need valid credentials in order to instantiate this class. Use Cloud.Login* methods for that purpose. Once the object is created, you need to start the coroutine, please look at the other methods available.
gamer | The gamer object received from a login or similar function. Used to authenticate (receive events related to the said gamer). |
domain | The domain on which to listen for events. Note that you may create multiple event loops, especially if you are using multiple domains. The default domain, that you should use unless you are explicitly using multiple domains, is the private domain. |
iterationDuration | Sets a custom timeout in seconds for the long polling event loop. Should be used with care and set to a high value (at least 60). Defaults to 590 (~10 min). |
|
get |
The domain on which this loop is listening.
|
addremove |
This event is raised when an event is received.
DomainEventLoop CotcSdk.DomainEventLoop.Resume | ( | ) |
Resumes a suspended event coroutine.
DomainEventLoop CotcSdk.DomainEventLoop.Start | ( | ) |
Starts the coroutine. Call this upon initialization.
DomainEventLoop CotcSdk.DomainEventLoop.Stop | ( | ) |
Will stop the event coroutine. Might take some time until the current request finishes. You should not use this object for other purposes later on. In particular, do not start it again.
DomainEventLoop CotcSdk.DomainEventLoop.Suspend | ( | ) |
Suspends the event coroutine.