Browse Source

feat(Search) Search hotkey now working. CMD + K

main
Jonathan McCaffrey 4 years ago
parent
commit
ba2eeec13f
  1. 16
      Components/Components.csproj
  2. 36
      Components/Form/FormNumberComponent.razor
  3. 7
      Components/Form/FormTextComponent.razor
  4. 20
      Components/Inputs/SearchButtonComponent.razor
  5. 42
      Components/Navigation/DesktopNavComponent.razor
  6. 4
      Components/Navigation/DesktopNavLinkComponent.razor
  7. 2
      Contexts/Contexts.csproj
  8. 10
      IGP/App.razor
  9. BIN
      IGP/Database.db
  10. 40
      IGP/Dialog/SearchDialogComponent.razor
  11. 18
      IGP/IGP.csproj
  12. 2
      IGP/Index.razor
  13. 7
      IGP/PageLayout.razor
  14. 2
      IGP/Pages/AnaltyicsPage.razor
  15. 2
      IGP/Pages/EconomyComparison.razor
  16. 2
      IGP/Pages/PermissionsPage.razor
  17. 2
      IGP/Pages/StoragePage.razor
  18. 31
      IGP/Portals/SearchPortal.razor
  19. 6
      IGP/wwwroot/content/docs/cheat-sheet.md
  20. 5
      IGP/wwwroot/content/docs/project-data.md
  21. 5
      IGP/wwwroot/content/docs/setup.md
  22. 5
      IGP/wwwroot/content/notes/coop/holdout.md
  23. 9
      IGP/wwwroot/content/notes/settings/hotkeys.md
  24. 5
      IGP/wwwroot/content/notes/the-basics/armor-types.md
  25. 6
      IGP/wwwroot/content/notes/the-basics/economy-overview.md
  26. 6
      IGP/wwwroot/content/notes/the-basics/families-factions-and-immortal-vanguards.md
  27. 6
      IGP/wwwroot/content/notes/the-basics/immortal-spells-and-pyre.md
  28. 5
      IGP/wwwroot/content/notes/the-basics/timing-and-scouting.md
  29. 2
      IGP/wwwroot/generated/GitChangeModels.json
  30. 2
      IGP/wwwroot/generated/GitPatchModels.json
  31. 15
      IGP/wwwroot/index.html
  32. 12
      IGP_Convert/IGP_Convert.csproj
  33. 2
      Model/BuildOrders/BuildOrderModel.cs
  34. 8
      Model/Model.csproj
  35. 27
      Model/Notes/NoteContentModel.cs
  36. 8
      Services/IServices.cs
  37. 11
      Services/Immortal/BuildOrderService.cs
  38. 9
      Services/Immortal/EconomyService.cs
  39. 2
      Services/Immortal/TimingService.cs
  40. 4
      Services/Services.csproj
  41. 3
      Services/Website/EntityDialogService.cs
  42. 75
      Services/Website/SearchService.cs

16
Components/Components.csproj

@ -15,24 +15,24 @@
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
<SupportedPlatform Include="browser"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Markdig" Version="0.28.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0-preview.2.22153.2" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2" />
<PackageReference Include="Markdig" Version="0.28.1"/>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0-preview.2.22153.2"/>
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2"/>
</ItemGroup>
<ItemGroup>
<Folder Include="Inputs\" />
<Folder Include="Inputs\"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Services\Services.csproj" />
<ProjectReference Include="..\Model\Model.csproj"/>
<ProjectReference Include="..\Services\Services.csproj"/>
</ItemGroup>
<ItemGroup>
<None Remove="Inputs\" />
<None Remove="Inputs\"/>
</ItemGroup>
</Project>

36
Components/Form/FormNumberComponent.razor

@ -48,25 +48,25 @@
void OnInputChanged(ChangeEventArgs changeEventArgs)
{
int valueWas = Value;
int newValue = int.Parse(changeEventArgs.Value!.ToString()!);
if (newValue > Max)
{
newValue = Max;
}
if (newValue < Min)
{
newValue = Min;
}
var valueWas = Value;
var newValue = int.Parse(changeEventArgs.Value!.ToString()!);
if (valueWas != newValue)
{
Value = newValue;
changeEventArgs.Value = newValue;
OnChange.InvokeAsync(changeEventArgs);
}
if (newValue > Max)
{
newValue = Max;
}
if (newValue < Min)
{
newValue = Min;
}
if (valueWas != newValue)
{
Value = newValue;
changeEventArgs.Value = newValue;
OnChange.InvokeAsync(changeEventArgs);
}
}
[Parameter]

