private void EffectSlotList_ItemClick(object sender, ItemClickEventArgs e) { EffectSlotViewModel effectSlotViewModel = e.ClickedItem as EffectSlotViewModel; if (effectSlotViewModel != null) { effectSlotViewModel.ToggleFlipActiveEffect(); } }
public void DropEffectInSlot(Point point, EffectViewModel effect) { EffectSlotViewModel effectSlotViewModel = GetEffectSlotAtPoint(point); if (effectSlotViewModel != null) { effectSlotViewModel.PushEffect(effect); CharacterViewModel.Effects.Remove(effect); } }
public void HighlightSlot(Point pointInEffectSheet) { ClearAllHighlights(); EffectSlotViewModel slot = EffectSlotList.GetItemAtPoint <EffectSlotViewModel>(pointInEffectSheet); if (slot != null) { EffectSlotList.SelectedItem = slot; } }
public EffectSlotViewModel GetEffectSlotAtPoint(Point point) { EffectSlotViewModel slot = EffectSlotList.GetItemAtPoint <EffectSlotViewModel>(point); if (slot != null) { return(slot); } return(null); }
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; } }
public Rect?GetBoundingRectForItem(EffectSlotViewModel item) { return(EffectSlotList.GetBoundingRectForItem(item)); }