public virtual void Setup(Image primaryImage, Image secondaryImage, Text buttonText, UITweenManager uitweenManager) { PrimaryImage = primaryImage; SecondaryImage = secondaryImage; ButtonText = buttonText; UITweenManager = uitweenManager; }
public override void UpdateState(DateTime?buttonDate, DateTime?calenderDate, DateTime?selectedStartDate, DateTime?selectedEndDate) { SecondaryImage.color = Color.clear; if (buttonDate != null && calenderDate != null) { if (buttonDate.Value.Month == calenderDate.Value.Month) { UITweenManager.ForceTween(PrimaryImage, m_BtnImageColor, null, 0f); UITweenManager.ForceTween(ButtonText, m_BtnTextColor, null, 0f); } else { UITweenManager.ForceTween(PrimaryImage, m_Btn_ImageColor_NotInMonth, null, 0f); UITweenManager.ForceTween(ButtonText, m_Btn_TextColor_NotInMonth, null, 0f); } } else { Debug.LogError("UHOH: buttonDate or calenderDate == null"); } }
public override void UpdateState(DateTime?buttonDate, DateTime?calenderDate, DateTime?selectedStartDate, DateTime?selectedEndDate) { UITweenManager.ForceTween(PrimaryImage, m_BtnImageColor, null, 0f); UITweenManager.ForceTween(ButtonText, m_BtnTextColor, null, 0f); }
public void Setup(Calender calender, DateTime buttonDate, string text, bool showDaysInOtherMonths, UITweenManager uiTweenManager) { m_DisplayDictionary = new Dictionary <State, DisplayState>(); m_Calender = calender; Date = buttonDate; m_ButtonText.text = text; m_ShowDaysInOtherMonths = showDaysInOtherMonths; m_DisplayDictionary.Add(State.Normal, m_NormalState); m_DisplayDictionary.Add(State.Hover, m_HoverState); m_DisplayDictionary.Add(State.Selected, m_SelectedState); if (m_HighlightedState != null) { m_DisplayDictionary.Add(State.Highlighted, m_HighlightedState); } else { Debug.Log("WARNING there's not highlight script defined, if this is the case, no highlight will be shown"); } m_DisplayDictionary.Add(State.Disabled, m_DisabledState); foreach (KeyValuePair <State, DisplayState> displayState in m_DisplayDictionary) { displayState.Value.Setup(m_ButtonPrimaryImage, m_ButtonSecondaryImage, m_ButtonText, uiTweenManager); } if (!m_ShowDaysInOtherMonths && buttonDate.Month != calender.Date.Month) { UpdateState(State.Disabled, m_Calender.Date, null, null); return; } // Force normal display script to trigger UpdateState(State.Normal, m_Calender.Date, null, null); }
public void Setup(int year, int month, DayOfWeek firstDayOfWeek, bool showDaysInOtherMonths, DateTime?startDate, DateTime?endDate, UITweenManager uiTweenManager) { Date = new DateTime(year, month, 1); m_FirstDayOfWeek = firstDayOfWeek; m_ShowDatesInOtherMonths = showDaysInOtherMonths; // Time to setup all the buttons! :) // create current month starting from 1 DateTime currentDate; currentDate = (DateTime)StartDate(); // update main date heading string monthHeading = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Date.Month); m_DateLabel.text = monthHeading.ToUpper() + " " + Date.Year; //used for mon-sun labels int startingIndex = (int)m_FirstDayOfWeek; for (int i = 0; i < 42; i++) { // update days of weeks labels if (i < 7) { m_DaysOfWeekLabels[i].text = ((DayOfWeek)startingIndex).ToString().Remove(1).ToUpper(); startingIndex++; if (startingIndex > 6) { startingIndex = 0; } } // update buttons CalenderButtons[i].Setup(this, currentDate, currentDate.Day.ToString(), m_ShowDatesInOtherMonths, uiTweenManager); if (CalenderRefreshed != null) { CalenderRefreshed(Date, CalenderButtons[i], currentDate); } currentDate = currentDate.AddDays(1); } }