7
Components/Form/FormTextComponent.razor

@ -11,7 +11,7 @@
placeholder="@Placeholder"
type="text"
value="@Value"
id="@labelId"
id="@Id"
@oninput="OnChange"
@onchange="OnChange"/>
</div>
@ -51,6 +51,9 @@
@code {
[Parameter]
public string Id { get; set; } = "";
[Parameter]
public string Label { get; set; } = "";
@ -62,7 +65,7 @@
[Parameter]
public EventCallback<ChangeEventArgs> OnChange { get; set; }
[Parameter]
public bool ReadOnly { get; set; }

20
Components/Inputs/SearchButtonComponent.razor

@ -1,5 +1,4 @@
@using System.Runtime.InteropServices
@inject ISearchService searchService
@inject ISearchService searchService
@inject NavigationManager navigationManager
@inject IJSRuntime jsRuntime
@ -7,13 +6,9 @@
<div class="searchText">
Search...
</div>
@if (false)
{
<div class="searchHotkey">
@CommandKey + K
</div>
}
<div class="searchHotkey">
@CommandKey + K
</div>
</button>
<style>
@ -35,6 +30,7 @@
.searchHotkey {
padding: 2px;
background-color: var(--info);
border: 2px solid var(--primary-border);
}
@ -42,20 +38,22 @@
@code {
[Parameter]
public RenderFragment ChildContent { get; set; } = default!;
private string userAgent = "";
string CommandKey => userAgent.Contains("Mac OS") ? "CMD" : "Ctrl";
private void ButtonClicked(EventArgs eventArgs)
{
searchService.Show();
}
protected override async Task OnInitializedAsync()
{
userAgent = await jsRuntime.InvokeAsync<string>("getUserAgent");
}
}

42
Components/Navigation/DesktopNavComponent.razor

@ -17,31 +17,31 @@
</NavLink>
<div class="sectionNavs">
@foreach (var webSection in WebSections)
{
var isSelected = navigationService.GetNavigationSectionId().Equals(webSection.Id);
var sectionButtonStyle = "sectionButton";
if (isSelected)
@foreach (var webSection in WebSections)
{
sectionButtonStyle += " sectionButtonSelected";
}
<div class="sectionNav">
<button onclick="@(() => { MenuClicked(webSection.Id); })" class="@sectionButtonStyle">@webSection.Name</button>
@if (isSelected)
var isSelected = navigationService.GetNavigationSectionId().Equals(webSection.Id);
var sectionButtonStyle = "sectionButton";
if (isSelected)
{
<div class="navMenuPosition">
<div class="navMenuContainer">
<DesktopNavSectionComponent Section=webSection />
</div>
</div>
sectionButtonStyle += " sectionButtonSelected";
}
</div>
}
<div class="sectionNav">
<button onclick="@(() => { MenuClicked(webSection.Id); })" class="@sectionButtonStyle">@webSection.Name</button>
@if (isSelected)
{
<div class="navMenuPosition">
<div class="navMenuContainer">
<DesktopNavSectionComponent Section=webSection/>
</div>
</div>
}
</div>
}
</div>
<SearchButtonComponent />
<SearchButtonComponent/>
</div>
</div>

4
Components/Navigation/DesktopNavLinkComponent.razor

@ -11,9 +11,7 @@
}
else
{
<NavLink @onclick="() => {
navigationService.ChangeNavigationState(NavigationStateType.Default);
navigationService.ChangeNavigationSectionId(-1); }" href="@Page.Href" class="desktopNavLink">
<NavLink @onclick="() => { navigationService.ChangeNavigationState(NavigationStateType.Default); navigationService.ChangeNavigationSectionId(-1); }" href="@Page.Href" class="desktopNavLink">
<div class="navName">
@Page.Name
</div>

2
Contexts/Contexts.csproj

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.2.22153.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

10
IGP/App.razor

