Photon Server API

Classes | Public Member Functions | Protected Member Functions | Properties | List of all members
Photon.Hive.Tests.TestGame Class Reference
Inheritance diagram for Photon.Hive.Tests.TestGame:
Photon.Hive.HiveHostGame Photon.Hive.HiveGame Photon.SocketServer.Net.IHttpRequestQueueCounters Photon.SocketServer.IUnknownTypeMapper Photon.Hive.Room

Public Member Functions

 TestGame (string roomId, Caching.RoomCacheBase parent, int emptyRoomTTL, IPluginManager eManager, string pluginName)
 
void SetIsOpen (bool value)
 
void SetSuppressRoomEvents (bool value)
 
void SetSlice (int value)
 
IEnumerable< ActorGetDisconnectedActors ()
 
IEnumerable< ActorGetActors ()
 
TestPlugin GetPlugin ()
 
void WaitRemovePeerFromGame ()
 
void WaitForRaisevent ()
 
void WaitForCacheOpEvent ()
 
bool WaitForDispose ()
 
void WaitForAllActorsDisposed ()
 
bool WaitOnCleanupActor (int timeout)
 
void AddActorToGroup (byte groupId, TestActor actor)
 
- Public Member Functions inherited from Photon.Hive.HiveHostGame
 HiveHostGame (string gameName, RoomCacheBase roomCache, IGameStateFactory gameStateFactory=null, int maxEmptyRoomTTL=0, IPluginManager pluginManager=null, string pluginName="", Dictionary< string, object > environment=null, int lastTouchLimitMilliseconds=0, int lastTouchCheckIntervalMilliseconds=0, HttpRequestQueueOptions httpRequestQueueOptions=null, ExtendedPoolFiber executionFiber=null)
 
override bool BeforeRemoveFromCache ()
 Called by the RoomCacheBase if the room is about to be removed from the cache. More...
 
override void OnClose ()
 
Dictionary< byte, byte[]> GetGameStateAsByteArray ()
 
bool SetGameState (Dictionary< byte, byte[]> state)
 
void HttpQueueRequestsIncrement ()
 
void HttpQueueResponsesIncrement ()
 
void HttpQueueSuccessIncrement ()
 
void HttpQueueTimeoutIncrement ()
 
void HttpQueueErrorsIncrement ()
 
void HttpQueueOfflineResponsesIncrement ()
 
void HttpQueueConcurrentRequestsIncrement ()
 
void HttpQueueConcurrentRequestsDecrement ()
 
void HttpQueueQueuedRequestsIncrement ()
 
void HttpQueueQueuedRequestsDecrement ()
 
void HttpRequestExecuteTimeIncrement (long ticks)
 
void HttpQueueOnlineQueueCounterIncrement ()
 
void HttpQueueOnlineQueueCounterDecrement ()
 
void HttpQueueBackedoffRequestsIncrement ()
 
void HttpQueueBackedoffRequestsDecrement ()
 
void HttpRequestIncrement ()
 
void HttpSuccessIncrement ()
 
void HttpTimeoutIncrement ()
 
void HttpErrorsIncrement ()
 
void HttpResponseIncrement ()
 
bool OnUnknownType (Type type, ref object obj)
 
override void RemoveInactiveActor (Actor actor)
 
SerializableGameState GetSerializableGameState ()
 
Dictionary< string, object > GetGameState ()
 
bool SetGameState (Dictionary< string, object > state)
 
- Public Member Functions inherited from Photon.Hive.HiveGame
 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)
 
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 ()
 
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...
 
void Release ()
 

Protected Member Functions

override void ProcessMessage (Messages.IMessage message)
 
override void CleanupActor (Actor actor)
 
override bool ProcessRaiseEvent (HivePeer peer, RaiseEventRequest raiseEventRequest, SendParameters sendParameters, Actor actor)
 
override bool ProcessBeforeCloseGame (CloseRequest request)
 
override bool ProcessCloseGame (object state)
 
override void Dispose (bool dispose)
 Releases unmanaged and - optionally - managed resources More...
 
