private void GuestEnter(Puben pub, PubSettings userPubSettings) { pub.guestsInPub++; LogText?.Invoke($"{Name} enters BaBar, and goes to the bar", this); TimeToWait(userPubSettings.GuestWalkToBar, userPubSettings.PubSimulationSpeed); pub.QueueAtBar.Add(this); }
private void GuestLeaves(Puben pub, PubSettings userPubSettings) { pub.dirtyGlasses.itemCollection.Add(pub.dirtyGlass); LogText?.Invoke($"{Name} leaves the bar", this); pub.chairs.itemBag.Add(pub.chair); pub.guestsInPub--; }
private void Log(string text) { if (LogText.InvokeRequired) { LogText.Invoke(new Action(() => Log(text))); return; } LogText.AppendText(text + Environment.NewLine); }
private void GuestDrinks(Puben pub, PubSettings userPubSettings) { pub.chairs.itemBag.TryTake(out pub.chair); LogText?.Invoke($"{Name} sits down and drinks the beer", this); TimeToWait(pub.random.Next(userPubSettings.GuestDrinkBeerMinTime, userPubSettings.GuestDrinkBeerMaxTime), userPubSettings.PubSimulationSpeed); }
private void GuestLookingForChair(Puben pub, PubSettings userPubSettings) { LogText?.Invoke($"{Name} takes the beer and looks for a chair", this); TimeToWait(userPubSettings.GuestWalkToChair, userPubSettings.PubSimulationSpeed); }
protected virtual void OnRequestLogUpdated(SpecialEvent e) => LogText?.Invoke(this, e);
//log the correct message public void LogMessage(string text) { LogAppendDelegate la = new LogAppendDelegate(LogAppend); LogText.Invoke(la, Color.Black, DateTime.Now.ToString("HH:mm:ss ") + text); }
//log the error message public void LogError(string text) { LogAppendDelegate la = new LogAppendDelegate(LogAppend); LogText.Invoke(la, Color.Red, DateTime.Now.ToString("HH:mm:ss ") + text); }