From 7f81380c89944609e172dcc836059c3fd65f9ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=98=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD?= Date: Sat, 10 Aug 2024 12:04:47 +0200 Subject: [PATCH] feat: show attackes in list and map --- Client/Application/Components/Map.xaml | 4 ++++ Client/Application/ViewModels/CreatureListViewModel.cs | 6 ++++++ Client/Application/ViewModels/CreatureMapViewModel.cs | 5 +++++ Client/Application/Views/MainWindow.xaml | 5 ++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Client/Application/Components/Map.xaml b/Client/Application/Components/Map.xaml index 4c51570..7a2bbc7 100644 --- a/Client/Application/Components/Map.xaml +++ b/Client/Application/Components/Map.xaml @@ -152,6 +152,10 @@ + + + + diff --git a/Client/Application/ViewModels/CreatureListViewModel.cs b/Client/Application/ViewModels/CreatureListViewModel.cs index 6913672..c585297 100644 --- a/Client/Application/ViewModels/CreatureListViewModel.cs +++ b/Client/Application/ViewModels/CreatureListViewModel.cs @@ -26,6 +26,8 @@ namespace Client.Application.ViewModels public bool IsTarget => Id == hero.TargetId; + public bool IsAttacker => hero.AttackerIds.Contains(creature.Id); + public ICommand MouseLeftClickCommand { get; } public ICommand MouseLeftDoubleClickCommand { get; } public ICommand MouseRightClickCommand { get; } @@ -90,6 +92,10 @@ namespace Client.Application.ViewModels { OnPropertyChanged("IsTarget"); } + if (e.PropertyName == "AttackerIds") + { + OnPropertyChanged("IsAttacker"); + } } private readonly CreatureInterface creature; diff --git a/Client/Application/ViewModels/CreatureMapViewModel.cs b/Client/Application/ViewModels/CreatureMapViewModel.cs index c75dd87..8bd6dec 100644 --- a/Client/Application/ViewModels/CreatureMapViewModel.cs +++ b/Client/Application/ViewModels/CreatureMapViewModel.cs @@ -63,6 +63,7 @@ namespace Client.Application.ViewModels public bool IsTarget => Id == hero.TargetId; public bool IsAggressive => creature.AggroRadius > 0 && !creature.VitalStats.IsDead && creature.IsHostile; public float AggroRadius => creature.AggroRadius / scale; + public bool IsAttacker => hero.AttackerIds.Contains(creature.Id); public ICommand MouseLeftClickCommand { get; } public ICommand MouseLeftDoubleClickCommand { get; } @@ -117,6 +118,10 @@ namespace Client.Application.ViewModels { OnPropertyChanged("IsTarget"); } + if (e.PropertyName == "AttackerIds") + { + OnPropertyChanged("IsAttacker"); + } } private void HeroPosition_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e) diff --git a/Client/Application/Views/MainWindow.xaml b/Client/Application/Views/MainWindow.xaml index e29ee24..08be434 100644 --- a/Client/Application/Views/MainWindow.xaml +++ b/Client/Application/Views/MainWindow.xaml @@ -73,7 +73,10 @@ - + + + +