private void OnDecorationImageMouseDown(object sender, MouseButtonEventArgs e)
        {
            PlacedDecoration decoration = (sender as Image).Tag as PlacedDecoration;

            secretBase.PutAwayDecoration(decoration);
            for (int i = 0; i < decorationImages.Count; i++)
            {
                if (!secretBase.PlacedDecorations.Contains(decorationImages[i].Tag as PlacedDecoration))
                {
                    gridRoomContents.Children.Remove(decorationImages[i]);
                    decorationImages.RemoveAt(i);
                    i--;
                }
            }
            FillListViewItems();

            if (mode == PlaceModes.Move)
            {
                Mode = PlaceModes.Moving;
                foreach (Image image2 in decorationImages)
                {
                    image2.IsHitTestVisible = false;
                }
                SelectPlaceDecoration(decoration.ID);
            }
            UpdateDetails();
        }
        private void OnDecorationImageMouseLeave(object sender, MouseEventArgs e)
        {
            PlacedDecoration decoration = (sender as Image).Tag as PlacedDecoration;

            if (hoverDecoration == decoration)
            {
                rectPlaceMask.Visibility = Visibility.Hidden;
                hoverDecoration          = null;
            }
        }
        private void OnDecorationImageMouseEnter(object sender, MouseEventArgs e)
        {
            PlacedDecoration decoration = (sender as Image).Tag as PlacedDecoration;

            if (hoverDecoration != decoration)
            {
                BitmapSource bitmap = ItemDatabase.GetDecorationFullSizeImageFromID(decoration.ID);
                rectPlaceMask.Visibility  = Visibility.Visible;
                rectPlaceMask.OpacityMask = new ImageBrush(bitmap);
                rectPlaceMask.Width       = bitmap.PixelWidth;
                rectPlaceMask.Height      = bitmap.PixelHeight;
                rectPlaceMask.Margin      = (sender as Image).Margin;
                Panel.SetZIndex(rectPlaceMask, Panel.GetZIndex(sender as Image) + 1);
                hoverDecoration = decoration;
            }
        }
        private void OnShowNoteMatsChecked(object sender, RoutedEventArgs e)
        {
            showNotes = checkBoxShowNoteMats.IsChecked.Value;

            foreach (Image image in decorationImages)
            {
                PlacedDecoration decoration = image.Tag as PlacedDecoration;
                if (decoration.DecorationData.DataType == DecorationDataTypes.NoteMat)
                {
                    if (showNotes)
                    {
                        image.Source = ResourceDatabase.GetImageFromName("NoteMat" + (decoration.ID - 51).ToString());
                    }
                    else
                    {
                        image.Source = ItemDatabase.GetDecorationFullSizeImageFromID(decoration.ID);
                    }
                }
            }
        }
 public void OrganizeZIndexes()
 {
     foreach (Image image in decorationImages)
     {
         PlacedDecoration decoration = image.Tag as PlacedDecoration;
         int zIndex = 16 * decoration.Y;
         if (decoration.DecorationData.DecorationType == DecorationTypes.Doll)
         {
             if (decoration.ID >= 111)                     // Big Doll
             {
                 zIndex += 160;
             }
             else
             {
                 zIndex += 162;
             }
         }
         else if (decoration.DecorationData.DecorationType == DecorationTypes.Cushion)
         {
             zIndex += 162;
         }
         Grid.SetZIndex(image, zIndex);
     }
 }
 public abstract void PutAwayDecoration(PlacedDecoration decoration);
