示例#1
0
 public void Run()
 {
     pub.Log("Arrived", LogBox.Waitress);
     Task.Run(() =>
     {
         while (pub.IsOpen || pub.Shelf.Count != pub.Options.NumberOfGlasses || (pub.WaitingPatrons.Count + pub.BarDisk.Count) > 0)
         {
             TakeEmptyGlasses();
             PlaceGlasses();
         }
         pub.Log("Left the bar with her best friend, the bartender.\n", LogBox.Waitress);
         pub.WaitressIsPresent = false;
     }, pub.mainWindow.token);
 }
示例#2
0
        private void CreatePatron()
        {
            if (pub.Options.BadGuyBouncer)
            {
                if (pub.TimeUntilClosing <= 100)
                {
                    pub.Options.BadGuyBouncer = false;
                    pub.Log("Oh shit, a bus full of tourists!", LogBox.Event);

                    for (int i = 0; i < 15; i++)
                    {
                        new Patron(pub).Run();
                    }
                }
                else
                {
                    new Patron(pub).Run();
                }
            }
            else if (pub.Options.CouplesNight)
            {
                new Patron(pub).Run();
                new Patron(pub).Run();
            }
            else
            {
                new Patron(pub).Run();
            }
        }
示例#3
0
        public void Run()
        {
            pub.Log("Arrived", LogBox.Bartender);

            Task.Run(() =>
            {
                while (pub.IsOpen || (pub.WaitingPatrons.Count + pub.BarDisk.Count) > 0)
                {
                    if (currentPatron == null)
                    {
                        TryGetPatron();
                    }
                    else
                    {
                        if (currentGlass == null)
                        {
                            TryGetGlass();
                        }
                        else
                        {
                            pub.Log($"Pouring beer for {currentPatron.Name}", LogBox.Bartender);
                            Thread.Sleep((int)(pub.Options.BartenderPourTiming / pub.Options.Speed));
                            pub.mainWindow.pauseBartender.WaitOne();
                            lock (pub.BarDisk)
                            {
                                pub.BarDisk.Add(currentPatron, currentGlass);
                            }
                            currentPatron = null;
                            currentGlass  = null;
                        }
                    }
                }
                WaitForPatronsAndLoveInterestWaitress();
            }, pub.mainWindow.token);
        }
示例#4
0
        public void Run()
        {
            Console.WriteLine($"{Name} enqueued");
            Task.Run(() =>
            {
                Thread.Sleep((int)(pub.Options.PatronArriveTiming / pub.Options.Speed));
                pub.WaitingPatrons.Enqueue(this);

                pub.mainWindow.pauseBouncerAndPatrons.WaitOne();
                Ready = true;
                Console.WriteLine($"{Name} ready");
                pub.Log($"{Name} is waiting to be served", LogBox.Patron);

                WaitForGlass();
                WaitForTable();
                DrinkAndLeave();
            }, pub.mainWindow.token);
        }