Ejemplo n.º 1
0
 public virtual async Task <RoleEnterZoneResponse> DoPlayerEnterAsync(AreaZonePlayer player, RoleEnterZoneRequest enter)
 {
     if (await player.OnEnterAsync() == false)
     {
         log.Error("Can Not Find Session Or Logic : " + enter.roleSessionName + " : " + enter.roleUUID);
     }
     try
     {
         player.SessionReconnect();
         var tcs = new System.Threading.Tasks.TaskCompletionSource <RoleEnterZoneResponse>();
         this.node.PlayerEnter(player, ToAddUnit(enter), client =>
         {
             if (HasAddPlayer == false)
             {
                 HasAddPlayer = true;
             }
             client.Actor.SetAttribute(nameof(AreaZonePlayer.RoleSessionName), player.RoleSessionName);
             tcs.TrySetResult(new RoleEnterZoneResponse()
             {
                 s2c_code           = RoleEnterZoneResponse.CODE_OK,
                 mapTemplateID      = this.MapTemplateID,
                 zoneUUID           = this.ZoneUUID,
                 zoneTemplateID     = this.ZoneTemplateID,
                 roleBattleData     = enter.roleData,
                 roleDisplayName    = enter.roleDisplayName,
                 roleUnitTemplateID = enter.roleUnitTemplateID,
                 roleScenePos       = new ZonePosition()
                 {
                     x = client.Actor.X,
                     y = client.Actor.Y,
                     z = client.Actor.Z
                 },
                 areaName  = service.SelfAddress.ServiceName,
                 areaNode  = service.SelfAddress.ServiceNode,
                 guildUUID = enter.guildUUID,
             });
         }, err =>
         {
             tcs.TrySetResult(new RoleEnterZoneResponse()
             {
                 s2c_code = RoleEnterZoneResponse.CODE_ERROR,
                 s2c_msg  = err.Message,
             });
         });
         return(await tcs.Task);
     }
     catch (Exception err)
     {
         log.Error(err);
         return(new RoleEnterZoneResponse()
         {
             s2c_code = RoleEnterZoneResponse.CODE_ERROR,
             s2c_msg = err.Message,
         });
     }
 }
Ejemplo n.º 2
0
 public virtual void DoPlayerReconnect(AreaZonePlayer player)
 {
     player.SessionReconnect();
     this.node.PlayerReconnect(player, (client) => { }, (err) => { });
 }