28 changed files with 1115 additions and 288 deletions
@ -0,0 +1,87 @@ |
|||||||
|
<div class="groupButtonContainerContainer"> |
||||||
|
<div class="groupButtonContainer"> |
||||||
|
@foreach (var choice in Choices) { |
||||||
|
var styleClass = ""; |
||||||
|
if (choice.Equals(Choice)) { |
||||||
|
styleClass = "selected"; |
||||||
|
} |
||||||
|
<button @onclick="@(e => OnChangeChoice(choice))" class="groupChoiceButton @styleClass">@choice</button> |
||||||
|
} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<style> |
||||||
|
|
||||||
|
.groupButtonContainerContainer { |
||||||
|
margin: auto; |
||||||
|
display: flex; |
||||||
|
flex-direction: column; |
||||||
|
justify-content: flex-start; |
||||||
|
justify-items: flex-start; |
||||||
|
} |
||||||
|
.groupButtonContainer { |
||||||
|
display: flex; |
||||||
|
background-color: var(--background); |
||||||
|
gap: 2px; |
||||||
|
margin-right: auto; |
||||||
|
border-radius: 8px; |
||||||
|
} |
||||||
|
|
||||||
|
.groupChoiceButton { |
||||||
|
background-color: var(--primary); |
||||||
|
color: white; |
||||||
|
padding: 12px; |
||||||
|
border: 1px solid var(--primary); |
||||||
|
} |
||||||
|
|
||||||
|
.groupChoiceButton:hover { |
||||||
|
background-color: var(--primary-hover); |
||||||
|
border-color: var(--primary-border-hover); |
||||||
|
} |
||||||
|
|
||||||
|
.selected { |
||||||
|
background-color: var(--secondary); |
||||||
|
color: white; |
||||||
|
font-style: normal; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
|
||||||
|
.selected:hover { |
||||||
|
background-color: var(--secondary-hover); |
||||||
|
border-color: var(--secondary-border-hover); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
.groupButtonContainer .groupChoiceButton:first-child { |
||||||
|
border-top-left-radius: 8px; |
||||||
|
border-bottom-left-radius: 8px; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
.groupButtonContainer .groupChoiceButton:last-child { |
||||||
|
border-top-right-radius: 8px; |
||||||
|
border-bottom-right-radius: 8px; |
||||||
|
} |
||||||
|
|
||||||
|
</style> |
||||||
|
|
||||||
|
|
||||||
|
@code { |
||||||
|
|
||||||
|
[Parameter] |
||||||
|
public string Choice { get; set; } |
||||||
|
|
||||||
|
[Parameter] |
||||||
|
public List<string> Choices { get; set; } |
||||||
|
|
||||||
|
[Parameter] |
||||||
|
public EventCallback<string> OnClick { get; set; } |
||||||
|
|
||||||
|
|
||||||
|
protected override void OnInitialized() { } |
||||||
|
|
||||||
|
void OnChangeChoice(string choice) |
||||||
|
{ |
||||||
|
Choice = choice; |
||||||
|
OnClick.InvokeAsync(choice); |
||||||
|
} |
||||||
|
} |
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,78 @@ |
|||||||
|
@layout PageLayout |
||||||
|
|
||||||
|
@page "/database/{text}" |
||||||
|
|
||||||
|
@inject IEntityDisplayService entityDisplayService |
||||||
|
|
||||||
|
@implements IDisposable |
||||||
|
|
||||||
|
<LayoutLargeContentComponent> |
||||||
|
|
||||||
|
<PaperComponent> |
||||||
|
<FormDisplayComponent Label="Patch"> |
||||||
|
<Display> |
||||||
|
Game Patch: @EntityModel.GameVersion |
||||||
|
</Display> |
||||||
|
</FormDisplayComponent> |
||||||
|
</PaperComponent> |
||||||
|
|
||||||
|
<div style="margin-left: 8px"> |
||||||
|
<ButtonGroupComponent OnClick="((choice => { entityDisplayService.SetDisplayType(choice); }))" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
@if (entity == null) |
||||||
|
{ |
||||||
|
<div>Invalid entity name entered: @Text</div> |
||||||
|
<div>No such entity. Did you mean <b>"Throne"</b>?</div> |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
<PaperComponent> |
||||||
|
<CascadingValue Value="entity"> |
||||||
|
<CascadingValue Value="@entityDisplayService.GetDisplayType()"> |
||||||
|
|
||||||
|
<EntityViewComponent></EntityViewComponent> |
||||||
|
</CascadingValue> |
||||||
|
</CascadingValue> |
||||||
|
|
||||||
|
</PaperComponent> |
||||||
|
} |
||||||
|
|
||||||
|
</LayoutLargeContentComponent> |
||||||
|
|
||||||
|
|
||||||
|
<style> |
||||||
|
.databaseInfoContainer { |
||||||
|
display: flex; |
||||||
|
gap: 24px; |
||||||
|
} |
||||||
|
|
||||||
|
</style> |
||||||
|
|
||||||
|
@code { |
||||||
|
[Parameter] |
||||||
|
public string? Text { get; set; } |
||||||
|
|
||||||
|
private EntityModel? entity = null; |
||||||
|
|
||||||
|
protected override void OnInitialized() |
||||||
|
{ |
||||||
|
|
||||||
|
entityDisplayService.Subscribe(StateHasChanged); |
||||||
|
|
||||||
|
foreach (var e in DATA.Get().Values) |
||||||
|
{ |
||||||
|
if (e.Info().Name.Equals(Text)) |
||||||
|
{ |
||||||
|
entity = e; |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void IDisposable.Dispose() { |
||||||
|
entityDisplayService.Unsubscribe(StateHasChanged); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -1,31 +1,46 @@ |
|||||||
@{ |
@if (Vanguard != null) { |
||||||
var vanguard = Entity.VanguardAdded(); |
var immortalId = Vanguard.ImmortalId; |
||||||
|
|
||||||
var isNull = Entity.VanguardAdded() == null ? "null" : "not null"; |
|
||||||
} |
|
||||||
|
|
||||||
@if (vanguard != null) { |
|
||||||
var immortalId = Entity.VanguardAdded().ImmortalId; |
|
||||||
var immortal = DATA.Get()[immortalId]; |
var immortal = DATA.Get()[immortalId]; |
||||||
|
|
||||||
|
var replaced = DATA.Get()[Vanguard.ReplaceId]; |
||||||
|
|
||||||
<EntityDisplayComponent Title="Vanguard"> |
@if (StyleType.Equals("Plain")) |
||||||
|
{ |
||||||
<div> |
<div> |
||||||
|
<b>Immortal:</b> @immortal.Info().Name |
||||||
|
</div> |
||||||
|
@if (!Vanguard.ReplaceId.Equals("")) { |
||||||
<div> |
<div> |
||||||
<b>Immortal:</b> <EntityLabelComponent EntityId="@immortal.DataType"/> |
<b>Replaces:</b> @replaced.Info().Name |
||||||
</div> |
</div> |
||||||
@if (!Entity.VanguardAdded().ReplaceId.Equals("")) { |
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
<EntityDisplayComponent Title="Vanguard"> |
||||||
|
<div> |
||||||
<div> |
<div> |
||||||
<b>Replaces:</b> <EntityLabelComponent EntityId="@Entity.VanguardAdded().ReplaceId"></EntityLabelComponent> |
<b>Immortal:</b> <EntityLabelComponent EntityId="@immortal.DataType"/> |
||||||
</div> |
</div> |
||||||
} |
@if (!Vanguard.ReplaceId.Equals("")) { |
||||||
</div> |
<div> |
||||||
</EntityDisplayComponent> |
<b>Replaces:</b> <EntityLabelComponent EntityId="@Vanguard.ReplaceId"></EntityLabelComponent> |
||||||
|
</div> |
||||||
|
} |
||||||
|
</div> |
||||||
|
</EntityDisplayComponent> |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
@code { |
@code { |
||||||
[CascadingParameter] |
[CascadingParameter] |
||||||
public EntityModel? Entity { get; set; } |
public EntityModel? Entity { get; set; } |
||||||
|
|
||||||
|
private EntityVanguardAddedModel? Vanguard => Entity?.VanguardAdded(); |
||||||
|
|
||||||
|
[CascadingParameter] |
||||||
|
public string StyleType { get; set; } = "Detailed"; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
} |
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,41 @@ |
|||||||
|
using Model.Immortal.Types; |
||||||
|
|
||||||
|
namespace Services.Immortal; |
||||||
|
|
||||||
|
public class EntityDisplayService : IEntityDisplayService { |
||||||
|
private string displayType = "Detailed"; |
||||||
|
private event Action _onChange; |
||||||
|
|
||||||
|
public List<string> DefaultChoices() |
||||||
|
{ |
||||||
|
return new List<string>() { "Detailed", "Plain" }; |
||||||
|
} |
||||||
|
|
||||||
|
public void Subscribe(Action action) { |
||||||
|
_onChange += action; |
||||||
|
} |
||||||
|
|
||||||
|
public void Unsubscribe(Action action) { |
||||||
|
_onChange -= action; |
||||||
|
} |
||||||
|
|
||||||
|
private void NotifyDataChanged() { |
||||||
|
_onChange?.Invoke(); |
||||||
|
} |
||||||
|
|
||||||
|
public Action OnChange() { |
||||||
|
return _onChange; |
||||||
|
} |
||||||
|
|
||||||
|
public string GetDisplayType() |
||||||
|
{ |
||||||
|
return displayType; |
||||||
|
} |
||||||
|
|
||||||
|
public void SetDisplayType(string displayType) |
||||||
|
{ |
||||||
|
this.displayType = displayType; |
||||||
|
NotifyDataChanged(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue