Add sorting, filtering, and new columns to WeaponTable
Enhanced the `MudDataGrid` in `WeaponTable` by enabling multiple sorting and filtering while adding new "Faction" and "Immortal" columns. Extended `EntityModel` and `DATA` to support faction and immortal data for the table. Added "Neutral" faction and new entity "Pyre Miner" to the data model.
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
<MudDialogProvider/>
|
<MudDialogProvider/>
|
||||||
<MudSnackbarProvider/>
|
<MudSnackbarProvider/>
|
||||||
|
|
||||||
|
|
||||||
<MudLayout>
|
<MudLayout>
|
||||||
<MudAppBar Elevation="1">
|
<MudAppBar Elevation="1">
|
||||||
<MudHidden Breakpoint="Breakpoint.SmAndDown" Invert="true">
|
<MudHidden Breakpoint="Breakpoint.SmAndDown" Invert="true">
|
||||||
|
|||||||
@@ -1,15 +1,52 @@
|
|||||||
<h3>WeaponTable</h3>
|
<h3>WeaponTable</h3>
|
||||||
|
|
||||||
|
|
||||||
<MudDataGrid Items="@_entityWeapons">
|
<MudDataGrid Items="@_entityWeapons" SortMode="SortMode.Multiple" Filterable="true">
|
||||||
<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"/>
|
<PropertyColumn Property="x => x.Parent.GetName()" Title="Owner Name"/>
|
||||||
|
|
||||||
|
<PropertyColumn Property="x => x.Parent.GetFaction()" Title="Faction"/>
|
||||||
|
<PropertyColumn Property="x => x.Parent.GetImmortal()" Title="Immortal"/>
|
||||||
</Columns>
|
</Columns>
|
||||||
</MudDataGrid>
|
</MudDataGrid>
|
||||||
|
|
||||||
|
@{
|
||||||
|
/**
|
||||||
|
|
||||||
|
<MudDataGrid T="Element" MultiSelection="true" Items="@Elements" SortMode="SortMode.Multiple" Filterable="true" QuickFilter="@_quickFilter"
|
||||||
|
Hideable="true" RowClick="@RowClicked" RowContextMenuClick="RowRightClicked" SelectedItemsChanged="@SelectedItemsChanged">
|
||||||
|
<ToolBarContent>
|
||||||
|
<MudText Typo="Typo.h6">Periodic Elements</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
<MudTextField @bind-Value="_searchString" Placeholder="Search" Adornment="Adornment.Start" Immediate="true"
|
||||||
|
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
|
||||||
|
</ToolBarContent>
|
||||||
|
<Columns>
|
||||||
|
<SelectColumn T="Element" />
|
||||||
|
<PropertyColumn Property="x => x.Number" Title="Nr" Sortable="false" Filterable="false" />
|
||||||
|
<PropertyColumn Property="x => x.Sign" />
|
||||||
|
<PropertyColumn Property="x => x.Name" SortBy="@_sortBy" />
|
||||||
|
<PropertyColumn Property="x => x.Position" />
|
||||||
|
<PropertyColumn Property="x => x.Molar" Title="Molar mass" />
|
||||||
|
<PropertyColumn Property="x => x.Group" Title="Category" />
|
||||||
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="Element" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="d-flex flex-wrap mt-4">
|
||||||
|
<MudSwitch @bind-Value="@_sortNameByLength" Color="Color.Primary">Sort Name Column By Length</MudSwitch>
|
||||||
|
</div>
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
List<EntityWeaponModel> _entityWeapons;
|
List<EntityWeaponModel> _entityWeapons;
|
||||||
|
|
||||||
|
|||||||
@@ -228,6 +228,16 @@ public class DATA
|
|||||||
new EntityModel(DataType.FACTION_Khardu, EntityType.Faction, true)
|
new EntityModel(DataType.FACTION_Khardu, EntityType.Faction, true)
|
||||||
.AddPart(new EntityInfoModel { Name = "Khardu" })
|
.AddPart(new EntityInfoModel { Name = "Khardu" })
|
||||||
},
|
},
|
||||||
|
// Factions
|
||||||
|
// Neutral
|
||||||
|
{
|
||||||
|
DataType.FACTION_Neutral,
|
||||||
|
new EntityModel(DataType.FACTION_Neutral, EntityType.Faction)
|
||||||
|
.AddPart(new EntityInfoModel
|
||||||
|
{
|
||||||
|
Name = "Neutral"
|
||||||
|
})
|
||||||
|
},
|
||||||
// Immortals
|
// Immortals
|
||||||
// Aru
|
// Aru
|
||||||
{
|
{
|
||||||
@@ -371,7 +381,6 @@ public class DATA
|
|||||||
Description = "Provides a fully upgraded base worth of alloy.",
|
Description = "Provides a fully upgraded base worth of alloy.",
|
||||||
Notes = "Revives in 40 seconds when destroyed."
|
Notes = "Revives in 40 seconds when destroyed."
|
||||||
})
|
})
|
||||||
.AddPart(new EntityFactionModel { Faction = DataType.NEUTRAL_PyreCamp })
|
|
||||||
.AddPart(new EntityFactionModel { Faction = DataType.FACTION_Neutral })
|
.AddPart(new EntityFactionModel { Faction = DataType.FACTION_Neutral })
|
||||||
.AddPart(new EntityHarvestModel
|
.AddPart(new EntityHarvestModel
|
||||||
{
|
{
|
||||||
@@ -3637,7 +3646,17 @@ public class DATA
|
|||||||
})
|
})
|
||||||
.AddPart(new EntityVitalityModel
|
.AddPart(new EntityVitalityModel
|
||||||
{ Health = 850, DefenseLayer = 200, Armor = ArmorType.Heavy, IsStructure = true })
|
{ Health = 850, DefenseLayer = 200, Armor = ArmorType.Heavy, IsStructure = true })
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
DataType.NEUTRAL_PyreMiner,
|
||||||
|
new EntityModel(DataType.NEUTRAL_PyreMiner, EntityType.Building)
|
||||||
|
.AddPart(new EntityInfoModel
|
||||||
|
{
|
||||||
|
Name = "Pyre Miner",
|
||||||
|
Description = "Passively harvest pyre.",
|
||||||
|
Notes = ""
|
||||||
|
})
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,6 +44,18 @@ public class EntityModel
|
|||||||
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityInfoModel)) as EntityInfoModel;
|
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityInfoModel)) as EntityInfoModel;
|
||||||
return entityInfo == null ? string.Empty : entityInfo.Name;
|
return entityInfo == null ? string.Empty : entityInfo.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetFaction()
|
||||||
|
{
|
||||||
|
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityFactionModel)) as EntityFactionModel;
|
||||||
|
return entityInfo == null ? string.Empty : DATA.Get()[entityInfo.Faction].GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetImmortal()
|
||||||
|
{
|
||||||
|
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityVanguardAddedModel)) as EntityVanguardAddedModel;
|
||||||
|
return entityInfo == null ? string.Empty : DATA.Get()[entityInfo.ImmortalId].GetName();
|
||||||
|
}
|
||||||
|
|
||||||
public string AsYaml()
|
public string AsYaml()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user