Ejemplo n.º 1
0
        private void EffectSlotList_ItemClick(object sender, ItemClickEventArgs e)
        {
            EffectSlotViewModel effectSlotViewModel = e.ClickedItem as EffectSlotViewModel;

            if (effectSlotViewModel != null)
            {
                effectSlotViewModel.ToggleFlipActiveEffect();
            }
        }
Ejemplo n.º 2
0
        public void DropEffectInSlot(Point point, EffectViewModel effect)
        {
            EffectSlotViewModel effectSlotViewModel = GetEffectSlotAtPoint(point);

            if (effectSlotViewModel != null)
            {
                effectSlotViewModel.PushEffect(effect);

                CharacterViewModel.Effects.Remove(effect);
            }
        }
Ejemplo n.º 3
0
        public void HighlightSlot(Point pointInEffectSheet)
        {
            ClearAllHighlights();

            EffectSlotViewModel slot = EffectSlotList.GetItemAtPoint <EffectSlotViewModel>(pointInEffectSheet);

            if (slot != null)
            {
                EffectSlotList.SelectedItem = slot;
            }
        }
Ejemplo n.º 4
0
        public EffectSlotViewModel GetEffectSlotAtPoint(Point point)
        {
            EffectSlotViewModel slot = EffectSlotList.GetItemAtPoint <EffectSlotViewModel>(point);

            if (slot != null)
            {
                return(slot);
            }

            return(null);
        }
Ejemplo n.º 5
0
        private void Grid_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
        {
            Point point = e.Position;

            Rect?boundingRect = null;

            bool pointIsInEffectsSheet = CharacterSheetGrid.IsPointInElement(CharacterEffectsSheet, point);
            bool pointIsInEffectsList  = CharacterSheetGrid.IsPointInElement(PossibleEffectsList, point);

            if (pointIsInEffectsSheet)
            {
                Point pointInChild = CharacterSheetGrid.TranslatePointToContainer(CharacterEffectsSheet, point);

                originalSlotViewModel = CharacterEffectsSheet.GetEffectSlotAtPoint(pointInChild);

                if (originalSlotViewModel != null)
                {
                    draggedViewModel = originalSlotViewModel.ActiveEffect;

                    boundingRect = CharacterEffectsSheet.GetBoundingRectForItem(originalSlotViewModel);

                    dragStartPosition = StartPosition.EffectGrid;
                }
            }
            else if (pointIsInEffectsList)
            {
                Point pointInChild = CharacterSheetGrid.TranslatePointToContainer(PossibleEffectsList, point);

                draggedViewModel = PossibleEffectsList.GetItemAtPoint <EffectViewModel>(pointInChild);

                dragStartPosition = StartPosition.PossibleList;

                boundingRect = PossibleEffectsList.GetBoundingRectForItem(draggedViewModel, CharacterSheetGrid);
            }

            if (draggedViewModel != null)
            {
                manipulationInitialized = true;

                DraggableEffect.EffectViewModel = draggedViewModel;

                //Save the initial touch point so we can calculate deltas
                lastManipulationPosition = point;

                DraggableEffect.Width  = 300;
                DraggableEffect.Height = boundingRect.Value.Height - 20; //stupid magic number

                DraggableEffectTranslateTransform.X = boundingRect.Value.X - (CharacterSheetGrid.ActualWidth / 2) + 150;
                DraggableEffectTranslateTransform.Y = boundingRect.Value.Y - (CharacterSheetGrid.ActualHeight / 2) + (DraggableEffect.Height / 2);

                DraggableEffect.Visibility = Visibility.Visible;
            }
        }
Ejemplo n.º 6
0
 public Rect?GetBoundingRectForItem(EffectSlotViewModel item)
 {
     return(EffectSlotList.GetBoundingRectForItem(item));
 }