feat(Documents) Notes/Docs page improvements and warning cleanup

This commit is contained in:
2022-04-07 13:30:00 -04:00
parent b270453030
commit d82e60efdf
223 changed files with 4396 additions and 2861 deletions
+15 -42
View File
@@ -1,50 +1,32 @@
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Model.Immortal.BuildOrders;
using Model.Immortal.Entity;
using Model.Immortal.Entity.Data;
using Model.BuildOrders;
using Model.Entity;
using Model.Entity.Data;
using YamlDotNet.Serialization;
namespace Services.Immortal;
public class BuildComparisionService : IBuildComparisonService {
private BuildComparisonModel buildComparison = new() {
Builds = new List<BuildOrderModel> {
new() {
Name = "one base",
Orders = new Dictionary<int, List<EntityModel>> {
{
0, new List<EntityModel> {
new(DataType.STARTING_Bastion, EntityType.Building)
}
}
}
},
new() {
Name = "two base",
Orders = new Dictionary<int, List<EntityModel>> {
{
0, new List<EntityModel> {
new(DataType.STARTING_Bastion, EntityType.Building),
new(DataType.STARTING_Bastion, EntityType.Building)
}
}
}
}
}
};
private event Action OnChange = default!;
private BuildComparisonModel buildComparison = new();
public void Subscribe(Action action) {
onChange += action;
OnChange += action;
}
public void Unsubscribe(Action action) {
onChange -= action;
OnChange -= action;
}
public void SetBuilds(BuildComparisonModel buildComparison) {
this.buildComparison = buildComparison;
private void NotifyDataChanged() {
OnChange?.Invoke();
}
public void SetBuilds(BuildComparisonModel buildComparisonModel) {
buildComparison = buildComparisonModel;
NotifyDataChanged();
}
@@ -66,7 +48,7 @@ public class BuildComparisionService : IBuildComparisonService {
WriteIndented = true
};
options.Converters.Add(new JsonStringEnumConverter());
buildComparison = JsonSerializer.Deserialize<BuildComparisonModel>(data, options);
buildComparison = JsonSerializer.Deserialize<BuildComparisonModel>(data, options)!;
// Must Hydrate because not loaded with Parts
HydratedLoadedJson();
@@ -87,15 +69,6 @@ public class BuildComparisionService : IBuildComparisonService {
return buildOrderText;
}
private event Action onChange;
private void NotifyDataChanged() {
onChange?.Invoke();
}
public Action OnChange() {
return onChange;
}
public void HydratedLoadedJson() {
foreach (var build in buildComparison.Builds)
+14 -18
View File
@@ -1,19 +1,19 @@
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Model.Immortal.BuildOrders;
using Model.Immortal.Entity;
using Model.Immortal.Types;
using Model.BuildOrders;
using Model.Entity;
using Model.Types;
using YamlDotNet.Serialization;
namespace Services.Immortal;
public class BuildOrderService : IBuildOrderService {
public static int HumanMicro = 2;
private int HumanMicro = 2;
private readonly BuildOrderModel buildOrder = new();
private int lastInterval;
private int lastInterval = 0;
public int GetLastRequestInterval() {
return lastInterval;
}
@@ -23,11 +23,11 @@ public class BuildOrderService : IBuildOrderService {
}
public void Subscribe(Action action) {
onChange += action;
OnChange += action;
}
public void Unsubscribe(Action action) {
onChange -= action;
OnChange -= action;
}
public void Add(EntityModel entity, int atInterval) {
@@ -81,7 +81,7 @@ public class BuildOrderService : IBuildOrderService {
}
public void RemoveLast() {
EntityModel entityRemoved = null;
EntityModel entityRemoved = null!;
if (buildOrder.Orders.Keys.Count > 1) {
@@ -184,7 +184,7 @@ public class BuildOrderService : IBuildOrderService {
select requiredEntity;
if (entitiesNeeded.Count() == 0) return false;
if (!entitiesNeeded.Any()) return false;
if (entitiesNeeded.Any() == false)
@@ -212,8 +212,8 @@ public class BuildOrderService : IBuildOrderService {
return buildOrder.Notes;
}
public void SetColor(string Color) {
buildOrder.Color = Color;
public void SetColor(string color) {
buildOrder.Color = color;
NotifyDataChanged();
}
@@ -221,14 +221,10 @@ public class BuildOrderService : IBuildOrderService {
return buildOrder.Color;
}
private event Action onChange;
private event Action OnChange = null!;
private void NotifyDataChanged() {
onChange?.Invoke();
}
public Action OnChange() {
return onChange;
OnChange?.Invoke();
}
public bool MeetsSupply(EntityModel entity) {
+9 -9
View File
@@ -1,22 +1,22 @@
using Model.Immortal.Economy;
using Model.Immortal.Entity;
using Model.Immortal.Types;
using Model.Economy;
using Model.Entity;
using Model.Types;
namespace Services.Immortal;
public class EconomyService : IEconomyService {
private List<EconomyModel> _overTime;
private List<EconomyModel> _overTime = null!;
public List<EconomyModel> GetOverTime() {
return _overTime;
}
public void Subscribe(Action action) {
_onChange += action;
onChange += action;
}
public void Unsubscribe(Action action) {
_onChange -= action;
onChange -= action;
}
public void Calculate(IBuildOrderService buildOrder, ITimingService timing, int fromInterval) {
@@ -137,13 +137,13 @@ public class EconomyService : IEconomyService {
return _overTime[atInterval];
}
private event Action _onChange;
private event Action onChange = null!;
private void NotifyDataChanged() {
_onChange?.Invoke();
onChange?.Invoke();
}
public Action OnChange() {
return _onChange;
return onChange;
}
}
+5 -9
View File
@@ -1,10 +1,10 @@
using Model.Immortal.Types;
using Model.Types;
namespace Services.Immortal;
public class EntityDisplayService : IEntityDisplayService {
private string displayType = "Detailed";
private event Action _onChange;
private event Action OnChange = null!;
public List<string> DefaultChoices()
{
@@ -12,19 +12,15 @@ public class EntityDisplayService : IEntityDisplayService {
}
public void Subscribe(Action action) {
_onChange += action;
OnChange += action;
}
public void Unsubscribe(Action action) {
_onChange -= action;
OnChange -= action;
}
private void NotifyDataChanged() {
_onChange?.Invoke();
}
public Action OnChange() {
return _onChange;
OnChange?.Invoke();
}
public string GetDisplayType()
+3 -3
View File
@@ -1,5 +1,5 @@
using Model.Immortal.Entity.Data;
using Model.Immortal.Types;
using Model.Entity.Data;
using Model.Types;
using static Services.IEntityFilterService;
namespace Services.Immortal;
@@ -159,7 +159,7 @@ public class EntityFilterService : IEntityFilterService {
}
private event EntityFilterAction _onChange;
private event EntityFilterAction _onChange = null!;
private void NotifyDataChanged(EntityFilterEvent entityFilterEvent) {
_onChange?.Invoke(entityFilterEvent);
+1 -1
View File
@@ -1,4 +1,4 @@
using Model.Immortal.Entity;
using Model.Entity;
namespace Services.Immortal;
@@ -1,4 +1,4 @@
using Model.Immortal.Types;
using Model.Types;
namespace Services.Immortal;
@@ -7,11 +7,11 @@ public class ImmortalSelectionService : IImmortalSelectionService {
private string _selectedImmortal = ImmortalType.Orzum;
public void Subscribe(Action action) {
_onChange += action;
OnChange += action;
}
public void Unsubscribe(Action action) {
_onChange -= action;
OnChange -= action;
}
public string GetFactionType() {
@@ -41,13 +41,10 @@ public class ImmortalSelectionService : IImmortalSelectionService {
return true;
}
private event Action _onChange;
private event Action OnChange = null!;
private void NotifyDataChanged() {
_onChange?.Invoke();
OnChange?.Invoke();
}
public Action OnChange() {
return _onChange;
}
}
+13 -13
View File
@@ -1,25 +1,25 @@
using Model.Immortal.Hotkeys;
using Model.Hotkeys;
namespace Services.Immortal;
public class KeyService : IKeyService {
private static readonly List<string> _pressedKeys = new();
private static readonly List<string> PressedKeys = new();
private string? _hotkey;
private string _hotkeyGroup = "C";
private bool _isHoldingSpace;
public void Subscribe(Action action) {
public void Subscribe(Action? action) {
_onChange += action;
}
public void Unsubscribe(Action action) {
public void Unsubscribe(Action? action) {
_onChange -= action;
}
public bool AddPressedKey(string key) {
_hotkey = null;
if (_pressedKeys.Count > 0) return false;
if (PressedKeys.Count > 0) return false;
var pressedKey = key.ToUpper();
if (pressedKey.Equals(" ") || pressedKey.Equals("SPACE")) {
@@ -31,12 +31,12 @@ public class KeyService : IKeyService {
return false;
}
if (!_pressedKeys.Contains(pressedKey)) {
if (!PressedKeys.Contains(pressedKey)) {
if (HotkeyModel.KeyGroups.Contains(pressedKey)) _hotkeyGroup = pressedKey;
if (HotkeyModel.HotKeys.Contains(pressedKey)) _hotkey = pressedKey;
_pressedKeys.Add(pressedKey);
PressedKeys.Add(pressedKey);
NotifyDataChanged();
return true;
}
@@ -45,7 +45,7 @@ public class KeyService : IKeyService {
}
public List<string> GetAllPressedKeys() {
return _pressedKeys;
return PressedKeys;
}
public bool RemovePressedKey(string key) {
@@ -61,8 +61,8 @@ public class KeyService : IKeyService {
return false;
}
if (_pressedKeys.Contains(pressedKey)) {
_pressedKeys.Remove(pressedKey);
if (PressedKeys.Contains(pressedKey)) {
PressedKeys.Remove(pressedKey);
NotifyDataChanged();
return true;
}
@@ -74,7 +74,7 @@ public class KeyService : IKeyService {
return _isHoldingSpace;
}
public string GetHotkey() {
public string? GetHotkey() {
return _hotkey;
}
@@ -82,13 +82,13 @@ public class KeyService : IKeyService {
return _hotkeyGroup;
}
private event Action _onChange;
private event Action? _onChange;
private void NotifyDataChanged() {
_onChange?.Invoke();
}
public Action OnChange() {
public Action? OnChange() {
return _onChange;
}
}
+7 -10
View File
@@ -1,6 +1,6 @@
using Model.Immortal.Entity;
using Model.Immortal.Entity.Data;
using Model.Immortal.MemoryTester;
using Model.Entity;
using Model.Entity.Data;
using Model.MemoryTester;
using static Services.IMemoryTesterService;
namespace Services.Immortal;
@@ -18,11 +18,11 @@ public class MemoryTesterService : IMemoryTesterService {
private readonly Random random = new();
public void Subscribe(MemoryAction action) {
_onChange += action;
OnChange += action;
}
public void Unsubscribe(MemoryAction action) {
_onChange -= action;
OnChange -= action;
}
public void GenerateQuiz() {
@@ -88,13 +88,10 @@ public class MemoryTesterService : IMemoryTesterService {
//public delegate void MemoryAction(MemoryTesterActions memoryAction);
private event MemoryAction _onChange;
private event MemoryAction OnChange = null!;
private void NotifyDataChanged(MemoryTesterEvent memoryAction) {
_onChange?.Invoke(memoryAction);
OnChange?.Invoke(memoryAction);
}
public MemoryAction OnChange() {
return _onChange;
}
}
+4 -4
View File
@@ -3,11 +3,11 @@
public class TimingService : ITimingService {
private int _timing = 360;
public void Subscribe(Action action) {
public void Subscribe(Action? action) {
_onChange += action;
}
public void Unsubscribe(Action action) {
public void Unsubscribe(Action? action) {
_onChange -= action;
}
@@ -22,13 +22,13 @@ public class TimingService : ITimingService {
}
}
private event Action _onChange;
private event Action? _onChange;
private void NotifyDataChanged() {
_onChange?.Invoke();
}
public Action OnChange() {
public Action? OnChange() {
return _onChange;
}
}