using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class FestivalRedpackDate : CellView
|
{
|
[SerializeField] Transform m_ContainerNormal;
|
[SerializeField] Transform m_ContainerSelect;
|
[SerializeField] Text m_Date;
|
[SerializeField] DateFontStyle m_NormalFontStyle;
|
[SerializeField] DateFontStyle m_SelectFontStyle;
|
[SerializeField] Button m_Select;
|
|
FestivalRedpackModel model { get { return ModelCenter.Instance.GetModel<FestivalRedpackModel>(); } }
|
|
int dayIndex = 0;
|
|
private void Awake()
|
{
|
m_Select.onClick.AddListener(Select);
|
}
|
|
public void Display(int index)
|
{
|
dayIndex = index;
|
|
m_ContainerNormal.SetActive(model.selectDateIndex != index);
|
m_ContainerSelect.SetActive(model.selectDateIndex == index);
|
|
OperationFestivalRedpack operation;
|
if (OperationTimeHepler.Instance.TryGetOperation(Operation.FestivalRedpack, out operation))
|
{
|
var date = operation.startDate.AddDays(index);
|
m_Date.text = StringUtility.Contact(string.Format("<Size={0}>",
|
model.selectDateIndex == index ? m_SelectFontStyle.fontSize : m_NormalFontStyle.fontSize),
|
Language.Get("FestivalTraditionalDate_" + index), "</Size>",
|
"\n", Language.Get("FestivalDate", date.month, date.day));
|
}
|
|
m_Date.color = model.selectDateIndex == index ? m_SelectFontStyle.fontColor : m_NormalFontStyle.fontColor;
|
m_Date.fontSize = m_NormalFontStyle.fontSize;
|
}
|
|
private void Select()
|
{
|
model.selectDateIndex = dayIndex;
|
}
|
|
[Serializable]
|
public class DateFontStyle
|
{
|
public Color fontColor;
|
public int fontSize;
|
}
|
}
|
}
|
|