viernes, 4 de octubre de 2013

All Photon Unity Networking Enums and Network Messages

// Comment
// ----------------------------------------------------------------------------
// 
//   PhotonNetwork Framework for Unity - Copyright (C) 2011 Exit Games GmbH
// 
// 
// 
// 
// developer@exitgames.com
// ----------------------------------------------------------------------------

using ExitGames.Client.Photon;
/// 
/// High level connection state of the client. Better use the more detailed .
/// 

public enum ConnectionState
{
    Disconnected,
    Connecting,
    Connected,
    Disconnecting,
    InitializingApplication
}

/// 
/// Detailed connection / networking peer state.
/// PUN implements a loadbalancing and authentication workflow "behind the scenes", so
/// some states will automatically advance to some follow up state. Those states are
/// commented with "(will-change)".
/// 
/// \ingroup publicApi
public enum PeerState
{
   /// Not running. Only set before initialization and first use.
    Uninitialized,
    /// Created and available to connect.
    PeerCreated,
    /// Working to establish the initial connection to the master server (until this process is finished, no operations can be sent).
    /// (will-change)
 Connecting,
    /// Connection is setup, now PUN will exchange keys for encryption or authenticate.
    /// (will-change)
    Connected,
    /// Not used at the moment.
    Queued,
    /// The application is authenticated. PUN usually joins the lobby now.
    /// (will-change) Unless AutoJoinLobby is false.
    Authenticated,
    /// Client is in the lobby of the Master Server and gets room listings.
    /// Use Join, Create or JoinRandom to get into a room to play.
 JoinedLobby,
    /// Disconnecting.
    /// (will-change)
    DisconnectingFromMasterserver,
    /// Connecting to game server (to join/create a room and play).
    /// (will-change)
    ConnectingToGameserver,
    /// Similar to Connected state but on game server. Still in process to join/create room.
    /// (will-change)
    ConnectedToGameserver,
    /// In process to join/create room (on game server).
    /// (will-change)
    Joining,
    /// Final state of a room join/create sequence. This client can now exchange events / call RPCs with other clients.
    Joined,
    /// Leaving a room.
    /// (will-change)
    Leaving,
    /// Workflow is leaving the game server and will re-connect to the master server.
    /// (will-change)
    DisconnectingFromGameserver,
    /// Workflow is connected to master server and will establish encryption and authenticate your app.
    /// (will-change)
    ConnectingToMasterserver,
    /// Same as Connected but coming from game server.
    /// (will-change)
    ConnectedComingFromGameserver,
    /// Same Queued but coming from game server.
    /// (will-change)
    QueuedComingFromGameserver,
    /// PUN is disconnecting. This leads to Disconnected.
    /// (will-change)
    Disconnecting,
    /// No connection is setup, ready to connect. Similar to PeerCreated.
    Disconnected,
    /// Final state for connecting to master without joining the lobby (AutoJoinLobby is false).
    ConnectedToMaster
}
/// 
/// Internal state how this peer gets into a particular room (joining it or creating it).
/// 

internal enum JoinType
{
    CreateGame,
    JoinGame,
    JoinRandomGame
}
// Photon properties, internally set by PhotonNetwork (PhotonNetwork builtin properties)
/// 
/// This enum makes up the set of MonoMessages sent by Photon Unity Networking.
/// Implement any of these constant names as method and it will be called
/// in the respective situation.
/// 
/// 
/// Implement:
/// public void OnLeftRoom() { //some work }
/// 
/// \ingroup publicApi

public enum PhotonNetworkingMessage
{
    /// 
 /// Called when the server is available and before client authenticates. Wait for the call to OnJoinedLobby (or OnConnectedToMaster) before the client does anything!
    /// Example: void OnConnectedToPhoton(){ ... }
    /// 
    /// This is not called for transitions from the masterserver to game servers, which is hidden for PUN users.
    OnConnectedToPhoton,
    /// 
 /// Called once the local user left a room.
    /// Example: void OnLeftRoom(){ ... }
    /// 
    OnLeftRoom,
    /// 
    /// Called -after- switching to a new MasterClient because the previous MC left the room (not when getting into a room). The last MC will already be removed at this time.
    /// Example: void OnMasterClientSwitched(PhotonPlayer newMasterClient){ ... }
    /// 
    OnMasterClientSwitched,
    /// 
    /// Called if a CreateRoom() call failed. Most likely because the room name is already in use.
    /// Example: void OnPhotonCreateRoomFailed(){ ... }
    /// 
    OnPhotonCreateRoomFailed,
    /// 
    /// Called if a JoinRoom() call failed. Most likely because the room does not exist or the room is full.
    /// Example: void OnPhotonJoinRoomFailed(){ ... }
    /// 
    OnPhotonJoinRoomFailed,
    /// 
    /// Called when CreateRoom finishes creating the room. After this, OnJoinedRoom will be called, too (no matter if creating one or joining).
    /// Example: void OnCreatedRoom(){ ... }
    /// 
    /// This implies the local client is the MasterClient.
    OnCreatedRoom,
    /// 
    /// Called on entering the Master Server's lobby. Client can create/join rooms but room list is not available until OnReceivedRoomListUpdate is called!
    /// Example: void OnJoinedLobby(){ ... }
    /// 
    /// 
    /// Note: When PhotonNetwork.autoJoinLobby is false, OnConnectedToMaster will be called instead and the room list won't be available.
    /// While in the lobby, the roomlist is automatically updated in fixed intervals (which you can't modify).
    /// 
    OnJoinedLobby,
    /// 
    /// Called after leaving the lobby.
    /// Example: void OnLeftLobby(){ ... }
    /// 
    OnLeftLobby,
    /// 
    /// Called after disconnecting from the Photon server.
    /// In some cases, other events are sent before OnDisconnectedFromPhoton is called. Examples: OnConnectionFail and OnFailedToConnectToPhoton.
    /// Example: void OnDisconnectedFromPhoton(){ ... }
    /// 
    OnDisconnectedFromPhoton,
    /// 
    /// Called when something causes the connection to fail (after it was established), followed by a call to OnDisconnectedFromPhoton.
    /// If the server could not be reached in the first place, OnFailedToConnectToPhoton is called instead.
    /// The reason for the error is provided as StatusCode.
    /// Example: void OnConnectionFail(DisconnectCause cause){ ... }
    /// 
    OnConnectionFail,
    /// 
    /// Called if a connect call to the Photon server failed before the connection was established, followed by a call to OnDisconnectedFromPhoton.
    /// If the connection was established but then fails, OnConnectionFail is called.
    /// Example: void OnFailedToConnectToPhoton(DisconnectCause cause){ ... }
    /// 
    OnFailedToConnectToPhoton,
    /// 
    /// Called for any update of the room listing (no matter if "new" list or "update for known" list). Only called in the Lobby state (on master server).
    /// Example: void OnReceivedRoomListUpdate(){ ... }
    /// 
    OnReceivedRoomListUpdate,
    /// 
    /// Called when entering a room (by creating or joining it). Called on all clients (including the Master Client).
    /// Example: void OnJoinedRoom(){ ... }
    /// 
    OnJoinedRoom,
    /// 
    /// Called after a remote player connected to the room. This PhotonPlayer is already added to the playerlist at this time.
    /// Example: void OnPhotonPlayerConnected(PhotonPlayer newPlayer){ ... }
    /// 
    OnPhotonPlayerConnected,
 /// 
    /// Called after a remote player disconnected from the room. This PhotonPlayer is already removed from the playerlist at this time.
    /// Example: void OnPhotonPlayerDisconnected(PhotonPlayer otherPlayer){ ... }
    /// 
    OnPhotonPlayerDisconnected,
 /// 
    /// Called after a JoinRandom() call failed. Most likely all rooms are full or no rooms are available.
    /// Example: void OnPhotonRandomJoinFailed(){ ... }
    /// 
    OnPhotonRandomJoinFailed,
    /// 
    /// Called after the connection to the master is established and authenticated but only when PhotonNetwork.AutoJoinLobby is false.
    /// If AutoJoinLobby is false, the list of available rooms won't become available but you could join (random or by name) and create rooms anyways.
    /// Example: void OnConnectedToMaster(){ ... }
    /// 
    OnConnectedToMaster,
    /// 
 /// Called every network 'update' on MonoBehaviours that are being observed by a PhotonView.
    /// Example: void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){ ... }
    /// 
    OnPhotonSerializeView,
    /// 
    /// Called on all scripts on a GameObject(and it's children) that have been spawned using PhotonNetwork.Instantiate
    /// Example: void OnPhotonInstantiate(PhotonMessageInfo info){ ... }
    /// 
    OnPhotonInstantiate,
    /// 
    /// Because the concurrent user limit was (temporarily) reached, this client is rejected by the server and disconnecting.
    /// 
    /// 
    /// When this happens, the user might try again later. You can't create or join rooms in OnPhotonMaxCcuReached(), cause the client will be disconnecting.
    /// You can raise the CCU limits with a new license (when you host yourself) or extended subscription (when using the Photon Cloud).
    /// The Photon Cloud will mail you when the CCU limit was reached. This is also visible in the Dashboard (webpage).
    /// Example: void OnPhotonMaxCccuReached(){ ... }
    /// 
    OnPhotonMaxCccuReached,
 /// 
    /// Called when inside a room when its custom properties have changed. This is ALSO called for room property changes by the local players.
    /// 
    /// 
    /// Example: void OnPhotonCustomRoomPropertiesChanged(){ ... }
    /// 
 OnPhotonCustomRoomPropertiesChanged,
 /// 
    /// Called when inside a room when a players custom properties change.
    /// 
    /// 
    /// Example: void OnPhotonPlayerPropertiesChanged(PhotonPlayer player){ ... }
    /// 
 OnPhotonPlayerPropertiesChanged,
    /// 
    /// Called when the server sent the response to a FindFriends request and updated PhotonNetwork.Friends.
    /// 
    /// 
    /// Example: void OnUpdatedFriendList(){ ... }
    /// 
    OnUpdatedFriendList,
    /// 
    /// Called when the custom authentication failed (due to user-input, bad tokens/secrets or wrong configuration). Followed by disconnect!
    /// Example: void OnCustomAuthenticationFailed(string debugMessage){ ... }
    /// 
    /// 
    /// Unless you setup a custom authentication service for your app (in the Dashboard), this won't be called!
    /// If authentication is successful, this method is also not called but OnJoinedLobby, OnConnectedToMaster will be called (just as usual).
    /// 
    OnCustomAuthenticationFailed,
}
/// 
/// Summarizes the cause for a disconnect. Used in: OnConnectionFail and OnFailedToConnectToPhoton.
/// 
/// Extracted from the status codes from ExitGames.Client.Photon.StatusCode.
/// 
/// \ingroup publicApi

