Photon Unity Networking 2 2.30

Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
PunTurnManager Class Reference

Pun turnBased Game manager. Provides an Interface (IPunTurnManagerCallbacks) for the typical turn flow and logic, between players Provides Extensions for Player, Room and RoomInfo to feature dedicated api for TurnBased Needs More...

Inherits MonoBehaviourPunCallbacks, and IOnEventCallback.

Public Member Functions

void BeginTurn ()
 Tells the TurnManager to begins a new turn. More...
 
void SendMove (object move, bool finished)
 Call to send an action. Optionally finish the turn, too. The move object can be anything. Try to optimize though and only send the strict minimum set of information to define the turn move. More...
 
bool GetPlayerFinishedTurn (Player player)
 Gets if the player finished the current turn. More...
 
void OnEvent (EventData photonEvent)
 Called by PhotonNetwork.OnEventCall registration More...
 
override void OnRoomPropertiesUpdate (Hashtable propertiesThatChanged)
 Called by PhotonNetwork More...
 
- Public Member Functions inherited from MonoBehaviourPunCallbacks
virtual void OnEnable ()
 
virtual void OnDisable ()
 
virtual void OnConnected ()
 Called to signal that the raw connection got established but before the client can call operation on the server. More...
 
virtual void OnLeftRoom ()
 Called when the local user/client left a room, so the game's logic can clean up it's internal state. More...
 
virtual void OnMasterClientSwitched (Player newMasterClient)
 Called after switching to a new MasterClient when the current one leaves. More...
 
virtual void OnCreateRoomFailed (short returnCode, string message)
 Called when the server couldn't create a room (OpCreateRoom failed). More...
 
virtual void OnJoinRoomFailed (short returnCode, string message)
 Called when a previous OpJoinRoom call failed on the server. More...
 
virtual void OnCreatedRoom ()
 Called when this client created a room and entered it. OnJoinedRoom() will be called as well. More...
 
virtual void OnJoinedLobby ()
 Called on entering a lobby on the Master Server. The actual room-list updates will call OnRoomListUpdate. More...
 
virtual void OnLeftLobby ()
 Called after leaving a lobby. More...
 
virtual void OnDisconnected (DisconnectCause cause)
 Called after disconnecting from the Photon server. It could be a failure or intentional More...
 
virtual void OnRegionListReceived (RegionHandler regionHandler)
 Called when the Name Server provided a list of regions for your title. More...
 
virtual void OnRoomListUpdate (List< RoomInfo > roomList)
 Called for any update of the room-listing while in a lobby (InLobby) on the Master Server. More...
 
virtual void OnJoinedRoom ()
 Called when the LoadBalancingClient entered a room, no matter if this client created it or simply joined. More...
 
virtual void OnPlayerEnteredRoom (Player newPlayer)
 Called when a remote player entered the room. This Player is already added to the playerlist. More...
 
virtual void OnPlayerLeftRoom (Player otherPlayer)
 Called when a remote player left the room or became inactive. Check otherPlayer.IsInactive. More...
 
virtual void OnJoinRandomFailed (short returnCode, string message)
 Called when a previous OpJoinRandom call failed on the server. More...
 
virtual void OnConnectedToMaster ()
 Called when the client is connected to the Master Server and ready for matchmaking and other tasks. More...
 
virtual void OnPlayerPropertiesUpdate (Player targetPlayer, Hashtable changedProps)
 Called when custom player-properties are changed. Player and the changed properties are passed as object[]. More...
 
virtual void OnFriendListUpdate (List< FriendInfo > friendList)
 Called when the server sent the response to a FindFriends request. More...
 
virtual void OnCustomAuthenticationResponse (Dictionary< string, object > data)
 Called when your Custom Authentication service responds with additional data. More...
 
virtual void OnCustomAuthenticationFailed (string debugMessage)
 Called when the custom authentication failed. Followed by disconnect! More...
 
virtual void OnWebRpcResponse (OperationResponse response)
 Called when the response to a WebRPC is available. See LoadBalancingClient.OpWebRpc. More...
 
virtual void OnLobbyStatisticsUpdate (List< TypedLobbyInfo > lobbyStatistics)
 Called when the Master Server sent an update for the Lobby Statistics. More...
 
virtual void OnErrorInfo (ErrorInfo errorInfo)
 Called when the client receives an event from the server indicating that an error happened there. More...
 

Public Attributes

float TurnDuration = 20f
 The duration of the turn in seconds. More...
 
