public override void ProcessInput(Event ev) { base.ProcessInput(ev); if (this.keycards is null) { this.keycards = new List <CompKeycard>(); } if (!this.keycards.Contains(this.keycard)) { this.keycards.Add(this.keycard); } int startLevel = this.keycards is null ? 1 : keycards.Min(x => x.Level); Func <int, string> textGetter; textGetter = ((int x) => "SCP_SetKeycard".Translate(x)); Dialog_Keycard window = new Dialog_Keycard(textGetter, 1, 5, delegate(int value) { foreach (CompKeycard key in this.keycards) { key.Level = (int)value; } }, startLevel); Find.WindowStack.Add(window); }
public override void ProcessInput(Event ev) { base.ProcessInput(ev); if (this.pawns is null) { this.pawns = new List <Pawn>(); } if (!this.pawns.Contains(this.pawn)) { this.pawns.Add(this.pawn); } int level = pawn.def.GetModExtension <KeycardHandler>().AccessLevel; Func <int, string> textGetter; textGetter = ((int x) => "SCP_SetKeycard".Translate(x)); Dialog_Keycard window = new Dialog_Keycard(textGetter, 1, 5, delegate(int value) { foreach (Pawn p in pawns) { pawn.def.GetModExtension <KeycardHandler>().AccessLevel = (int)value; } }, level); Find.WindowStack.Add(window); }