Adding Parent Connection for Parts
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
<h3>WeaponTable</h3>
|
<h3>WeaponTable</h3>
|
||||||
|
|
||||||
|
|
||||||
<MudDataGrid Items="@_entityWeapons.Take(4)">
|
<MudDataGrid Items="@_entityWeapons">
|
||||||
<Columns>
|
<Columns>
|
||||||
<PropertyColumn Property="x => x.Range" Title="Range"/>
|
<PropertyColumn Property="x => x.Range" Title="Range"/>
|
||||||
<PropertyColumn Property="x => x.Damage" Title="Damage"/>
|
<PropertyColumn Property="x => x.Damage" Title="Damage"/>
|
||||||
<PropertyColumn Property="x => x.AttacksPerSecond" Title="Attacks Per Second"/>
|
<PropertyColumn Property="x => x.AttacksPerSecond" Title="Attacks Per Second"/>
|
||||||
|
<PropertyColumn Property="x => x.Parent.GetName()" Title="Owner Name"/>
|
||||||
</Columns>
|
</Columns>
|
||||||
</MudDataGrid>
|
</MudDataGrid>
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,12 @@ public class EntityModel
|
|||||||
public bool IsSpeculative { get; set; }
|
public bool IsSpeculative { get; set; }
|
||||||
|
|
||||||
public string Descriptive { get; set; } = DescriptiveType.None;
|
public string Descriptive { get; set; } = DescriptiveType.None;
|
||||||
|
|
||||||
|
public string GetName()
|
||||||
|
{
|
||||||
|
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityInfoModel)) as EntityInfoModel;
|
||||||
|
return entityInfo == null ? string.Empty : entityInfo.Name;
|
||||||
|
}
|
||||||
|
|
||||||
public string AsYaml()
|
public string AsYaml()
|
||||||
{
|
{
|
||||||
@@ -63,6 +69,8 @@ public class EntityModel
|
|||||||
|
|
||||||
public EntityModel AddPart(IEntityPartInterface unitPart)
|
public EntityModel AddPart(IEntityPartInterface unitPart)
|
||||||
{
|
{
|
||||||
|
unitPart.Parent = this;
|
||||||
|
|
||||||
EntityParts.Add(unitPart);
|
EntityParts.Add(unitPart);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,5 @@
|
|||||||
|
|
||||||
public class IEntityPartInterface
|
public class IEntityPartInterface
|
||||||
{
|
{
|
||||||
|
public EntityModel Parent { get; set; }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user