Esempio n. 1
0
        public void Clear()
        {
            Additions.Clear();

            foreach (var tr in Contents)
            {
                Deletions.Add(tr);
            }

            PerformRemoves();
        }
Esempio n. 2
0
        private void PerformAdds()
        {
            foreach (var tr in Additions)
            {
                _contents.Add(tr);
                Verbose(30, $"Adding {tr} to {this}");
                tr.Completed += Remove;
                Added?.Invoke(this, tr);
            }

            Additions.Clear();
        }
Esempio n. 3
0
        private void PerformAdds()
        {
            foreach (var tr in Additions)
            {
                _contents.Add(tr);

                tr.Completed += Remove;

                if (Added != null)
                {
                    Added(this, tr);
                }
            }

            Additions.Clear();
        }
Esempio n. 4
0
        private void AddRemove()
        {
            DataLock.WaitOne();
            foreach (InstanceData t in Additions)
            {
                Data.Add(t);
            }

            foreach (InstanceData t in Removals)
            {
                Data.Remove(t);
            }

            Additions.Clear();
            Removals.Clear();
            DataLock.ReleaseMutex();
        }
Esempio n. 5
0
        public void HandleAddRemoves()
        {
            AdditionMutex.WaitOne();
            foreach (GameComponent component in Additions)
            {
                AddComponentImmediate(component);
            }

            Additions.Clear();
            AdditionMutex.ReleaseMutex();

            RemovalMutex.WaitOne();
            foreach (GameComponent component in Removals)
            {
                RemoveComponentImmediate(component);
            }

            Removals.Clear();
            RemovalMutex.ReleaseMutex();
        }