Example #1
0
 AddTarget <T>(T target)
     where T : Target
 {
     Guard.NotNull(target, nameof(target));
     Targets.Add(target);
     return(target);
 }
Example #2
0
        //创建任务
        protected Task CreateTask(TEnum type, TTarget target)
        {
            int enumIndex = Enum <TEnum> .Int(type);

            if (target == null)
            {
                return(null);
            }
            if (Targets.Contains(target))
            {
                foreach (var item in AllTask)
                {
                    if (item.Target == target)
                    {
                        return(item);
                    }
                }
                return(null);
            }
            if (!ConfigData[enumIndex].Valid.Invoke(target))
            {
                return(null);
            }
            var obj = new Task();

            AllTask.Add(obj);
            Targets.Add(target);
            TypedTask[enumIndex].Add(obj);
            obj.Init(type, target, this);
            return(obj);
        }
Example #3
0
        public void LoadData(IMouseFrame frame, IWhiskerVelocityFrame previousFrame, IFrameRateSettings frameRateSettings, IUnitSettings unitSettings)
        {
            TargetFrame = frame;

            int numberOfWhiskers = TargetFrame.Whiskers.Length;

            int previousFrameCounter         = 0;
            ISingleWhiskerVelocity nosePoint = null;

            for (int i = 0; i < numberOfWhiskers; i++)
            {
                IWhisker whisker = TargetFrame.Whiskers[i];

                ISingleWhiskerVelocity singleWhiskerVelocity = ModelResolver.Resolve <ISingleWhiskerVelocity>();
                singleWhiskerVelocity.Whisker           = whisker;
                singleWhiskerVelocity.FrameRateSettings = frameRateSettings;
                singleWhiskerVelocity.UnitSettings      = unitSettings;
                singleWhiskerVelocity.NosePoint         = nosePoint;

                if (whisker.WhiskerId == -1)
                {
                    nosePoint = singleWhiskerVelocity;
                }

                if (previousFrame != null)
                {
                    singleWhiskerVelocity.PreviousFrame = previousFrame.Targets[previousFrameCounter];
                }

                Targets.Add(singleWhiskerVelocity);
                previousFrameCounter++;
            }
        }
Example #4
0
 /// <summary>
 /// Interface aspect Ctor.
 /// </summary>
 /// <param name="Name">Name of the aspect.</param>
 /// <param name="interfaceTypeName">Full name of the type of the interface to match.</param>
 /// <param name="mixins">IList of mixin types.</param>
 /// <param name="pointcuts">IList of IPointcut instances.</param>
 public InterfaceAspect(string Name, string interfaceTypeName, IList mixins, IList pointcuts)
 {
     this.Name = Name;
     Mixins    = mixins;
     Pointcuts = pointcuts;
     Targets.Add(new AspectTarget(interfaceTypeName, AspectTargetType.Interface));
 }
Example #5
0
 /// <summary>
 /// Interface aspect Ctor.
 /// </summary>
 /// <param name="Name">Name of the aspect.</param>
 /// <param name="interfaceTypeName">Full name of the type of the interface to match.</param>
 /// <param name="mixins">Type[] array of mixin types</param>
 /// <param name="pointcuts">IPointcut[] array of pointcut instances</param>
 public InterfaceAspect(string Name, string interfaceTypeName, Type[] mixins, IPointcut[] pointcuts)
 {
     this.Name = Name;
     Mixins    = new ArrayList(mixins);
     Pointcuts = new ArrayList(pointcuts);
     Targets.Add(new AspectTarget(interfaceTypeName, AspectTargetType.Interface));
 }
Example #6
0
        // Constructor(s)
        public Player()
            : base((float)Math.PI * 1.5f)
        {
            this.Texture  = TextureManager.boss;
            this.Position = new Vector2(300, Globals.ScreenSize.Y - Texture.Height);

            this.Energy     = new Bar(new Vector2(400, Globals.ScreenSize.Y - 35), 100, 20, 100, Color.Orange);
            this.Rank       = 1;
            this.Experience = new Bar(new Vector2(Globals.ScreenSize.X / 2 - 330, 50), 300, 25, 100, Color.Green);
            this.Experience.Change(-Experience.MaxValue);
            this.RankPerks = new List <string>();
            Targets.Add("Enemy");
            Targets.Add("Boss");

            this.craft = new Button(new Vector2(700, 400), "Craft", TextureManager.SpriteFont20);
            for (int i = 0; i < 2; i++)
            {
                AddItem(new Item(Globals.Flee));
            }

            // Startmodules
            Inventory[2, 5] = new Weapon(this, 2, -1);
            Inventory[3, 5] = new Weapon(this, 3, -1);
            this.ShipHull   = new Hull(this, 6, -1);
            this.ShipShield = new Shield(new Vector2(200, Globals.ScreenSize.Y - 35), 100, 20, 60, 0, -1);
        }
Example #7
0
        private void ParseTargets(Project project)
        {
            foreach (Target mstarget in project.Targets)
            {
                if (!mstarget.IsImported || _defaultTargets.Contains(mstarget.Name))
                {
                    MSBuildTarget target = new MSBuildTarget(mstarget.Name);
                    target.Condition = mstarget.Condition;
                    target.Depends   = mstarget.DependsOnTargets.Replace(" ", "").Split(';');

                    if (_defaultTargets.Contains(target.Name))
                    {
                        target.Default = true;
                    }

                    if (_initialTargets.Contains(target.Name))
                    {
                        target.Initial = true;
                    }

                    Targets.Add(target);
                }
            }

            //Targets.Sort();
        }
 /// <summary>
 /// Signature aspect ctor.
 /// </summary>
 /// <param name="name">Name of the aspect</param>
 /// <param name="targetType">Specific Type to which the aspect should be applied.</param>
 /// <param name="mixins">Array of <c>System.Type</c>s to mixin</param>
 /// <param name="pointcuts">Array of IPointcut instances</param>
 public SignatureAspect(string name, Type targetType, Type[] mixins, IPointcut[] pointcuts)
 {
     Name      = name;
     Mixins    = new ArrayList(mixins);
     Pointcuts = new ArrayList(pointcuts);
     Targets.Add(new AspectTarget(targetType.FullName, AspectTargetType.Signature));
 }
 /// <summary>
 /// Signature aspect ctor.
 /// </summary>
 /// <param name="name">Name of the aspect</param>
 /// <param name="targetType">Specific Type to which the aspect should be applied.</param>
 /// <param name="mixins">Untyped list of <c>System.Type</c>s to mixin</param>
 /// <param name="pointcuts">Untyped list of IPointcut instances</param>
 public SignatureAspect(string name, Type targetType, IList mixins, IList pointcuts)
 {
     Name      = name;
     Mixins    = mixins;
     Pointcuts = pointcuts;
     Targets.Add(new AspectTarget(targetType.FullName, AspectTargetType.Signature));
 }
Example #10
0
 /// <summary>
 /// Attribute aspect Ctor.
 /// </summary>
 /// <param name="Name">Name of the aspect.</param>
 /// <param name="attributeTypeName">Full name of the type of the attribute to match.</param>
 /// <param name="mixins">Type[] array of mixin types</param>
 /// <param name="pointcuts">IPointcut[] array of pointcut instances</param>
 public AttributeAspect(string Name, string attributeTypeName, Type[] mixins, IPointcut[] pointcuts)
 {
     this.Name = Name;
     Mixins    = new ArrayList(mixins);
     Pointcuts = new ArrayList(pointcuts);
     Targets.Add(new AspectTarget(attributeTypeName, AspectTargetType.Attribute));
 }
Example #11
0
        public void RegisterTarget(string name, string dependencies, string description, Action method)
        {
            if (string.IsNullOrEmpty(DefaultTarget))
            {
                DefaultTarget = name;
            }

            Target target;

            if (!Targets.TryGetValue(name, out target))
            {
                target = new Target {
                    Name = name, Dependencies = new List <string>()
                };
                Targets.Add(name, target);
            }

            if (!string.IsNullOrWhiteSpace(dependencies))
            {
                target.Dependencies = target.Dependencies
                                      .Concat(dependencies.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)).
                                      ToList();
            }

            if (!string.IsNullOrWhiteSpace(description))
            {
                target.Description = description;
            }

            if (method != null)
            {
                target.Method = method;
            }
        }
Example #12
0
        public void AddTarget(ChainNode target, bool registerUndo = true)
        {
            if (target.HasDescendent(this))
            {
                Debug.LogWarning("Not adding target because it would create a circular reference.");
                return;
            }

            if (Targets.Contains(target))
            {
                return;
            }

            Targets.Add(target);


            if (registerUndo)
            {
                List <UndoItem> list = new List <UndoItem> {
                    new RouterConnection(target, this, true)
                };
                TargetAdded(this, target, list);
                UndoLord.Instance.Push(new UndoList(list));
            }
            else
            {
                TargetAdded(this, target, null);
            }
        }
 public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
 {
     if (syntaxNode is TypeDeclarationSyntax typeDeclarationSyntax)
     {
         Targets.Add(typeDeclarationSyntax);
     }
 }
Example #14
0
        public void LoadData(IMouseFrame frame)
        {
            TargetFrame = frame;

            IAngleTypeBase angleType;
            IWhisker       noseWhisker        = TargetFrame.Whiskers.FirstOrDefault(x => x.WhiskerId == -1);
            IWhisker       orientationWhisker = TargetFrame.Whiskers.FirstOrDefault(x => x.WhiskerId == 0);

            if (noseWhisker == null || orientationWhisker == null)
            {
                //can't generate centerline, use vertical
                angleType = ModelResolver.Resolve <IVertical>();
            }
            else
            {
                ICenterLine centerLine = ModelResolver.Resolve <ICenterLine>();
                centerLine.NosePoint        = noseWhisker.WhiskerPoints[0];
                centerLine.OrientationPoint = orientationWhisker.WhiskerPoints[0];
                angleType = centerLine;
            }


            foreach (IWhisker whisker in TargetFrame.Whiskers)
            {
                if (whisker.IsGenericPoint)
                {
                    continue;
                }

                ISingleWhiskerAngle singleWhiskerCurve = ModelResolver.Resolve <ISingleWhiskerAngle>();
                singleWhiskerCurve.Whisker   = whisker;
                singleWhiskerCurve.AngleType = angleType;
                Targets.Add(singleWhiskerCurve);
            }
        }
        public override void SpecialParse(FightData fightData, AgentData agentData, List <CombatItem> combatData)
        {
            AgentItem dummyAgent = agentData.AddCustomAgent(combatData.First().Time, combatData.Last().Time, AgentItem.AgentType.NPC, "WorldVsWorld", "", TriggerID);

            Targets.Add(new Target(dummyAgent));
            Targets[0].Health = 1;
        }
 public TemplateAspect() : base("Mojo.Aspect")
 {
     //target all classes implementing ITemplate
     Targets.Add(new AspectTarget(typeof(ITemplate), AspectTargetType.Interface));
     //target all methods marked with FactoryMethodAttribute
     Pointcuts.Add(new AttributePointcut(typeof(FactoryMethodAttribute), new FactoryMethodInterceptor()));
 }
Example #17
0
 private void AddTargetCommand()
 {
     if (!Targets.Contains(TargetsName))
     {
         Targets.Add(TargetsName);
     }
 }
        void OnPlayerCollisionStay(Collision collision)
        {
            var target = collision.gameObject.GetComponent <IPlayerHandsIKTarget>();

            if (target == null)
            {
                return;
            }

            for (int i = 0; i < Targets.Count; i++)
            {
                if (Targets[i].Collision.gameObject == collision.gameObject)
                {
                    if (target.Active)
                    {
                        Targets[i].Collision = collision;
                    }
                    else
                    {
                        Targets.RemoveAt(i);
                    }

                    return;
                }
            }

            if (target.Active)
            {
                Targets.Add(new TargetData(collision));
            }
        }
Example #19
0
 /// <summary>
 /// Create a new <see cref="LoggingRule" /> with a <paramref name="minLevel"/> which writes to <paramref name="target"/>.
 /// </summary>
 /// <param name="loggerNamePattern">Logger name pattern used for <see cref="LoggerNamePattern"/>. It may include one or more '*' or '?' wildcards at any position.</param>
 /// <param name="minLevel">Minimum log level needed to trigger this rule.</param>
 /// <param name="target">Target to be written to when the rule matches.</param>
 public LoggingRule(string loggerNamePattern, LogLevel minLevel, Target target)
     : this()
 {
     LoggerNamePattern = loggerNamePattern;
     Targets.Add(target);
     EnableLoggingForLevels(minLevel, LogLevel.MaxLevel);
 }
    /// <summary>
    /// Update is called once per frame
    /// </summary>
    protected virtual void Update()
    {
        // Finding targets
        for (int i = 0; i < Targets.Count;)
        {
            if (Targets[i].transform == null)
            {
                if (CurrentTarget == Targets[i])
                {
                    CurrentTarget = null;
                }
                Targets.RemoveAt(i);
            }
            else
            {
                ++i;
            }
        }
        for (int i = 0; i < targetTags.Length; ++i)
        {
            foreach (GameObject g in GameObject.FindGameObjectsWithTag(targetTags[i]))
            {
                if (!Target.ContainsTransform(Targets, g.transform))
                {
                    Targets.Add(new Target(g.transform, null, null));
                }
            }
        }

        // Updating the active target
        if (CurrentTarget == null)
        {
            GetClosestTarget();
        }
    }
Example #21
0
 private void AddHandlerTargetsToTargets(SpellEffectHandler handler)
 {
     foreach (var target in handler.Targets)
     {
         Targets.Add(target);
     }
 }
Example #22
0
 /// <summary>
 /// Attribute aspect Ctor.
 /// </summary>
 /// <param name="Name">Name of the aspect.</param>
 /// <param name="attributeTypeName">Full name of the type of the attribute to match.</param>
 /// <param name="mixins">IList of mixin types.</param>
 /// <param name="pointcuts">IList of IPointcut instances.</param>
 public AttributeAspect(string Name, string attributeTypeName, IList mixins, IList pointcuts)
 {
     this.Name = Name;
     Mixins    = mixins;
     Pointcuts = pointcuts;
     Targets.Add(new AspectTarget(attributeTypeName, AspectTargetType.Attribute));
 }
        protected virtual void ComputeFightTargets(AgentData agentData, List <CombatItem> combatItems)
        {
            foreach (int id in GetUniqueTargetIDs())
            {
                RegroupTargetsByID(id, agentData, combatItems);
            }
            List <int> ids = GetFightTargetsIDs();

            foreach (int id in ids)
            {
                List <AgentItem> agents = agentData.GetNPCsByID(id);
                foreach (AgentItem agentItem in agents)
                {
                    Targets.Add(new NPC(agentItem));
                }
            }
            List <ParseEnum.TrashIDS> ids2 = GetTrashMobsIDS();
            var aList = agentData.GetAgentByType(AgentItem.AgentType.NPC).Where(x => ids2.Contains(ParseEnum.GetTrashIDS(x.ID))).ToList();

            //aList.AddRange(agentData.GetAgentByType(AgentItem.AgentType.Gadget).Where(x => ids2.Contains(ParseEnum.GetTrashIDS(x.ID))));
            foreach (AgentItem a in aList)
            {
                var mob = new NPC(a);
                TrashMobs.Add(mob);
            }
        }
Example #24
0
        /// <summary>
        /// Adds the association to.
        /// </summary>
        /// <param name="targetModel">The target model.</param>
        /// <returns></returns>
        public Association AddAssociationTo(Entity targetModel)
        {
            Targets.Add(targetModel);
            IList <Association> assocs = Association.GetLinks(this, targetModel);

            return(assocs[assocs.Count - 1]);
        }
