feat: add ai type and state info
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Client.Domain.Common;
|
||||
using Client.Domain.AI;
|
||||
using Client.Domain.Common;
|
||||
using Client.Domain.Entities;
|
||||
using Client.Domain.ValueObjects;
|
||||
using System;
|
||||
@@ -59,13 +60,6 @@ namespace Client.Application.ViewModels
|
||||
return hero.InventoryInfo;
|
||||
}
|
||||
}
|
||||
public ulong Money
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public TargetSummaryInfoViewModel? Target
|
||||
{
|
||||
@@ -81,10 +75,24 @@ namespace Client.Application.ViewModels
|
||||
return hero.AttackerIds.ToList();
|
||||
}
|
||||
}
|
||||
public HeroSummaryInfoViewModel(Hero hero)
|
||||
public string AIType
|
||||
{
|
||||
get
|
||||
{
|
||||
return ai.Type.ToString();
|
||||
}
|
||||
}
|
||||
public string AIState
|
||||
{
|
||||
get
|
||||
{
|
||||
return ai.IsEnabled ? ai.CurrentState.ToString() : "Disabled";
|
||||
}
|
||||
}
|
||||
public HeroSummaryInfoViewModel(Hero hero, AIInterface ai)
|
||||
{
|
||||
this.hero = hero;
|
||||
|
||||
this.ai = ai;
|
||||
hero.FullName.PropertyChanged += FullName_PropertyChanged;
|
||||
hero.Phenotype.PropertyChanged += Phenotype_PropertyChanged;
|
||||
hero.ExperienceInfo.PropertyChanged += ExperienceInfo_PropertyChanged;
|
||||
@@ -92,6 +100,19 @@ namespace Client.Application.ViewModels
|
||||
hero.VitalStats.PropertyChanged += VitalStats_PropertyChanged;
|
||||
hero.InventoryInfo.PropertyChanged += InventoryInfo_PropertyChanged;
|
||||
hero.PropertyChanged += Hero_PropertyChanged;
|
||||
ai.PropertyChanged += Ai_PropertyChanged;
|
||||
}
|
||||
|
||||
private void Ai_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == "Type")
|
||||
{
|
||||
OnPropertyChanged("AIType");
|
||||
}
|
||||
if (e.PropertyName == "CurrentState" || e.PropertyName == "IsEnabled")
|
||||
{
|
||||
OnPropertyChanged("AIState");
|
||||
}
|
||||
}
|
||||
|
||||
private void Hero_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
@@ -147,6 +168,7 @@ namespace Client.Application.ViewModels
|
||||
}
|
||||
|
||||
private readonly Hero hero;
|
||||
private readonly AIInterface ai;
|
||||
private TargetSummaryInfoViewModel? target;
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ namespace Client.Application.ViewModels
|
||||
|
||||
public void Handle(HeroCreatedEvent @event)
|
||||
{
|
||||
Hero = new HeroSummaryInfoViewModel(@event.Hero);
|
||||
Hero = new HeroSummaryInfoViewModel(@event.Hero, ai);
|
||||
hero = @event.Hero;
|
||||
Map.Hero = hero;
|
||||
Map.CombatZone = new AICombatZoneMapViewModel(aiConfig.Combat.Zone, hero);
|
||||
|
@@ -225,8 +225,8 @@
|
||||
<TextBlock Padding="0 0 0 3">Position:</TextBlock>
|
||||
<TextBlock Padding="0 0 0 3">Exp:</TextBlock>
|
||||
<TextBlock Padding="0 0 0 3">Weight:</TextBlock>
|
||||
<TextBlock Padding="0 0 0 3">Adena:</TextBlock>
|
||||
<TextBlock Padding="0 0 0 3">Inv. slots:</TextBlock>
|
||||
<TextBlock Padding="0 0 0 3">AI:</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Padding="0 0 0 3">
|
||||
@@ -254,7 +254,6 @@
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding Path=Money, Mode=OneWay}" Padding="0 0 0 3"></TextBlock>
|
||||
<TextBlock Padding="0 0 0 3">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0}/{1}">
|
||||
@@ -263,6 +262,14 @@
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock Padding="0 0 0 3">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0} ({1})">
|
||||
<Binding Path="AIType" Mode="OneWay"/>
|
||||
<Binding Path="AIState" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
<StackPanel Grid.Column="1" DataContext="{Binding Target, Mode=OneWay}" Visibility="{Binding Path=.,Converter={StaticResource NullToVisibilityConverter}}" Margin="4">
|
||||
|
Reference in New Issue
Block a user