Browse Source

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

main
Jonathan McCaffrey 4 years ago
parent
commit
ba2eeec13f
  1. 4
      Components/Form/FormNumberComponent.razor
  2. 5
      Components/Form/FormTextComponent.razor
  3. 10
      Components/Inputs/SearchButtonComponent.razor
  4. 4
      Components/Navigation/DesktopNavLinkComponent.razor
  5. 8
      IGP/App.razor
  6. BIN
      IGP/Database.db
  7. 16
      IGP/Dialog/SearchDialogComponent.razor
  8. 1
      IGP/PageLayout.razor
  9. 25
      IGP/Portals/SearchPortal.razor
  10. 6
      IGP/wwwroot/content/docs/cheat-sheet.md
  11. 5
      IGP/wwwroot/content/docs/project-data.md
  12. 5
      IGP/wwwroot/content/docs/setup.md
  13. 5
      IGP/wwwroot/content/notes/coop/holdout.md
  14. 9
      IGP/wwwroot/content/notes/settings/hotkeys.md
  15. 5
      IGP/wwwroot/content/notes/the-basics/armor-types.md
  16. 6
      IGP/wwwroot/content/notes/the-basics/economy-overview.md
  17. 6
      IGP/wwwroot/content/notes/the-basics/families-factions-and-immortal-vanguards.md
  18. 6
      IGP/wwwroot/content/notes/the-basics/immortal-spells-and-pyre.md
  19. 5
      IGP/wwwroot/content/notes/the-basics/timing-and-scouting.md
  20. 2
      IGP/wwwroot/generated/GitChangeModels.json
  21. 2
      IGP/wwwroot/generated/GitPatchModels.json
  22. 13
      IGP/wwwroot/index.html
  23. 8
      Model/Model.csproj
  24. 19
      Model/Notes/NoteContentModel.cs
  25. 5
      Services/Immortal/BuildOrderService.cs
  26. 7
      Services/Immortal/EconomyService.cs
  27. 3
      Services/Website/EntityDialogService.cs
  28. 41
      Services/Website/SearchService.cs

4
Components/Form/FormNumberComponent.razor

@ -48,8 +48,8 @@
void OnInputChanged(ChangeEventArgs changeEventArgs)
{
int valueWas = Value;
int newValue = int.Parse(changeEventArgs.Value!.ToString()!);
var valueWas = Value;
var newValue = int.Parse(changeEventArgs.Value!.ToString()!);
if (newValue > Max)
{

5
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; } = "";

10
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>
}
</button>
<style>
@ -35,6 +30,7 @@
.searchHotkey {
padding: 2px;
background-color: var(--info);
border: 2px solid var(--primary-border);
}
@ -42,6 +38,7 @@
@code {
[Parameter]
public RenderFragment ChildContent { get; set; } = default!;
@ -58,4 +55,5 @@
{
userAgent = await jsRuntime.InvokeAsync<string>("getUserAgent");
}
}

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>

8
IGP/App.razor

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

BIN
IGP/Database.db

Binary file not shown.

16
IGP/Dialog/SearchDialogComponent.razor

@ -5,7 +5,7 @@
@inject NavigationManager navigationManager
@if (searchService.IsLoaded())
@if (searchService.IsLoaded() && searchService.IsVisible)
{
<div class="searchBackground" onclick="@CloseDialog">
<div class="searchContainer"
@ -13,7 +13,7 @@
@onclick:stopPropagation="true">
<FormLayoutComponent>
<FormTextComponent Placeholder="Search..." OnChange="SearchChanged"></FormTextComponent>
<FormTextComponent Id="search-input-box" Placeholder="Search..." OnChange="SearchChanged"></FormTextComponent>
</FormLayoutComponent>
<div class="searchBox">
@ -37,9 +37,7 @@
</div>
</div>
}
}
}
</div>
@ -110,7 +108,6 @@
}
</style>
}
@ -125,11 +122,16 @@
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,7 +151,6 @@
{
if (url.Contains("#"))
{
navigationManager.NavigateTo(url,
navigationManager.Uri.Split("#").First().Contains(url.Split("#").First()));
}
@ -157,7 +158,6 @@
{
navigationManager.NavigateTo(url);
}
}
private void SearchChanged(ChangeEventArgs obj)

1
IGP/PageLayout.razor

@ -41,7 +41,6 @@
await webService.Load();
await Focus();
}
private async Task Focus()

25
IGP/Portals/SearchPortal.razor

@ -1,13 +1,12 @@
@implements IDisposable;
@inject ISearchService searchService
@inject IJSRuntime jsRuntime
@if (searchService.IsVisible)
{
<SearchDialogComponent></SearchDialogComponent>
}
@code {
private string test = "Q";
protected override void OnInitialized()
{
@ -17,8 +16,11 @@
protected override async Task OnInitializedAsync()
{
await searchService.Load();
await jsRuntime.InvokeVoidAsync("SetDotnetReference", DotNetObjectReference.Create(this));
}
public void Dispose()
{
searchService.Unsubscribe(OnUpdate);
@ -28,4 +30,21 @@
{
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"}]

13
IGP/wwwroot/index.html

@ -13,7 +13,7 @@
<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="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>

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"/>

19
Model/Notes/NoteContentModel.cs

@ -26,19 +26,24 @@ public class NoteContentModel
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)
{
@ -49,19 +54,13 @@ 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()
{

5
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;

7
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,10 +157,7 @@ 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];
}

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)
{

41
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 readonly IDocumentationService documentationService;
private bool isLoaded = false;
public List<SearchPointModel> SearchPoints { get; set; } = new();
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;
@ -26,6 +23,10 @@ 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)
@ -56,7 +57,9 @@ 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
});
@ -66,17 +69,20 @@ public class SearchService : ISearchService
foreach (var note in noteService.NoteContentModels)
{
SearchPoints.Add(new SearchPointModel(){ Title = note.Name,
PointType = "Note", Href = note.GetNoteLink()});
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(){
SearchPoints.Add(new SearchPointModel
{
Title = entity.Info().Name,
Tags = $"{entity.EntityType},{entity.Descriptive}",
PointType = "Entity",
@ -89,8 +95,11 @@ public class SearchService : ISearchService
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());
}

Loading…
Cancel
Save