zoukankan      html  css  js  c++  java
  • Photon3Unity3D.dll 解析一

    IPhotonPeerListener  Photon客户端回调接口

       1:  //只要有来自Photon Server的事件就触发
       2:  public virtual void OnEvent( EventData photonEvent )
       3:  {
       4:      this.DebugReturn( String.Format( "OnEvent: {0}", photonEvent.ToStringFull() ) );
       5:  }
       6:   
       7:  //当状态改变时调用
       8:  public virtual void OnStatusChanged( StatusCode statusCode )
       9:  {
      10:      this.DebugReturn( String.Format( "OnStatusChanged: {0}", statusCode ) );
      11:   
      12:      switch (statusCode)
      13:      {
      14:          case StatusCode.Connect:
      15:              this.State = ClientState.Connected;
      16:              break;
      17:          case StatusCode.Disconnect:
      18:              this.State = ClientState.Disconnected;
      19:              this.ActorNumber = 0;
      20:              break;
      21:          case StatusCode.ExceptionOnConnect:
      22:              this.OfflineReason = "Connection failed.
    Is the server online? Firewall open?";
      23:              break;
      24:          case StatusCode.SecurityExceptionOnConnect:
      25:              this.OfflineReason = "Security Exception on connect.
    Most likely, the policy request failed.
    Is Photon and the Policy App running?";
      26:              break;
      27:          case StatusCode.Exception:
      28:              this.OfflineReason = "Communication terminated by Exception.
    Probably the server shutdown locally.
    Or the network connection terminated.";
      29:              break;
      30:          case StatusCode.TimeoutDisconnect:
      31:              this.OfflineReason = "Disconnect due to timeout.
    Probably the server shutdown locally.
    Or the network connection terminated.";
      32:              break;
      33:          case StatusCode.DisconnectByServer:
      34:              this.OfflineReason = "Timeout Disconnect by server.
    The server did not get responses in time.";
      35:              break;
      36:          case StatusCode.DisconnectByServerLogic:
      37:              this.OfflineReason = "Disconnect by server.
    The servers logic (application) disconnected this client for some reason.";
      38:              break;
      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.";
      41:              break;
      42:          default:
      43:              this.DebugReturn( "StatusCode not handled: " + statusCode );
      44:              break;
      45:      }
      46:  }
      47:   
      48:  //当操作响应时调用
      49:  public virtual void OnOperationResponse( OperationResponse operationResponse )
      50:  {
      51:      this.DebugReturn( String.Format( "OnOperationResponse: {0}", operationResponse.ToStringFull() ) );
      52:   
      53:      switch (operationResponse.OperationCode)
      54:      {
      55:          case (byte)LiteOpCode.Join:
      56:              this.State = ClientState.InRoom;
      57:              this.ActorNumber = (int)operationResponse[(byte)LiteOpKey.ActorNr];
      58:              break;
      59:          case (byte)LiteOpCode.Leave:
      60:              this.State = ClientState.Connected;
      61:              break;
      62:      }
      63:  }
      64:   
      65:  //服务端主动发出的信息通知
      66:  public void DebugReturn( DebugLevel level, string message )
      67:  {
      68:      this.DebugReturn( message );
      69:  }

    image

  • 相关阅读:
    Flash 终将谢幕:微软将于年底( 2020 年 )停止对 Flash 的支持
    分布式id生成方案总结
    如何设计一个亿级网关(API Gateway)?
    服务之间的调用为啥不直接用 HTTP 而用 RPC?
    Dubbo 总结:关于 Dubbo 的重要知识点
    CAP理论解读
    单点登录(SSO)的设计与实现
    入职微软三个月把老板炒了,七个月自己跑路是一种怎样的体验?
    有关链表的小技巧,我都给你总结好了
    排序算法入门之「选择排序」
  • 原文地址:https://www.cnblogs.com/huntdream/p/3362172.html
Copyright © 2011-2022 走看看