A Room that supports the following requests:
Public Member Functions | |
HiveGame (string gameName, RoomCacheBase roomCache, IGameStateFactory gameStateFactory=null, int maxEmptyRoomTTL=0, ExtendedPoolFiber executionFiber=null) | |
Initializes a new instance of the HiveGame class. More... | |
override string | ToString () |
virtual void | RemoveInactiveActor (Actor actor) |
void | OnActorRemoved (Actor actor) |
void | OnActorDeactivated (Actor actor) |
Public Member Functions inherited from Photon.Hive.Room | |
Room (string name, RoomCacheBase roomCache=null, IGameStateFactory gameStateFactory=null, int maxEmptyRoomTTL=0, ExtendedPoolFiber executionFiber=null) | |
Initializes a new instance of the Room class without a room name. More... | |
override string | ToString () |
virtual bool | BeforeRemoveFromCache () |
Called by the RoomCacheBase if the room is about to be removed from the cache. More... | |
void | EnqueueMessage (IMessage message) |
Enqueues an IMessage to the end of the execution queue. More... | |
void | EnqueueOperation (HivePeer peer, Operation operationRequest, SendParameters sendParameters) |
Enqueues an OperationRequest to the end of the execution queue. More... | |
IDisposable | ScheduleMessage (IMessage message, int timeMs) |
Schedules a message to be processed after a specified time. More... | |
void | Dispose () |
Releases resources used by this instance. More... | |
void | Release () |
Public Attributes | |
virtual bool | IsPersistent => false |
RoomEventCacheManager | EventCache => this.RoomState.EventCache |
EventCacheDictionary | ActorEventCache => this.RoomState.ActorEventCache |
Contains Caching.EventCaches for all actors. More... | |
ActorsManager | ActorsManager => this.RoomState.ActorsManager |
bool | CacheDiscarded => this.EventCache.Discarded || this.ActorEventCache.Discarded |
Protected Member Functions | |
override void | OnClose () |
virtual void | CleanupActor (Actor actor) |
virtual void | DeactivateActor (Actor actor) |
bool | CreateGame (HivePeer peer, JoinGameRequest request, SendParameters sendParameters) |
override void | ExecuteOperation (HivePeer peer, Operation operation, SendParameters sendParameters) |
Called for each operation in the execution queue. Every Room has a queue of incoming operations to execute. Per game ExecuteOperation is never executed multi-threaded, thus all code executed here has thread safe access to all instance members. More... | |
Actor | GetActorByPeer (HivePeer peer) |
Gets the actor for a HivePeer. More... | |
Hashtable | GetLobbyGameProperties (Hashtable source) |
virtual void | HandleChangeGroupsOperation (HivePeer peer, ChangeGroups changeGroupsRequest, SendParameters sendParameters) |
abstract void | HandleCreateGameOperation (HivePeer peer, SendParameters sendParameters, JoinGameRequest createGameRequest) |
virtual void | HandleDebugGameOperation (HivePeer peer, DebugGameRequest request, SendParameters sendParameters) |
virtual void | HandleGetPropertiesOperation (HivePeer peer, GetPropertiesRequest getPropertiesRequest, SendParameters sendParameters) |
Handles the GetPropertiesRequest operation: Sends the properties with the OperationResponse. More... | |
abstract void | HandleJoinGameOperation (HivePeer peer, SendParameters sendParameters, JoinGameRequest joinGameRequest) |
Handles the JoinGameRequest: Joins a peer to a room and calls PublishJoinEvent. Before a JoinOperation reaches this point (inside a room), the HivePeer made sure that it is removed from the previous Room (if there was any). More... | |
abstract void | HandleLeaveOperation (HivePeer peer, SendParameters sendParameters, LeaveRequest leaveOperation) |
Handles the LeaveRequest and calls RemovePeerFromGame. More... | |
abstract void | HandleRaiseEventOperation (HivePeer peer, RaiseEventRequest raiseEventRequest, SendParameters sendParameters) |
Handles the RaiseEventRequest: Sends a CustomEvent to actors in the room. More... | |
abstract void | HandleRemovePeerMessage (HivePeer peer, int reason, string details) |
abstract void | HandleSetPropertiesOperation (HivePeer peer, SetPropertiesRequest request, SendParameters sendParameters) |
Handles the SetPropertiesRequest and sends event PropertiesChangedEvent to all Actors in the room. More... | |
virtual void | JoinFailureHandler (byte leaveReason, HivePeer peer, JoinGameRequest request) |
bool | JoinApplyGameStateChanges (HivePeer peer, JoinGameRequest joinRequest, SendParameters sendParameters, out Actor actor) |
virtual void | SendErrorResponse (HivePeer peer, byte opCode, ErrorCode errorCode, string msg, SendParameters sendParameters, Dictionary< byte, object > errorData=null) |
this method not only allows us to send error response but also we overwrite it to send old error codes to old clients More... | |
void | SendErrorResponseAndDisconnect (HivePeer peer, byte opCode, ErrorCode errorCode, string msg, SendParameters sendParameters, Dictionary< byte, object > errorData=null) |
virtual bool | AddExpectedUsers (JoinGameRequest joinRequest) |
bool | JoinSendResponseAndEvents (HivePeer peer, JoinGameRequest joinRequest, SendParameters sendParameters, Actor actor, ProcessJoinParams prms) |
virtual OperationResponse | GetUserJoinResponse (JoinGameRequest joinRequest, Actor actor, ProcessJoinParams prms) |
void | LeaveOperationHandler (HivePeer peer, SendParameters sendParameters, LeaveRequest request) |
void | LogOperation (HivePeer peer, OperationRequest operationRequest) |
override void | ProcessMessage (IMessage message) |
Processes a game message. Messages are used for internal communication. Per default only message RemovePeerFromGame is handled, a message that is sent when a player leaves a game due to disconnect or due to a subsequent join to a different game. More... | |
bool | RaiseEventOperationHandler (HivePeer peer, RaiseEventRequest raiseEventRequest, SendParameters sendParameters, Actor actor) |
virtual int | RemovePeerFromGame (HivePeer peer, bool isComingBack) |
Removes a peer from the game. This method is called if a client sends a LeaveRequest or disconnects. More... | |
bool | SetProperties (int actorNr, Hashtable properties, Hashtable expected, bool broadcast) |
bool | ValidateAndFillSetPropertiesRequest (HivePeer peer, SetPropertiesRequest request, out string errorMsg) |
virtual void | OnGamePropertiesChanged (SetPropertiesRequest request) |
void | PublishResultsAndSetGameProperties (bool propertiesUpdateResult, string errorMessage, SetPropertiesRequest request, HivePeer peer, SendParameters sendParameters) |
virtual bool | SetNewPropertyValues (SetPropertiesRequest request, out string errorMessage) |
void | CheckTotalPropertiesSize (SetPropertiesRequest setPropertiesRequest) |
virtual bool | TryAddPeerToGame (HivePeer peer, int actorNr, out Actor actor, out bool isNewActor, out ErrorCode errorcode, out string reason, JoinGameRequest joinRequest) |
Tries to add a HivePeer to this game instance. More... | |
bool | UpdateEventCache (int actorNr, byte eventCode, object data, byte cacheOp, out string msg) |
bool | UpdateCacheSlice (CacheOperation op, int actorNr, int? sliceIndex, out string message) |
virtual void | OnGameFull (HivePeer peer, JoinGameRequest joinGameRequest, SendParameters sendParameters) |
Protected Member Functions inherited from Photon.Hive.Room | |
Room (string name, ExtendedPoolFiber executionFiber, RoomCacheBase roomCache, IGameStateFactory gameStateFactory=null, int maxEmptyRoomTTL=0) | |
Initializes a new instance of the Room class. More... | |
virtual void | Dispose (bool dispose) |
Releases unmanaged and - optionally - managed resources More... | |
void | PublishEvent (HiveEventBase e, Actor actor, SendParameters sendParameters) |
Publishes an event to a single actor on a specified channel. More... | |
void | PublishEvent (HiveEventBase e, IEnumerable< Actor > actorList, SendParameters sendParameters) |
Publishes an event to a list of actors on a specified channel. More... | |
void | PublishEvent (EventData e, IEnumerable< Actor > actorList, SendParameters sendParameters) |
Publishes an event to a list of actors on a specified channel. More... | |
void | PublishErrorInfoEvent (string errorMsg, IEnumerable< Actor > actorList, SendParameters sendParameters) |
void | ScheduleRoomRemoval (int roomLiveTime) |
Schedules the removal of the room instance from the cache. The room will be removed after the specified time if there are no room references left. More... | |
void | TryRemoveRoomFromCache () |
Removes the room instance from the cache if there are no references to the instance left. More... | |
Protected Attributes | |
readonly LogQueue | LogQueue |
IHiveGameAppCounters | gameAppCounters = NullHiveGameAppCounters.Instance |
IEnumerable< Actor > | InactiveActors => this.ActorsManager.InactiveActors |
IEnumerable< Actor > | ActiveActors => this.ActorsManager.ActiveActors |
GroupManager | GroupManager => this.RoomState.GroupManager |
GameState | RoomState => this.roomState |
Protected Attributes inherited from Photon.Hive.Room | |
readonly RoomCacheBase | roomCache |
readonly IGameStateFactory | gameStateFactory |
string | RemoveRoomPathString |
DateTime | removalStartTimestamp = DateTime.MinValue |
GameState | roomState |
Static Protected Attributes | |
static readonly string[] | EmptyStringArray = {} |
Properties | |
IHiveGameAppCounters | GameAppCounters [get, set] |
int | MasterClientId [get] |
bool | IsOpen [get, set] |
bool | IsVisible [get, set] |
bool | IsFinished [get, set] |
whether finished. it is not same as IsOpen == false. More... | |
string | LobbyId [get, set] |
bool | DeleteCacheOnLeave [get, set] |
Gets or sets a value indicating whether cached events are automatically deleted for actors which are leaving a room. More... | |
HashSet< object > | LobbyProperties [get, set] |
Contains the keys of the game properties hashtable which should be listed in the lobby. More... | |
AppLobbyType | LobbyType [get, set] |
byte | MaxPlayers [get, set] |
int | PlayerTTL [get, set] |
Player live time More... | |
bool | SuppressRoomEvents [get, set] |
Gets or sets a value indicating if common room events (Join, Leave) will suppressed. More... | |
bool | SuppressPlayerInfo [get, set] |
bool | CheckUserOnJoin [get, set] |
int | LimitMaxPropertiesSizePerGame = 0 [get, set] |
Properties inherited from Photon.Hive.Room | |
RemoveState | RemoveRoomPath [get, set] |
ExtendedPoolFiber | ExecutionFiber [get] |
Gets a PoolFiber instance used to synchronize access to this instance. More... | |
bool | IsDisposed [get] |
Gets a value indicating whether IsDisposed. More... | |
string | Name [get] |
Gets the name (id) of the room. More... | |
int | EmptyRoomLiveTime [get, protected set] |
Gets or sets a value indicating how long the room instance will be keeped alive in the room cache after all peers have left the room. More... | |
int | MaxEmptyRoomTTL [get] |
DateTime | UtcCreated [get] |
long | RoomCreationTS [get] |
IDisposable | RemoveTimer [get, set] |
Timer for removing room More... | |
PropertyBag< object > | Properties [get] |
Gets a PropertyBag instance used to store custom room properties. More... | |
A Room that supports the following requests:
|
inline |
Initializes a new instance of the HiveGame class.
gameName | The name of the game. |
roomCache | The RoomCacheBase instance to which the room belongs. |
gameStateFactory | Custom factory for GameState. if null is set, default factory is used |
maxEmptyRoomTTL | A value indicating how long the room instance will be kept alive in the room cache after all peers have left the room. |
executionFiber |
|
inlineprotectedvirtual |
|
inlineprotected |
|
inlineprotectedvirtual |
Reimplemented in Photon.LoadBalancing.GameServer.Game.
|
inlineprotected |
|
inlineprotectedvirtual |
Reimplemented in Photon.LoadBalancing.GameServer.Game.
|
inlineprotectedvirtual |
Called for each operation in the execution queue. Every Room has a queue of incoming operations to execute. Per game ExecuteOperation is never executed multi-threaded, thus all code executed here has thread safe access to all instance members.
peer | The peer. |
operation | The operation request to execute. |
sendParameters | The send Parameters. |
Reimplemented from Photon.Hive.Room.
Gets the actor for a HivePeer.
peer | The peer. |
|
inlineprotected |
|
inlineprotectedvirtual |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotectedvirtual |
|
protectedpure virtual |
Implemented in Photon.Hive.HiveHostGame, and Photon.LoadBalancing.GameServer.Game.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
Handles the GetPropertiesRequest operation: Sends the properties with the OperationResponse.
peer | The peer. |
getPropertiesRequest | The operation to handle. |
sendParameters | The send Parameters. |
|
protectedpure virtual |
Handles the JoinGameRequest: Joins a peer to a room and calls PublishJoinEvent. Before a JoinOperation reaches this point (inside a room), the HivePeer made sure that it is removed from the previous Room (if there was any).
peer | The peer. |
sendParameters | The send Parameters. |
joinGameRequest | The join Game Request. |
Implemented in Photon.Hive.HiveHostGame, and Photon.LoadBalancing.GameServer.Game.
|
protectedpure virtual |
Handles the LeaveRequest and calls RemovePeerFromGame.
peer | The peer. |
sendParameters | The send Parameters. |
leaveOperation | The operation. |
Implemented in Photon.Hive.HiveHostGame.
|
protectedpure virtual |
Handles the RaiseEventRequest: Sends a CustomEvent to actors in the room.
peer | The peer. |
raiseEventRequest | The operation |
sendParameters | The send Parameters. |
Implemented in Photon.Hive.HiveHostGame.
|
protectedpure virtual |
Implemented in Photon.Hive.HiveHostGame.
|
protectedpure virtual |
Handles the SetPropertiesRequest and sends event PropertiesChangedEvent to all Actors in the room.
peer | The peer. |
request | The SetPropertiesRequest operation to handle. |
sendParameters | The send Parameters. |
Implemented in Photon.Hive.HiveHostGame.
|
inlineprotected |
|
inlineprotectedvirtual |
Reimplemented in Photon.Hive.HiveHostGame, and Photon.LoadBalancing.GameServer.Game.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
inlineprotectedvirtual |
Reimplemented from Photon.Hive.Room.
|
inlineprotectedvirtual |
Reimplemented in Photon.LoadBalancing.GameServer.Game.
|
inlineprotectedvirtual |
Reimplemented in Photon.LoadBalancing.GameServer.Game.
|
inlineprotectedvirtual |
Processes a game message. Messages are used for internal communication. Per default only message RemovePeerFromGame is handled, a message that is sent when a player leaves a game due to disconnect or due to a subsequent join to a different game.
message | Message to process. |
Reimplemented from Photon.Hive.Room.
|
inlineprotected |
|
inlineprotected |
|
inlinevirtual |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotectedvirtual |
Removes a peer from the game. This method is called if a client sends a LeaveRequest or disconnects.
peer | The HivePeer to remove. |
isComingBack | whether we expect peer will come back or not |
|
inlineprotectedvirtual |
this method not only allows us to send error response but also we overwrite it to send old error codes to old clients
peer | |
opCode | |
errorCode | |
msg | |
sendParameters | |
errorData |
|
inlineprotected |
|
inlineprotectedvirtual |
|
inlineprotected |
|
inline |
|
inlineprotectedvirtual |
Tries to add a HivePeer to this game instance.
peer | The peer to add. |
actorNr | The actor Nr. |
actor | When this method returns this out param contains the Actor associated with the peer . |
errorcode | returns error code if we fail to add actor |
reason | reason why player can not be added |
isNewActor | returns true if actor is new |
joinRequest | join request which was sent by client |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
protected |
EventCacheDictionary Photon.Hive.HiveGame.ActorEventCache => this.RoomState.ActorEventCache |
Contains Caching.EventCaches for all actors.
ActorsManager Photon.Hive.HiveGame.ActorsManager => this.RoomState.ActorsManager |
bool Photon.Hive.HiveGame.CacheDiscarded => this.EventCache.Discarded || this.ActorEventCache.Discarded |
|
staticprotected |
RoomEventCacheManager Photon.Hive.HiveGame.EventCache => this.RoomState.EventCache |
|
protected |
|
protected |
|
protected |
virtual bool Photon.Hive.HiveGame.IsPersistent => false |
|
protected |
|
protected |
|
getset |
|
getset |
Gets or sets a value indicating whether cached events are automatically deleted for actors which are leaving a room.
|
getset |
|
getsetprotected |
whether finished. it is not same as IsOpen == false.
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
Contains the keys of the game properties hashtable which should be listed in the lobby.
|
getset |
|
get |
|
getset |
|
getset |
Player live time
|
getset |
|
getset |
Gets or sets a value indicating if common room events (Join, Leave) will suppressed.