Exemplo n.º 1
0
        internal async Task UpdateFateView(HeistHub hub, bool setOkayButton = true)
        {
            // Update idle people with some more information
            switch (this.PreviousStatus)
            {
            case HeistPlayer.Status.InJail:
                if (this.YearsLeftInJail <= 0)
                {
                    var message = TextGenerator.FreeFromJail;
                    await hub.UpdateHeistStatus(this, message.Item1, message.Item2, setOkayButton);
                }
                else
                {
                    var message = TextGenerator.StillInJail;
                    await hub.UpdateHeistStatus(this, message.Item1, string.Format(message.Item2, this.YearsLeftInJail), setOkayButton);
                }

                await hub.UpdateGlobalNews(this, this.Room.Players.Values, true /*NewToJail*/, false /*HeistUpdates*/);

                break;

            case HeistPlayer.Status.FindingHeist:
                var vacationMessage = TextGenerator.VacationEnded;
                await hub.UpdateHeistStatus(this, vacationMessage.Item1, vacationMessage.Item2, setOkayButton);

                await hub.UpdateGlobalNews(this, this.Room.Players.Values, true /*NewToJail*/, true /*HeistUpdates*/);

                break;

            case HeistPlayer.Status.HeistDecisionMade:
                await hub.UpdateHeistStatus(this, this.Decision.FateTitle, this.Decision.FateDescription, setOkayButton);

                if (this.Decision.GoOnHeist && this.Decision.FellowHeisters != null && this.Decision.FellowHeisters.Count > 0)
                {
                    await hub.UpdateHeistMeetup(this, this.Decision.FellowHeisters);
                }
                else if (!this.Decision.GoOnHeist && !this.Decision.ReportPolice)
                {
                    await hub.UpdateGlobalNews(this, this.Room.Players.Values, true /*NewToJail*/, true /*HeistUpdates*/);
                }

                if (!string.IsNullOrEmpty(this.Decision.FateSummary))
                {
                    await hub.UpdateHeistSummary(this, this.Decision.FateSummary);
                }

                break;
            }
        }