Example #25
0
        protected override void UpdateTargets(string tag, float range2)  //modules, selectableTargets must be at z=0;
        {
            GameObject[] targets = GameObject.FindGameObjectsWithTag(tag);
            int          count   = targets.Length;

            SelectableTarget[] selectables = new SelectableTarget[count];

            for (int i = 0; i < count; i++)
            {
                selectables[i] = targets[i].GetComponent <SelectableTarget>();
            }
            for (int i = 0; i < count; i++)
            {
                if (selectables[i] == null)
                {
                    targets[i]     = targets[i].transform.parent.gameObject;
                    selectables[i] = targets[i].GetComponent <SelectableTarget>();
                }
            }
            if (combining)
            {
                count = 0;
                for (int i = 0; i < targets.Length; i++)
                {
                    if (targets[i].GetComponent <CombineAction>().Combinable(part, up, down))
                    {
                        selectables[count] = selectables[i];
                        targets[count++]   = targets[i];
                    }
                }
            }

            for (int i = 0; i < count; i++)
            {
                if ((transform.position - targets[i].transform.position).sqrMagnitude <= range2)
                {
                    if (!Targets.Contains(targets[i])) //add targets that newly came into range
                    {
                        if (!selectables[i].IsSelectable(PlayerInside, tag))
                        {
                            continue;
                        }
                        Targets.Add(targets[i]);
                        selectables[i].SetGlow(PlayerInside, true);
                    }
                    else if (!selectables[i].IsSelectable(PlayerInside, tag))
                    {
                        Targets.Remove(targets[i]);
                    }
                }
                else //out of range
                {
                    if (Targets.Remove(targets[i])) //remove targets that went out of range
                    {
                        targets[i].GetComponent <SelectableTarget>().SetGlow(PlayerInside, false);
                    }
                }
            }
        }
Example #26
0
        public async Task <Exception> ValidateAsync(IProgress <ProgressEventArgs> progress)
        {
            Targets.Select(x => {
                try
                {
                    x.Dispose();
                }
                catch { }
                return(x);
            });
            Targets.Clear();


            if (Sources.Count == 0)
            {
                throw new InvalidOperationException("At least one source needs to be defined.");
            }
            try
            {
                foreach (var source in Sources)
                {
                    if (source.Checked)                 //EBORJA
                    {
                        await source.PopulateTargets(); //Clear and populate

                        foreach (var target in source.Targets)
                        {
                            target.DeploymentStatusMessage = "";
                            //await target.TryConnect(CancellationToken.None);
                            Targets.Add(target);
                        }
                    }
                }

                if (Targets == null || Targets.Count == 0)
                {
                    throw new InvalidOperationException("Cannot start deployment without target.");
                }

                foreach (var scriptFile in ScriptFiles)
                {
                    if (!scriptFile.IsValid)
                    {
                        throw new SqlScriptFileException(scriptFile.ScriptErrors);
                    }
                }
            }
            catch (Exception ex)
            {
                Status = DeploymentStatus.Error;
                progress?.Report(new ProgressEventArgs(ex));
                return(ex);
            }
            await Task.Delay(100);

            progress?.Report(new ProgressEventArgs("Deployment validated!"));

            return(null);
        }
Example #27
0
        private void AddTargetButton_Click(object sender, RoutedEventArgs e)
        {
            Target t = new Target();

            t.Title = "<New Target>";
            Targets.Add(t);
            Selected = t;
        }
Example #28
0
 protected DDManipulationFrameBase(params DDObject[] targets)
     : this()
 {
     foreach (DDObject target in targets)
     {
         Targets.Add(target);
     }
 }
        public IContextAppender TargetedMessage(string message)
        {
            var received = _ReceivedFactory(nick => new PublicMessageFromCivilian(nick, message, NextTimestamp()));

            Targets.Add(received);
            _appendedCount++;
            return(this);
        }
Example #30
0
        public void SetTargets(IUnitOfWork unitOfWork)
        {
            var shop   = unitOfWork.ShopRepository.FindByIdOrNull(ShopGuid);
            var owners = shop.Owners.Select(owner => owner.OwnerGuid).ToList();

            Targets.Add(shop.Creator.OwnerGuid);
            Targets.AddRange(owners);
        }