Fan website of IMMORTAL: Gates of Pyre.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

67 lines
1.6 KiB

@implements IDisposable
@if (entity != null)
{
<div class="entityClickView">
<CascadingValue Value="entity">
<CascadingValue Value="@viewType">
<EntityViewComponent></EntityViewComponent>
</CascadingValue>
</CascadingValue>
</div>
}
<style>
.entityClickView {
overflow-y: scroll; width: 100%; overflow-x: hidden; height: 550px;
}
</style>
@code {
private EntityModel? entity = default!;
private string viewType = "Detailed";
[Inject]
IKeyService KeyService { get; set; } = default!;
[Inject]
IImmortalSelectionService FilterService { get; set; } = default!;
[Inject]
IBuildOrderService BuildOrderService { get; set; } = default!;
protected override void OnInitialized()
{
KeyService.Subscribe(HandleClick);
BuildOrderService.Subscribe(OnBuildOrderChanged);
}
void IDisposable.Dispose()
{
KeyService.Unsubscribe(HandleClick);
BuildOrderService.Unsubscribe(OnBuildOrderChanged);
}
protected void HandleClick()
{
var hotkey = KeyService.GetHotkey();
var hotkeyGroup = KeyService.GetHotkeyGroup();
var isHoldSpace = KeyService.IsHoldingSpace();
var faction = FilterService.GetFactionType();
var immortal = FilterService.GetImmortalType();
var foundEntity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal);
if (foundEntity != null)
{
entity = foundEntity;
StateHasChanged();
}
}
void OnBuildOrderChanged()
{
StateHasChanged();
}
}