Hi,
I'm trying to create a calendar with NGUI. There seems to be no one who have tried this, so here goes. I asked on the Unity3D form aswell, and this was one of the answers:
class TestCalendar {
@MenuItem("Test/Calendar")
static function Test() {
var now = System.DateTime.Now;
// build ngui
var Refresh = function() {
Debug.Log("Refreshing");
// NGUI clear the panel with days buttons
// get first day of month
var i = now.AddDays(-(now.Day - 1));
// interate in days until change the month
while (i.Month == now.Month) {
Debug.Log(i);
i = i.AddDays(1);
// NGUI add a new button for this day
}
// NGUI reposition all buttons with UIGrid
};
var OnClickNext = function() {
Debug.Log("On user click next month");
now = now.AddMonths(1);
Refresh();
};
Refresh();
// simulate someone clicking in next
OnClickNext();
}
}
I'm trying as I go here so i'll post updates. But does anybody else have experience, ideas or code they can share? Would be nice to make this public for everyone to create calendars with NGUI.