@ -15,7 +15,8 @@
<EntityDialogPortal/>
<ToastPortal/>
<SearchPortal />
<SearchPortal/>
<style>
a {
@ -68,11 +69,4 @@
@code {
#if NO_SQL
#else
[Inject]
DatabaseContext Database { get; set; }
#endif
}

BIN
IGP/Database.db

Binary file not shown.

40
IGP/Dialog/SearchDialogComponent.razor

@ -5,24 +5,24 @@
@inject NavigationManager navigationManager
@if (searchService.IsLoaded())
@if (searchService.IsLoaded() && searchService.IsVisible)
{
<div class="searchBackground" onclick="@CloseDialog">
<div class="searchContainer"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
<FormLayoutComponent>
<FormTextComponent Placeholder="Search..." OnChange="SearchChanged"></FormTextComponent>
<FormTextComponent Id="search-input-box" Placeholder="Search..." OnChange="SearchChanged"></FormTextComponent>
</FormLayoutComponent>
<div class="searchBox">
@if (SearchText.Length > 0)
{
foreach (var searchSection in searchService.Searches)
{
var searchPoints = searchSection.Value.FindAll(x => x.Title.ToLower().Contains(SearchText.ToLower()));
@if (searchPoints.Count > 0)
{
<div>
@ -30,22 +30,20 @@
@searchSection.Key
</div>
<div class="searchContents">
@foreach (var searchPoint in searchPoints)
{
<button class="searchLink @searchPoint.PointType.ToLower()" @onclick="() => OnSearch(searchPoint)">@searchPoint.Title</button>
}
@foreach (var searchPoint in searchPoints)
{
<button class="searchLink @searchPoint.PointType.ToLower()" @onclick="() => OnSearch(searchPoint)">@searchPoint.Title</button>
}
</div>
</div>
</div>
}
}
}
</div>
</div>
</div>
<style>
.pageContents * {
filter: blur(2px);
@ -110,7 +108,6 @@
}
</style>
}
@ -125,12 +122,17 @@
searchService.Subscribe(OnSearchChanged);
}
private System.Threading.Timer timer = null!;
private void OnSearchChanged()
{
if (searchService.IsVisible)
{
jsRuntime.InvokeVoidAsync("SetFocusToElement", "search-dialog-input");
timer = new System.Threading.Timer(_ =>
{
jsRuntime.InvokeVoidAsync("SetFocusToElement", "search-input-box");
InvokeAsync(StateHasChanged);
}, null, 1, 1);
}
}
@ -149,15 +151,13 @@
{
if (url.Contains("#"))
{
navigationManager.NavigateTo(url,
navigationManager.Uri.Split("#").First().Contains(url.Split("#").First()));
navigationManager.NavigateTo(url,
navigationManager.Uri.Split("#").First().Contains(url.Split("#").First()));
}
else
{
navigationManager.NavigateTo(url);
}
}
private void SearchChanged(ChangeEventArgs obj)

18
IGP/IGP.csproj

@ -20,10 +20,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Markdig" Version="0.28.1" />
<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" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2" />
<PackageReference Include="Markdig" Version="0.28.1"/>
<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"/>
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2"/>
<!--
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" />
@ -32,17 +32,17 @@
</ItemGroup>
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Components\Components.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Services\Services.csproj" />
<ProjectReference Include="..\Components\Components.csproj"/>
<ProjectReference Include="..\Model\Model.csproj"/>
<ProjectReference Include="..\Services\Services.csproj"/>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\generated" />
<Folder Include="wwwroot\generated"/>
</ItemGroup>
<ItemGroup>

2
IGP/Index.razor

@ -3,7 +3,7 @@
@layout PageLayout
<DevOnlyComponent>
<SearchButtonComponent />
<SearchButtonComponent/>
</DevOnlyComponent>
<HomePage/>

7
IGP/PageLayout.razor

@ -39,19 +39,18 @@
protected override async Task OnInitializedAsync()
{
await webService.Load();
await Focus();
await Focus();
}
private async Task Focus()
private async Task Focus()
{
// await jsRuntime.InvokeVoidAsync("SetFocusToElement", pageContents);
}
protected override async void OnAfterRender(bool firstRender)
{
// await jsRuntime.InvokeVoidAsync("SetFocusToElement", pageContents);
// await jsRuntime.InvokeVoidAsync("SetFocusToElement", pageContents);
}
void IDisposable.Dispose()

