예제 #1
0
            void Process(ReactiveCollectionEvent <T> e)
            {
                switch (e.type)
                {
                case ReactiveCollectionEventType.Reset:
                    RefillBuffer();
                    break;

                case ReactiveCollectionEventType.Insert:
                    var item = mapFunc(e.newItem);
                    buffer.Insert(e.position, item);
                    break;

                case ReactiveCollectionEventType.Remove:
                    buffer.RemoveAt(e.position);
                    break;

                case ReactiveCollectionEventType.Set:
                    var newItem = mapFunc(e.newItem);
                    buffer[e.position] = newItem;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
예제 #2
0
            void Process(ReactiveCollectionEvent <T> e)
            {
                switch (e.type)
                {
                case ReactiveCollectionEventType.Reset:
                    ProperRefill();
                    break;

                case ReactiveCollectionEventType.Insert:
                    Insert(e.position, e.newItem);
                    break;

                case ReactiveCollectionEventType.Remove:
                    Remove(e.position);
                    break;

                case ReactiveCollectionEventType.Set:
                    //TODO make proper set event resolve if needed
                    Remove(e.position);
                    Insert(e.position, e.newItem);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }