public void UpdateTargetPointer()
        {         // @TODO: allow for multiple targets/AoE/Line/etc.
            if (currentCommandTarget == null)
            {
                List <BattleActor>[] targets = battleManager.GetAllTargets();
                ISelectionItem       command = commandStack.Peek().GetSelectedItem();
                switch (((ChooseTargetSelectionItem)command).targetType)
                {
                case TargetType.Enemy:
                    // @TODO: get last selected enemy, if possible
                    currentCommandTarget = targets[0][0].gameObject;
                    break;

                case TargetType.Ally:
                    // @TODO: get last selected ally, if possible
                    currentCommandTarget = targets[1][0].gameObject;
                    break;

                case TargetType.Self:
                case TargetType.Free:
                    Debug.LogWarning(command.GetSelectionType() + " not yet implemented");
                    return;
                }

                if (currentCommandTarget == null)
                {
                    throw new System.Exception("Could not find a target");
                }
            }

            pointer = battleHUD.SetPointerTarget(playerController, currentCommandTarget);
        }
Exemple #2
0
        public override bool IsValid(object value)
        {
            bool valid = false;

            if (value is System.Collections.IEnumerable)
            {
                foreach (Object item in value as System.Collections.IEnumerable)
                {
                    if (item is ISelectionItem)
                    {
                        ISelectionItem listItem = ( ISelectionItem )item;
                        if (listItem.IsSelected)
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        throw new InvalidOperationException(String.Format(Localization.ErrorMessages.SelectionRequiredAttributeISelectionItem_FS,
                                                                          this.GetType( ).FullName, typeof(ISelectionItem).FullName));
                    }
                }
            }
            else
            {
                throw new InvalidOperationException(String.Format(Localization.ErrorMessages.SelectionRequiredAttributeIEnumerable_FS, this.GetType( ).FullName));
            }
            return(valid);
        }
Exemple #3
0
        public SelectionDetailsResponse(JSelectionDetailsResponse jResult)
        {
            Images = new IImage[0];
            Items  = new ISelectionItem[0];

            if (jResult == null)
            {
                return;
            }

            Id              = jResult.Id;
            CType           = jResult.CType;
            PublicationDate = jResult.Publication_Date;
            Title           = jResult.Title;
            Description     = jResult.Description;
            BodyText        = jResult.Body_Text;
            SiteUrl         = jResult.Site_Url;
            Slug            = jResult.Slug;
            if (jResult.Images != null)
            {
                Images = jResult.Images.Select(i => new ImageImpl(i));
            }

            if (jResult.Items != null)
            {
                Items = jResult.Items.Select(i => new SelectionItem(i));
            }
        }
 protected SelectionItemViewModel(ISelectionItem <T> selectionItem)
 {
     item             = selectionItem;
     item.Checked    += OnItemCheckStataChanged;
     item.UnChecked  += OnItemCheckStataChanged;
     item.Selected   += OnItemSelectedStataChanged;
     item.UnSelected += OnItemSelectedStataChanged;
 }
Exemple #5
0
 public SelectionAdorner(Canvas panel,
                         Point?dragStartPoint,
                         ISelectionPanel designerPanel,
                         ISelectionItem selectionItem) : base(panel)
 {
     _selectionItem  = selectionItem;
     _designerCanvas = panel;
     _designerPanel  = designerPanel;
     _startPoint     = dragStartPoint;
 }
 internal static int GetItemCountBridge(this ISelectionItem extension, BaseProdControl control)
 {
     try
     {
         return(UiaGetItemCount(control));
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     catch (InvalidOperationException)
     {
         return(NativeGetItemCount(control));
     }
 }
 internal static bool IsItemSelectedBridge(this ISelectionItem extension, BaseProdControl control, int index)
 {
     try
     {
         return(UiaIsItemSelected(control, index));
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     catch (InvalidOperationException)
     {
         return(NativeIsItemSelected(control, index));
     }
 }
 /// <summary>
 /// Sets the selected list item.
 /// </summary>
 /// <param name="extension">The extended interface.</param>
 /// <param name="control">The UI Automation element</param>
 /// <param name="itemText">The text of the item to select.</param>
 internal static void SetSelectedItemBridge(this ISelectionItem extension, BaseProdControl control, string itemText)
 {
     try
     {
         UiaSetSelectedItem(control, itemText);
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     catch (InvalidOperationException)
     {
         NativeSetSelectedItem(control, itemText);
     }
 }
 internal static bool IsItemSelectedBridge(this ISelectionItem extension, BaseProdControl control, string text)
 {
     try
     {
         return(UiaIsItemSelected(control, text));
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     catch (InvalidOperationException err)
     {
         //TODO: No IsItemSelectedBridge native
         throw new ProdOperationException(err);
     }
 }
Exemple #10
0
        public SelectionDetailsNodeViewModel(ISelectionItem item, IDataSource dataSource)
        {
            if (item == null)
            {
                return;
            }

            var image = item.FirstImage;

            if (image.Image != null)
            {
                Image = image.Thumbnail.Small;
            }
            else
            {
                LoadImage(item.ItemUrl);
            }

            Title       = item.Title.GetNormalString();
            Description = item.Description.StripHtmlTags();
            Type        = item.CType.GetCType();
            Id          = item.Id;
            Source      = item.ItemUrl;
        }
Exemple #11
0
 protected override SheetMergeFileListItemViewModel CreateViewModel(ISelectionItem <Sheet> item)
 {
     return(new SheetMergeFileListItemViewModel(item));
 }
 /// <summary>
 /// Abstract method for creating list item viewmodel
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected abstract TViewModel CreateViewModel(ISelectionItem <T> item);
Exemple #13
0
 public SheetMergeFileListItemViewModel(ISelectionItem <Sheet> item)
     : base(item)
 {
     sheet = item.Target;
 }
Exemple #14
0
 void Initialize()
 {
     this._selectionItemPattern = new SelectionItemImplementation <UIObject>(uiObject: this, containerFactory: UIObject.Factory);
 }
        public CommandPhase OnUpdate(LinkedListNode <UIActionType> input)
        {
            EventSelectionPanel currentUIPanel = null;

            if (commandData.commandStack.Count > 0)
            {
                currentUIPanel = commandData.commandStack.Peek();
            }
            else
            {
                throw new System.Exception("Invalid CommandPhase State - " +
                                           "Currently in SelectingCommandPhase but there are no command panels");
            }

            switch (input.Value)
            {
            case UIActionType.Down:
                currentUIPanel.NavigateDown();
                break;

            case UIActionType.Up:
                currentUIPanel.NavigateUp();
                break;

            case UIActionType.Right:
                currentUIPanel.NavigateRight();
                break;

            case UIActionType.Left:
                currentUIPanel.NavigateLeft();
                break;

            case UIActionType.CancelUICommand:
                currentUIPanel.Hide();
                currentUIPanel.DestroyPanel();
                commandData.commandStack.Pop();
                if (commandData.commandStack.Count == 0)
                {
                    return(CommandPhase.WaitingForInput);
                }
                break;

            case UIActionType.SubmitUICommand:

                ISelectionItem command = currentUIPanel.GetSelectedItem();
                switch (command.GetSelectionType())
                {
                case ISelectionType.ItemSelected:
                    return(CommandPhase.SelectingTarget);

                case ISelectionType.OpenSubMenu:
                    EventSelectionPanel esp = commandData.battleHUD.CreateSelectionPanel();
                    esp.SetOptionList(((SubMenuSelectionItem)command).subList, command.GetName());
                    commandData.commandStack.Push(esp);
                    break;
                }

                break;
            }

            return(CommandPhase.SelectingCommand);
        }