public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo g in base.GetGizmos()) { yield return(g); } if (this.def.building.bed_humanlike && base.Faction == Faction.OfPlayer) { Command_Toggle pris = new Command_Toggle(); pris.defaultLabel = "CommandBedSetForPrisonersLabel".Translate(); pris.defaultDesc = "CommandBedSetForPrisonersDesc".Translate(); pris.icon = ContentFinder <Texture2D> .Get("UI/Commands/ForPrisoners", true); pris.isActive = new Func <bool>(this.get_ForPrisoners); pris.toggleAction = delegate() { this.ToggleForPrisonersByInterface(); }; if (!Building_Bed.RoomCanBePrisonCell(this.GetRoom(RegionType.Set_Passable)) && !this.ForPrisoners) { pris.Disable("CommandBedSetForPrisonersFailOutdoors".Translate()); } pris.hotKey = KeyBindingDefOf.Misc3; pris.turnOffSound = null; pris.turnOnSound = null; yield return(pris); yield return(new Command_Toggle { defaultLabel = "CommandBedSetAsMedicalLabel".Translate(), defaultDesc = "CommandBedSetAsMedicalDesc".Translate(), icon = ContentFinder <Texture2D> .Get("UI/Commands/AsMedical", true), isActive = new Func <bool>(this.get_Medical), toggleAction = delegate() { this.Medical = !this.Medical; }, hotKey = KeyBindingDefOf.Misc2 }); if (!this.ForPrisoners && !this.Medical) { yield return(new Command_Action { defaultLabel = "CommandBedSetOwnerLabel".Translate(), icon = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner", true), defaultDesc = "CommandBedSetOwnerDesc".Translate(), action = delegate() { Find.WindowStack.Add(new Dialog_AssignBuildingOwner(this)); }, hotKey = KeyBindingDefOf.Misc3 }); } } yield break; }
public override void DrawExtraSelectionOverlays() { base.DrawExtraSelectionOverlays(); Room room = this.GetRoom(RegionType.Set_Passable); if (room != null && Building_Bed.RoomCanBePrisonCell(room)) { room.DrawFieldEdges(); } }
public override IEnumerable <Gizmo> GetGizmos() { using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator()) { if (enumerator.MoveNext()) { Gizmo g = enumerator.Current; yield return(g); /*Error: Unable to find new state assignment for yield return*/; } } if (!base.def.building.bed_humanlike) { yield break; } if (base.Faction != Faction.OfPlayer) { yield break; } Command_Toggle pris = new Command_Toggle { defaultLabel = "CommandBedSetForPrisonersLabel".Translate(), defaultDesc = "CommandBedSetForPrisonersDesc".Translate(), icon = ContentFinder <Texture2D> .Get("UI/Commands/ForPrisoners", true), isActive = this.get_ForPrisoners, toggleAction = delegate { ((_003CGetGizmos_003Ec__Iterator1) /*Error near IL_0158: stateMachine*/)._0024this.ToggleForPrisonersByInterface(); } }; if (!Building_Bed.RoomCanBePrisonCell(this.GetRoom(RegionType.Set_Passable)) && !this.ForPrisoners) { pris.Disable("CommandBedSetForPrisonersFailOutdoors".Translate()); } pris.hotKey = KeyBindingDefOf.Misc3; pris.turnOffSound = null; pris.turnOnSound = null; yield return((Gizmo)pris); /*Error: Unable to find new state assignment for yield return*/; IL_0355: /*Error near IL_0356: Unexpected return in MoveNext()*/; }
private void ToggleForPrisonersByInterface() { if (Building_Bed.lastPrisonerSetChangeFrame == Time.frameCount) { return; } Building_Bed.lastPrisonerSetChangeFrame = Time.frameCount; bool newForPrisoners = !this.ForPrisoners; SoundDef soundDef = (!newForPrisoners) ? SoundDefOf.CheckboxTurnedOff : SoundDefOf.CheckboxTurnedOn; soundDef.PlayOneShotOnCamera(null); List <Building_Bed> bedsToAffect = new List <Building_Bed>(); foreach (Building_Bed current in (from so in Find.Selector.SelectedObjects where so is Building_Bed select so).Cast <Building_Bed>()) { if (current.ForPrisoners != newForPrisoners) { Room room = current.GetRoom(RegionType.Set_Passable); if (room == null || !Building_Bed.RoomCanBePrisonCell(room)) { if (!bedsToAffect.Contains(current)) { bedsToAffect.Add(current); } } else { foreach (Building_Bed current2 in room.ContainedBeds) { if (!bedsToAffect.Contains(current2)) { bedsToAffect.Add(current2); } } } } } Action action = delegate { List <Room> list = new List <Room>(); foreach (Building_Bed current4 in bedsToAffect) { Room room2 = current4.GetRoom(RegionType.Set_Passable); current4.ForPrisoners = (newForPrisoners && !room2.TouchesMapEdge); for (int j = 0; j < this.SleepingSlotsCount; j++) { Pawn curOccupant = this.GetCurOccupant(j); if (curOccupant != null) { curOccupant.jobs.EndCurrentJob(JobCondition.InterruptForced, true); } } if (!list.Contains(room2) && !room2.TouchesMapEdge) { list.Add(room2); } } foreach (Room current5 in list) { current5.Notify_RoomShapeOrContainedBedsChanged(); } }; if ((from b in bedsToAffect where b.owners.Any <Pawn>() && b != this select b).Count <Building_Bed>() == 0) { action(); } else { StringBuilder stringBuilder = new StringBuilder(); if (newForPrisoners) { stringBuilder.Append("TurningOnPrisonerBedWarning".Translate()); } else { stringBuilder.Append("TurningOffPrisonerBedWarning".Translate()); } stringBuilder.AppendLine(); foreach (Building_Bed current3 in bedsToAffect) { if ((newForPrisoners && !current3.ForPrisoners) || (!newForPrisoners && current3.ForPrisoners)) { for (int i = 0; i < current3.owners.Count; i++) { stringBuilder.AppendLine(); stringBuilder.Append(current3.owners[i].NameStringShort); } } } stringBuilder.AppendLine(); stringBuilder.AppendLine(); stringBuilder.Append("AreYouSure".Translate()); Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(stringBuilder.ToString(), action, false, null)); } }