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); } }
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); }
void bEliminate_Click(object sender, EventArgs e) { PrisonerUtil.EliminatePrisoner(prison, SelectedPrisoner.Id); SelectedPrisoner = null; UpdatePrisoners(); }
void lbPrisoners_SelectedIndexChanged(object sender, EventArgs e) { SelectedPrisoner = prison.Objects.Prisoners.Values.ToArray()[lbPrisoners.SelectedIndex]; }
// 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(); }
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; } }