2
IGP/Pages/AnaltyicsPage.razor

@ -8,7 +8,7 @@
<Title>Not Implemented</Title>
<Message></Message>
</AlertComponent>
<PaperComponent>
TODO
</PaperComponent>

2
IGP/Pages/EconomyComparison.razor

@ -8,7 +8,7 @@
<Title>Not Implemented</Title>
<Message></Message>
</AlertComponent>
<PaperComponent>
TODO
</PaperComponent>

2
IGP/Pages/PermissionsPage.razor

@ -8,7 +8,7 @@
<Title>Not Implemented</Title>
<Message></Message>
</AlertComponent>
<PaperComponent>
TODO
</PaperComponent>

2
IGP/Pages/StoragePage.razor

@ -7,7 +7,7 @@
<Title>Not Implemented</Title>
<Message></Message>
</AlertComponent>
<PaperComponent>
TODO
</PaperComponent>

31
IGP/Portals/SearchPortal.razor

@ -1,14 +1,13 @@
@implements IDisposable;
@inject ISearchService searchService
@inject IJSRuntime jsRuntime
@if (searchService.IsVisible)
{
<SearchDialogComponent></SearchDialogComponent>
}
<SearchDialogComponent></SearchDialogComponent>
@code {
private string test = "Q";
protected override void OnInitialized()
{
searchService.Subscribe(OnUpdate);
@ -17,15 +16,35 @@
protected override async Task OnInitializedAsync()
{
await searchService.Load();
await jsRuntime.InvokeVoidAsync("SetDotnetReference", DotNetObjectReference.Create(this));
}
public void Dispose()
{
searchService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
[JSInvokable("OnKeyPress")]
public async Task OnKeyPress(string code, bool ctrlKey, bool shiftKey, bool altKey, bool metaKey)
{
if (code.ToLower().Equals("k") && (ctrlKey || shiftKey || altKey || metaKey))
{
if (searchService.IsVisible)
{
searchService.Hide();
}
else
{
searchService.Show();
}
}
}
}

6
IGP/wwwroot/content/docs/cheat-sheet.md

@ -1,8 +1,6 @@
---
title: Cheat Sheet
summary: Handy links or quick information on this project.
created_date: 2022-04-11
updated_date: 2022-04-11
title: Cheat Sheet summary: Handy links or quick information on this project. created_date: 2022-04-11 updated_date:
2022-04-11
---
# Overview

5
IGP/wwwroot/content/docs/project-data.md

@ -1,8 +1,5 @@
---
title: Project Data
summary: Using data in this project.
created_date: 2022-04-11
updated_date: 2022-04-11
title: Project Data summary: Using data in this project. created_date: 2022-04-11 updated_date: 2022-04-11
---
# Overview

5
IGP/wwwroot/content/docs/setup.md

@ -1,8 +1,5 @@
---
title: Setup
summary: Get set up on developing this web project.
created_date: 3/30/2022
updated_date: 4/7/2022
title: Setup summary: Get set up on developing this web project. created_date: 3/30/2022 updated_date: 4/7/2022
---
# Overview

5
IGP/wwwroot/content/notes/coop/holdout.md

@ -1,8 +1,5 @@
---
title: Holdout
summary: First coop test map in pre-alpha.
created_date: 2/18/2022
updated_date: 2/18/2022
title: Holdout summary: First coop test map in pre-alpha. created_date: 2/18/2022 updated_date: 2/18/2022
---
Information contained in this note is based on this <a href="https://www.youtube.com/watch?v=XkAgOCIz3DE">YouTube,

9
IGP/wwwroot/content/notes/settings/hotkeys.md

@ -1,8 +1,6 @@
---
title: Custom HotKey Setup
summary: Customize your hotkeys in the pre-alpha.
created_date: 4/13/2022
updated_date: 4/13/2022
title: Custom HotKey Setup summary: Customize your hotkeys in the pre-alpha. created_date: 4/13/2022 updated_date:
4/13/2022
---
In the pre-alpha, IGP comes with some Unreal default hotkey setup.
@ -97,7 +95,8 @@ You can notice a single line of this file can be broken down like this.
`ActionMappings=(ActionName="AttackMove",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=A)`
- `ActionMappings=(***)`: Indicates content is an action mapping. i.e. a hotkey
- `ActionName="AttackMove"`: Indicates the name of the selected action. Here, we are using the `AttackMove` move action, that forces your selected army to attack.
- `ActionName="AttackMove"`: Indicates the name of the selected action. Here, we are using the `AttackMove` move action,
that forces your selected army to attack.
- `Key=A`: Indicates key being mapped to the action. Set to `Key=Tab` to require the Tab key to be pressed instead, to
perform the `AttackMove` action.
- `bShift=False`: Indicates that the Shift key is not held. Set to `bShift=True` to require a shift key held to

5
IGP/wwwroot/content/notes/the-basics/armor-types.md

@ -1,8 +1,5 @@
---
title: Armor Types
summary: Heavy, Medium, and Light. What does it mean?
created_date: 4/13/2000
updated_date: 4/13/2000
title: Armor Types summary: Heavy, Medium, and Light. What does it mean? created_date: 4/13/2000 updated_date: 4/13/2000
---
## Armor Types

6
IGP/wwwroot/content/notes/the-basics/economy-overview.md

@ -1,6 +1,4 @@
---
title: Economy Overview
summary: Alloy, Ether and Supply. Don't forget to expand!
created_date: 1/01/2000
updated_date: 1/01/2000
title: Economy Overview summary: Alloy, Ether and Supply. Don't forget to expand!
created_date: 1/01/2000 updated_date: 1/01/2000
---

6
IGP/wwwroot/content/notes/the-basics/families-factions-and-immortal-vanguards.md

@ -1,6 +1,4 @@
---
title: Families, Factions, and Immortal Vanguards
summary: How IMMORTAL: Gates of Pyre handle your army selection choices
created_date: 1/01/2000
updated_date: 1/01/2000
title: Families, Factions, and Immortal Vanguards summary: How IMMORTAL: Gates of Pyre handle your army selection
choices created_date: 1/01/2000 updated_date: 1/01/2000
---

6
IGP/wwwroot/content/notes/the-basics/immortal-spells-and-pyre.md

@ -1,8 +1,6 @@
---
title: Immortals Spells and Pyre
summary: Customize your hotkeys in the pre-alpha.
created_date: 1/01/2000
updated_date: 1/01/2000
title: Immortals Spells and Pyre summary: Customize your hotkeys in the pre-alpha. created_date: 1/01/2000 updated_date:
1/01/2000
---
## What are Immortals

5
IGP/wwwroot/content/notes/the-basics/timing-and-scouting.md

@ -1,8 +1,5 @@
---
title: Timing and Scouting
summary: Knowing is half the battle.
created_date: 1/01/2000
updated_date: 1/01/2000
title: Timing and Scouting summary: Knowing is half the battle. created_date: 1/01/2000 updated_date: 1/01/2000
---
## Timing

2
IGP/wwwroot/generated/GitChangeModels.json

File diff suppressed because one or more lines are too long

2
IGP/wwwroot/generated/GitPatchModels.json

@ -1 +1 @@
[{"Id":1,"Name":"Database UX Patch","Date":"2022-03-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":2,"Name":"Thrum Stats Hotfix","Date":"2022-03-12T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":3,"Name":"Memory Tester Patch","Date":"2022-03-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":4,"Name":"Hide Pyre Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":5,"Name":"Stream Patch","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":6,"Name":"Agile UI Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":7,"Name":"Armor Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":8,"Name":"Home Page Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":9,"Name":"Mobile Menu Hotfix 2","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":10,"Name":"Mobile Menu Hotfix","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":11,"Name":"Mobile Menu Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":12,"Name":"0.0.6.8375a Patch","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":13,"Name":"Google Tracking Hotfix","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":14,"Name":"Privacy Policy Patch","Date":"2022-02-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":15,"Name":"Home Page Quick Hotfix","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":16,"Name":"Early Agile Patch","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":17,"Name":"Form Text Rendering Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":18,"Name":"Reducing Timing Interval Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":19,"Name":"Changelog Patch","Date":"2022-02-14T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":20,"Name":"SQL Patch","Date":"2022-03-26T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":21,"Name":"Stream Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":22,"Name":"0.0.6.8900a Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":23,"Name":"Database Links Patch","Date":"2022-04-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":24,"Name":"Open Source Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":25,"Name":"Stream Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":26,"Name":"Notes/Docs Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":27,"Name":"Stream Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":28,"Name":"Passive Patch","Date":"2022-04-12T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":29,"Name":"0.0.6.9121a Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":30,"Name":"Stream Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":31,"Name":"BuildCalc Hotfix","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":32,"Name":"Search Path","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"}]
[{"Id":1,"Name":"Database UX Patch","Date":"2022-03-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":2,"Name":"Thrum Stats Hotfix","Date":"2022-03-12T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":3,"Name":"Memory Tester Patch","Date":"2022-03-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":4,"Name":"Hide Pyre Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":5,"Name":"Stream Patch","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":6,"Name":"Agile UI Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":7,"Name":"Armor Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":8,"Name":"Home Page Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":9,"Name":"Mobile Menu Hotfix 2","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":10,"Name":"Mobile Menu Hotfix","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":11,"Name":"Mobile Menu Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":12,"Name":"0.0.6.8375a Patch","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":13,"Name":"Google Tracking Hotfix","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":14,"Name":"Privacy Policy Patch","Date":"2022-02-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":15,"Name":"Home Page Quick Hotfix","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":16,"Name":"Early Agile Patch","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":17,"Name":"Form Text Rendering Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":18,"Name":"Reducing Timing Interval Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":19,"Name":"Changelog Patch","Date":"2022-02-14T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":20,"Name":"SQL Patch","Date":"2022-03-26T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":21,"Name":"Stream Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":22,"Name":"0.0.6.8900a Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":23,"Name":"Database Links Patch","Date":"2022-04-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":24,"Name":"Open Source Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":25,"Name":"Stream Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":26,"Name":"Notes/Docs Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":27,"Name":"Stream Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":28,"Name":"Passive Patch","Date":"2022-04-12T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":29,"Name":"0.0.6.9121a Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":30,"Name":"Stream Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":31,"Name":"BuildCalc Hotfix","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":32,"Name":"Search Patch","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":33,"Name":"Search Hotfix","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"}]

15
IGP/wwwroot/index.html

@ -12,8 +12,8 @@
<link href="css/app.css" rel="stylesheet"/>
<link href="IGP.styles.css" rel="stylesheet"/>
<link href="manifest.json" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
<link href="manifest.json" rel="manifest"/>
<link href="icon-512.png" rel="apple-touch-icon" sizes="512x512"/>
</head>
<body style="background-color: #161618; color: white;">
@ -37,14 +37,21 @@
});
</script>
<script>
window.DotNetReference = null;
window.SetDotnetReference = function (dotnetReference) {
window.DotNetReference = dotnetReference;
};
window.getUserAgent = () => {
return navigator.userAgent;
};
</script>
<script>
window.SetFocusToElement = (elementId) => {
document.getElementById(elementId).focus();
};
document.addEventListener("keydown", function (e) {
DotNetReference?.invokeMethodAsync('OnKeyPress', e.key, e.ctrlKey, e.shiftKey, e.altKey, e.metaKey)
});
</script>
<script>navigator.serviceWorker.register('service-worker.js');</script>

