Exemplo n.º 1
0
        public static void AddBuilding(int fromClient, Packet packet)
        {
            int baseID   = packet.ReadInt();
            var instance = packet.ReadBuildingInstanceData();
            int oldID    = instance.ID;
            int newID;

            using (var provider = new ServiceProvider())
            {
                provider.AddBuilding(instance);
                var baseData = provider.BaseDataService.Get(baseID);
                baseData.Buildings.Add(instance);
                provider.SaveChanges();
                newID = instance.ID;
            }

            ServerSend.BuildingAdded(fromClient, oldID, newID);
        }