- Protected Member Functions inherited from Photon.Hive.HiveHostGame
virtual void OnActorBanned (Actor actor)
 
override void HandleCreateGameOperation (HivePeer peer, SendParameters sendParameters, CreateGameRequest createGameRequest)
 
override 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...
 
bool ReinitGame ()
 
override void HandleLeaveOperation (HivePeer peer, SendParameters sendParameters, LeaveRequest leaveOperation)
 Handles the LeaveRequest and calls HiveGame.RemovePeerFromGame. More...
 
override void HandleRaiseEventOperation (HivePeer peer, RaiseEventRequest raiseEventRequest, SendParameters sendParameters)
 Handles the RaiseEventRequest: Sends a CustomEvent to actors in the room. More...
 
override void HandleRemovePeerMessage (HivePeer peer, int reason, string details)
 
override void HandleSetPropertiesOperation (HivePeer peer, SetPropertiesRequest request, SendParameters sendParameters)
 Handles the SetPropertiesRequest and sends event PropertiesChangedEvent to all Actors in the room. More...
 
virtual bool ProcessBeforeJoinGame (JoinGameRequest joinRequest, SendParameters sendParameters, HivePeer peer)
 
virtual bool ProcessBeforeSetProperties (HivePeer peer, SetPropertiesRequest request, Hashtable oldValues, SendParameters sendParameters)
 
virtual bool ProcessSetProperties (HivePeer peer, bool result, string errorMsg, SetPropertiesRequest request, SendParameters sendParameters)
 
override void JoinFailureHandler (byte leaveReason, HivePeer peer, JoinGameRequest request)
 
virtual bool ProcessCreateGame (HivePeer peer, JoinGameRequest joinRequest, SendParameters sendParameters)
 
virtual bool ProcessJoin (int actorNr, JoinGameRequest joinRequest, SendParameters sendParameters, ProcessJoinParams prms, HivePeer peer)
 
virtual bool ProcessLeaveGame (int actorNr, LeaveRequest request, SendParameters sendParameters, HivePeer peer)
 
override OperationResponse GetUserJoinResponse (JoinGameRequest joinRequest, int actorNr, ProcessJoinParams prms)
 
- Protected Member Functions inherited from Photon.Hive.HiveGame
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 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...
 
bool Join (HivePeer peer, JoinGameRequest joinRequest, SendParameters sendParameters)
 
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)
 
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...
 
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...
 

Properties

int ActorCounter [get, set]
 
new TestActorsManager ActorsManager [get]
 
- Properties inherited from Photon.Hive.HiveHostGame
IGamePlugin Plugin [get]
 
IPluginInstance PluginInstance [get]
 
Dictionary< string, object > Environment [get, set]
 
int HttpForwardedOperationsLimit [get, protected set]
 
override bool IsPersistent [get]
 
object this[object key] [get, set]
 
- Properties inherited from Photon.Hive.HiveGame
IHiveGameAppCounters GameAppCounters [get, set]
 
int MasterClientId [get]
 
virtual bool IsPersistent [get]
 
IEnumerable< ActorInactiveActors [get]
 