12
IGP_Convert/IGP_Convert.csproj

@ -8,17 +8,17 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Contexts\Contexts.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" />
<ProjectReference Include="..\Contexts\Contexts.csproj"/>
<ProjectReference Include="..\Model\Model.csproj"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.2.22153.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.2.22153.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-preview.2.22153.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

2
Model/BuildOrders/BuildOrderModel.cs

@ -17,7 +17,7 @@ public class BuildOrderModel
public Dictionary<string, int> UniqueCompletedTimes { get; set; } = new();
public Dictionary<string, int> UniqueCompletedCount { get; set; } = new();
public Dictionary<int, int> SupplyCountTimes { get; set; } = new();
public List<EntityModel> GetHarvestersCompletedBefore(int interval)
{
return (from ordersAtTime in StartedOrders

8
Model/Model.csproj

@ -3,14 +3,6 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="_PaperWork\**"/>
<EmbeddedResource Remove="_PaperWork\**"/>
<None Remove="_PaperWork\**"/>
<None Remove="Immortal\MemoryTester\"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
<PackageReference Include="YamlDotNet" Version="11.2.1"/>

27
Model/Notes/NoteContentModel.cs

@ -24,22 +24,27 @@ public class NoteContentModel
public string Description { get; set; }
public string Content { get; set; }
[NotMapped]
public virtual string LoadedContent { get; set; }
[NotMapped] public virtual string LoadedContent { get; set; }
public string IsHidden { get; set; } = "False";
public string IsPreAlpha { get; set; } = "True";
[NotMapped]
public virtual ICollection<NoteContentModel> NoteContentModels { get; set; } = new List<NoteContentModel>();
[NotMapped] public virtual NoteContentModel Parent { get; set; }
[NotMapped] public virtual int PageOrder { get; set; }
public List<SearchPointModel> GetHeaders()
{
var regex = new Regex(@"^#* (.*)$", RegexOptions.Multiline);
var listOfMatches = regex.Matches(LoadedContent);
List<SearchPointModel> foundHeaders = new List<SearchPointModel>();
var foundHeaders = new List<SearchPointModel>();
foreach (var capture in listOfMatches)
{
var cleanUp = capture.ToString();
@ -49,18 +54,12 @@ public class NoteContentModel
cleanUp = cleanUp.Replace("\"", "");
cleanUp = cleanUp.Trim();
cleanUp = cleanUp.Replace(" ", "-");
foundHeaders.Add(new SearchPointModel(){ Title = capture.ToString().Trim(), Href = cleanUp});
foundHeaders.Add(new SearchPointModel { Title = capture.ToString().Trim(), Href = cleanUp });
Console.WriteLine($"Capture: {cleanUp}");
}
return foundHeaders;
}
[NotMapped]
public virtual ICollection<NoteContentModel> NoteContentModels { get; set; } = new List<NoteContentModel>();
[NotMapped] public virtual NoteContentModel Parent { get; set; }
[NotMapped] public virtual int PageOrder { get; set; }
private string GetLink()

8
Services/IServices.cs

@ -28,16 +28,16 @@ public interface IToastService
public interface ISearchService
{
public List<SearchPointModel> SearchPoints { get; set; }
public Dictionary<string, List<SearchPointModel>> Searches { get; set; }
public bool IsVisible { get; set; }
public void Subscribe(Action action);
public void Unsubscribe(Action action);
public void Search(string entityId);
public Task Load();
public bool IsLoaded();
@ -90,7 +90,7 @@ public interface IAgileService
public void Unsubscribe(Action? action);
public void Update();
public Task Load();
public Task Load();
public bool IsLoaded();
}

11
Services/Immortal/BuildOrderService.cs

@ -13,14 +13,15 @@ namespace Services.Immortal;
public class BuildOrderService : IBuildOrderService
{
private BuildOrderModel buildOrder = new();
public int BuildingInputDelay { get; set; } = 2;
private int lastInterval = 0;
private int lastInterval;
public BuildOrderService()
{
Reset();
}
public int BuildingInputDelay { get; set; } = 2;
public Dictionary<int, List<EntityModel>> StartedOrders => buildOrder.StartedOrders;
public Dictionary<int, List<EntityModel>> CompletedOrders => buildOrder.CompletedOrders;
public Dictionary<string, int> UniqueCompletedTimes => buildOrder.UniqueCompletedTimes;
@ -254,7 +255,7 @@ public class BuildOrderService : IBuildOrderService
public void Reset()
{
lastInterval = 0;
buildOrder = new BuildOrderModel
{
StartedOrders = new Dictionary<int, List<EntityModel>>
@ -304,7 +305,7 @@ public class BuildOrderService : IBuildOrderService
}
}
};
NotifyDataChanged();
}
@ -326,7 +327,7 @@ public class BuildOrderService : IBuildOrderService
atInterval = interval;
if (entity.EntityType != EntityType.Army) atInterval += BuildingInputDelay;
return true;
}
}

