feat: add highlighting for target in creature list

This commit is contained in:
k0t9i
2023-02-09 23:07:57 +04:00
parent ad5d7a5159
commit 123d039263
2 changed files with 37 additions and 19 deletions

View File

@ -24,6 +24,8 @@ namespace Client.Application.ViewModels
public float DeltaZ => creature.DeltaZ(hero);
public bool IsTarget => Id == hero.TargetId;
public ICommand MouseLeftClickCommand { get; }
public ICommand MouseLeftDoubleClickCommand { get; }
public ICommand MouseRightClickCommand { get; }
@ -47,6 +49,7 @@ namespace Client.Application.ViewModels
creature.PropertyChanged += Creature_PropertyChanged;
creature.Transform.Position.PropertyChanged += Position_PropertyChanged;
hero.Transform.Position.PropertyChanged += HeroPosition_PropertyChanged;
hero.PropertyChanged += Hero_PropertyChanged;
MouseLeftClickCommand = new RelayCommand(OnMouseLeftClick);
MouseLeftDoubleClickCommand = new RelayCommand(OnMouseLeftDoubleClick);
MouseRightClickCommand = new RelayCommand(OnMouseRightClick);
@ -80,6 +83,14 @@ namespace Client.Application.ViewModels
}
}
private void Hero_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "TargetId")
{
OnPropertyChanged("IsTarget");
}
}
private readonly CreatureInterface creature;
private readonly Hero hero;
private readonly WorldHandler worldHandler;