Photon Server API
Public Member Functions | Protected Member Functions | Properties | List of all members
Photon.Hive.Caching.RoomReference Class Reference

Used to observe references to room instances from a room cache. A reference to a room should be released (disposed) if it is not longer needed. The related cache observes the number of references to a room and removes a room if it has no references left. More...

Inheritance diagram for Photon.Hive.Caching.RoomReference:

Public Member Functions

 RoomReference (RoomCacheBase roomCache, Room room, PeerBase ownerPeer)
 Initializes a new instance of the RoomReference class. More...
 
void Dispose ()
 Removes the room reference from the associated room cache. The related room instance will be removed from the cache if no more references to the room exists. More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Releases unmanaged and - optionally - managed resources More...
 

Properties

Guid Id [get]
 Gets the unique id for this instance. More...
 
PeerBase OwnerPeer [get]
 
bool IsDisposed [get]
 Gets a value indicating whether this instance is disposed. More...
 
Room Room [get, protected set]
 Gets or sets the room of this reference. More...
 

Detailed Description

Used to observe references to room instances from a room cache. A reference to a room should be released (disposed) if it is not longer needed. The related cache observes the number of references to a room and removes a room if it has no references left.

In the Lite application the room reference will be stored in a peers state property whern the peer joines a room. When a peer leaves a room the reference to the room will be disposed. This pattern ensures that room/game instances will not be disposed if there are still peers/clients holding a reference to the room/game.

Constructor & Destructor Documentation

Photon.Hive.Caching.RoomReference.RoomReference ( RoomCacheBase  roomCache,
Room  room,
PeerBase  ownerPeer 
)
inline

Initializes a new instance of the RoomReference class.

Parameters
roomCacheThe room cache.
roomThe room.
ownerPeerAn PeerBase instance which obtained the room reference.

Member Function Documentation

void Photon.Hive.Caching.RoomReference.Dispose ( )
inline

Removes the room reference from the associated room cache. The related room instance will be removed from the cache if no more references to the room exists.

virtual void Photon.Hive.Caching.RoomReference.Dispose ( bool  disposing)
inlineprotectedvirtual

Releases unmanaged and - optionally - managed resources

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.

Property Documentation

Guid Photon.Hive.Caching.RoomReference.Id
get

Gets the unique id for this instance.

bool Photon.Hive.Caching.RoomReference.IsDisposed
get

Gets a value indicating whether this instance is disposed.

true if this instance is disposed; otherwise, false.

PeerBase Photon.Hive.Caching.RoomReference.OwnerPeer
get
Room Photon.Hive.Caching.RoomReference.Room
getprotected set

Gets or sets the room of this reference.

The room.