Calendar
Note
DateTime.TimeOfDay is not setted or changed by Calendar.
Options
Interactable
bool
Is interactable?
Date
DateTime
Current date.
Date Min
DateTime
Minimal date.
Date Max
DateTime
Maximum date.
First Day Of Week
DayOfWeek
First day of the week.
Container
RectTransform
Container for the dates.
Calendar Date Template
CalendarDateBase
Template for the date.
HeaderContainer
RectTransform
Container for the day of weeks.
Calendar Day Of Week Template
CalendarDayOfWeekBase
Template for the day of week.
Date Text
Text
Text to display the current date.
Month Text
Text
Text to display the current month.
Events
OnDateChanged
UnityEvent<DateTime>
OnDateClick
UnityEvent<DateTime>
namespace UIWidgets.Examples
{
using UnityEngine;
/// <summary>
/// Test Calendar.
/// </summary>
public class TestCalendar : MonoBehaviour
{
/// <summary>
/// Calendar.
/// </summary>
[SerializeField]
protected UIWidgets.Calendar Calendar;
/// <summary>
/// Start this instance.
/// </summary>
protected virtual void Start()
{
Calendar.OnDateChanged.AddListener(ProcessDate);
// change first day of the week
Calendar.FirstDayOfWeek = System.DayOfWeek.Sunday;
// change culture (display days and months in english)
Calendar.Culture = new System.Globalization.CultureInfo("en-US");
// change culture (display days and months in french)
Calendar.Culture = new System.Globalization.CultureInfo("fr-FR");
// change calendar
SetCalendar(new System.Globalization.JapaneseCalendar());
}
void ProcessDate(System.DateTime dt)
{
Debug.Log(dt);
}
void SetCalendar(System.Globalization.Calendar calendar)
{
Calendar.Culture.DateTimeFormat.Calendar = calendar;
Calendar.UpdateCalendar();
}
}
}