Ejemplo n.º 1
0
 void OnMyFrameAcknowledged(int frameIndex, int peerId)
 {
     // my peer has acknowledged the frame, so my
     // input is ready to be processed
     // make sure to set all frames prior to this one acknowledged too
     SimulationClock.SetReadyForFrame(frameIndex, MyPeerId, allPrior: true);
 }
Ejemplo n.º 2
0
        public void ServeFood(int tableNumber)
        {
            StartAction("Sert les plats à la table " + tableNumber, 2);
            Table tableToServe = diningRoom.Tables.Find(t => t.TableNumber == tableNumber);

            tableToServe.LastTimeOrderWasTakenCareOf = SimulationClock.GetInstance().SimulationDateTime;
            //List<Plate> platesReadyToServe = diningRoom.Countertop.PlatesToServe;
            //foreach (var plate in pTS)
            //{
            //    diningRoom.Countertop.Orders.First(x => x.Orders.Values.ToList()
            //    .ForEach(i => { if (i.DishName.Equals(plate.Dish.DishName) && x.CourseType.Equals(plate.Dish.CourseType)) { pTS.Remove(plate); } }));
            //}
            foreach (var order in tableToServe.OrderedDishes.Where(x => x.CourseType == tableToServe.NextCourseToServe))
            {
                lock (Countertop.LockObjPlatesToServe)
                {
                    foreach (var plat in diningRoom.Countertop.PlatesToServe)
                    {
                        if (order.DishName == plat.Dish.DishName)
                        {
                            tableToServe.ServedFood.Add(plat);
                            diningRoom.Countertop.PlatesToServe.Remove(plat);
                            break;
                        }
                    }
                }
            }
            tableToServe.NextCourseToServe++;
            EndAction();
            //Passer au CourseType suivant
        }
Ejemplo n.º 3
0
        //		protected int m_greatestFrameFromNetwork = -1;

        void OnReceivedFrameFromNetwork(int frameIndex, int peerId)
        {
            var simulationFrame = Network.GetSimulationFrame(frameIndex);

            Simulation.SetOrExtendFrame(frameIndex, simulationFrame);
            // I have received data from the peer
            SimulationClock.SetReadyForFrame(frameIndex, peerId);
        }
        public void TakeOrders(int tableNumber)
        {
            StartAction("Prend les commandes à la table " + tableNumber, 1);
            Table table = diningRoom.Tables.First(x => x.TableNumber == tableNumber);

            foreach (var customer in table.SeatedCustomers)
            {
                customer.ChooseRecipes(table.OrderedDishes);
            }
            GiveOrdersToKitchen(tableNumber);
            table.LastTimeOrderWasTakenCareOf = SimulationClock.GetInstance().SimulationDateTime;
            EndAction();
        }
Ejemplo n.º 5
0
 public ControllerFacade(IModel model, IView view)
 {
     this.model      = model;
     this.view       = view;
     simulationClock = SimulationClock.GetInstance();
     simulationClock.ChangeSimulationSpeed(RealSecondsFor1MinuteInSimulation);
     while (view.MainWindow?.settings?.parameters == null)
     {
     }
     model.DiningRoom.Countertop.SubscribeToNewPlateIsReady(this);
     view.MainWindow.SubscribeToUserInputObserve(this);
     view.MainWindow.settings.parameters.SubscribeToParametersConfigured(this);
     SimulationTimeOfServiceStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 19, 0, 0);
 }