C# 클래스 LoadBalancingPeer

Internally used by PUN. A LoadbalancingPeer provides the operations and enum definitions needed to use the loadbalancing server application which is also used in Photon Cloud.
The LoadBalancingPeer does not keep a state, instead this is done by a LoadBalancingClient.
상속: PhotonPeer
파일 보기 프로젝트 열기: daniel-cheng/stellar 1 사용 예제들

Private Properties

프로퍼티 타입 설명
RoomOptionsToOpParameters void

공개 메소드들

메소드 설명
LoadBalancingPeer ( ConnectionProtocol protocolType ) : System

Creates a Peer with selected connection protocol.

Each connection protocol has it's own default networking ports for Photon.

LoadBalancingPeer ( IPhotonPeerListener listener, ConnectionProtocol protocolType ) : System

Creates a Peer with default connection protocol (UDP).

OpAuthenticate ( string appId, string appVersion, AuthenticationValues, authValues, string regionCode, bool getLobbyStatistics ) : bool

Sends this app's appId and appVersion to identify this application server side. This is an async request which triggers a OnOperationResponse() call.

This operation makes use of encryption, if that is established before. See: EstablishEncryption(). Check encryption with IsEncryptionAvailable. This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).

OpAuthenticateOnce ( string appId, string appVersion, AuthenticationValues, authValues, string regionCode, EncryptionMode encryptionMode, ConnectionProtocol expectedProtocol ) : bool

Sends this app's appId and appVersion to identify this application server side. This is an async request which triggers a OnOperationResponse() call.

This operation makes use of encryption, if that is established before. See: EstablishEncryption(). Check encryption with IsEncryptionAvailable. This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).

OpChangeGroups ( byte groupsToRemove, byte groupsToAdd ) : bool

Operation to handle this client's interest groups (for events in room).

Note the difference between passing null and byte[0]: null won't add/remove any groups. byte[0] will add/remove all (existing) groups. First, removing groups is executed. This way, you could leave all groups and join only the ones provided. Changes become active not immediately but when the server executes this operation (approximately RTT/2).

OpCreateRoom ( EnterRoomParams, opParams ) : bool

Creates a room (on either Master or Game Server). The OperationResponse depends on the server the peer is connected to: Master will return a Game Server to connect to. Game Server will return the joined Room's data. This is an async request which triggers a OnOperationResponse() call.

If the room is already existing, the OperationResponse will have a returnCode of ErrorCode.GameAlreadyExists.

OpFindFriends ( string friendsToFind ) : bool

Request the rooms and online status for a list of friends (each client must set a unique username via OpAuthenticate).

Used on Master Server to find the rooms played by a selected list of users. Users identify themselves by using OpAuthenticate with a unique username. The list of usernames must be fetched from some other source (not provided by Photon). The server response includes 2 arrays of info (each index matching a friend from the request): ParameterCode.FindFriendsResponseOnlineList = bool[] of online states ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)

OpGetRegions ( string appId ) : bool
OpJoinLobby ( TypedLobby, lobby = null ) : bool

Joins the lobby on the Master Server, where you get a list of RoomInfos of currently open rooms. This is an async request which triggers a OnOperationResponse() call.

OpJoinRandomRoom ( OpJoinRandomRoomParams, opJoinRandomRoomParams ) : bool

Operation to join a random, available room. Overloads take additional player properties. This is an async request which triggers a OnOperationResponse() call. If all rooms are closed or full, the OperationResponse will have a returnCode of ErrorCode.NoRandomMatchFound. If successful, the OperationResponse contains a gameserver address and the name of some room.

OpJoinRoom ( EnterRoomParams, opParams ) : bool

Joins a room by name or creates new room if room with given name not exists. The OperationResponse depends on the server the peer is connected to: Master will return a Game Server to connect to. Game Server will return the joined Room's data. This is an async request which triggers a OnOperationResponse() call.

If the room is not existing (anymore), the OperationResponse will have a returnCode of ErrorCode.GameDoesNotExist. Other possible ErrorCodes are: GameClosed, GameFull.

OpLeaveLobby ( ) : bool

Leaves the lobby on the Master Server. This is an async request which triggers a OnOperationResponse() call.

OpLeaveRoom ( bool becomeInactive ) : bool

Leaves a room with option to come back later or "for good".

OpRaiseEvent ( byte eventCode, object customEventContent, bool sendReliable, RaiseEventOptions, raiseEventOptions ) : bool

Send an event with custom code/type and any content to the other players in the same room.

This override explicitly uses another parameter order to not mix it up with the implementation for Hashtable only.

OpSetCustomPropertiesOfActor ( int actorNr, ExitGames.Client.Photon.Hashtable actorProperties ) : bool
OpSetCustomPropertiesOfRoom ( ExitGames.Client.Photon.Hashtable gameProperties, bool broadcast, byte channelId ) : bool
OpSettings ( bool receiveLobbyStats ) : bool

Internally used operation to set some "per server" settings. This is for the Master Server.

보호된 메소드들

