public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine(dateOfCreation.ToString()); sb.AppendLine(); sb.AppendLine(entryText); return(sb.ToString()); }
bool DrawGenericWorldDateField(WorldDate prevDate, int labelWidth, string labelText, out WorldDate newDate, bool omitHours = false) { bool result = false; bool foldout = prevDate == null || prevDate.ShowInFoldout; bool newFoldout = EditorGUILayout.Foldout(foldout, (foldout) ? labelText : labelText + ": " + ((prevDate == null) ? "..." : prevDate.ToString())); if (newFoldout) { EditorGUILayout.BeginVertical(Config.FoldoutInteriorStyle); { bool prevIsNull = prevDate == null; int days = (prevIsNull) ? 0 : prevDate.Days; int hours = (prevIsNull) ? 0 : prevDate.Hours; int minutes = (prevIsNull) ? 0 : prevDate.Minutes; int secs = (prevIsNull) ? 0 : prevDate.Seconds; days = (omitHours) ? 0 : EditorGUILayout.IntField("Day", days); hours = EditorGUILayout.IntField("Hour", hours); minutes = EditorGUILayout.IntField("Minute", minutes); secs = EditorGUILayout.IntField("Seconds", secs); days = (days >= 0) ? days : 0; hours = (hours >= 0) ? hours : 0; minutes = (minutes >= 0) ? minutes : 0; secs = (secs >= 0) ? secs : 0; newDate = new WorldDate(secs, minutes, hours, days); result = !newDate.Equals(prevDate); } EditorGUILayout.EndVertical(); } else { newDate = prevDate; } newDate.ShowInFoldout = newFoldout; prevDate.ShowInFoldout = newFoldout; return(result); }