IPhotonPeerListener Photon客户端回调接口
1: //只要有来自Photon Server的事件就触发
2: public virtual void OnEvent( EventData photonEvent )
4: this.DebugReturn( String.Format( "OnEvent: {0}", photonEvent.ToStringFull() ) );
8: public virtual void OnStatusChanged( StatusCode statusCode )
10: this.DebugReturn( String.Format( "OnStatusChanged: {0}", statusCode ) );
14: case StatusCode.Connect:
15: this.State = ClientState.Connected;
17: case StatusCode.Disconnect:
18: this.State = ClientState.Disconnected;
19: this.ActorNumber = 0;
21: case StatusCode.ExceptionOnConnect:
22: this.OfflineReason = "Connection failed.
Is the server online? Firewall open?";
24: case StatusCode.SecurityExceptionOnConnect:
25: this.OfflineReason = "Security Exception on connect.
Most likely, the policy request failed.
Is Photon and the Policy App running?";
27: case StatusCode.Exception:
28: this.OfflineReason = "Communication terminated by Exception.
Probably the server shutdown locally.
Or the network connection terminated.";
30: case StatusCode.TimeoutDisconnect:
31: this.OfflineReason = "Disconnect due to timeout.
Probably the server shutdown locally.
Or the network connection terminated.";
33: case StatusCode.DisconnectByServer:
34: this.OfflineReason = "Timeout Disconnect by server.
The server did not get responses in time.";
36: case StatusCode.DisconnectByServerLogic:
37: this.OfflineReason = "Disconnect by server.
The servers logic (application) disconnected this client for some reason.";
39: case StatusCode.DisconnectByServerUserLimit:
40: this.OfflineReason = "Server reached it's user limit.
The server is currently not accepting connections.
The license does not allow it.";
43: this.DebugReturn( "StatusCode not handled: " + statusCode );
49: public virtual void OnOperationResponse( OperationResponse operationResponse )
51: this.DebugReturn( String.Format( "OnOperationResponse: {0}", operationResponse.ToStringFull() ) );
53: switch (operationResponse.OperationCode)
55: case (byte)LiteOpCode.Join:
56: this.State = ClientState.InRoom;
57: this.ActorNumber = (int)operationResponse[(byte)LiteOpKey.ActorNr];
59: case (byte)LiteOpCode.Leave:
60: this.State = ClientState.Connected;
66: public void DebugReturn( DebugLevel level, string message )
68: this.DebugReturn( message );