IPunTurnManagerCallbacks TurnManagerListener
 The turn manager listener. Set this to your own script instance to catch Callbacks More...
 

Static Public Attributes

const byte TurnManagerEventOffset = 0
 The turn manager event offset event message byte. Used internaly for defining data in Room Custom Properties More...
 
const byte EvMove = 1 + TurnManagerEventOffset
 The Move event message byte. Used internaly for saving data in Room Custom Properties More...
 
const byte EvFinalMove = 2 + TurnManagerEventOffset
 The Final Move event message byte. Used internaly for saving data in Room Custom Properties More...
 

Properties

int Turn [get]
 Wraps accessing the "turn" custom properties of a room. More...
 
float ElapsedTimeInTurn [get]
 Gets the elapsed time in the current turn in seconds More...
 
float RemainingSecondsInTurn [get]
 Gets the remaining seconds for the current turn. Ranges from 0 to TurnDuration More...
 
bool IsCompletedByAll [get]
 Gets a value indicating whether the turn is completed by all. More...
 
bool IsFinishedByMe [get]
 Gets a value indicating whether the current turn is finished by me. More...
 
bool IsOver [get]
 Gets a value indicating whether the current turn is over. That is the ElapsedTimeinTurn is greater or equal to the TurnDuration More...
 
- Properties inherited from MonoBehaviourPun
PhotonView photonView [get]
 A cached reference to a PhotonView on this GameObject. More...
 

Detailed Description

Pun turnBased Game manager. Provides an Interface (IPunTurnManagerCallbacks) for the typical turn flow and logic, between players Provides Extensions for Player, Room and RoomInfo to feature dedicated api for TurnBased Needs

Member Function Documentation

◆ BeginTurn()

void BeginTurn ( )

Tells the TurnManager to begins a new turn.

◆ GetPlayerFinishedTurn()

bool GetPlayerFinishedTurn ( Player  player)

Gets if the player finished the current turn.

Returns
true, if player finished the current turn, false otherwise.
Parameters
playerThe Player to check for

◆ OnEvent()

void OnEvent ( EventData  photonEvent)

Called by PhotonNetwork.OnEventCall registration

Parameters
photonEventPhoton event.

Implements IOnEventCallback.

◆ OnRoomPropertiesUpdate()

override void OnRoomPropertiesUpdate ( Hashtable  propertiesThatChanged)
virtual

Called by PhotonNetwork

Parameters
propertiesThatChangedProperties that changed.

Reimplemented from MonoBehaviourPunCallbacks.

◆ SendMove()

void SendMove ( object  move,
bool  finished 
)

Call to send an action. Optionally finish the turn, too. The move object can be anything. Try to optimize though and only send the strict minimum set of information to define the turn move.

Parameters
move
finished

Member Data Documentation

◆ EvFinalMove

const byte EvFinalMove = 2 + TurnManagerEventOffset
static

The Final Move event message byte. Used internaly for saving data in Room Custom Properties

◆ EvMove

const byte EvMove = 1 + TurnManagerEventOffset
static

The Move event message byte. Used internaly for saving data in Room Custom Properties

◆ TurnDuration

float TurnDuration = 20f

The duration of the turn in seconds.

◆ TurnManagerEventOffset

const byte TurnManagerEventOffset = 0
static

The turn manager event offset event message byte. Used internaly for defining data in Room Custom Properties

◆ TurnManagerListener

IPunTurnManagerCallbacks TurnManagerListener

The turn manager listener. Set this to your own script instance to catch Callbacks

Property Documentation

◆ ElapsedTimeInTurn

float ElapsedTimeInTurn
get

Gets the elapsed time in the current turn in seconds

The elapsed time in the turn.

◆ IsCompletedByAll

bool IsCompletedByAll
get

Gets a value indicating whether the turn is completed by all.

true if this turn is completed by all; otherwise, false.

◆ IsFinishedByMe

bool IsFinishedByMe
get

Gets a value indicating whether the current turn is finished by me.

true if the current turn is finished by me; otherwise, false.

◆ IsOver

bool IsOver
get

Gets a value indicating whether the current turn is over. That is the ElapsedTimeinTurn is greater or equal to the TurnDuration

true if the current turn is over; otherwise, false.

◆ RemainingSecondsInTurn

float RemainingSecondsInTurn
get

Gets the remaining seconds for the current turn. Ranges from 0 to TurnDuration

The remaining seconds fo the current turn

◆ Turn

int Turn
get

Wraps accessing the "turn" custom properties of a room.

The turn index