DataPicker 버그 픽스
This commit is contained in:
@@ -32,9 +32,23 @@ namespace UVC.UI.Modal.DatePicker
|
||||
[SerializeField]
|
||||
public GameObject _item;
|
||||
|
||||
public List<GameObject> _dateItems = new List<GameObject>();
|
||||
const int _totalDateNum = 42;
|
||||
|
||||
[Header("Colors")]
|
||||
[SerializeField]
|
||||
public Color textColor = ColorUtil.FromHex("808080");
|
||||
[SerializeField]
|
||||
public Color selectColor = ColorUtil.FromHex("F5A623");
|
||||
[SerializeField]
|
||||
public Color todayColor = Color.white;
|
||||
[SerializeField]
|
||||
public Color saturdayColor = ColorUtil.FromHex("4A90E2");
|
||||
[SerializeField]
|
||||
public Color sundayColor = ColorUtil.FromHex("FF5E5E");
|
||||
|
||||
private List<GameObject> _dateItems = new List<GameObject>();
|
||||
private const int _totalDateNum = 42;
|
||||
|
||||
private DateTime _initTime;
|
||||
private DateTime _dateTime;
|
||||
|
||||
|
||||
@@ -67,6 +81,7 @@ namespace UVC.UI.Modal.DatePicker
|
||||
|
||||
|
||||
instance.gameObject.SetActive(true);
|
||||
instance._initTime = initialDate;
|
||||
instance._dateTime = initialDate;
|
||||
|
||||
//화면 센터에 위치 시키기
|
||||
@@ -74,7 +89,7 @@ namespace UVC.UI.Modal.DatePicker
|
||||
rectTransform.anchoredPosition = new Vector2((Screen.width - rectTransform.sizeDelta.x) / 2, -(Screen.height - rectTransform.sizeDelta.y) / 2);
|
||||
_onDateSelectedCallback = onDateSelected;
|
||||
|
||||
if (hasInstance) instance.RefreshTextColor();
|
||||
if (hasInstance) instance.CreateCalendar();
|
||||
|
||||
ShowBlock();
|
||||
}
|
||||
@@ -166,31 +181,31 @@ namespace UVC.UI.Modal.DatePicker
|
||||
|
||||
DateTime day = firstDay.AddDays(date);
|
||||
|
||||
Color textColor = ColorUtil.FromHex("808080");
|
||||
Color txtColor = textColor;
|
||||
//토요일 색 변경
|
||||
if (day.DayOfWeek == DayOfWeek.Saturday) //토요일
|
||||
{
|
||||
textColor = ColorUtil.FromHex("4A90E2");
|
||||
txtColor = saturdayColor;
|
||||
}
|
||||
else if (day.DayOfWeek == DayOfWeek.Sunday) //일요일
|
||||
{
|
||||
textColor = ColorUtil.FromHex("FF5E5E");
|
||||
txtColor = sundayColor;
|
||||
}
|
||||
|
||||
//오늘 날짜인지 확인해서 text 색 변경
|
||||
if (day.Date == DateTime.Now.Date)
|
||||
{
|
||||
textColor = Color.white;
|
||||
txtColor = todayColor;
|
||||
}
|
||||
|
||||
|
||||
if (day.Date == _dateTime.Date)
|
||||
if (day.Date == _initTime.Date)
|
||||
{
|
||||
//_dateTime날짜와 같은 날짜면 색 변경
|
||||
textColor = ColorUtil.FromHex("F5A623");
|
||||
//_initTime날짜와 같은 날짜면 색 변경
|
||||
txtColor = selectColor;
|
||||
}
|
||||
|
||||
label.color = textColor;
|
||||
label.color = txtColor;
|
||||
|
||||
if (i >= index)
|
||||
{
|
||||
@@ -208,49 +223,6 @@ namespace UVC.UI.Modal.DatePicker
|
||||
_monthNumText.text = _dateTime.Month.ToString("D2");
|
||||
}
|
||||
|
||||
void RefreshTextColor()
|
||||
{
|
||||
DateTime firstDay = _dateTime.AddDays(-(_dateTime.Day - 1));
|
||||
int date = 0;
|
||||
for (int i=0;i< _dateItems.Count; i++)
|
||||
{
|
||||
if (_dateItems[i].activeSelf)
|
||||
{
|
||||
|
||||
TextMeshProUGUI label = _dateItems[i].GetComponentInChildren<TextMeshProUGUI>();
|
||||
DateTime day = firstDay.AddDays(date);
|
||||
|
||||
Color textColor = ColorUtil.FromHex("808080");
|
||||
|
||||
//토요일 색 변경
|
||||
if (day.DayOfWeek == DayOfWeek.Saturday) //토요일
|
||||
{
|
||||
textColor = ColorUtil.FromHex("4A90E2");
|
||||
}
|
||||
else if (day.DayOfWeek == DayOfWeek.Sunday) //일요일
|
||||
{
|
||||
textColor = ColorUtil.FromHex("FF5E5E");
|
||||
}
|
||||
|
||||
//오늘 날짜인지 확인해서 text 색 변경
|
||||
if (day.Date == DateTime.Now.Date)
|
||||
{
|
||||
textColor = Color.white;
|
||||
}
|
||||
|
||||
if (day.Date == _dateTime.Date)
|
||||
{
|
||||
//_dateTime날짜와 같은 날짜면 색 변경
|
||||
textColor = ColorUtil.FromHex("F5A623");
|
||||
}
|
||||
|
||||
label.color = textColor;
|
||||
|
||||
date++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int GetDays(DayOfWeek day)
|
||||
{
|
||||
switch (day)
|
||||
|
||||
Reference in New Issue
Block a user