A Room that supports the following requests:
Public Member Functions | |
HiveGame (string gameName, RoomCacheBase roomCache, IGameStateFactory gameStateFactory=null, int maxEmptyRoomTTL=0, int lastTouchLimitMilliseconds=0, int lastTouchCheckIntervalMilliseconds=0, ExtendedPoolFiber executionFiber=null) | |
Initializes a new instance of the HiveGame class. More... | |
override string | ToString () |
bool | CheckBeforeJoinThisIsNewCreatedRoom (JoinGameRequest request) |
bool | CheckAfterJoinThisIsNewCreatedRoom (bool isNewActor) |
virtual void | RemoveInactiveActor (Actor actor) |
void | PublishEventDiconnected (Actor actor, int? newMasterClientId) |
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, OperationRequest operationRequest, SendParameters sendParameters) |
Enqueues an OperationRequest to the end of the execution queue. More... | |
IDisposable | ScheduleMessage (IMessage message, long timeMs) |
Schedules a message to be processed after a specified time. More... | |
void | Dispose () |
Releases resources used by this instance. More... | |
virtual void | OnClose () |
void | Release () |
Protected Member Functions | |
virtual void | CleanupActor (Actor actor) |
virtual void | DeactivateActor (Actor actor) |
bool | CreateGame (HivePeer peer, JoinGameRequest request, SendParameters sendParameters) |
override void | ExecuteOperation (HivePeer peer, OperationRequest operationRequest, 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) |
Hashtable | GetLobbyGameProperties (Hashtable source, HashSet< object > list) |
virtual void | HandleChangeGroupsOperation (HivePeer peer, ChangeGroups changeGroupsRequest, SendParameters sendParameters) |
bool | UpdateCacheSlice (HivePeer peer, byte op, int? sliceIndex, ref string message) |
virtual void | HandleCreateGameOperation (HivePeer peer, SendParameters sendParameters, CreateGameRequest 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... | |
virtual 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... | |
virtual void | HandleLeaveOperation (HivePeer peer, SendParameters sendParameters, LeaveRequest leaveOperation) |
Handles the LeaveRequest and calls RemovePeerFromGame. More... | |
virtual void | HandleRaiseEventOperation (HivePeer peer, RaiseEventRequest raiseEventRequest, SendParameters sendParameters) |
Handles the RaiseEventRequest: Sends a CustomEvent to actors in the room. More... | |
virtual void | HandleRemovePeerMessage (HivePeer peer, int reason, string details) |
virtual void | HandleSetPropertiesOperation (HivePeer peer, SetPropertiesRequest request, SendParameters sendParameters) |
Handles the SetPropertiesRequest and sends event PropertiesChangedEvent to all Actors in the room. More... | |
bool | Join (HivePeer peer, JoinGameRequest joinRequest, SendParameters sendParameters) |
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) |
virtual bool | AddExpectedUsers (JoinGameRequest joinRequest) |
bool | JoinSendResponseAndEvents (HivePeer peer, JoinGameRequest joinRequest, SendParameters sendParameters, int actorNr, ProcessJoinParams prms) |
virtual OperationResponse | GetUserJoinResponse (JoinGameRequest joinRequest, int actorNr, 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... | |
void | PublishEventCache (HivePeer litePeer, JoinGameRequest joinRequest) |
Sends all cached events to a peer. More... | |
virtual void | PublishJoinEvent (HivePeer peer, JoinGameRequest joinRequest) |
Sends a JoinEvent to all Actors. More... | |
virtual void | PublishLeaveEvent (Actor actor, int? newMasterClientId) |
Sends a LeaveEvent to all Actors. More... | |
bool | RaiseEventOperationHandler (HivePeer peer, RaiseEventRequest raiseEventRequest, SendParameters sendParameters, Actor actor) |
virtual int | RemovePeerFromGame (HivePeer peer, bool isCommingBack) |
Removes a peer from the game. This method is called if a client sends a LeaveRequest or disconnects. More... | |
bool | SetPropertiesRequestHandler (HivePeer peer, SetPropertiesRequest request, SendParameters sendParameters) |
void | RevertProperties (IDictionary oldPropertyValues, SetPropertiesRequest request) |
Hashtable | GetOldPropertyValues (SetPropertiesRequest request) |
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) |
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 (Actor actor, RaiseEventRequest raiseEventRequest, out string msg) |
Helper method of HandleRaiseEventOperation. Stores an event for new actors. More... | |
bool | UpdateEventCache (Actor actor, byte eventCode, object data, byte cacheOp, out string msg) |
bool | UpdateEventCache (Actor actor, byte evCode, object data, CacheOperation cacheOp, ref string msg) |
bool | ValidateGame (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 | 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 |
readonly int | LastTouchLimitMilliseconds |
readonly int | LastTouchCheckIntervalMilliseconds |
IHiveGameAppCounters | gameAppCounters = NullHiveGameAppCounters.Instance |
Protected Attributes inherited from Photon.Hive.Room | |
readonly RoomCacheBase | roomCache |
readonly IGameStateFactory | gameStateFactory |
string | RemoveRoomPathString |
GameState | roomState |
Properties | |
IHiveGameAppCounters | GameAppCounters [get, set] |
int | MasterClientId [get] |
virtual bool | IsPersistent [get] |
IEnumerable< Actor > | InactiveActors [get] |
IEnumerable< Actor > | Actors [get] |
bool | PublishUserId [get, set] |
bool | IsOpen [get, set] |
bool | IsVisible [get, set] |
string | LobbyId [get, set] |
bool | DeleteCacheOnLeave [get, set] |
Gets or sets a value indicating whether cached events are automaticly 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 listet 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... | |
RoomEventCacheManager | EventCache [get] |
EventCacheDictionary | ActorEventCache [get] |
Contains Caching.EventCaches for all actors. More... | |
GroupManager | GroupManager [get] |
ActorsManager | ActorsManager [get] |
GameState | RoomState [get] |
bool | CheckUserOnJoin [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] |
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. |
lastTouchLimitMilliseconds | Specifies to maximum value for a peers GetLastTouch in milliseconds before a peer will removed from the room. If set to zero no check will bew performed. |
lastTouchCheckIntervalMilliseconds | Specifies the in interval in milliseconds to check peer in the room for the GetLastTouched value. If set to zero no check will be performed. |
executionFiber |
|
inlineprotectedvirtual |
|
inline |
|
inline |
|
inlineprotectedvirtual |
Reimplemented in Photon.LoadBalancing.GameServer.Game, and Photon.Hive.Tests.TestGame.
|
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. |
operationRequest | The operation request to execute. |
sendParameters | The send Parameters. |
Reimplemented from Photon.Hive.Room.
Gets the actor for a HivePeer.
peer | The peer. |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotectedvirtual |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
Handles the GetPropertiesRequest operation: Sends the properties with the OperationResponse.
peer | The peer. |
getPropertiesRequest | The operation to handle. |
sendParameters | The send Parameters. |
|
inlineprotectedvirtual |
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. |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotectedvirtual |
Handles the LeaveRequest and calls RemovePeerFromGame.
peer | The peer. |
sendParameters | The send Parameters. |
leaveOperation | The operation. |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotectedvirtual |
Handles the RaiseEventRequest: Sends a CustomEvent to actors in the room.
peer | The peer. |
raiseEventRequest | The operation |
sendParameters | The send Parameters. |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotectedvirtual |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotectedvirtual |
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. |
Reimplemented in Photon.Hive.HiveHostGame.
|
inlineprotected |
|
inlineprotected |
|
inlineprotectedvirtual |
Reimplemented in Photon.Hive.HiveHostGame, and Photon.LoadBalancing.GameServer.Game.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
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 |
Sends all cached events to a peer.
litePeer | The lite peer that receives the events. |
joinRequest |
|
inline |
|
inlineprotectedvirtual |
Sends a JoinEvent to all Actors.
peer | The peer. |
joinRequest | The join request. |
|
inlineprotectedvirtual |
Sends a LeaveEvent to all Actors.
actor | The actor which sents the event. |
newMasterClientId |
|
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. |
isCommingBack | whether we expect peer will come back or not |
|
inlineprotected |
|
inlineprotectedvirtual |
|
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 |
|
inlineprotected |
Helper method of HandleRaiseEventOperation. Stores an event for new actors.
actor | The actor. |
raiseEventRequest | The raise event request. |
msg | Contains an error message if the method returns false. |
|
inlineprotected |
|
inlineprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
get |
Contains Caching.EventCaches for all actors.
|
get |
|
get |
|
getset |
|
getset |
Gets or sets a value indicating whether cached events are automaticly deleted for actors which are leaving a room.
|
get |
|
getset |
|
get |
|
get |
|
getset |
|
get |
|
getset |
|
getset |
|
getset |
Contains the keys of the game properties hashtable which should be listet in the lobby.
|
getset |
|
get |
|
getset |
|
getset |
Player live time
|
getset |
|
get |
|
getset |
Gets or sets a value indicating if common room events (Join, Leave) will suppressed.