Esempio n. 1
0
 public async Task Removed(string fileName)
 {
     if (OnRemoved != null)
     {
         await OnRemoved.Invoke(fileName);
     }
 }
        public IEnumerable <SlamTrackedObject> Remove(IEnumerable <int> items)
        {
            if (items is null)
            {
                return(new List <SlamTrackedObject>());
            }
            var list    = items.ToList();
            var removed = new List <SlamTrackedObject>();

            lock (_objects)
            {
                foreach (var id in list.Where(_objects.ContainsKey))
                {
                    removed.Add(_objects[id].Item1);
                    _objects[id].Item2.Clear();
                    lock (_lineContainers)
                    {
                        _lineContainers.Remove(_objects[id].Item2);
                    }

                    _objects.Remove(id);
                }
            }

            OnRemoved?.Invoke(this, new RemovedEventArgs(list));
            return(removed);
        }
 public override void ViewDidDisappear(bool animated)
 {
     // Note that ViewWillDisappear fires even if the user hasn't actually dragged the popup view off screen, so
     // it's premature and can only trust DidDisappear.
     // Note that the animated boolean is true even if I programmatically close
     OnRemoved?.Invoke(this, new EventArgs());
 }
Esempio n. 4
0
 public override void Remove()
 {
     OnRemoved?.Invoke(Content);
     m_typeIcon.enabled = true;
     Content            = null;
     Clear();
 }
Esempio n. 5
0
    public void OnDragEnd(GameObject obj)
    {
        Destroy(MouseData.tempItemBeingDragged); //Destroys the temporarily created item.
        if (MouseData.interfaceMouseIsOver == null)
        {
            return;
        }
        if (MouseData.slotHoveredOver)
        {
            // If the mouse hovers over the trash can prefab it will distroy to item out of the inventory
            if (slotsOnInterface[obj].item.Id >= 0 && MouseData.interfaceMouseIsOver.name == "Trash Can Panel")
            {
                slotsOnInterface[obj].RemoveItem();
            }
            else if (slotsOnInterface[obj].item.Id >= 0 && MouseData.interfaceMouseIsOver.name == "Top Rack Panel" || MouseData.interfaceMouseIsOver.name == "Bottom Rack Panel")
            {
                OnRemoved?.Invoke(slotsOnInterface[obj]);

                slotsOnInterface[obj].RemoveItem();
            }
            else
            {
                InventorySlot mouseHoverSlotData = MouseData.interfaceMouseIsOver.slotsOnInterface[MouseData.slotHoveredOver];
                // only will start to swap if there is an item in the inventory
                if (slotsOnInterface[obj].item.Id >= 0)
                {
                    inventory.SwapItems(slotsOnInterface[obj], mouseHoverSlotData);
                }
            }
            return;
        }
    }
Esempio n. 6
0
 public override void Remove()
 {
     OnRemoved?.Invoke(Content);
     Content = null;
     m_quantityLabel.text = "";
     Clear();
 }
        public IEnumerable <SlamLine> Remove(IEnumerable <int> items)
        {
            if (items is null)
            {
                return(new List <SlamLine>());
            }
            var list    = items.ToList();
            var removed = new List <SlamLine>();

            lock (_lines)
            {
                foreach (var id in list)
                {
                    var index = _lines.FindIndex(l => l.Id == id);
                    if (index == -1)
                    {
                        continue;
                    }
                    removed.Add(_lines[index]);
                    _lines.RemoveAt(index);
                }
            }

            OnRemoved?.Invoke(this, new RemovedEventArgs(list));
            return(removed);
        }
        public void Remove(IEnumerable <SlamTrackedObject> items)
        {
            if (items is null)
            {
                return;
            }
            var list = items.ToList();

            lock (_objects)
            {
                foreach (var item in list)
                {
                    if (!_objects.ContainsKey(item.Id))
                    {
                        continue;
                    }
                    _objects[item.Id].Item2.Clear();
                    lock (_lineContainers)
                    {
                        _lineContainers.Remove(_objects[item.Id].Item2);
                    }

                    _objects.Remove(item.Id);
                }
            }

            OnRemoved?.Invoke(this, new RemovedEventArgs(list.Select(i => i.Id).ToList()));
        }