메소드 설명
OpSetPropertiesOfActor ( int actorNr, ExitGames.Client.Photon.Hashtable actorProperties, ExitGames.Client.Photon.Hashtable expectedProperties = null, bool webForward = false ) : bool

Sets properties of a player / actor. Internally this uses OpSetProperties, which can be used to either set room or player properties.

OpSetPropertiesOfRoom ( ExitGames.Client.Photon.Hashtable gameProperties, ExitGames.Client.Photon.Hashtable expectedProperties = null, bool webForward = false ) : bool

Sets properties of a room. Internally this uses OpSetProperties, which can be used to either set room or player properties.

OpSetPropertyOfRoom ( byte propCode, object value ) : void

비공개 메소드들

메소드 설명
RoomOptionsToOpParameters ( object>.Dictionary op, RoomOptions, roomOptions ) : void

메소드 상세

LoadBalancingPeer() 공개 메소드

Creates a Peer with selected connection protocol.
Each connection protocol has it's own default networking ports for Photon.
public LoadBalancingPeer ( ConnectionProtocol protocolType ) : System
protocolType ConnectionProtocol The preferred option is UDP.
리턴 System

LoadBalancingPeer() 공개 메소드

Creates a Peer with default connection protocol (UDP).
public LoadBalancingPeer ( IPhotonPeerListener listener, ConnectionProtocol protocolType ) : System
listener IPhotonPeerListener
protocolType ConnectionProtocol
리턴 System

OpAuthenticate() 공개 메소드

Sends this app's appId and appVersion to identify this application server side. This is an async request which triggers a OnOperationResponse() call.
This operation makes use of encryption, if that is established before. See: EstablishEncryption(). Check encryption with IsEncryptionAvailable. This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).
public OpAuthenticate ( string appId, string appVersion, AuthenticationValues, authValues, string regionCode, bool getLobbyStatistics ) : bool
appId string Your application's name or ID to authenticate. This is assigned by Photon Cloud (webpage).
appVersion string The client's version (clients with differing client appVersions are separated and players don't meet).
authValues AuthenticationValues, Contains all values relevant for authentication. Even without account system (external Custom Auth), the clients are allowed to identify themselves.
regionCode string Optional region code, if the client should connect to a specific Photon Cloud Region.
getLobbyStatistics bool Set to true on Master Server to receive "Lobby Statistics" events.
리턴 bool

OpAuthenticateOnce() 공개 메소드

Sends this app's appId and appVersion to identify this application server side. This is an async request which triggers a OnOperationResponse() call.
This operation makes use of encryption, if that is established before. See: EstablishEncryption(). Check encryption with IsEncryptionAvailable. This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).
public OpAuthenticateOnce ( string appId, string appVersion, AuthenticationValues, authValues, string regionCode, EncryptionMode encryptionMode, ConnectionProtocol expectedProtocol ) : bool
appId string Your application's name or ID to authenticate. This is assigned by Photon Cloud (webpage).
appVersion string The client's version (clients with differing client appVersions are separated and players don't meet).
authValues AuthenticationValues, Optional authentication values. The client can set no values or a UserId or some parameters for Custom Authentication by a server.
regionCode string Optional region code, if the client should connect to a specific Photon Cloud Region.
encryptionMode EncryptionMode
expectedProtocol ConnectionProtocol
리턴 bool

OpChangeGroups() 공개 메소드

Operation to handle this client's interest groups (for events in room).
Note the difference between passing null and byte[0]: null won't add/remove any groups. byte[0] will add/remove all (existing) groups. First, removing groups is executed. This way, you could leave all groups and join only the ones provided. Changes become active not immediately but when the server executes this operation (approximately RTT/2).
public OpChangeGroups ( byte groupsToRemove, byte groupsToAdd ) : bool
groupsToRemove byte Groups to remove from interest. Null will not remove any. A byte[0] will remove all.
groupsToAdd byte Groups to add to interest. Null will not add any. A byte[0] will add all current.
리턴 bool

OpCreateRoom() 공개 메소드

Creates a room (on either Master or Game Server). The OperationResponse depends on the server the peer is connected to: Master will return a Game Server to connect to. Game Server will return the joined Room's data. This is an async request which triggers a OnOperationResponse() call.
If the room is already existing, the OperationResponse will have a returnCode of ErrorCode.GameAlreadyExists.
public OpCreateRoom ( EnterRoomParams, opParams ) : bool
opParams EnterRoomParams,
리턴 bool

OpFindFriends() 공개 메소드

Request the rooms and online status for a list of friends (each client must set a unique username via OpAuthenticate).
Used on Master Server to find the rooms played by a selected list of users. Users identify themselves by using OpAuthenticate with a unique username. The list of usernames must be fetched from some other source (not provided by Photon). The server response includes 2 arrays of info (each index matching a friend from the request): ParameterCode.FindFriendsResponseOnlineList = bool[] of online states ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)
public OpFindFriends ( string friendsToFind ) : bool
friendsToFind string Array of friend's names (make sure they are unique).
리턴 bool

OpGetRegions() 공개 메소드

public OpGetRegions ( string appId ) : bool
appId string
리턴 bool

OpJoinLobby() 공개 메소드

