// Token: 0x0600033D RID: 829 RVA: 0x0001A9B8 File Offset: 0x00018BB8
 static EntityManager9()
 {
     foreach (Type type in from x in Assembly.GetExecutingAssembly().GetTypes()
              where !x.IsAbstract && x.IsClass
              select x)
     {
         if (typeof(Ability9).IsAssignableFrom(type))
         {
             using (IEnumerator <AbilityIdAttribute> enumerator2 = type.GetCustomAttributes <AbilityIdAttribute>().GetEnumerator())
             {
                 while (enumerator2.MoveNext())
                 {
                     AbilityIdAttribute abilityIdAttribute = enumerator2.Current;
                     EntityManager9.abilityTypes.Add(abilityIdAttribute.AbilityId, type);
                 }
                 continue;
             }
         }
         if (typeof(Hero9).IsAssignableFrom(type))
         {
             using (IEnumerator <HeroIdAttribute> enumerator3 = type.GetCustomAttributes <HeroIdAttribute>().GetEnumerator())
             {
                 while (enumerator3.MoveNext())
                 {
                     HeroIdAttribute heroIdAttribute = enumerator3.Current;
                     EntityManager9.heroTypes.Add(heroIdAttribute.HeroId, type);
                 }
                 continue;
             }
         }
         if (typeof(Unit9).IsAssignableFrom(type))
         {
             foreach (UnitNameAttribute unitNameAttribute in type.GetCustomAttributes <UnitNameAttribute>())
             {
                 EntityManager9.unitTypes.Add(unitNameAttribute.Name, type);
             }
         }
     }
     EntityManager9.UnitMonitor          = new UnitMonitor();
     EntityManager9.AbilityMonitor       = new AbilityMonitor();
     EntityManager9.delayedEntityHandler = UpdateManager.Subscribe(new Action(EntityManager9.DelayedEntitiesOnUpdate), 1000, false);
     EntityManager9.AddCurrentUnits();
     EntityManager9.AddCurrentAbilities();
     ObjectManager.OnAddEntity    += EntityManager9.OnAddEntity;
     ObjectManager.OnRemoveEntity += EntityManager9.OnRemoveEntity;
     UpdateManager.BeginInvoke(new Action(EntityManager9.DemoModeCheck), 2000);
     UpdateManager.BeginInvoke(new Action(EntityManager9.LoadCheck), 5000);
 }
Пример #2
0
 // Token: 0x06000019 RID: 25 RVA: 0x00007880 File Offset: 0x00005A80
 protected override void OnActivate()
 {
     try
     {
         Hero localHero = ObjectManager.LocalHero;
         Type type      = Array.Find <Type>(Assembly.GetExecutingAssembly().GetTypes(), delegate(Type x)
         {
             if (!x.IsAbstract && x.IsClass && typeof(BaseHero).IsAssignableFrom(x))
             {
                 HeroIdAttribute customAttribute = x.GetCustomAttribute <HeroIdAttribute>();
                 return(((customAttribute != null) ? new HeroId?(customAttribute.HeroId) : null) == localHero.HeroId);
             }
             return(false);
         });
         if (type == null)
         {
             Logger.Warn("O9K.AIO // Hero is not supported");
             Logger.Warn("O9K.AIO // Dynamic combo will be loaded");
             this.hero = new BaseHero(this.context);
         }
         else if (!this.freeHeroes.Contains(localHero.HeroId) && !this.context.FeatureManager.IsFeatureActive(0))
         {
             Hud.DisplayWarning("O9K.AIO // You need O9K.AIO.Unlocker for current hero", 10f);
             this.disabledMenu = new DisabledMenuManager(localHero, this.context.MenuManager);
         }
         else
         {
             this.hero = (BaseHero)Activator.CreateInstance(type, new object[]
             {
                 this.context
             });
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, null);
     }
 }