Beispiel #1
0
        public static void SendUpdate(int gameId, int shipId, UpdateToClient update)
        {
            var groupName = GetShipGroupName(gameId, shipId);

            var context = GlobalHost.ConnectionManager.GetHubContext<GameHub>();

            //if (groupsWorking)
            //{
            //var group = context.Clients.Group(groupName);
            //group.handleUpdate(update);
            //}
            //else
            context.Clients.All.handleUpdate(update);
        }
Beispiel #2
0
 internal void SendUpdate()
 {
     if (Players.Count > 0)
     {
         var update = new UpdateToClient() { GameId = Game.Id, ShipId = Id, Energy = (int)this.Energy, FrontShield = (int)Shields[0].Strength, RearShield = (int)Shields[2].Strength, LeftShield = (int)Shields[3].Strength, RightShield = (int)Shields[1].Strength, ShieldsEngaged = this.ShieldsEngaged };
         foreach (var entity in StarSystem.Entites)
         {
             if (entity.Sounds.Count > 0)
                 update.Sounds.AddRange(entity.Sounds);
             update.Entities.Add(new EntityUpdate() { Id = entity.Id, Type = entity.Type, Rotation = (float)entity.Orientation, Position = entity.Position });
         }
         if (missionState != null)
             update.missionUpdate = missionState.getMissionStatusUpdate();
         GameHub.SendUpdate(Game.Id, Id, update);
         System.Diagnostics.Debug.WriteLine("Update Sent. Mission status:" + update.missionUpdate);
     }
 }