Exemplo n.º 1
0
 public void OnResponse(OperationResponse operationResponse, PhotonService service)
 {
     // 判断事件类型并调用对应的方法
     switch (operationResponse.OperationCode)
     {
         // 玩家角色进入场景
         case (byte) OperationCode.WorldEnter:
             OnEnter(operationResponse, service);
             break;
     }
 }
Exemplo n.º 2
0
 public void OnEvent(EventData eventData, PhotonService service)
 {
     // 判断事件类型并调用对应的方法
     switch (eventData.Code)
     {
         // 玩家角色进入场景
         case (byte) EventCode.WorldEnter:
             OnEnter(eventData, service);
             break;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 类型:方法
 /// 名称:Awake
 /// 作者:taixihuase
 /// 作用:创建单例
 /// 编写日期:2015/7/17
 /// </summary>
 void Awake()
 {
     // 若当前不存在单例,则创建单例并实例化客户端服务进程
     if (_instance == null)
     {
         _instance = this;
         Service   = new PhotonService();
         DontDestroyOnLoad(this);
     }
     else
     {
         // 若已存在一个单例,则销毁该单例所挂载的对象
         if (this != _instance)
         {
             Destroy(gameObject);
         }
     }
 }
Exemplo n.º 4
0
 public void OnResponse(OperationResponse operationResponse, PhotonService service)
 {
     Character character = (Character)
         Serialization.Deserialize(operationResponse.Parameters[(byte) ParameterCode.CreateCharacter]);
     LoadCharacterEventArgs e = new LoadCharacterEventArgs(character);
     FindObjectOfType<LoadCharacter>().OnLoad(service, e);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 类型:方法
 /// 名称:Awake
 /// 作者:taixihuase
 /// 作用:创建单例
 /// 编写日期:2015/7/17
 /// </summary>
 void Awake()
 {
     // 若当前不存在单例,则创建单例并实例化客户端服务进程
     if (_instance == null)
     {
         _instance = this;
         Service = new PhotonService();
         DontDestroyOnLoad(this);
     }
     else
     {
         // 若已存在一个单例,则销毁该单例所挂载的对象
         if (this != _instance)
         {
             Destroy(gameObject);
         }
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 类型:方法
 /// 名称:OnEnter
 /// 作者:taixihuase
 /// 作用:当有玩家进入场景时,触发事件
 /// 编写日期:2015/7/22
 /// </summary>
 /// <param name="eventData"></param>
 /// <param name="service"></param>
 private void OnEnter(EventData eventData, PhotonService service)
 {
     WorldEnterEventArgs e = new WorldEnterEventArgs(eventData);
     PhotonService.Events.OnWorldEnter(service, e);
 }
Exemplo n.º 7
0
 /// <summary>
 /// 类型:方法
 /// 名称:OnEnter
 /// 作者:taixihuase
 /// 作用:当自身角色进入场景时,触发事件
 /// 编写日期:2015/7/22
 /// </summary>
 /// <param name="operationResponse"></param>
 /// <param name="service"></param>
 private void OnEnter(OperationResponse operationResponse, PhotonService service)
 {
     WorldEnterEventArgs e = new WorldEnterEventArgs(operationResponse);
     PhotonService.Events.OnWorldEnter(service, e);
 }
Exemplo n.º 8
0
 public void OnResponse(OperationResponse operationResponse, PhotonService service)
 {
     LoginEventArgs e = new LoginEventArgs(operationResponse);
     PhotonService.Events.OnLogin(service, e);
 }