Refactor DataTables and cleanup redundant code

Refactored `WeaponTable` grid to use a typed parameter and improve readability. Removed outdated or unnecessary sample comments, consolidated duplicate code, and reorganized theme-related components in `PageLayout`. Simplified initialization logic and improved formatting consistency.
This commit is contained in:
Jonathan
2025-04-27 21:45:28 -04:00
parent 764192891c
commit e28f74b354
8 changed files with 60 additions and 123 deletions
+9 -6
View File
@@ -38,22 +38,25 @@ public class EntityModel
public bool IsSpeculative { get; set; }
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 GetFaction()
{
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityFactionModel)) as EntityFactionModel;
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;
var entityInfo =
EntityParts.FirstOrDefault(a =>
a.GetType() == typeof(EntityVanguardAddedModel)) as EntityVanguardAddedModel;
return entityInfo == null ? string.Empty : DATA.Get()[entityInfo.ImmortalId].GetName();
}
@@ -82,7 +85,7 @@ public class EntityModel
public EntityModel AddPart(IEntityPartInterface unitPart)
{
unitPart.Parent = this;
EntityParts.Add(unitPart);
return this;
}