diff --git a/Client/Application/Components/StatsBar.xaml b/Client/Application/Components/StatsBar.xaml
index 9d047d5..ed98e6a 100644
--- a/Client/Application/Components/StatsBar.xaml
+++ b/Client/Application/Components/StatsBar.xaml
@@ -9,6 +9,15 @@
-
+
+
+
+
+
+
+
+
diff --git a/Client/Application/ViewModels/HeroSummaryInfoViewModel.cs b/Client/Application/ViewModels/HeroSummaryInfoViewModel.cs
index a272af9..c3f4124 100644
--- a/Client/Application/ViewModels/HeroSummaryInfoViewModel.cs
+++ b/Client/Application/ViewModels/HeroSummaryInfoViewModel.cs
@@ -67,7 +67,7 @@ namespace Client.Application.ViewModels
}
}
- public CreatureListViewModel? Target
+ public TargetSummaryInfoViewModel? Target
{
get
{
@@ -93,7 +93,7 @@ namespace Client.Application.ViewModels
{
if (target == null && hero.Target != null)
{
- target = new CreatureListViewModel(hero.Target, hero);
+ target = new TargetSummaryInfoViewModel(hero.Target, hero);
OnPropertyChanged("Target");
}
else if (target != null && hero.Target == null)
@@ -135,6 +135,6 @@ namespace Client.Application.ViewModels
}
private readonly Hero hero;
- private CreatureListViewModel? target;
+ private TargetSummaryInfoViewModel? target;
}
}
diff --git a/Client/Application/ViewModels/TargetSummaryInfoViewModel.cs b/Client/Application/ViewModels/TargetSummaryInfoViewModel.cs
new file mode 100644
index 0000000..b8d51aa
--- /dev/null
+++ b/Client/Application/ViewModels/TargetSummaryInfoViewModel.cs
@@ -0,0 +1,81 @@
+using Client.Domain.Common;
+using Client.Domain.Entities;
+using Client.Domain.ValueObjects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Client.Application.ViewModels
+{
+ public class TargetSummaryInfoViewModel : ObservableObject
+ {
+ public uint Id => creature.Id;
+
+ public string Name => creature.Name;
+
+ public Vector3 Position => creature.Transform.Position;
+
+ public string BriefInfo => creature.BriefInfo;
+
+ public float Distance => creature.Distance(hero);
+
+ public float DeltaZ => creature.DeltaZ(hero);
+
+ public uint Hp => creature.VitalStats.Hp;
+
+ public uint MaxHp => creature.VitalStats.MaxHp;
+
+ public TargetSummaryInfoViewModel(CreatureInterface creature, Hero hero)
+ {
+ creature.PropertyChanged += Creature_PropertyChanged;
+ creature.Transform.Position.PropertyChanged += Position_PropertyChanged;
+ creature.VitalStats.PropertyChanged += VitalStats_PropertyChanged;
+ hero.Transform.Position.PropertyChanged += HeroPosition_PropertyChanged;
+
+ this.creature = creature;
+ this.hero = hero;
+ }
+
+ private void VitalStats_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == "Hp")
+ {
+ OnPropertyChanged("Hp");
+ }
+ if (e.PropertyName == "MaxHp")
+ {
+ OnPropertyChanged("MaxHp");
+ }
+ }
+
+ private void HeroPosition_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ OnPropertyChanged("Distance");
+ OnPropertyChanged("DeltaZ");
+ }
+
+ private void Position_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ OnPropertyChanged("Distance");
+ OnPropertyChanged("DeltaZ");
+ OnPropertyChanged("Transform");
+ }
+
+ private void Creature_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == "Name")
+ {
+ OnPropertyChanged("Name");
+ }
+ if (e.PropertyName == "BriefInfo")
+ {
+ OnPropertyChanged("BriefInfo");
+ }
+ }
+
+ private readonly CreatureInterface creature;
+ private readonly Hero hero;
+ }
+}
diff --git a/Client/Application/Views/MainWindow.xaml b/Client/Application/Views/MainWindow.xaml
index 9f5cc80..71814d8 100644
--- a/Client/Application/Views/MainWindow.xaml
+++ b/Client/Application/Views/MainWindow.xaml
@@ -97,12 +97,17 @@
-
+
-
+
+
+
+
+
+
@@ -113,77 +118,86 @@
-
-
-
- Position:
- Exp:
- Weight:
- Adena:
- Inv. slots:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ Position:
+ Exp:
+ Weight:
+ Adena:
+ Inv. slots:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
- Position:
- Distance:
- Delta Z:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ Position:
+ Distance:
+ Delta Z:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Client/Domain/Entities/CreatureInterface.cs b/Client/Domain/Entities/CreatureInterface.cs
index 8045faa..8c2cae2 100644
--- a/Client/Domain/Entities/CreatureInterface.cs
+++ b/Client/Domain/Entities/CreatureInterface.cs
@@ -11,6 +11,7 @@ namespace Client.Domain.Entities
public interface CreatureInterface : INotifyPropertyChanged
{
uint Id { get; set; }
+ VitalStats VitalStats { get; set; }
Transform Transform { get; set; }
string Name { get; }
string BriefInfo { get; }
diff --git a/Client/Domain/Entities/Player.cs b/Client/Domain/Entities/Player.cs
index d600eff..161f0e1 100644
--- a/Client/Domain/Entities/Player.cs
+++ b/Client/Domain/Entities/Player.cs
@@ -15,6 +15,7 @@ namespace Client.Domain.Entities
{
private FullName fullName;
private Phenotype phenotype;
+ private VitalStats vitalStats = new VitalStats(0, 0, 0, 0, 0, 0);
public uint Id { get; set; }
public Transform Transform { get; set; }
@@ -58,6 +59,8 @@ namespace Client.Domain.Entities
}
}
+ public VitalStats VitalStats { get => vitalStats; set => vitalStats = value; }
+
public Player(uint id, Transform transform, FullName fullName, Phenotype phenotype)
{
Id = id;
diff --git a/Client/Domain/ValueObjects/VitalStats.cs b/Client/Domain/ValueObjects/VitalStats.cs
index 2c1a5b1..26cf09a 100644
--- a/Client/Domain/ValueObjects/VitalStats.cs
+++ b/Client/Domain/ValueObjects/VitalStats.cs
@@ -1,4 +1,5 @@
using Client.Domain.Common;
+using System;
namespace Client.Domain.ValueObjects
{
@@ -11,8 +12,8 @@ namespace Client.Domain.ValueObjects
private uint cp;
private uint maxCp;
- public uint Hp { get => hp; set { if (value != hp) { hp = value; OnPropertyChanged("Hp"); } } }
- public uint MaxHp { get => maxHp; set { if (value != maxHp) { maxHp = value; OnPropertyChanged("MaxHp"); } } }
+ public uint Hp { get => hp; set { if (value != hp) { hp = value; OnPropertyChanged("Hp"); OnPropertyChanged("MaxHp"); } } }
+ public uint MaxHp { get => Math.Max(hp, maxHp); set { if (value != maxHp) { maxHp = value; OnPropertyChanged("MaxHp"); } } }
public uint Mp { get => mp; set { if (value != mp) { mp = value; OnPropertyChanged("Mp"); } } }
public uint MaxMp { get => maxMp; set { if (value != maxMp) { maxMp = value; OnPropertyChanged("MaxMp"); } } }
public uint Cp { get => cp; set { if (value != cp) { cp = value; OnPropertyChanged("Cp"); } } }