Beispiel #1
0
        public EventInviteResponseDialog CreateEventInviteResponseDialog(CalendarEventItem eventItem)
        {
            EventInviteResponseDialog eventInviteResponseDialog = this.InstantiateDialog <EventInviteResponseDialog>(this.m_eventInviteResponseDialogPrefab, this.Level3Canvas);

            eventInviteResponseDialog.SetCalendarEvent(eventItem);
            return(eventInviteResponseDialog);
        }
Beispiel #2
0
 public void OpenCalendarDialog(CalendarEventItem eventItem)
 {
 }
        private IEnumerator AddEventsToContent()
        {
            CultureInfo cultureInfo        = MobileDeviceLocale.GetCultureInfoLocale();
            CultureInfo currentCultureInfo = Thread.CurrentThread.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = cultureInfo;
            int numPendingInvites = 0;

            this.m_dateHeaders.Clear();
            uint numGuildEvents = Calendar.GetNumGuildEvents();
            List <CalendarGuildEventInfo> guildEvents = new List <CalendarGuildEventInfo>();

            for (uint num = 0u; num < numGuildEvents; num += 1u)
            {
                CalendarGuildEventInfo item;
                if (Calendar.GetGuildEventInfo(num, ref item))
                {
                    guildEvents.Add(item);
                }
            }
            CalendarEventItem forceClosedEventItem = null;
            DateTime          eventDate            = DateTime.Now;
            int eventCount = 0;

            for (int offsetMonth = 0; offsetMonth <= 1; offsetMonth++)
            {
                int year  = DateTime.Now.Year + ((DateTime.Now.Month != 12 || offsetMonth != 1) ? 0 : 1);
                int month = DateTime.Now.Month + offsetMonth;
                if (month > 12)
                {
                    month -= 12;
                }
                int  daysInMonth = DateTime.DaysInMonth(year, month);
                uint day         = (uint)((offsetMonth != 0) ? 0 : (DateTime.Now.Day - 1));
                while ((ulong)day < (ulong)((long)daysInMonth) && (eventDate - DateTime.Now).TotalDays < 15.0)
                {
                    int  currentEventCount = eventCount;
                    uint numDayEvents      = Calendar.GetNumDayEvents(offsetMonth, day);
                    if (numDayEvents > 0u || guildEvents.Any((CalendarGuildEventInfo guildEvent) => this.$this.IsEventOnDay(guildEvent, eventDate)))
                    {
                        GameObject gameObject = this.m_scrollContent.AddAsChildObject(this.m_scrollSectionHeaderPrefab);
                        gameObject.GetComponentInChildren <Text>().text = eventDate.ToString(StaticDB.GetString("FULL_DATE", "dddd, MMMM d, yyyy"));
                        this.m_dateHeaders.Add(eventDate, gameObject);
                        List <CalendarEventData> list = new List <CalendarEventData>();
                        for (uint num2 = 0u; num2 < numDayEvents; num2 += 1u)
                        {
                            CalendarDayEvent dayEvent;
                            if (Calendar.GetDayEvent(offsetMonth, day, num2, ref dayEvent))
                            {
                                CalendarEventData calendarEventData = new CalendarEventData(dayEvent, num2);
                                list.Add(calendarEventData);
                                if (calendarEventData.IsPendingInvite())
                                {
                                    numPendingInvites++;
                                }
                            }
                        }
                        uint num3 = 0u;
                        while ((ulong)num3 < (ulong)((long)guildEvents.Count))
                        {
                            CalendarGuildEventInfo guildEvent = guildEvents[(int)num3];
                            if (this.IsEventOnDay(guildEvent, eventDate))
                            {
                                CalendarEventData calendarEventData2 = list.FirstOrDefault((CalendarEventData eventData) => eventData.EventID == guildEvent.eventID);
                                if (calendarEventData2 == null)
                                {
                                    list.Add(new CalendarEventData(guildEvent, num3));
                                }
                                else
                                {
                                    calendarEventData2.AddGuildInfo(guildEvent);
                                }
                            }
                            num3 += 1u;
                        }
                        list.Sort(EventsListPanel.Sorter);
                        bool flag = false;
                        foreach (CalendarEventData calendarEventData3 in list)
                        {
                            GameObject gameObject2;
                            if (calendarEventData3.CalendarType == CalendarType.Holiday)
                            {
                                gameObject2 = this.m_scrollContent.AddAsChildObject(this.m_holidayListItemPrefab);
                            }
                            else
                            {
                                gameObject2 = this.m_scrollContent.AddAsChildObject(this.m_eventListItemPrefab);
                            }
                            if (gameObject2 != null)
                            {
                                gameObject2.GetComponentInChildren <CalendarEventItem>().SetEventInfo(calendarEventData3);
                                bool flag2 = !this.m_isOnlyShowingPendingInvites || calendarEventData3.IsPendingInvite();
                                if (calendarEventData3.IsCommunityEvent && calendarEventData3.ClubID != null)
                                {
                                    ulong?guildID = CommunityData.Instance.GetGuildID();
                                    if (guildID != null && guildID.Value == calendarEventData3.ClubID.Value)
                                    {
                                        flag2 &= CalendarCVar.ShowGuildEvents.GetValue();
                                    }
                                    else
                                    {
                                        flag2 &= CalendarCVar.ShowCommunityEvents.GetValue();
                                    }
                                }
                                gameObject2.gameObject.SetActive(flag2);
                                flag = (flag || flag2);
                                if (calendarEventData3.EventID == EventInviteResponseDialog.ForceClosedEventID)
                                {
                                    forceClosedEventItem = gameObject2.GetComponentInChildren <CalendarEventItem>();
                                }
                                if (flag)
                                {
                                    eventCount++;
                                }
                            }
                        }
                        gameObject.gameObject.SetActive(flag);
                    }
                    eventDate = eventDate.AddDays(1.0);
                    if (eventCount > currentEventCount)
                    {
                        yield return(null);
                    }
                    day += 1u;
                }
            }
            if (numPendingInvites > 0)
            {
                GameObject gameObject3 = this.m_scrollContent.AddAsChildObject(this.m_scrollSectionHeaderPrefab);
                gameObject3.GetComponentInChildren <Text>().text = StaticDB.GetString("CALENDAR_PENDING_INVITATIONS_HEADER", "Pending Invitations [PH]");
                gameObject3.transform.SetSiblingIndex(0);
                this.m_pendingInvitesButton = this.m_scrollContent.AddAsChildObject(this.m_pendingInviteButtonPrefab);
                this.m_pendingInvitesButton.GetComponentInChildren <Button>().onClick.AddListener(new UnityAction(this.TogglePendingInvitesFilter));
                this.m_pendingInvitesButton.transform.SetSiblingIndex(1);
                Text componentInChildren = this.m_pendingInvitesButton.GetComponentInChildren <Text>();
                if (componentInChildren != null)
                {
                    componentInChildren.text = StaticDB.GetString((!this.m_isOnlyShowingPendingInvites) ? "CALENDAR_PENDING_INVITATIONS" : "BACK", (!this.m_isOnlyShowingPendingInvites) ? "Invitations [PH]" : "Back [PH]");
                }
            }
            else if (this.m_isOnlyShowingPendingInvites)
            {
                this.TogglePendingInvitesFilter();
            }
            Thread.CurrentThread.CurrentCulture = currentCultureInfo;
            if (forceClosedEventItem != null)
            {
                forceClosedEventItem.OpenEventItem();
            }
            else if (EventInviteResponseDialog.ForceClosedEventID != null)
            {
                AllPopups.instance.ShowGenericPopupFull(StaticDB.GetString("EVENT_NOT_AVAILABLE", "Event is no longer available [PH]"));
            }
            yield break;
        }
 public void SetCalendarEvent(CalendarEventItem eventItem)
 {
     this.CalendarEventItem = eventItem;
 }