Exemple #7
0
        public void LoadSecretBase(SecretBase secretBase)
        {
            this.secretBase = secretBase;
            foreach (Image image in decorationImages)
            {
                this.gridRoomContents.Children.Remove(image);
            }
            gridRoomContents.Visibility = Visibility.Visible;

            imageTrainer.Margin     = new Thickness(16 * RoomData.TrainerX, 16 * RoomData.TrainerY - 8, 0, 0);
            imageTrainer.Source     = ResourceDatabase.GetImageFromName(secretBase.TrainerGender.ToString() + "SecretBase" + ((byte)secretBase.TrainerID % 5).ToString());
            imageTrainer.Visibility = (secretBase.IsPlayerSecretBase ? Visibility.Hidden : Visibility.Visible);

            BitmapSource roomImage = RoomData.Image;

            gridRoomContents.Width  = roomImage.PixelWidth;
            gridRoomContents.Height = roomImage.PixelHeight;
            imageRoom.Width         = roomImage.PixelWidth;
            imageRoom.Height        = roomImage.PixelHeight;
            imageRoom.Source        = roomImage;

            /*if (RoomData.Type == SecretBaseRoomTypes.Tree || RoomData.Type == SecretBaseRoomTypes.Shrub) {
             *      rectRoomBackground.Visibility = Visibility.Hidden;
             * }
             * else {*/
            rectRoomBackground.Margin     = new Thickness((1 - RoomData.Width % 2) * -8, (1 - RoomData.Height % 2) * -8, 0, 0);
            rectRoomBackground.Visibility = Visibility.Visible;
            (rectRoomBackground.Fill as ImageBrush).ImageSource = RoomData.BackgroundImage;
            //}

            foreach (PlacedDecoration decoration in secretBase.PlacedDecorations)
            {
                DecorationData decorationData  = decoration.DecorationData;
                BitmapSource   decorationImage = ItemDatabase.GetDecorationFullSizeImageFromID(decoration.ID);
                Image          image           = new OpaqueClickableImage();
                image.Width               = decorationImage.PixelWidth;
                image.Height              = decorationImage.PixelHeight;
                image.Stretch             = Stretch.None;
                image.Source              = decorationImage;
                image.Margin              = new Thickness(16 * (decoration.X - decorationData.OriginX), 16 * (decoration.Y - decorationData.OriginY), 0, 0);
                image.HorizontalAlignment = HorizontalAlignment.Left;
                image.VerticalAlignment   = VerticalAlignment.Top;
                image.Tag = decoration;
                decorationImages.Add(image);

                this.gridRoomContents.Children.Add(image);
            }

            foreach (Image image in decorationImages)
            {
                PlacedDecoration decoration = image.Tag as PlacedDecoration;
                int zIndex = 16 * decoration.Y;
                if (decoration.DecorationData.DecorationType == DecorationTypes.Doll)
                {
                    if (decoration.ID >= 111)                     // Big Doll
                    {
                        zIndex += 160;
                    }
                    else
                    {
                        zIndex += 162;
                    }
                }
                else if (decoration.DecorationData.DecorationType == DecorationTypes.Cushion)
                {
                    zIndex += 162;
                }
                Grid.SetZIndex(image, zIndex);
            }

            Grid.SetZIndex(imageTrainer, 16 * RoomData.TrainerY);
        }
 private void OnDecorationImageMouseLeave(object sender, MouseEventArgs e)
 {
     PlacedDecoration decoration = (sender as Image).Tag as PlacedDecoration;
     if (hoverDecoration == decoration) {
         rectPlaceMask.Visibility = Visibility.Hidden;
         hoverDecoration = null;
     }
 }
 private void OnDecorationImageMouseEnter(object sender, MouseEventArgs e)
 {
     PlacedDecoration decoration = (sender as Image).Tag as PlacedDecoration;
     if (hoverDecoration != decoration) {
         BitmapSource bitmap = ItemDatabase.GetDecorationFullSizeImageFromID(decoration.ID);
         rectPlaceMask.Visibility = Visibility.Visible;
         rectPlaceMask.OpacityMask = new ImageBrush(bitmap);
         rectPlaceMask.Width = bitmap.PixelWidth;
         rectPlaceMask.Height = bitmap.PixelHeight;
         rectPlaceMask.Margin = (sender as Image).Margin;
         Panel.SetZIndex(rectPlaceMask, Panel.GetZIndex(sender as Image) + 1);
         hoverDecoration = decoration;
     }
 }