Esempio n. 9
0
        public void UpdateBy(IEnumerable <KeyValuePair <TKey, TItem> > source)
        {
            foreach (var kvp in source)
            {
                TItem currentValue;
                if (currentValues.TryGetValue(kvp.Key, out currentValue))
                {
                    if (currentValue.Equals(kvp.Value) == false)
                    {
                        currentValues[kvp.Key] = kvp.Value;
                        OnUpdated.Raise(kvp.Key, kvp.Value);
                    }
                }
                else
                {
                    currentValues[kvp.Key] = kvp.Value;
                    OnAdded.Raise(kvp.Key, kvp.Value);
                }
            }

            var keysRemoved = currentValues.Keys.Except(source.Select(kvp => kvp.Key)).ToArray();

            foreach (var keyRemoved in keysRemoved)
            {
                OnRemoved.Raise(keyRemoved, currentValues[keyRemoved]);
                currentValues.Remove(keyRemoved);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Removes an entity and its components.
        /// Pools unused entities.
        /// </summary>
        public void Remove(int eid)
        {
            Entity entity = caboodle.Pool.ReleaseEntity(entities.Get(eid));

            OnRemoved?.Invoke(entity);
            _components.RemoveComponents(eid);
            entities.Remove(eid); // Remove the entity after the events finnish
        }
 public void Remove()
 {
     foreach (IModdable moddable in _withinRange)
     {
         Modifier.RemoveFrom(moddable, this);
         OnRemoved?.Invoke(moddable);
     }
 }
Esempio n. 12
0
        public void Cleanup()
        {
            // Don't do anything if this object was already released
            if (isReleased)
            {
                return;
            }

            OnRemoved?.Invoke(this);

            // This will release the poolable objects of the mesh and the entity
            OnCleanupEvent?.Invoke(this);

            foreach (var kvp in components)
            {
                if (kvp.Value == null)
                {
                    continue;
                }

                if (!(kvp.Value is IPoolableObjectContainer poolableContainer))
                {
                    continue;
                }

                if (poolableContainer.poolableObject == null)
                {
                    continue;
                }

                poolableContainer.poolableObject.Release();
            }

            components.Clear();

            if (meshesInfo.meshRootGameObject)
            {
                Utils.SafeDestroy(meshesInfo.meshRootGameObject);
                meshesInfo.CleanReferences();
            }

            if (gameObject)
            {
                int childCount = gameObject.transform.childCount;

                // Destroy any other children
                for (int i = 0; i < childCount; i++)
                {
                    Utils.SafeDestroy(gameObject.transform.GetChild(i).gameObject);
                }

                //NOTE(Brian): This will prevent any component from storing/querying invalid gameObject references.
                gameObject = null;
            }

            OnTransformChange = null;
            isReleased        = true;
        }
Esempio n. 13
0
 public void Remove(T item)
 {
     Items.Remove(item);
     Debug.Log("Removed: " + item);
     if (OnRemoved != null)
     {
         OnRemoved.Invoke(item);
     }
 }
        public void RemoveAt(int index)
        {
            lock (_lines)
            {
                _lines.RemoveAt(index);
            }

            OnRemoved?.Invoke(this, new RemovedEventArgs(new[] { index }));
        }
Esempio n. 15
0
 public void RemoveAt(int index)
 {
     lock (_items)
     {
         RemoveTraces(new[] { _items[index] });
         _items.Remove(index);
         OnRemoved?.Invoke(this, new RemovedEventArgs(new[] { index }));
     }
 }
Esempio n. 16
0
    private void OnDestroy()
    {
        OnRemoved?.Invoke(this);

        if (_movementStrategy != null)
        {
            _movementStrategy.OnStepFinished -= HandleStepFinished;
        }
    }
Esempio n. 17
0
 internal void DoRemoved()
 {
     Parent = null;
     if (View != null)
     {
         View = null;
         DoRemovedFromView();
     }
     OnRemoved?.Invoke();
 }
        public void DeleteAll()
        {
            // Invoke removed for all entries
            foreach (var pair in json)
            {
                OnRemoved?.Invoke(pair.Key);
            }

            json = new JObject();
        }
Esempio n. 19
0
 public void Clear()
 {
     lock (_items)
     {
         _traceContainer.Clear();
         var ids = _items.Keys.ToList();
         _items.Clear();
         OnRemoved?.Invoke(this, new RemovedEventArgs(ids));
     }
 }
        public void Delete(string name)
        {
            string path = GetFullPath(name);

            if (File.Exists(path))
            {
                File.Delete(path);
                OnRemoved?.Invoke(name);
            }
        }
Esempio n. 21
0
        public bool RemoveItem(Item item)
        {
            bool res = items.Remove(item);

            if (res)
            {
                OnRemoved?.Invoke(item);
            }
            return(res);
        }
Esempio n. 22
0
        bool IDictionary <TKey, TValue> .Remove(TKey key)
        {
            var value  = Value[key];
            var result = Value.Remove(key);

            if (result)
            {
                OnRemoved?.Invoke(new KeyValuePair <TKey, TValue>(key, value));
            }
            return(result);
        }
Esempio n. 23
0
        protected void DrawItemRow(string item)
        {
            using (new EditorGUILayout.HorizontalScope()) {
                DrawItem(item);

                if (DrawRemoveButton())
                {
                    OnRemoved?.Invoke(item);
                }
            }
        }
Esempio n. 24
0
        public bool Remove(TCloudItem item)
        {
            lock (_items)
            {
                RemoveTraces(new[] { item });
                var res = _items.Remove(item.Id);
                OnRemoved?.Invoke(this, new RemovedEventArgs(new[] { item.Id }));

                return(res);
            }
        }
        public void Clear()
        {
            List <int> lines;

            lock (_lines)
            {
                lines = _lines.Select(l => l.Id).ToList();
                _lines.Clear();
            }

            OnRemoved?.Invoke(this, new RemovedEventArgs(lines));
        }
Esempio n. 26
0
 public override void TryRemoveEntity(int entityID)
 {
     for (var i = 0; i < length; i++)
     {
         if (entities[i] == entityID)
         {
             length--;
             Array.Copy(entities, i + 1, entities, i, length - i);
             OnRemoved?.Invoke(i);
             break;
         }
     }
 }
Esempio n. 27
0
        /// <summary>
        /// Remove the oldObject from the list if it can be found.
        /// </summary>
        /// <param name="oldObject"></param>
        public void Remove(T oldObject)
        {
            if (objects.Contains(oldObject))
            {
                objects.Remove(oldObject);
                OnRemoved?.Invoke(oldObject);
            }

            if (objects.Count <= 0)
            {
                OnEmpty?.Invoke();
            }
        }
        /// <summary>
        /// Remove the popup from the map
        /// </summary>
        /// <returns></returns>
        /// <exception cref="ComponentNotAddedToMapException">The control has not been added to the map</exception>
        /// <exception cref="PopupAlreadyRemovedException">The popup has already been removed</exception>
        public virtual async ValueTask RemoveAsync()
        {
            Logger?.LogAzureMapsControlInfo(AzureMapLogEvent.Popup_RemoveAsync, "Removing popup");
            Logger?.LogAzureMapsControlDebug(AzureMapLogEvent.Popup_RemoveAsync, $"Id: {Id}");

            EnsureJsRuntimeExists();
            EnsureNotRemoved();

            await JSRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.Popup.Remove.ToPopupNamespace(), Id);

            OnRemoved?.Invoke();
            IsRemoved = true;
        }
        public bool Remove(SlamLine item)
        {
            bool res;

            lock (_lines)
            {
                res = _lines.Remove(item);
            }

            OnRemoved?.Invoke(this, new RemovedEventArgs(new[] { item.Id }));


            return(res);
        }
Esempio n. 30
0
        /// <summary>
        /// Removes the component
        /// </summary>
        public C RemoveComponent <C>(int eid)
            where C : Component
        {
            var collection = Get(typeof(C));
            var c          = collection.Remove(eid) as C;

            ComponentInfo info;

            info.id        = collection.GetId();
            info.component = c;

            OnRemoved?.Invoke(eid, info);

            return(c);
        }