IEnumerable< ActorActors [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...
 

Additional Inherited Members

- Protected Types inherited from Photon.Hive.Room
enum  RemoveState {
  RemoveState.Alive, RemoveState.TryRemoveRoomFromCacheCalled, RemoveState.RoomRemoved, RemoveState.TryRemoveRoomFromCacheCalledRoomNotRemoved,
  RemoveState.ProcessCloseGameCalled, RemoveState.TriggerPluginOnCloseCalled, RemoveState.AliveGotNewPlayer, RemoveState.ScheduleTriggerPluginOnCloseCalled,
  RemoveState.ProcessBeforeCloseGameCalled, RemoveState.ProcessBeforeCloseGameCalledEmptyRoomLiveTimeLECalled, RemoveState.BeforeRemoveFromCacheCalled, RemoveState.BeforeRemoveFromCacheActionCalled,
  RemoveState.GameDisposeCalled
}
 
- Static Protected Member Functions inherited from Photon.Hive.HiveHostGame
static string GetCallStack ()
 
- Protected Attributes inherited from Photon.Hive.HiveHostGame
CallCounter PendingPluginContinue = new CallCounter()
 
CallEnv callEnv
 
- Protected Attributes inherited from Photon.Hive.HiveGame
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
 
- Static Protected Attributes inherited from Photon.Hive.HiveHostGame
static readonly IHttpQueueCountersInstance _Total = HttpQueuePerformanceCounters.GetInstance("_Total")
 
static readonly IHttpQueueCountersInstance CountersInstance
 

Constructor & Destructor Documentation

◆ TestGame()

Photon.Hive.Tests.TestGame.TestGame ( string  roomId,
Caching.RoomCacheBase  parent,
int  emptyRoomTTL,
IPluginManager  eManager,
string  pluginName 
)
inline

Member Function Documentation

◆ AddActorToGroup()

void Photon.Hive.Tests.TestGame.AddActorToGroup ( byte  groupId,
TestActor  actor 
)
inline

◆ CleanupActor()

override void Photon.Hive.Tests.TestGame.CleanupActor ( Actor  actor)
inlineprotectedvirtual

Reimplemented from Photon.Hive.HiveGame.

◆ Dispose()

override void Photon.Hive.Tests.TestGame.Dispose ( bool  dispose)
inlineprotectedvirtual

Releases unmanaged and - optionally - managed resources

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

Reimplemented from Photon.Hive.Room.

◆ GetActors()

IEnumerable<Actor> Photon.Hive.Tests.TestGame.GetActors ( )
inline

◆ GetDisconnectedActors()

IEnumerable<Actor> Photon.Hive.Tests.TestGame.GetDisconnectedActors ( )
inline

◆ GetPlugin()

TestPlugin Photon.Hive.Tests.TestGame.GetPlugin ( )
inline

◆ ProcessBeforeCloseGame()

override bool Photon.Hive.Tests.TestGame.ProcessBeforeCloseGame ( CloseRequest  request)
inlineprotectedvirtual

Reimplemented from Photon.Hive.HiveHostGame.

◆ ProcessCloseGame()

override bool Photon.Hive.Tests.TestGame.ProcessCloseGame ( object  state)
inlineprotectedvirtual

Reimplemented from Photon.Hive.HiveHostGame.

◆ ProcessMessage()

override void Photon.Hive.Tests.TestGame.ProcessMessage ( Messages.IMessage  message)
inlineprotected

◆ ProcessRaiseEvent()

override bool Photon.Hive.Tests.TestGame.ProcessRaiseEvent ( HivePeer  peer,
RaiseEventRequest  raiseEventRequest,
SendParameters  sendParameters,
Actor  actor 
)
inlineprotectedvirtual

Reimplemented from Photon.Hive.HiveHostGame.

◆ SetIsOpen()

void Photon.Hive.Tests.TestGame.SetIsOpen ( bool  value)
inline

◆ SetSlice()

void Photon.Hive.Tests.TestGame.SetSlice ( int  value)
inline

◆ SetSuppressRoomEvents()

void Photon.Hive.Tests.TestGame.SetSuppressRoomEvents ( bool  value)
inline

◆ WaitForAllActorsDisposed()

void Photon.Hive.Tests.TestGame.WaitForAllActorsDisposed ( )
inline

◆ WaitForCacheOpEvent()

void Photon.Hive.Tests.TestGame.WaitForCacheOpEvent ( )
inline

◆ WaitForDispose()

bool Photon.Hive.Tests.TestGame.WaitForDispose ( )
inline

◆ WaitForRaisevent()

void Photon.Hive.Tests.TestGame.WaitForRaisevent ( )
inline

◆ WaitOnCleanupActor()

bool Photon.Hive.Tests.TestGame.WaitOnCleanupActor ( int  timeout)
inline

◆ WaitRemovePeerFromGame()

void Photon.Hive.Tests.TestGame.WaitRemovePeerFromGame ( )
inline

Property Documentation

◆ ActorCounter

int Photon.Hive.Tests.TestGame.ActorCounter
getset

◆ ActorsManager

new TestActorsManager Photon.Hive.Tests.TestGame.ActorsManager
get