9
Services/Immortal/EconomyService.cs

@ -1,8 +1,6 @@
using Model.Economy;
using Model.Entity;
using Model.Feedback;
using Model.Types;
using Services.Website;
namespace Services.Immortal;
@ -159,11 +157,8 @@ public class EconomyService : IEconomyService
public EconomyModel GetEconomy(int atInterval)
{
if (atInterval >= economyOverTime.Count)
{
return economyOverTime.Last();
}
if (atInterval >= economyOverTime.Count) return economyOverTime.Last();
return economyOverTime[atInterval];
}

2
Services/Immortal/TimingService.cs

@ -28,7 +28,7 @@ public class TimingService : ITimingService
NotifyDataChanged();
}
}
public int GetTravelTime()
{
return travelTime;

4
Services/Services.csproj

@ -15,11 +15,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="YamlDotNet" Version="11.2.1" />
<PackageReference Include="YamlDotNet" Version="11.2.1"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Model\Model.csproj"/>
</ItemGroup>
</Project>

3
Services/Website/EntityDialogService.cs

@ -3,9 +3,8 @@
//TODO Move to a database folder, with EntityService, EntityFilterService
public class EntityDialogService : IEntityDialogService
{
private string? entityId;
private readonly List<string> history = new();
private string? entityId;
public void Subscribe(Action action)
{

75
Services/Website/SearchService.cs

@ -1,23 +1,20 @@
using Model.Entity.Data;
using Model.Feedback;
using Model.Website;
namespace Services.Website;
public class SearchService : ISearchService
{
private bool isLoaded = false;
public List<SearchPointModel> SearchPoints { get; set; } = new();
private readonly IDocumentationService documentationService;
public Dictionary<string, List<SearchPointModel>> Searches { get; set; } = new();
private bool isLoaded;
private readonly INoteService noteService;
private IWebsiteService websiteService;
private INoteService noteService;
private IDocumentationService documentationService;
private readonly IWebsiteService websiteService;
public SearchService(IWebsiteService websiteService, INoteService noteService, IDocumentationService documentationService)
public SearchService(IWebsiteService websiteService, INoteService noteService,
IDocumentationService documentationService)
{
this.websiteService = websiteService;
this.noteService = noteService;
@ -25,7 +22,11 @@ public class SearchService : ISearchService
// All Unit Data
}
public List<SearchPointModel> SearchPoints { get; set; } = new();
public Dictionary<string, List<SearchPointModel>> Searches { get; set; } = new();
public bool IsVisible { get; set; }
public void Subscribe(Action action)
@ -47,8 +48,8 @@ public class SearchService : ISearchService
await websiteService.Load();
await noteService.Load();
await documentationService.Load();
Searches.Add("Pages", new List<SearchPointModel>());
Searches.Add("Notes", new List<SearchPointModel>());
Searches.Add("Documents", new List<SearchPointModel>());
@ -56,47 +57,55 @@ public class SearchService : ISearchService
foreach (var webPage in websiteService.WebPageModels)
{
SearchPoints.Add(new SearchPointModel{ Title = webPage.Name,
SearchPoints.Add(new SearchPointModel
{
Title = webPage.Name,
PointType = "WebPage",
Href=webPage.Href
Href = webPage.Href
});
Searches["Pages"].Add(SearchPoints.Last());
}
foreach (var note in noteService.NoteContentModels)
{
SearchPoints.Add(new SearchPointModel(){ Title = note.Name,
PointType = "Note", Href = note.GetNoteLink()});
Searches["Notes"].Add(SearchPoints.Last());
SearchPoints.Add(new SearchPointModel
{
Title = note.Name,
PointType = "Note", Href = note.GetNoteLink()
});
Searches["Notes"].Add(SearchPoints.Last());
}
foreach (var entity in DATA.Get().Values)
{
SearchPoints.Add(new SearchPointModel(){
Title = entity.Info().Name,
SearchPoints.Add(new SearchPointModel
{
Title = entity.Info().Name,
Tags = $"{entity.EntityType},{entity.Descriptive}",
PointType = "Entity",
Href = $"database/{entity.Info().Name.ToLower()}"
});
Searches["Entities"].Add(SearchPoints.Last());
}
foreach (var doc in documentationService.DocContentModels)
{
SearchPoints.Add(new SearchPointModel { Title = doc.Name,
PointType = "Document", Href = doc.GetDocLink()});
SearchPoints.Add(new SearchPointModel
{
Title = doc.Name,
PointType = "Document", Href = doc.GetDocLink()
});
Searches["Documents"].Add(SearchPoints.Last());
}
isLoaded = true;
NotifyDataChanged();
}
@ -108,14 +117,14 @@ public class SearchService : ISearchService
public void Show()
{
IsVisible = true;
NotifyDataChanged();
}
public void Hide()
{
IsVisible = false;
NotifyDataChanged();
}

Loading…
Cancel
Save