private void OnRemovePerson()
        {
            var selectedSearchable = SelectedObject as ISearchable;

            if (selectedSearchable == null)
            {
                return;
            }

            AllObjects.Remove(selectedSearchable);
        }
        public virtual void Remove(T item)
        {
            AllObjects.Remove(item);

            // Update the total number of pages

            // if the last item on the last page is removed
            if (currentPageNumber > TotalPagesNumber)
            {
                currentPageNumber--;
            }

            Calculate(CurrentPageNumber);
            OnTotalChange();
        }
Пример #3
0
        private void DestroyNotMappedWorldObjects()
        {
            foreach (var item in AllObjects.ToArray())
            {
                if (!item.Value.Updated)
                {
                    try
                    {
                        if (item.Value.Controller != null)
                        {
                            Destroy(item.Value.Controller);
                            item.Value.Controller = null;
                        }

                        AllObjects.Remove(item.Key);
                    }
                    catch (Exception e)
                    {
                        WriteLog($"Error while DestroyNotMappedWorldObjects='{e}'");
                    }
                }
            }
        }
Пример #4
0
 public void RemoveObject(ManageableObjet obj)
 {
     AllObjects.Remove(obj);
     //StatPanel statPanel = _og.MainPanel.StatPanels.FirstOrDefault(x => x.Type == obj.Type);
     //_og.MainPanel.UpdateGlobalStat(statPanel, -1);
 }
Пример #5
0
        private void GameObject_OnDelete(GameObject sender, EventArgs args)
        {
            AllObjects.Remove(sender);

            var hero = sender as AIHeroClient;

            if (hero != null)
            {
                AllHeroes.Remove(hero);
                if (hero.IsEnemy)
                {
                    EnemyHeroes.Remove(hero);
                    AllEnemies.Remove(hero);
                }
                else
                {
                    AllyHeroes.Remove(hero);
                    AllAllies.Remove(hero);
                }

                return;
            }

            var minion = sender as Obj_AI_Minion;

            if (minion != null)
            {
                if (minion.Team != GameObjectTeam.Neutral)
                {
                    if (minion.GetMinionType().HasFlag(Extensions.MinionTypes.Ward))
                    {
                        AllWards.Remove(minion);
                        if (minion.IsEnemy)
                        {
                            EnemyWards.Remove(minion);
                        }
                        else
                        {
                            AllyWards.Remove(minion);
                        }
                    }
                    else
                    {
                        AllMinions.Remove(minion);
                        if (minion.IsEnemy)
                        {
                            EnemyMinions.Remove(minion);
                            AllEnemies.Remove(minion);
                        }
                        else
                        {
                            AllyMinions.Remove(minion);
                            AllAllies.Remove(minion);
                        }
                    }
                }
                else if (minion.Name != "WardCorpse")
                {
                    switch (minion.GetJungleType())
                    {
                    case Extensions.JungleType.Small:
                        SmallJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Large:
                        LargeJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Epic:
                        EpicJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Legendary:
                        LegendaryJungleMinions.Remove(minion);
                        break;
                    }

                    AllJungleMinions.Remove(minion);
                }

                return;
            }

            var particle = sender as Obj_GeneralParticleEmitter;

            if (particle != null)
            {
                AllParticleEmitters.Remove(particle);
                return;
            }

            var turret = sender as Obj_AI_Turret;

            if (turret != null)
            {
                AllTurrets.Remove(turret);

                if (turret.IsEnemy)
                {
                    EnemyTurrets.Remove(turret);
                }
                else
                {
                    AllyTurrets.Remove(turret);
                }

                return;
            }

            var shop = sender as Obj_Shop;

            if (shop != null)
            {
                AllShops.Remove(shop);

                if (shop.IsAlly)
                {
                    AllyShops.Remove(shop);
                }
                else
                {
                    EnemyShops.Remove(shop);
                }

                return;
            }

            var spawnPoint = sender as Obj_SpawnPoint;

            if (spawnPoint != null)
            {
                AllSpawnPoints.Remove(spawnPoint);

                if (spawnPoint.IsAlly)
                {
                    AllySpawnPoints.Remove(spawnPoint);
                }
                else
                {
                    EnemySpawnPoints.Remove(spawnPoint);
                }
            }

            var inhibitor = sender as Obj_BarracksDampener;

            if (inhibitor != null)
            {
                AllInhibitors.Remove(inhibitor);

                if (inhibitor.IsAlly)
                {
                    AllyInhibitors.Remove(inhibitor);
                }
                else
                {
                    EnemyInhibitors.Remove(inhibitor);
                }
            }

            var nexus = sender as Obj_HQ;

            if (nexus != null)
            {
                AllNexus.Remove(nexus);

                if (nexus.IsAlly)
                {
                    AllyNexus = null;
                }
                else
                {
                    EnemyNexus = null;
                }
            }

            var missile = sender as MissileClient;

            if (missile != null)
            {
                AllMissiles.Remove(missile);

                if (missile.IsAlly)
                {
                    AllyMissiles.Remove(missile);
                }
                else
                {
                    EnemyMissiles.Remove(missile);
                }
            }
        }