示例#1
0
        public UCEItemRow(Object item, string slotName = null, bool showMove = true)
        {
            Item     = item;
            SlotName = slotName;

            InitializeComponent();

            if (slotName == null || slotName.Length == 0)
            {
                tbItemName.Text = item?.Name;
            }
            else
            {
                tbItemName.Text = $"{item?.Name} ({slotName})";
            }

            img.Source = DefaultResources.GetVisualImageOrDefault(item.Visual);

            RefreshBackground();

            if (!showMove)
            {
                tbMove.Visibility = Visibility.Hidden;
            }
        }
示例#2
0
        private void Initialize(Visual visual, string id, object tag = null)
        {
            InitializeComponent();

            Tag = tag;

            iImage.Source = DefaultResources.GetVisualImageOrDefault(visual);
            lID.Text      = id;
        }
示例#3
0
        public UCEObjectRow(Object obj, bool selected = false)
        {
            InitializeComponent();

            Tag     = obj;
            Checked = selected;

            iImage.Source = DefaultResources.GetVisualImageOrDefault(obj.Visual);
            lID.Text      = obj.Id;
        }
示例#4
0
        private void RefreshInfo()
        {
            if (list.SelectedItem != null)
            {
                Player    player    = (Player)((ListBoxItem)list.SelectedItem).Tag;
                Character character = player.Character;

                iVisualImage.Source = DefaultResources.GetVisualImageOrDefault(character.Visual);

                tbName.Text = character.Id;

                BuildAbilityList(character);
                BuildClassList(character);

                gridInfo.Visibility       = Visibility.Visible;
                visualSelector.Visibility = Visibility.Hidden;
            }
            else
            {
                ClearInfo();
            }
        }
示例#5
0
        public void Redraw()
        {
            canvas.Children.Clear();

            foreach (var square in Map.Squares)
            {
                Image image = new Image();
                image.Width  = image.Height = CellSize;
                image.Margin = new Thickness(TranslateX(square.Key.X * CellSize), TranslateY(square.Key.Y * CellSize), 0.0, 0.0);
                image.Source = DefaultResources.GetVisualImageOrDefault(square.Value.Visual);
                canvas.Children.Add(image);
            }

            foreach (var mapObject in Map.Objects)
            {
                if (mapObject.Position == null || !Map.IsPositionWithin(mapObject.Position))
                {
                    continue;
                }
                if (IsGameMode && !mapObject.IsVisible)
                {
                    continue;
                }

                Image image = new Image();
                image.Width  = image.Height = CellSize;
                image.Margin = new Thickness(TranslateX(mapObject.Position.X * CellSize), TranslateY(mapObject.Position.Y * CellSize), 0.0, 0.0);
                image.Source = DefaultResources.GetVisualImageOrDefault(mapObject.Visual);
                canvas.Children.Add(image);
            }

            for (int row = 0; row <= Rows; ++row)
            {
                Line line = new Line();
                line.Stroke = Brushes.Black;
                line.Y1     = line.Y2 = TranslateY(row * CellSize);
                line.X1     = TranslateX(0);
                line.X2     = TranslateX(Cols * CellSize);
                canvas.Children.Add(line);
            }

            for (int col = 0; col <= Cols; ++col)
            {
                Line line = new Line();
                line.Stroke = Brushes.Black;
                line.X1     = line.X2 = TranslateX(col * CellSize);
                line.Y1     = TranslateY(0);
                line.Y2     = TranslateY(Rows * CellSize);
                canvas.Children.Add(line);
            }

            if (!IsGameMode)
            {
                foreach (Position spawner in Map.SpawnerPositions)
                {
                    Image spawnerSymbol = new Image();
                    spawnerSymbol.Width  = spawnerSymbol.Height = CellSize / 3;
                    spawnerSymbol.Source = DefaultResources.PlusSymbolImage;
                    spawnerSymbol.Margin = new Thickness(TranslateX(spawner.X * CellSize) + 4.0, TranslateY(spawner.Y * CellSize) + 4.0, 0.0, 0.0);
                    canvas.Children.Add(spawnerSymbol);
                }
            }

            foreach (Position selectedPosition in SelectedPositions)
            {
                Rectangle rect = new Rectangle();
                rect.Stroke          = Brushes.GreenYellow;
                rect.StrokeThickness = 3.0;
                rect.Margin          = new Thickness(TranslateX(selectedPosition.X * CellSize) + 4.0, TranslateY(selectedPosition.Y * CellSize) + 4.0, 0.0, 0.0);
                rect.Width           = rect.Height = CellSize - 8.0;
                canvas.Children.Add(rect);
            }

            if (HoveredPosition != null)
            {
                Rectangle rect = new Rectangle();
                rect.Stroke = Brushes.DarkCyan;
                rect.Margin = new Thickness(TranslateX(HoveredPosition.X * CellSize) + 4.0, TranslateY(HoveredPosition.Y * CellSize) + 4.0, 0.0, 0.0);
                rect.Width  = rect.Height = CellSize - 8.0;
                canvas.Children.Add(rect);
            }

            canvas.InvalidateVisual();
        }