Example #1
0
 private void OnGetOtherPlayerIdentity(PlayerIdentityGetResponse response, object cookie)
 {
     this.otherPlayerIdentityInfo = response.Info;
     PlayerIdentityController.GetOtherPlayerIdentityCallback getOtherPlayerIdentityCallback = cookie as PlayerIdentityController.GetOtherPlayerIdentityCallback;
     if (getOtherPlayerIdentityCallback != null)
     {
         getOtherPlayerIdentityCallback(this.otherPlayerIdentityInfo);
     }
 }
Example #2
0
 public void GetOtherPlayerIdentity(PlayerIdentityController.GetOtherPlayerIdentityCallback callback)
 {
     if (this.otherPlayerIdentityInfo != null)
     {
         if (callback != null)
         {
             callback(this.otherPlayerIdentityInfo);
         }
     }
     else
     {
         int identityIndex = (!this.IsFirstIdentity(Service.CurrentPlayer.PlayerId)) ? 0 : 1;
         PlayerIdentityGetCommand playerIdentityGetCommand = new PlayerIdentityGetCommand(new PlayerIdentityRequest
         {
             IdentityIndex = identityIndex
         });
         playerIdentityGetCommand.AddSuccessCallback(new AbstractCommand <PlayerIdentityRequest, PlayerIdentityGetResponse> .OnSuccessCallback(this.OnGetOtherPlayerIdentity));
         playerIdentityGetCommand.Context = callback;
         Service.ServerAPI.Sync(playerIdentityGetCommand);
     }
 }