feat(DataCollection) Added opt-in data collection

This commit is contained in:
2022-04-25 12:43:23 -04:00
parent 5e9ed4c2f5
commit 43d7391df2
79 changed files with 798 additions and 283 deletions
+11 -9
View File
@@ -1,11 +1,12 @@
@layout PageLayout
@inherits BasePage
@page "/database"
@implements IDisposable
@inject IEntityDisplayService entityDisplayService
@inject IVariableService variableService
@inject IEntityDisplayService EntityDisplayService
@inject IVariableService VariableService
<LayoutLargeContentComponent>
<WebsiteTitleComponent>Database</WebsiteTitleComponent>
@@ -13,13 +14,13 @@
<PaperComponent>
<FormDisplayComponent Label="Patch">
<Display>
Game Patch: @variableService.Variables["GamePatch"]
Game Patch: @VariableService.Variables["GamePatch"]
</Display>
</FormDisplayComponent>
</PaperComponent>
<div style="margin-left: 8px">
<ButtonGroupComponent OnClick="choice => { entityDisplayService.SetDisplayType(choice); }" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent>
<ButtonGroupComponent OnClick="choice => { EntityDisplayService.SetDisplayType(choice); }" Choice="@EntityDisplayService.GetDisplayType()" Choices="@EntityDisplayService.DefaultChoices()"></ButtonGroupComponent>
</div>
<PaperComponent>
@@ -31,7 +32,7 @@
@foreach (var entity in searches)
{
<CascadingValue Value="entity">
<CascadingValue Value="@entityDisplayService.GetDisplayType()">
<CascadingValue Value="@EntityDisplayService.GetDisplayType()">
<EntityViewComponent></EntityViewComponent>
</CascadingValue>
</CascadingValue>
@@ -67,7 +68,7 @@
Is this database updated to the latest version?
</InfoQuestionComponent>
<InfoAnswerComponent>
Maybe. Check this <b>@variableService.Variables["GamePatch"]</b> version number, and compare it to the number on discord, in the <b>#game-updates</b> channel. That should give a general sense of how out of date the data is.
Maybe. Check this <b>@VariableService.Variables["GamePatch"]</b> version number, and compare it to the number on discord, in the <b>#game-updates</b> channel. That should give a general sense of how out of date the data is.
</InfoAnswerComponent>
</InfoBodyComponent>
@@ -134,16 +135,17 @@
protected override void OnInitialized()
{
base.OnInitialized();
RefreshFactionSearch();
EntityFilterService.Subscribe(OnChange);
entityDisplayService.Subscribe(StateHasChanged);
EntityDisplayService.Subscribe(StateHasChanged);
}
void IDisposable.Dispose()
{
EntityFilterService.Unsubscribe(OnChange);
entityDisplayService.Unsubscribe(StateHasChanged);
EntityDisplayService.Unsubscribe(StateHasChanged);
}
void OnChange(EntityFilterEvent filterEntityEvent)
+25 -11
View File
@@ -1,24 +1,27 @@
@layout PageLayout
@inherits BasePage
@page "/database/{text}"
@inject IEntityDisplayService entityDisplayService
@inject IEntityDisplayService EntityDisplayService
@inject IVariableService VariableService
@inject IVariableService variableService
@implements IDisposable
<LayoutLargeContentComponent>
<PaperComponent>
<FormDisplayComponent Label="Patch">
<Display>
Game Patch: @variableService.Variables["GamePatch"]
Game Patch: @VariableService.Variables["GamePatch"]
</Display>
</FormDisplayComponent>
</PaperComponent>
<div style="margin-left: 8px">
<ButtonGroupComponent OnClick="choice => { entityDisplayService.SetDisplayType(choice); }" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent>
<ButtonGroupComponent OnClick="choice => { EntityDisplayService.SetDisplayType(choice); }" Choice="@EntityDisplayService.GetDisplayType()" Choices="@EntityDisplayService.DefaultChoices()"></ButtonGroupComponent>
</div>
@@ -33,7 +36,7 @@
</CodeComponent>
</PaperComponent>
}
else if (entity == null)
else if (_entity == null)
{
<PaperComponent>
<div>Invalid entity name entered: @Text</div>
@@ -44,8 +47,8 @@
else
{
<PaperComponent>
<CascadingValue Value="entity">
<CascadingValue Value="@entityDisplayService.GetDisplayType()">
<CascadingValue Value="_entity">
<CascadingValue Value="@EntityDisplayService.GetDisplayType()">
<EntityViewComponent></EntityViewComponent>
</CascadingValue>
@@ -62,17 +65,28 @@
[Parameter]
public string? Text { get; set; }
private EntityModel? entity;
private EntityModel? _entity;
protected override void OnInitialized()
{
entityDisplayService.Subscribe(StateHasChanged);
EntityDisplayService.Subscribe(StateHasChanged);
}
protected override void OnParametersSet()
{
base.OnParametersSet();
base.OnInitialized();
FocusEntity();
}
private void FocusEntity()
{
foreach (var e in DATA.Get().Values)
{
if (e.Info().Name.ToLower().Equals(Text!.ToLower()))
{
entity = e;
_entity = e;
return;
}
}
@@ -80,7 +94,7 @@
void IDisposable.Dispose()
{
entityDisplayService.Unsubscribe(StateHasChanged);
EntityDisplayService.Unsubscribe(StateHasChanged);
}
}
@@ -244,6 +244,7 @@
protected override void OnInitialized()
{
base.OnInitialized();
StorageService.Subscribe(RefreshDefaults);
}
@@ -213,6 +213,7 @@
protected override void OnInitialized()
{
base.OnInitialized();
}
void OnChangeFaction(string clickedFaction)