Пример #1
0
        public void AddChanges(List <Change> cl)
        {
            lock (changeLock)
            {
                // add all Changes
                changes.AddRange(cl);

                // add dates of subscription of each Change on this Effect
                var changeSubDates    = new List <DateTime>(cl.Count);
                var changeBaseSubDate = DateTime.Now;
                ListUtil.Populate(changeSubDates, changeBaseSubDate);
                for (int i = 0; i < changeSubDates.Count; i++)
                {
                    changeSubDates[i] = new DateTime(changeBaseSubDate.Ticks + i);
                }
                this.changeSubDates.AddRange(changeSubDates);

                // use date when the Effect itself was added to it's EffectHandler
                // to inform the TotalChange(s)
                DateTime effectSubDate;
                if (effectHandler != null)
                {
                    if (effectHandler.TryGetEffectSubDate(this, out effectSubDate))
                    {
                        effectHandler.AddToTotalChanges(cl, effectSubDate, changeSubDates);
                    }
                    else
                    {
                        MakeLogError("Effect was not properly subscribed in EffectHandler!");
                    }
                }
            }
        }