public static string DefaultRiskString(GamePlayer Player, GameAction Action) { if (Action.RiskPercent == 0) { return(null); } return(GameFormat.FormatPercent(Action.RiskPercent)); }
void RebuildStatus() { // Top status area LabelName.Content = HumanPlayer.Name; LabelPlayerPosition.Content = $"(#{HumanPlayer.Values.Rank})"; // Todo: compute LabelAge.Content = string.Format("Age: {0}", (int)Math.Floor(HumanPlayer.Age)); LabelTime.Content = string.Format("Q{0} {1}", GameEngine.Quarter, GameEngine.CurrentYear); LabelMoney.Content = GameFormat.FormatMoney(HumanPlayer.ThisRound.Money); double moneyPercent = 0; if (HumanPlayer.Values.Money != 0) { moneyPercent = (double)HumanPlayer.ThisRound.Money / HumanPlayer.Values.Money - 1; } LabelMoneyChange.Content = string.Format("({0})", GameFormat.FormatPercent(moneyPercent)); LabelMoneyChange.Foreground = moneyPercent < 0 ? Brushes.DarkRed : Brushes.DarkGreen; LabelFans.Content = GameFormat.FormatFans(HumanPlayer.ThisRound.FanCount); double fanPercent = 0; if (HumanPlayer.Values.FanCount != 0) { fanPercent = (double)HumanPlayer.ThisRound.FanCount / HumanPlayer.Values.FanCount - 1; } LabelFansChange.Content = string.Format("({0})", GameFormat.FormatPercent(fanPercent)); LabelFansChange.Foreground = fanPercent < 0 ? Brushes.DarkRed : Brushes.DarkGreen; // Side panel status LabelTimeRemaining.Content = string.Format("Time Remaining ({0})", GameFormat.FormatTime(HumanPlayer.ThisRound.TimeRemaining)); double TimeRemainingPercent = HumanPlayer.ThisRound.TimeRemaining / 90.0; BarTimeRemaining.SetPercent(TimeRemainingPercent, TimeRemainingPercent, false); double sentimentPercent = HumanPlayer.AffinityAsPercent(HumanPlayer.ThisRound.PublicSentiment); LabelPublicSentiment.Content = string.Format("Public Sentiment ({0})", GameFormat.FormatPercent(sentimentPercent)); BarPublicSentiment.SetPercent(sentimentPercent, sentimentPercent, true); double affinityProfessional = HumanPlayer.AffinityAsPercent(HumanPlayer.ThisRound.AffinityProfessional); LabelProfessionalAffinity.Content = string.Format("Professional Affinity ({0})", GameFormat.FormatPercent(affinityProfessional)); BarProfessionalAffinity.SetPercent(affinityProfessional, affinityProfessional, false); double affinityMedia = HumanPlayer.AffinityAsPercent(HumanPlayer.ThisRound.AffinityMedia); LabelMediaAffinity.Content = string.Format("Media Affinity ({0})", GameFormat.FormatPercent(affinityMedia)); BarMediaAffinity.SetPercent(affinityMedia, affinityMedia, false); double affinitySocial = HumanPlayer.AffinityAsPercent(HumanPlayer.ThisRound.AffinitySocial); LabelSocialAffinity.Content = string.Format("Social Affinity ({0})", GameFormat.FormatPercent(affinitySocial)); BarSocialAffinity.SetPercent(affinitySocial, affinitySocial, false); double affinityCriminal = HumanPlayer.AffinityAsPercent(HumanPlayer.ThisRound.AffinityCriminal); LabelCriminalAffinity.Content = string.Format("Criminal Affinity ({0})", GameFormat.FormatPercent(affinityCriminal)); BarCriminalAffinity.SetPercent(affinityCriminal, affinityCriminal, false); }