Joins the lobby on the Master Server, where you get a list of RoomInfos of currently open rooms. This is an async request which triggers a OnOperationResponse() call.
public OpJoinLobby ( TypedLobby, lobby = null ) : bool
lobby TypedLobby, The lobby join to.
리턴 bool

OpJoinRandomRoom() 공개 메소드

Operation to join a random, available room. Overloads take additional player properties. This is an async request which triggers a OnOperationResponse() call. If all rooms are closed or full, the OperationResponse will have a returnCode of ErrorCode.NoRandomMatchFound. If successful, the OperationResponse contains a gameserver address and the name of some room.
public OpJoinRandomRoom ( OpJoinRandomRoomParams, opJoinRandomRoomParams ) : bool
opJoinRandomRoomParams OpJoinRandomRoomParams,
리턴 bool

OpJoinRoom() 공개 메소드

Joins a room by name or creates new room if room with given name not exists. The OperationResponse depends on the server the peer is connected to: Master will return a Game Server to connect to. Game Server will return the joined Room's data. This is an async request which triggers a OnOperationResponse() call.
If the room is not existing (anymore), the OperationResponse will have a returnCode of ErrorCode.GameDoesNotExist. Other possible ErrorCodes are: GameClosed, GameFull.
public OpJoinRoom ( EnterRoomParams, opParams ) : bool
opParams EnterRoomParams,
리턴 bool

OpLeaveLobby() 공개 메소드

Leaves the lobby on the Master Server. This is an async request which triggers a OnOperationResponse() call.
public OpLeaveLobby ( ) : bool
리턴 bool

OpLeaveRoom() 공개 메소드

Leaves a room with option to come back later or "for good".
public OpLeaveRoom ( bool becomeInactive ) : bool
becomeInactive bool Async games can be re-joined (loaded) later on. Set to false, if you want to abandon a game entirely.
리턴 bool

OpRaiseEvent() 공개 메소드

Send an event with custom code/type and any content to the other players in the same room.
This override explicitly uses another parameter order to not mix it up with the implementation for Hashtable only.
public OpRaiseEvent ( byte eventCode, object customEventContent, bool sendReliable, RaiseEventOptions, raiseEventOptions ) : bool
eventCode byte Identifies this type of event (and the content). Your game's event codes can start with 0.
customEventContent object Any serializable datatype (including Hashtable like the other OpRaiseEvent overloads).
sendReliable bool If this event has to arrive reliably (potentially repeated if it's lost).
raiseEventOptions RaiseEventOptions, Contains (slightly) less often used options. If you pass null, the default options will be used.
리턴 bool

OpSetCustomPropertiesOfActor() 공개 메소드

public OpSetCustomPropertiesOfActor ( int actorNr, ExitGames.Client.Photon.Hashtable actorProperties ) : bool
actorNr int
actorProperties ExitGames.Client.Photon.Hashtable
리턴 bool

OpSetCustomPropertiesOfRoom() 공개 메소드

public OpSetCustomPropertiesOfRoom ( ExitGames.Client.Photon.Hashtable gameProperties, bool broadcast, byte channelId ) : bool
gameProperties ExitGames.Client.Photon.Hashtable
broadcast bool
channelId byte
리턴 bool

OpSetPropertiesOfActor() 보호된 메소드

Sets properties of a player / actor. Internally this uses OpSetProperties, which can be used to either set room or player properties.
protected OpSetPropertiesOfActor ( int actorNr, ExitGames.Client.Photon.Hashtable actorProperties, ExitGames.Client.Photon.Hashtable expectedProperties = null, bool webForward = false ) : bool
actorNr int The payer ID (a.k.a. actorNumber) of the player to attach these properties to.
actorProperties ExitGames.Client.Photon.Hashtable The properties to add or update.
expectedProperties ExitGames.Client.Photon.Hashtable If set, these must be in the current properties-set (on the server) to set actorProperties: CAS.
webForward bool Set to true, to forward the set properties to a WebHook, defined for this app (in Dashboard).
리턴 bool

OpSetPropertiesOfRoom() 보호된 메소드

Sets properties of a room. Internally this uses OpSetProperties, which can be used to either set room or player properties.
protected OpSetPropertiesOfRoom ( ExitGames.Client.Photon.Hashtable gameProperties, ExitGames.Client.Photon.Hashtable expectedProperties = null, bool webForward = false ) : bool
gameProperties ExitGames.Client.Photon.Hashtable The properties to add or update.
expectedProperties ExitGames.Client.Photon.Hashtable The properties expected when update occurs. (CAS : "Check And Swap")
webForward bool "WebFlag" to indicate if request should be forwarded as "PathProperties" webhook or not.
리턴 bool

OpSetPropertyOfRoom() 보호된 메소드

protected OpSetPropertyOfRoom ( byte propCode, object value ) : void
propCode byte
value object
리턴 void

OpSettings() 공개 메소드

Internally used operation to set some "per server" settings. This is for the Master Server.
public OpSettings ( bool receiveLobbyStats ) : bool
receiveLobbyStats bool Set to true, to get Lobby Statistics (lists of existing lobbies).
리턴 bool