Esempio n. 1
0
 public override void FinishedReadingNode(Node node) {
     var obj = (ObjectBase)node;
     if ("Prisoner".Equals(obj.Type)) {
         var prisoner = new Prisoner(obj);
         Prisoners.Add(prisoner.Id, prisoner);
     } else {
         OtherObjects.Add(obj.Id, obj);
     }
 }
Esempio n. 2
0
        public override void FinishedReadingNode(Node node)
        {
            var obj = (ObjectBase)node;

            if ("Prisoner".Equals(obj.Type))
            {
                var prisoner = new Prisoner(obj);
                Prisoners.Add(prisoner.Id, prisoner);
            }
            else
            {
                OtherObjects.Add(obj.Id, obj);
            }
        }
Esempio n. 3
0
        void LoadPrisonToGui() {
            // Load general tab
            nDay.Value = TimeConversion.IndexToDay(prison.TimeIndex);
            tTime.Text = String.Format("{0:00}:{1:00}",
                                       TimeConversion.IndexTo12Hour(prison.TimeIndex),
                                       TimeConversion.IndexToMinute(prison.TimeIndex));
            cAmPm.SelectedIndex = (TimeConversion.IsPm(prison.TimeIndex) ? 1 : 0);

            xMisconduct.Checked = prison.EnabledMisconduct;
            xContinuousIntake.Checked = prison.EnabledIntake;
            xFogOfWar.Checked = prison.EnabledVisibility;
            xFailureConditions.Checked = prison.FailureConditions;
            xDecay.Checked = prison.EnabledDecay;

            // Load finances tab
            xUnlimitedFunds.Checked = prison.UnlimitedFunds;
            nBalance.Value = prison.Finance.Balance;
            nBankLoanAmount.Value = prison.Finance.BankLoan;
            nCreditRating.Value = Convert.ToDecimal(prison.Finance.BankCreditRating*100);
            nOwnership.Value = Convert.ToDecimal(prison.Finance.Ownership);

            // Load prisoners tab
            UpdatePrisoners();
            SelectedPrisoner = null;

            // Load research tab
            clbResearch.Items.Clear();
            clbResearch.Items.AddRange(ResearchData.GetInGameNames());
            if (prison.Research != null) {
                foreach (ResearchItem item in prison.Research.Items) {
                    if (item.Label == "None") continue;
                    int idx = ResearchData.GetIndex(item.Label);
                    if (idx < 0) {
                        idx = ResearchData.AddItem(item.Label);
                        clbResearch.Items.Add(item.Label);
                    }
                    if (item.Progress > .999) {
                        clbResearch.SetItemChecked(idx, true);
                    }
                }
            }

            int numContraband = CountContraband();
            miRemoveAllContraband.Text = String.Format("Remove all contraband ({0})", numContraband);
            miRemoveAllContraband.Enabled = (numContraband > 0);

            int numTrees = prison.Objects.OtherObjects
                                 .Values .Count(obj => obj.Type == "Tree");
            miRemoveAllTrees.Text = String.Format("Remove all trees ({0})", numTrees);
            miRemoveAllTrees.Enabled = (numTrees > 0);
        }
Esempio n. 4
0
 void bEliminate_Click(object sender, EventArgs e) {
     PrisonerUtil.EliminatePrisoner(prison, SelectedPrisoner.Id);
     SelectedPrisoner = null;
     UpdatePrisoners();
 }
Esempio n. 5
0
 void lbPrisoners_SelectedIndexChanged(object sender, EventArgs e) {
     SelectedPrisoner = prison.Objects.Prisoners.Values.ToArray()[lbPrisoners.SelectedIndex];
 }
Esempio n. 6
0
 // Updates list on the "Prisoners" tab. Resets SelectedPrisoner.
 void UpdatePrisoners() {
     lbPrisoners.Items.Clear();
     prisonerNames = prison.Objects.Prisoners.Values
                           .Select(PrisonerUtil.NamePrisoner)
                           .ToArray();
     lbPrisoners.Items.AddRange(prisonerNames);
     if (!prison.Objects.Prisoners.Values.Contains(selectedPrisoner)) {
         SelectedPrisoner = null;
     }
     UpdatePrisonerCounts();
 }
Esempio n. 7
0
 public static string NamePrisoner(Prisoner prisoner) {
     string nickName;
     if (UnnamedPrisoners.TryGetValue(prisoner.Bio.Nitg, out nickName)) {
         // Fix for nameless prisoners
         return '"' + nickName + '"';
     } else {
         return prisoner.Bio.Forname + " " + prisoner.Bio.Surname;
     }
 }