feat(Database) Adding entity dialog

This commit is contained in:
2022-04-01 17:35:10 -04:00
parent c4f1b86f27
commit a9d3920237
36 changed files with 429 additions and 150 deletions
+1
View File
@@ -13,6 +13,7 @@
</NotFound>
</Router>
<EntityDialogPortal/>
<style>
a {
+66
View File
@@ -0,0 +1,66 @@
@inject IEntityDialogService entityDialogService
<div class="dialogBackground" onclick="@CloseDialog">
<div class="dialogContainer"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
@if (entity == null)
{
<div>Entity is null</div>
}
else
{
<div class="dialogHeader">
<div class="dialogTitle">
@entity.Info().Name
</div>
</div>
<div class="dialogContent">
<div>
<EntityVanguardAddedComponent Entity=@entity></EntityVanguardAddedComponent>
<EntityInfoComponent Entity=@entity></EntityInfoComponent>
<EntityVanguardsComponent Entity=@entity></EntityVanguardsComponent>
<EntityProductionComponent Entity=@entity></EntityProductionComponent>
<EntityStatsComponent Entity=@entity></EntityStatsComponent>
<EntityMechanicsComponent Entity=@entity></EntityMechanicsComponent>
<EntityPassivesComponent Entity=@entity></EntityPassivesComponent>
<EntityPyreSpellsComponent Entity=@entity></EntityPyreSpellsComponent>
<EntityUpgradesComponent Entity=@entity></EntityUpgradesComponent>
<EntityWeaponsComponent Entity=@entity></EntityWeaponsComponent>
<EntityAbilitiesComponent Entity=@entity></EntityAbilitiesComponent>
</div>
</div>
<div class="dialogFooter"></div>
}
</div>
</div>
@code {
private EntityModel entity = null;
[Parameter] public string EntityId { get; set; }
protected override void OnParametersSet()
{
if (entityDialogService.GetEntityId() == null)
{
return;
}
entity = DATA.Get()[EntityId];
}
public void CloseDialog()
{
entityDialogService.CloseDialog();
}
}
@@ -0,0 +1,58 @@
.dialogBackground {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
}
.dialogContainer {
margin-left: auto;
margin-right: auto;
margin-top: 64px;
width: 800px;
height: 600px;
background-color: var(--background);
border-width: var(--dialog-border-width);
border-style: solid;
border-color: var(--dialog-border-color);
border-radius: var(--dialog-radius);
box-shadow: 1px 2px 2px black;
}
.dialogHeader {
width: 100%;
background-color: var(--accent);
border-top-left-radius: var(--dialog-radius);
border-top-right-radius: var(--dialog-radius);
border-bottom: 4px solid black;
}
.dialogTitle {
padding: 16px;
font-size: 2rem;
font-weight: bold;
}
.dialogContent {
flex-grow: 1;
padding: 6px;
overflow-y: auto;
overflow-x: hidden;
height: 500px;
}
.dialogFooter {
width: 100%;
height: 6px;
background-color: var(--paper);
}
+1 -10
View File
@@ -15,16 +15,6 @@
<DefineConstants>TRACE;NO_SQL</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove="Pages\Agile\AgilePage.razor.css" />
<None Remove="Pages\ChangeLogPage.razor.css" />
</ItemGroup>
<ItemGroup>
<Content Include="Pages\Agile\AgilePage.razor.css" />
<Content Include="Pages\ChangeLogPage.razor.css" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-preview.2.22153.2" PrivateAssets="all" />
@@ -45,4 +35,5 @@
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Services\Services.csproj" />
</ItemGroup>
</Project>
+3 -1
View File
@@ -2,5 +2,7 @@
@layout PageLayout
<HomePage></HomePage>
<HomePage></HomePage>
@@ -52,7 +52,7 @@
continue;
}
var isVanguard = entity.Vanguard() != null;
var isVanguard = entity.VanguardAdded() != null;
var style = isVanguard ? "font-weight: bold;" : "";
<div style="@style">@entity.Info()?.Name</div>
@@ -126,7 +126,7 @@
// Move to Filter Service
bool InvalidVanguard(EntityModel entity) {
if (entity.Vanguard() != null && entity.Vanguard()?.Immortal != FilterService.GetImmortalType() && FilterService.GetImmortalType() != ImmortalType.Any) {
if (entity.VanguardAdded() != null && entity.VanguardAdded()?.ImmortalId != FilterService.GetImmortalType() && FilterService.GetImmortalType() != ImmortalType.Any) {
return true;
}
@@ -138,7 +138,7 @@
if (entity.Replaceds().Count > 0) {
var isReplaced = false;
foreach (var replaced in entity.Replaceds()) {
if (FilterService.GetImmortalType() == replaced.Immortal) {
if (FilterService.GetImmortalType() == replaced.ImmortalId) {
isReplaced = true;
break;
}
@@ -3,7 +3,7 @@
@onkeydown="HandleKeyDown"
@onkeyup="HandleKeyUp"
@onkeydown:preventDefault="true"
colorwn:stopPropagation="true">
@onkeydown:stopPropagation="true">
@ChildContent
</div>
+1 -1
View File
@@ -170,7 +170,7 @@
}
else {
immortals = (from entity in factions
where entity.Vanguard() == null || entity.Vanguard().Immortal == selectedImmortalType
where entity.VanguardAdded() == null || entity.VanguardAdded().ImmortalId == selectedImmortalType
select entity).ToList();
}
@@ -1,11 +1,11 @@
@if (Entity != null) {
var isVanguard = Entity.Vanguard() != null ? " vanguard" : "";
var isVanguard = Entity.VanguardAdded() != null ? " vanguard" : "";
<div class="enititiesContainer @isVanguard">
<EntityHeaderComponent Entity=Entity></EntityHeaderComponent>
<div class="entityPartsContainer">
<EntityVanguardComponent Entity=Entity></EntityVanguardComponent>
<div>
<EntityVanguardAddedComponent Entity=Entity></EntityVanguardAddedComponent>
<EntityInfoComponent Entity=Entity></EntityInfoComponent>
<EntityVanguardsComponent Entity=Entity></EntityVanguardsComponent>
<EntityProductionComponent Entity=Entity></EntityProductionComponent>
@@ -30,28 +30,11 @@
display: flex;
flex-wrap: wrap;
}
.vanguard {
border: 4px solid var(--accent);
border-radius: 8px;
}
.entityPartsContainer {
display: flex;
flex-direction: column;
flex-wrap: wrap;
width: 100%;
}
@@media only screen and (max-width: 1025px) {
.enititiesContainer {
padding: 0px;
}
.entityPartsContainer {
margin: 0px;
}
}
</style>
@@ -8,7 +8,7 @@
<div>
<div>
<b>Name:</b> @info.Name
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/>
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)
@@ -9,7 +9,7 @@
<div>
<div>
<b>Name:</b> @info.Name
<b>Name:</b> <EntityLabelComponent EntityId="@passive.DataType"/>
</div>
<div style="max-width: 600px;">
<b>Description:</b> @((MarkupString)info.Description)
@@ -13,7 +13,7 @@
<div>
<span>
<b>@requirement.Requirement.Replace("_", " "):</b> @requirement.Name
<b>@requirement.Requirement.Replace("_", " "):</b> <EntityLabelComponent EntityId="@requirement.DataType"/>
</span>
</div>
}
@@ -46,6 +46,13 @@
<b>Build Time:</b> @production.BuildTime.ToString()s
</div>
}
@if (!production.Energy.Equals(0)) {
<div>
<b>Energy:</b> @production.Energy
</div>
}
@if (!production.Cooldown.Equals(0)) {
<div>
@@ -8,7 +8,7 @@
<div>
<div>
<b>Name:</b> @info.Name
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/>
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)
@@ -5,7 +5,7 @@
var entity = EntityModel.Get(upgradeId.Id);
<div>
<div>
<b>Name:</b> @entity.Info().Name
<b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/>
</div>
<div>
<b>Description:</b> @entity.Info().Description
@@ -0,0 +1,31 @@
@{
var vanguard = Entity.VanguardAdded();
var isNull = Entity.VanguardAdded() == null ? "null" : "not null";
}
@if (vanguard != null) {
var immortalId = Entity.VanguardAdded().ImmortalId;
var immortal = DATA.Get()[immortalId];
<EntityDisplayComponent Title="Vanguard">
<div>
<div>
<b>Immortal:</b> <EntityLabelComponent EntityId="@immortal.DataType"/>
</div>
@if (!Entity.VanguardAdded().ReplaceId.Equals("")) {
<div>
<b>Replaces:</b> <EntityLabelComponent EntityId="@Entity.VanguardAdded().ReplaceId"></EntityLabelComponent>
</div>
}
</div>
</EntityDisplayComponent>
}
@code {
[Parameter]
public EntityModel Entity { get; set; }
}
@@ -1,21 +0,0 @@
@if (Entity.Vanguard() != null) {
<EntityDisplayComponent Title="Vanguard">
<div>
<div>
<b>Immortal:</b> @Entity.Vanguard().Immortal.Replace("_", " ")
</div>
@if (Entity.Vanguard().Replaces != "") {
<div>
<b>Replaces:</b> @Entity.Vanguard().Replaces.Replace("_", " ")
</div>
}
</div>
</EntityDisplayComponent>
}
@code {
[Parameter]
public EntityModel Entity { get; set; }
}
@@ -3,24 +3,21 @@
@foreach (var data in Entity.IdVanguards()) {
var entity = EntityModel.Get(data.Id);
var info = entity.Info();
var production = entity.Production();
var requirements = entity.Requirements();
var vanguard = entity.Vanguard();
var vanguard = entity.VanguardAdded();
var productionBuilding = (from building in requirements
where building.Requirement == RequirementType.Production_Building
select building).First().Name;
select building).First().DataType;
<div>
<div>
<b>Name:</b> @info.Name
<b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/>
</div>
<div>
<b>Replaces:</b> @vanguard.Replaces
<b>Replaces:</b> <EntityLabelComponent EntityId="@vanguard.ReplaceId"/>
</div>
<div>
<b>Built From:</b> @productionBuilding
<b>Built From:</b> <EntityLabelComponent EntityId="@productionBuilding"/>
</div>
</div>
}
@@ -13,12 +13,15 @@
@if (EntityFilterService.GetFactionType() != "Any" && EntityFilterService.GetFactionType() != "None") {
<div class="filterContainer">
@foreach (var choice in EntityFilterService.GetImmortalChoices()) {
@foreach (var choice in EntityFilterService.GetImmortalChoices())
{
var name = DATA.Get()[choice].Info().Name;
var styleClass = "";
if (choice.Equals(EntityFilterService.GetImmortalType())) {
styleClass = "selected";
}
<button class="choiceButton @styleClass" @onclick="@(e => OnChangeImmortal(choice))">@choice</button>
<button class="choiceButton @styleClass" @onclick="@(e => OnChangeImmortal(choice))">@name</button>
}
</div>
}
@@ -52,10 +55,10 @@
<FormLabelComponent>Immortal</FormLabelComponent>
<ChildContent>
<option value="@ImmortalType.Any" selected>Any</option>
<option value="@ImmortalType.Mala">Mala</option>
<option value="@ImmortalType.Xol">Xol</option>
<option value="@ImmortalType.Orzum">Orzum</option>
<option value="@ImmortalType.Ajari">Ajari</option>
<option value="@DataType.IMMORTAL_Mala">Mala</option>
<option value="@DataType.IMMORTAL_Xol">Xol</option>
<option value="@DataType.IMMORTAL_Orzum">Orzum</option>
<option value="@DataType.IMMORTAL_Ajari">Ajari</option>
</ChildContent>
</FormSelectComponent>
+27
View File
@@ -0,0 +1,27 @@
@implements IDisposable;
@inject IEntityDialogService entityDialogService
@if (entityDialogService.HasDialog())
{
<EntityDialogComponent EntityId="@entityDialogService.GetEntityId()"></EntityDialogComponent>
}
@code {
protected override void OnInitialized()
{
entityDialogService.Subscribe(OnUpdate);
}
public void Dispose() {
entityDialogService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
}
+2
View File
@@ -38,6 +38,8 @@ builder.Services.AddSingleton(new HttpClient {
});
builder.Services.AddSingleton<IEntityDialogService, EntityDialogService>();
#if NO_SQL
#else
+2
View File
@@ -9,7 +9,9 @@
@using Components.Navigation
@using Components.Shared
@using Components.Utils
@using IGP.Portals
@using IGP.Pages
@using IGP.Dialog
@using IGP.Pages.Agile.Parts
@using IGP.Pages.BuildCalculator.Parts
@using IGP.Pages.Database.Entity
+4
View File
@@ -17,6 +17,10 @@
--paper-border: #151516;
--info: #451376;
--info-border: #210b36;
--dialog-border-color: black;
--dialog-border-width: 2px;
--dialog-radius: 6px;
}
html {