public enum DisconnectCause
{
    /// Connection could not be established.
    /// Possible cause: Local server not running.
    ExceptionOnConnect = StatusCode.ExceptionOnConnect,
    /// The security settings for client or server don't allow a connection (see remarks).
    /// 
    /// A common cause for this is that browser clients read a "crossdomain" file from the server.
    /// If that file is unavailable or not configured to let the client connect, this exception is thrown.
    /// Photon usually provides this crossdomain file for Unity.
    /// If it fails, read:
    /// http://doc.exitgames.com/photon-server/PolicyApp
    /// 
    SecurityExceptionOnConnect = StatusCode.SecurityExceptionOnConnect,
    /// Connection timed out.
    /// Possible cause: Remote server not running or required ports blocked (due to router or firewall).
    TimeoutDisconnect = StatusCode.TimeoutDisconnect,
    /// Exception in the receive-loop.
    /// Possible cause: Socket failure.
    InternalReceiveException = StatusCode.InternalReceiveException,
    /// Server actively disconnected this client.
    DisconnectByServer = StatusCode.DisconnectByServer,
    /// Server actively disconnected this client.
    /// Possible cause: Server's send buffer full (too much data for client).
    DisconnectByServerLogic = StatusCode.DisconnectByServerLogic,
    /// Server actively disconnected this client. 
    /// Possible cause: The server's user limit was hit and client was forced to disconnect (on connect).
    DisconnectByServerUserLimit = StatusCode.DisconnectByServerUserLimit,
    /// Some exception caused the connection to close.
    Exception = StatusCode.Exception,
    /// (32756) Authorization on the Photon Cloud failed because the app's subscription does not allow to use a particular region's server.
    InvalidRegion = ErrorCode.InvalidRegion,
    /// (32757) Authorization on the Photon Cloud failed because the concurrent users (CCU) limit of the app's subscription is reached.
    MaxCcuReached = ErrorCode.MaxCcuReached,
}


No hay comentarios: