Exemple #1
0
        public override string ToString()
        {
            Common.StringBuilder text = new Common.StringBuilder();

            text += StoryProgression.Localize("Accounting:Header", false, new object[] { SimClock.ElapsedCalendarDays() - mStartDay });

            mValues.Sort(new Comparison <Value>(Value.SortByName));

            string result = null;

            int net = 0;

            foreach (Value value in mValues)
            {
                if (value.Amount > 0)
                {
                    result += value.ToString();

                    net += value.Amount;
                }
            }

            if (!string.IsNullOrEmpty(result))
            {
                text += Common.NewLine + Common.NewLine + StoryProgression.Localize("Accounting:Gain");
                text += result;
            }

            result = null;

            foreach (Value value in mValues)
            {
                if (value.Amount < 0)
                {
                    result += value.ToString();

                    net += value.Amount;
                }
            }

            if (!string.IsNullOrEmpty(result))
            {
                text += Common.NewLine + Common.NewLine + StoryProgression.Localize("Accounting:Loss");
                text += result;
            }

            text += Common.NewLine + Common.NewLine + StoryProgression.Localize("Accounting:Net", false, new object[] { net });

            return(text.ToString());
        }
Exemple #2
0
        protected SimDescription GetSelection()
        {
            if (Sim.ActiveActor == null)
            {
                return(null);
            }

            SimSelection sims = SimSelection.Create(this);

            if (sims.IsEmpty)
            {
                SimpleMessageDialog.Show(Name, StoryProgression.Localize("SimID:Error"));
                return(null);
            }

            return(sims.SelectSingle());
        }
Exemple #3
0
        protected override bool PrivatePerform()
        {
            string text = StringInputDialog.Show(Name, GetPrompt(), Value.ToString(), 256, StringInputDialog.Validation.None);

            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }

            int iValue = 0;

            if (!int.TryParse(text, out iValue))
            {
                SimpleMessageDialog.Show(Name, StoryProgression.Localize("Integer:Error"));
                return(false);
            }

            SetValue(Validate(iValue));
            return(true);
        }
Exemple #4
0
        public override void ApplyOverride(IGenericLevelOption paramOption, OverrideStyle style)
        {
            if ((style & OverrideStyle.MergeSet) == OverrideStyle.MergeSet)
            {
                AccountingData value = Value;
                if (value == null)
                {
                    return;
                }

                string result = Manager.House.Name;

                result += Common.NewLine + value.ToString();

                int assets = GetValue <AssetsOption, int>();
                int debt   = GetValue <DebtOption, int>();

                result += Common.NewLine + StoryProgression.Localize("Accounting:Assets", false, new object[] { assets });
                result += Common.NewLine + StoryProgression.Localize("Accounting:Debts", false, new object[] { debt });

                Common.Notify(result);
            }
        }
Exemple #5
0
        protected override bool PrivatePerform()
        {
            string text = StringInputDialog.Show(Name, Localize("Prompt"), Value.x.ToString() + " : " + Value.y.ToString(), 256, StringInputDialog.Validation.None);

            if (text == null)
            {
                return(false);
            }

            string[] range = text.Split(':');

            if (range.Length != 2)
            {
                SimpleMessageDialog.Show(Name, StoryProgression.Localize("Range:FormatError"));
                return(false);
            }

            float min;

            if (!float.TryParse(range[0].Trim(), out min))
            {
                SimpleMessageDialog.Show(Name, StoryProgression.Localize("Range:MinError"));
                return(false);
            }

            float max;

            if (!float.TryParse(range[1].Trim(), out max))
            {
                SimpleMessageDialog.Show(Name, StoryProgression.Localize("Range:MaxError"));
                return(false);
            }

            SetValue(Adjust(min, max));
            return(true);
        }
Exemple #6
0
 public override string ToString()
 {
     return(StoryProgression.Localize("Accounting:Body", false, new object[] { StoryProgression.Localize("AccountingValue:" + mKey), mValue }));
 }