feat: add attackers handling
This commit is contained in:
@@ -74,6 +74,13 @@ namespace Client.Application.ViewModels
|
||||
return target;
|
||||
}
|
||||
}
|
||||
public List<uint> Attackers
|
||||
{
|
||||
get
|
||||
{
|
||||
return hero.AttackerIds.ToList();
|
||||
}
|
||||
}
|
||||
public HeroSummaryInfoViewModel(Hero hero)
|
||||
{
|
||||
this.hero = hero;
|
||||
@@ -102,6 +109,10 @@ namespace Client.Application.ViewModels
|
||||
OnPropertyChanged("Target");
|
||||
}
|
||||
}
|
||||
else if (e.PropertyName == "AttackerIds")
|
||||
{
|
||||
OnPropertyChanged("Attackers");
|
||||
}
|
||||
}
|
||||
|
||||
private void InventoryInfo_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
|
@@ -221,6 +221,13 @@
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
<ListBox Grid.Row="3" Margin="4" ItemsSource="{Binding Attackers, Mode=OneWay}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Column="1" DataContext="{Binding Target, Mode=OneWay}" Visibility="{Binding Path=.,Converter={StaticResource NullToVisibilityConverter}}" Margin="4">
|
||||
<TextBlock FontSize="16" Text="{Binding Path=Name, Mode=OneWay}"></TextBlock>
|
||||
<TextBlock Text="{Binding Path=BriefInfo, Mode=OneWay}"></TextBlock>
|
||||
|
@@ -1,8 +1,11 @@
|
||||
using Client.Domain.Common;
|
||||
using Client.Domain.Enums;
|
||||
using Client.Domain.ValueObjects;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace Client.Domain.Entities
|
||||
{
|
||||
@@ -63,6 +66,9 @@ namespace Client.Domain.Entities
|
||||
}
|
||||
public uint AggroRadius { get; set; } = 0;
|
||||
public bool IsHostile { get; set; } = false;
|
||||
// TODO move from domain
|
||||
[JsonProperty("AttackerIds", ObjectCreationHandling = ObjectCreationHandling.Replace)]
|
||||
public List<uint> AttackerIds { get => attackerIds; set { if (!value.All(attackerIds.Contains) || !attackerIds.All(value.Contains)) { attackerIds = value; OnPropertyChanged("AttackerIds"); } } }
|
||||
|
||||
public Hero(uint id, Transform transform, FullName fullName, VitalStats vitalStats, Phenotype phenotype, ExperienceInfo experienceInfo, PermanentStats permanentStats, VariableStats variableStats, Reputation reputation, InventoryInfo inventoryInfo, uint targetId, bool isStanding)
|
||||
{
|
||||
@@ -100,5 +106,6 @@ namespace Client.Domain.Entities
|
||||
private Phenotype phenotype;
|
||||
private CreatureInterface? target;
|
||||
private uint targetId;
|
||||
private List<uint> attackerIds = new List<uint>();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user