示例#1
0
        internal static void Remove(ScheduledEvent scheduledEvent)
        {
            if (ScheduledEvents.Contains(scheduledEvent))
            {
                ScheduledEventsCount--;
                ScheduledEvents.Remove(scheduledEvent);
            }
            else
            {
                var errorMessage = $"[UnityTools.Scheduler] You are trying to remove a scheduled event, \n " +
                                   $"but there is no such scheduled event (already removed? forgot to make it null?).";

                Delegate[] invocationList = scheduledEvent.Action.GetInvocationList();
                errorMessage += $"\n Invocation actions of the scheduled event:";

                if (invocationList.Length > 0)
                {
                    for (int i = 0; i < invocationList.Length; i++)
                    {
                        errorMessage += $"\n {invocationList[i].Target} - {invocationList[i].Method}";
                    }
                }
                else
                {
                    errorMessage += $"\n no invocation actions.";
                }

                Debug.LogError(errorMessage);;
            }
        }
示例#2
0
        public void NotifyRemoval(BaseNotifier notifier)
        {
            Event eventToBeNotifiedAbout = ((EventNotifier)notifier).EvetToBeNotifiedAbout;

            if (!eventToBeNotifiedAbout.Participants.Contains(this, new PersonComparer()))
            {
                return;
            }

            if (!ScheduledEvents.Contains(eventToBeNotifiedAbout, new EventComparer()))
            {
                return;
            }

            CancleParticipationInEvent(eventToBeNotifiedAbout);
            DbManager.Instance.ModifyPerson(this);
        }
示例#3
0
        public void NotifyChange(BaseNotifier notifier)
        {
            Event eventToBeNotifiedAbout = ((EventNotifier)notifier).EvetToBeNotifiedAbout;

            if (eventToBeNotifiedAbout.Participants.Contains(this, new PersonComparer()))
            {
                if (ScheduledEvents.Contains(eventToBeNotifiedAbout, new EventComparer()))
                {
                    if (IsAvailableForEventExcludingOneSpecificEvent(eventToBeNotifiedAbout.ScheduledDateTimeBeging, eventToBeNotifiedAbout.ScheduledDateTimeEnd, eventToBeNotifiedAbout))
                    {
                        if (CancleParticipationInEvent(eventToBeNotifiedAbout) && ScheduleParticipationInEvent(eventToBeNotifiedAbout))
                        {
                            DbManager.Instance.ModifyPerson(this);
                        }
                    }
                    else
                    {
                        if (CancleParticipationInEvent(eventToBeNotifiedAbout))
                        {
                            DbManager.Instance.ModifyPerson(this);
                        }
                    }
                }
                else
                {
                    if (IsAvailableForEvent(eventToBeNotifiedAbout.ScheduledDateTimeBeging, eventToBeNotifiedAbout.ScheduledDateTimeEnd))
                    {
                        if (ScheduleParticipationInEvent(eventToBeNotifiedAbout))
                        {
                            DbManager.Instance.ModifyPerson(this);
                        }
                    }
                }
            }
            else
            {
                if (ScheduledEvents.Contains(eventToBeNotifiedAbout, new EventComparer()))
                {
                    if (CancleParticipationInEvent(eventToBeNotifiedAbout))
                    {
                        DbManager.Instance.ModifyPerson(this);
                    }
                }
            }
        }