public void Add(PlayAnimationPacket pkt) { lock (mAnimations) { mAnimations.Add(pkt); } }
//PlayAnimationPacket private static void HandlePacket(PlayAnimationPacket packet) { var mapId = packet.MapId; var animId = packet.AnimationId; var targetType = packet.TargetType; var entityId = packet.EntityId; if (targetType == -1) { var map = MapInstance.Get(mapId); if (map != null) { map.AddTileAnimation(animId, packet.X, packet.Y, packet.Direction); } } else if (targetType == 1) { if (Globals.Entities.ContainsKey(entityId)) { if (Globals.Entities[entityId] != null && !Globals.EntitiesToDispose.Contains(entityId)) { var animBase = AnimationBase.Get(animId); if (animBase != null) { var animInstance = new Animation( animBase, false, packet.Direction == -1 ? false : true, -1, Globals.Entities[entityId] ); if (packet.Direction > -1) { animInstance.SetDir(packet.Direction); } Globals.Entities[entityId].Animations.Add(animInstance); } } } } else if (targetType == 2) { var map = MapInstance.Get(mapId); if (map != null) { if (map.LocalEntities.ContainsKey(entityId)) { if (map.LocalEntities[entityId] != null) { var animBase = AnimationBase.Get(animId); if (animBase != null) { var animInstance = new Animation( animBase, false, packet.Direction == -1 ? true : false, -1, map.LocalEntities[entityId] ); if (packet.Direction > -1) { animInstance.SetDir(packet.Direction); } map.LocalEntities[entityId].Animations.Add(animInstance); } } } } } }