Beispiel #1
0
        public Target BuildTarget(BoardPosition sourcePosition, TargetNames targetName)
        {
            Target target = new Target();
            List <BoardPosition> localPath = new List <BoardPosition>();

            target.Source        = sourcePosition;
            _sourcePosition      = sourcePosition;
            target.IsValidTarget = true;
            int x = sourcePosition.XIndex;
            int y = sourcePosition.YIndex;

            switch (targetName)
            {
            case TargetNames.Target_East:
                localPath             = GetLocalPath(3, 0);
                target.TargetPosition = _currentBoard[x + 3, y];
                break;

            case TargetNames.Target_SouthEast:
                localPath             = GetLocalPath(3, -3);
                target.TargetPosition = _currentBoard[x + 3, y - 3];
                break;

            case TargetNames.Target_South:
                localPath             = GetLocalPath(0, -3);
                target.TargetPosition = _currentBoard[x, y - 3];
                break;

            case TargetNames.Target_SouthWest:
                localPath             = GetLocalPath(-3, -3);
                target.TargetPosition = _currentBoard[x - 3, y - 3];
                break;

            case TargetNames.Target_West:
                localPath             = GetLocalPath(-3, 0);
                target.TargetPosition = _currentBoard[x - 3, y];
                break;

            case TargetNames.Target_NorthWest:
                localPath             = GetLocalPath(-3, 3);
                target.TargetPosition = _currentBoard[x - 3, y + 3];
                break;

            case TargetNames.Target_North:
                localPath             = GetLocalPath(0, 3);
                target.TargetPosition = _currentBoard[x, y + 3];
                break;

            case TargetNames.Target_NorthEast:
                localPath             = GetLocalPath(3, 3);
                target.TargetPosition = _currentBoard[x + 3, y + 3];
                break;
            }
            target.Path = localPath;
            target.MovesRequiredToFillPath = GetRequiredMovesList(target.Path);
            return(target);
        }
Beispiel #2
0
 public void Reset()
 {
     Active = false;
     TargetNames.Clear();
     Type         = 0;
     SkillID      = 0;
     Min_Per      = 100;
     TickDuration = 0L;
     Min_MP       = 0;
     Range        = Globals.gamedata.botoptions.HealRange;
 }
        /// <summary>
        /// Determines the target.
        /// </summary>
        /// <param name="store">The store.</param>
        /// <param name="instance">The instance.</param>
        /// <returns>System.String.</returns>
        /// <exception cref="System.Configuration.ConfigurationErrorsException"></exception>
        protected string DetermineTarget(string store, Guid instance)
        {
            string targetName;

            if (!TargetNames.TryGetValue(store, out targetName))
            {
                throw new ConfigurationErrorsException($"The target name for data store {store} is unknown.");
            }
            targetName = string.Format(targetName, instance);
            return(targetName);
        }
        private void OnObjectSelected(IObjectViewModel selectedObject)
        {
            if (selectedObject == null)
            {
                return;
            }
            if (Operation != ActionOperation.SetObjectText && Operation != ActionOperation.SetVisibility)
            {
                return;
            }
            var selector = TargetNames.FirstOrDefault(t => t == selectedObject.Properties.Name);

            if (selector != null)
            {
                TargetName = selector;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Calculates the target rank.
        /// </summary>
        /// <param name="metadata">The metadata.</param>
        /// <returns>The rank.</returns>
        public virtual int?CalculateTargetRank(UIComponentMetadata metadata)
        {
            if (!IsNameApplicable(metadata.Name))
            {
                return(null);
            }

            int?depthOfTypeInheritance = GetDepthOfInheritance(TargetTypes, metadata.ComponentType);

            if (depthOfTypeInheritance == null)
            {
                return(null);
            }

            int?depthOfParentTypeInheritance = GetDepthOfInheritance(TargetParentTypes, metadata.ParentComponentType);

            if (depthOfParentTypeInheritance == null)
            {
                return(null);
            }

            int rank       = 0;
            int rankFactor = 100000;

            if (TargetNames != null && TargetNames.Any())
            {
                rank += rankFactor;
            }
            rankFactor /= 2;

            if (depthOfTypeInheritance >= 0)
            {
                rank += Math.Max(rankFactor - (depthOfTypeInheritance.Value * 100), 0);
            }
            rankFactor /= 2;

            if (depthOfParentTypeInheritance >= 0)
            {
                rank += Math.Max(rankFactor - (depthOfParentTypeInheritance.Value * 100), 0);
            }

            return(rank);
        }
        private void OnVariableSelected(NotificationMessage <IVariableWrapper> message)
        {
            if (message.Notification != Messages.VariableSelected)
            {
                return;
            }
            if (Operation != ActionOperation.SetValue)
            {
                return;
            }

            var selectedVariable = message.Content;
            var selector         = TargetNames.FirstOrDefault(t => t == selectedVariable.Name);

            if (selector != null)
            {
                TargetName = selector;
            }
        }
        private void UpdateTargetNames()
        {
            TargetNames.Clear();
            switch (Operation)
            {
            case ActionOperation.SetValue:
                _variablesRepository.GetNames(Action.Variable.Name).ForEach(t => TargetNames.Add(t));
                break;

            case ActionOperation.SetVisibility:
                _objectsRepository.GetNames().ForEach(t => TargetNames.Add(t));
                break;

            case ActionOperation.SetObjectText:
                _objectsRepository.GetNamesOfObjectsWithText().ForEach(t => TargetNames.Add(t));
                break;
            }
            TargetIsEmpty = TargetNames.Count == 0;
            TargetName    = _isInEditMode
                ? Action.Result.TargetName
                : TargetIsEmpty ? null : TargetNames[0];
        }
Beispiel #8
0
 /// <summary>
 /// Determines whether the component name applies the name criteria.
 /// </summary>
 /// <param name="name">The component name.</param>
 /// <returns>
 ///   <c>true</c> if the name applies the criteria; otherwise, <c>false</c>.
 /// </returns>
 public bool IsNameApplicable(string name)
 {
     return(TargetNames == null || !TargetNames.Any() || TargetNames.Contains(name));
 }
Beispiel #9
0
 internal JenkinsOptions AddFlubuTargets(params string[] targetNames)
 {
     TargetNames.AddRange(targetNames);
     return(this);
 }
Beispiel #10
0
 public void SetTarget(TargetNames targetName)
 {
     target = allTarget.FirstOrDefault(x => x.Key == targetName.ToString()).Value;
 }