private List <FloatMenuOption> GetFloatMenuOptions(ScheduledDay day) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (ReligionProperty property in SelFacility.AssignedReligion.GetSettings <ReligionSettings_ReligionActivity>(SettingsTagDefOf.ActivityTag).Properties) { ActivityTaskDef taskDef = property.GetObject <ActivityTaskDef>(); list.Add(new FloatMenuOption(taskDef.label, (Action)(() => { if (!this.SelFacility.Map.mapPawns.FreeColonists.Any <Pawn>(x => x.GetReligionComponent().Religion == SelFacility.AssignedReligion)) { CreateNoPawnsOfReligionDialog(SelFacility.AssignedReligion); } ActivityTask task = new ActivityTask(day, property); if (TaskManager.DefaultPawn != null) { task.PawnRestriction = TaskManager.DefaultPawn; } day.Add(task); day.Reorder(); }), MenuOptionPriority.Default, (Action)null, (Thing)null, 29f, (Func <Rect, bool>)(rect => Widgets.InfoCardButton(rect.x + 5f, rect.y + (float)(((double)rect.height - 24.0) / 2.0), taskDef)), (WorldObject)null)); } if (!list.Any <FloatMenuOption>()) { list.Add(new FloatMenuOption("NoneBrackets".Translate(), (Action)null, MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } return(list); }
private void DrawDay(Rect rect, int dayNumber) { ScheduledDay day = TaskManager.ScheduledDays.FirstOrDefault(x => x.DayNumber == dayNumber); Widgets.DrawBox(rect); Rect firstLine = rect.ContractedBy(6); firstLine.height = 20; Widgets.Label(firstLine, dayNumber.ToString()); Rect copy = new Rect(firstLine); copy.width = 20; copy.x += copy.width; if (Widgets.ButtonImageFitted(copy, GraphicsCache.Copy, Color.white)) { ActivityTaskUtility.Clipboard = day; SoundDefOf.Tick_High.PlayOneShotOnCamera((Map)null); } TooltipHandler.TipRegionByKey(copy, "CopyBillTip"); Rect paste = new Rect(copy); paste.x += paste.width; if (ActivityTaskUtility.Clipboard == null) { GUI.color = Color.gray; Widgets.DrawTextureFitted(paste, (Texture)GraphicsCache.Paste, 1f); GUI.color = Color.white; TooltipHandler.TipRegionByKey(paste, "PasteBillTip"); } else { if (Widgets.ButtonImageFitted(paste, GraphicsCache.Paste, Color.white)) { ScheduledDay clip = ActivityTaskUtility.Clipboard; foreach (var task in clip.Tasks) { day.Add(task); } SoundDefOf.Tick_Low.PlayOneShotOnCamera((Map)null); } TooltipHandler.TipRegionByKey(paste, "PasteBillTip"); } if (day != null) { DrawDayInterFace(new Rect(rect.x + 6, rect.y + 30f, rect.width, rect.height * .75f), day); } Rect touchable = new Rect(rect); touchable.y += 30; touchable.height -= 30; if (Mouse.IsOver(touchable)) { //Widgets.DrawBox(rect, 3); Widgets.DrawBox(touchable, 3); if (Input.GetMouseButtonDown(0)) { if (day == null) { TaskManager.AddDay(dayNumber); } var options = GetFloatMenuOptions(day); if (!options.NullOrEmpty()) { Find.WindowStack.Add((Window) new Dialog_ScheduleDayConfig(day, GetFloatMenuOptions(day))); } } } }