private void DoRecurring(Rect rect) { Widgets.CheckboxLabeled(rect, I18n.Translate("EditReminder.Recur"), ref recur); if (recur) { var timeInputRect = rect; timeInputRect.y = rect.yMax + 5; timeInputRect.height = 30; FWidgets.Label(timeInputRect, I18n.Translate("EditReminder.RecurEvery"), anchor: TextAnchor.MiddleLeft); var dayRect = timeInputRect; dayRect.x += 120f; dayRect.width = 60f; Widgets.TextFieldNumeric(dayRect, ref recurEveryDays, ref recurEveryDaysBuffer); var dayLabelRect = dayRect; dayLabelRect.x = dayRect.xMax + 4f; FWidgets.Label(dayLabelRect, I18n.Translate("EditReminder.DaysAnd"), anchor: TextAnchor.MiddleCenter); var hourRect = dayLabelRect; hourRect.x = dayLabelRect.xMax + 4f; hourRect.width = 30f; Widgets.TextFieldNumeric(hourRect, ref recurEveryHours, ref recurEveryHoursBuffer, 0, 23); var hourLabelRect = hourRect; hourLabelRect.x = hourRect.xMax + 4f; hourLabelRect.width = 60f; FWidgets.Label(hourLabelRect, I18n.Translate("EditReminder.Hours"), anchor: TextAnchor.MiddleLeft); } }
private void DoRelativeTime(Rect rect) { FWidgets.Label(rect, I18n.Translate("EditReminder.FireIn"), anchor: TextAnchor.MiddleLeft); var dayRect = rect; dayRect.x += 60f; dayRect.width = 60f; Widgets.TextFieldNumeric(dayRect, ref daysFromNowValue, ref daysFromNowBuffer); var dayLabelRect = dayRect; dayLabelRect.x = dayRect.xMax + 4f; FWidgets.Label(dayLabelRect, I18n.Translate("EditReminder.DaysAnd"), anchor: TextAnchor.MiddleCenter); var hourRect = dayLabelRect; hourRect.x = dayLabelRect.xMax + 4f; hourRect.width = 30f; Widgets.TextFieldNumeric(hourRect, ref hoursFromNowValue, ref hoursFromNowBuffer, 0, 23); var hourLabelRect = hourRect; hourLabelRect.x = hourRect.xMax + 4f; hourLabelRect.width = 60f; FWidgets.Label(hourLabelRect, I18n.Translate("EditReminder.Hours"), anchor: TextAnchor.MiddleLeft); fireOnTick = DateHelper.RelativeTimeToGameTicks(daysFromNowValue, hoursFromNowValue); }
private void DoAbsoluteTime(Rect rect) { FWidgets.Label(rect, I18n.Translate("EditReminder.FireOn"), anchor: TextAnchor.MiddleLeft); var dayRect = rect; dayRect.x = rect.x + 60f; dayRect.width = 30f; Widgets.TextFieldNumeric(dayRect, ref dayValue, ref dayBuffer, 1, 15); var ofRect = dayRect; ofRect.x = dayRect.xMax + 4f; ofRect.width = 15f; FWidgets.Label(ofRect, I18n.Translate("Of"), anchor: TextAnchor.MiddleCenter); var quadrumRect = ofRect; quadrumRect.x = ofRect.xMax + 4f; quadrumRect.width = 100f; var pressed = Widgets.ButtonText(quadrumRect, quadrumValue.Label()); if (pressed) { Find.WindowStack.Add(new FloatMenu(MakeQuadrumOptions())); } var commaRect = ofRect; commaRect.x = quadrumRect.xMax + 2f; commaRect.width = 5f; FWidgets.Label(commaRect, ",", anchor: TextAnchor.MiddleCenter); var yearRect = commaRect; yearRect.x = commaRect.xMax + 4f; yearRect.width = 60f; Widgets.TextFieldNumeric(yearRect, ref yearValue, ref yearBuffer); var atRect = commaRect; atRect.x = yearRect.xMax + 4f; atRect.width = 15f; FWidgets.Label(atRect, I18n.Translate("At"), anchor: TextAnchor.MiddleCenter); var hourRect = atRect; hourRect.x = atRect.xMax + 4f; hourRect.width = 30f; Widgets.TextFieldNumeric(hourRect, ref hourValue, ref hourBuffer, 0, 23); var offsetHours = RemindersGameComponent.VectorForTime.HasValue ? GenDate.TimeZoneAt(RemindersGameComponent.VectorForTime.Value.x) : 0; int dateToTicks = DateHelper.DateToGameTicksOffsetAgnostic(yearValue, quadrumValue, dayValue, hourValue, offsetHours); fireOnTick = dateToTicks; }
public override void DoWindowContents(Rect inRect) { FWidgets.Label(inRect, I18n.Translate("EditReminder.Title"), font: GameFont.Medium); inRect.yMin += 40; var selectRect = inRect; selectRect.height = 60; DoLetterDefSelection(selectRect); var titleRect = selectRect; titleRect.y = selectRect.yMax + 15; titleRect.height = 55; DoTitle(titleRect); var bodyRect = titleRect; bodyRect.y = titleRect.yMax + 15; bodyRect.height = 85; DoBody(bodyRect); var timeRect = bodyRect; timeRect.y = bodyRect.yMax + 15; DoTime(timeRect); if (selectedTimeRep != TimeRepresentation.NextLoad) { var recurRect = timeRect; recurRect.y = timeRect.yMax + 15; recurRect.height = 30; DoRecurring(recurRect); } else { recur = false; } var buttonsRect = inRect; buttonsRect.yMin = inRect.yMax - 50; buttonsRect.xMin = inRect.xMax - 210; // 100 per button * 2, + 10 margin DoButtons(buttonsRect); }