Exemplo n.º 1
0
        async Task IHandle <PlayerLoggedIn> .Handle(PlayerLoggedIn message)
        {
            var generator = AttachedObject.GetComponent <ClientboundPacketComponent>().GetGenerator();

            // PositionAndLook
            var position      = AttachedObject.GetEntityWorldPosition();
            var lookComponent = AttachedObject.GetComponent <EntityLookComponent>();
            await generator.PositionAndLook(position.X, position.Y, position.Z, lookComponent.Yaw, lookComponent.Pitch, 0, AttachedObject.GetComponent <TeleportComponent>().StartNew());

            // Health
            var healthComponent = AttachedObject.GetComponent <HealthComponent>();
            var foodComponent   = AttachedObject.GetComponent <FoodComponent>();
            await generator.UpdateHealth(healthComponent.Health, healthComponent.MaxHealth, foodComponent.Food, foodComponent.MaxFood, foodComponent.FoodSaturation);

            // Experience
            var expComponent = AttachedObject.GetComponent <ExperienceComponent>();
            await generator.SetExperience(expComponent.ExperienceBar, expComponent.Level, expComponent.TotalExperience);

            // Inventory
            var slots = await AttachedObject.GetComponent <InventoryComponent>().GetInventoryWindow().GetSlots(AttachedObject);

            await generator.WindowItems(0, slots);

            InstallPropertyChangedHandlers();
        }
Exemplo n.º 2
0
        async Task IHandle <PlayerLoggedIn> .Handle(PlayerLoggedIn message)
        {
            _loaded = false;
            await _chunkLoader.JoinGame(AttachedObject.GetWorld(), AttachedObject);

            _loaded = true;
        }
Exemplo n.º 3
0
 Task IHandle <PlayerLoggedIn> .Handle(PlayerLoggedIn message)
 {
     _keepAliveWaiters.Clear();
     _isOnline = true;
     AttachedObject.GetComponent <GameTickComponent>()
     .Tick += OnGameTick;
     return(Task.CompletedTask);
 }
Exemplo n.º 4
0
 Task IHandle <PlayerLoggedIn> .Handle(PlayerLoggedIn message)
 {
     CompleteSpawn();
     AttachedObject.QueueOperation(() =>
     {
         return(GrainFactory.GetGrain <IWorldPartition>(AttachedObject.GetAddressByPartitionKey()).Enter(AttachedObject));
     });
     return(Task.CompletedTask);
 }
Exemplo n.º 5
0
 async Task IHandle <PlayerLoggedIn> .Handle(PlayerLoggedIn message)
 {
     await SendPlayerListAddPlayer(new[] { AttachedObject });
 }