示例#1
0
        /// <summary>
        ///     Adds or removes a <see cref="GameObject" /> from the appropiate lists
        /// </summary>
        /// <param name="object">The <see cref="GameObject" /> to be processed</param>
        /// <param name="new">Determines whether to add or remove an item</param>
        private static void Process(GameObject @object, bool @new)
        {
            GetExecutor(@object, @new)(GameObjectList);
            GetExecutor(@object as Obj_GeneralParticleEmitter, @new)(Obj_GeneralParticleEmitterList);

            var attackable = @object as AttackableUnit;

            if (attackable == null)
            {
                return;
            }

            GetExecutor(attackable, @new)(AttackableUnitList);
            GetExecutor(attackable as Obj_HQ, @new)(Obj_HQList);
            GetExecutor(attackable as Obj_BarracksDampener, @new)(Obj_BarracksDampenerList);

            var @base = attackable as Obj_AI_Base;

            if (@base == null)
            {
                return;
            }

            GetExecutor(@base, @new)(Obj_AI_BaseList);
            GetExecutor(@base as Obj_AI_Hero, @new)(Obj_AI_HeroList);
            GetExecutor(@base as Obj_AI_Turret, @new)(Obj_AI_TurretList);

            var minion = attackable as Obj_AI_Minion;

            if (minion == null)
            {
                return;
            }

            GetExecutor(minion, @new)(Obj_AI_MinionList);

            if (minion.IsValid)
            {
                var type = minion.GetMinionType();

                GetExecutor(minion, @new)(
                    !type.HasFlag(MinionTypes.Melee) && !type.HasFlag(MinionTypes.Ranged)
                        ? !type.HasFlag(MinionTypes.Ward)
                              ? minion.GetJungleType() == JungleType.Unknown
                                    ? !minion.IsPet()
                                        ? OtherMinions
                                        : Pets
                                    : JungleMinions
                              : Wards
                        : Minions);
            }
            else
            {
                GetExecutor(minion, @new)(Minions);
                GetExecutor(minion, @new)(Wards);
                GetExecutor(minion, @new)(JungleMinions);
                GetExecutor(minion, @new)(Pets);
                GetExecutor(minion, @new)(OtherMinions);
            }
        }
示例#2
0
        /// <summary>
        /// Property getter.
        /// </summary>
        public IVelPropertyGet GetPropertyGet(Object obj, String identifier, Info i)
        {
            AbstractExecutor executor;

            Type type = obj.GetType();

            // First try for a getFoo() type of property (also getfoo())
            executor = new PropertyExecutor(runtimeLogger, introspector, type, identifier);

            // If that didn't work, look for get("foo")
            if (!executor.IsAlive)
            {
                executor = new GetExecutor(runtimeLogger, introspector, type, identifier);
            }

            // If that didn't work, look for boolean isFoo()
            if (!executor.IsAlive)
            {
                executor = new BooleanPropertyExecutor(runtimeLogger, introspector, type, identifier);
            }

            // If that didn't work, look for an enumeration
            if (!executor.IsAlive && (obj is Type) && (obj as Type).IsEnum)
            {
                executor = new EnumValueExecutor(runtimeLogger, introspector, obj as Type, identifier);
            }

            return(new VelGetterImpl(executor));
        }
        /// <summary> Property  getter
        /// </summary>
        public VelPropertyGet getPropertyGet(Object obj, String identifier, Info i)
        {
            AbstractExecutor executor;

            Type claz = obj.GetType();

            /*
             *  first try for a getFoo() type of property
             *  (also getfoo() )
             */

            executor = new PropertyExecutor(rlog, introspector, claz, identifier);

            /*
             *  if that didn't work, look for get("foo")
             */

            if (!executor.isAlive())
            {
                executor = new GetExecutor(rlog, introspector, claz, identifier);
            }

            /*
             *  finally, look for boolean isFoo()
             */

            if (!executor.isAlive())
            {
                executor = new BooleanPropertyExecutor(rlog, introspector, claz, identifier);
            }

            return((executor != null) ? new VelGetterImpl(this, executor) : null);
        }
示例#4
0
        public IVelPropertyGet GetPropertyGet(object obj, string identifier, Info i)
        {
            Type             type             = obj.GetType();
            AbstractExecutor abstractExecutor = new PropertyExecutor(this.rlog, UberspectImpl.introspector, type, identifier);

            if (!abstractExecutor.IsAlive)
            {
                abstractExecutor = new GetExecutor(this.rlog, UberspectImpl.introspector, type, identifier);
            }
            if (!abstractExecutor.IsAlive)
            {
                abstractExecutor = new BooleanPropertyExecutor(this.rlog, UberspectImpl.introspector, type, identifier);
            }
            return((abstractExecutor != null) ? new UberspectImpl.VelGetterImpl(abstractExecutor) : null);
        }
        /// <summary> Property  getter</summary>
        /// <param name="obj">
        /// </param>
        /// <param name="identifier">
        /// </param>
        /// <param name="i">
        /// </param>
        /// <returns> A Velocity Getter Method.
        /// </returns>
        /// <throws>  Exception </throws>
        public virtual IVelPropertyGet GetPropertyGet(object obj, string identifier, Info i)
        {
            if (obj == null)
            {
                return(null);
            }

            System.Type claz = obj.GetType();

            /*
             *  first try for a getFoo() type of property
             *  (also getfoo() )
             */
            AbstractExecutor executor = new PropertyExecutor(log, introspector, claz, identifier);

            /*
             * Let's see if we are a map...
             */
            if (!executor.Alive)
            {
                executor = new MapGetExecutor(log, claz, identifier);
            }

            /*
             *  if that didn't work, look for Get("foo")
             */

            if (!executor.Alive)
            {
                executor = new GetExecutor(log, introspector, claz, identifier);
            }

            /*
             *  finally, look for boolean isFoo()
             */

            if (!executor.Alive)
            {
                executor = new BooleanPropertyExecutor(log, introspector, claz, identifier);
            }

            return((executor.Alive) ? new VelGetterImpl(executor) : null);
        }
示例#6
0
        public async Task Execute(object message, IServiceProvider services)
        {
            var ctx = CreateContext(message.GetType(), message, services);

            await GetExecutor(ctx.GetType(), services)(ctx);
        }