feat(Documents) Notes/Docs page improvements and warning cleanup
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
|
||||
<FormLayoutComponent>
|
||||
<FormDisplayComponent Label="Army ready at">
|
||||
<Display>@LastInterval | T @Interval.ToTime(LastInterval)</Display>
|
||||
<Display>@lastInterval | T @Interval.ToTime(lastInterval)</Display>
|
||||
</FormDisplayComponent>
|
||||
<FormDisplayComponent Label="Army units built">
|
||||
<Display>
|
||||
<div style="display: flex; width: 100%; gap: 12px; flex-wrap: wrap;">
|
||||
@foreach (var unit in armyCount) {
|
||||
@foreach (var unit in armyCount)
|
||||
{
|
||||
<div style="width:90px; height: 60px; border: 1px solid gray; padding: 8px;">
|
||||
<div>@unit.Value.ToString()x</div>
|
||||
<div>@unit.Key</div>
|
||||
@@ -22,38 +23,46 @@
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
public IBuildOrderService BuildOrder { get; set; }
|
||||
public IBuildOrderService BuildOrder { get; set; } = default!;
|
||||
|
||||
int LastInterval;
|
||||
private int lastInterval;
|
||||
|
||||
readonly Dictionary<string, int> armyCount = new();
|
||||
|
||||
List<EntityModel> army = new();
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
BuildOrder.Subscribe(OnBuildOrderChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
BuildOrder.Unsubscribe(OnBuildOrderChanged);
|
||||
}
|
||||
|
||||
void OnBuildOrderChanged() {
|
||||
void OnBuildOrderChanged()
|
||||
{
|
||||
armyCount.Clear();
|
||||
|
||||
LastInterval = 0;
|
||||
lastInterval = 0;
|
||||
|
||||
var entitiesOverTime = BuildOrder.GetOrders();
|
||||
|
||||
foreach (var entitiesAtTime in entitiesOverTime) {
|
||||
foreach (var entity in entitiesAtTime.Value) {
|
||||
if (entity.EntityType == EntityType.Army) {
|
||||
if (!armyCount.TryAdd(entity.Info().Name, 1)) {
|
||||
foreach (var entitiesAtTime in entitiesOverTime)
|
||||
{
|
||||
foreach (var entity in entitiesAtTime.Value)
|
||||
{
|
||||
if (entity.EntityType == EntityType.Army)
|
||||
{
|
||||
if (!armyCount.TryAdd(entity.Info().Name, 1))
|
||||
{
|
||||
armyCount[entity.Info().Name]++;
|
||||
}
|
||||
|
||||
if (entity.Production() != null && entity.Production().BuildTime + entitiesAtTime.Key > LastInterval) {
|
||||
LastInterval = entity.Production().BuildTime + entitiesAtTime.Key;
|
||||
if (entity.Production() != null && entity.Production().BuildTime + entitiesAtTime.Key > lastInterval)
|
||||
{
|
||||
lastInterval = entity.Production().BuildTime + entitiesAtTime.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,27 +23,30 @@
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
IBuildOrderService BuildOrderService { get; set; }
|
||||
IBuildOrderService BuildOrderService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
IEconomyService EconomyService { get; set; }
|
||||
IEconomyService EconomyService { get; set; } = default!;
|
||||
|
||||
EconomyModel economy = new();
|
||||
int supplyGranted;
|
||||
int supplyTaken;
|
||||
int extraBuildings;
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
BuildOrderService.Subscribe(OnBuildOrderChanged);
|
||||
EconomyService.Subscribe(OnBuildOrderChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
BuildOrderService.Unsubscribe(OnBuildOrderChanged);
|
||||
EconomyService.Subscribe(OnBuildOrderChanged);
|
||||
}
|
||||
|
||||
void OnBuildOrderChanged() {
|
||||
void OnBuildOrderChanged()
|
||||
{
|
||||
economy = EconomyService.GetEconomy(BuildOrderService.GetLastRequestInterval());
|
||||
|
||||
var ordersOverTime = BuildOrderService.GetOrders();
|
||||
@@ -61,7 +64,8 @@
|
||||
select order.Supply().Grants).Sum();
|
||||
|
||||
extraBuildings = 0;
|
||||
if (supplyGranted > 160) {
|
||||
if (supplyGranted > 160)
|
||||
{
|
||||
extraBuildings = (supplyGranted - 160) / 16;
|
||||
supplyGranted = 160;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
@implements IDisposable
|
||||
@inject IBuildOrderService buildOrderService
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
<FormLayoutComponent>
|
||||
<FormTextAreaComponent Label="JSON Data"
|
||||
Rows="14"
|
||||
Value="@BuildOrderService.AsJson()">
|
||||
Value="@buildOrderService.AsJson()">
|
||||
</FormTextAreaComponent>
|
||||
</FormLayoutComponent>
|
||||
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
IBuildOrderService BuildOrderService { get; set; }
|
||||
|
||||
protected override void OnInitialized() {
|
||||
BuildOrderService.Subscribe(StateHasChanged);
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
buildOrderService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
BuildOrderService.Unsubscribe(StateHasChanged);
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
buildOrderService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
@implements IDisposable
|
||||
|
||||
<div class="chartsContainer">
|
||||
@foreach (var chart in charts) {
|
||||
@foreach (var chart in charts)
|
||||
{
|
||||
<div style="width: @chart.IntervalDisplayMax.ToString()px; height: @chart.ValueDisplayMax.ToString()px">
|
||||
<div style="position: relative; border: 2px solid gray; border-radius:2px; width: @chart.IntervalDisplayMax.ToString()px; height: @chart.ValueDisplayMax.ToString()px">
|
||||
@foreach (var point in chart.Points) {
|
||||
@foreach (var point in chart.Points)
|
||||
{
|
||||
<div style="position: absolute;
|
||||
bottom:@point.GetValue(chart.HighestValuePoint, chart.ValueDisplayMax)px;
|
||||
left:@point.GetInterval(chart.HighestIntervalPoint, chart.IntervalDisplayMax)px;
|
||||
@@ -51,10 +53,10 @@
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
IEconomyService EconomyService { get; set; }
|
||||
IEconomyService EconomyService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
IBuildOrderService BuildOrderService { get; set; }
|
||||
IBuildOrderService BuildOrderService { get; set; } = default!;
|
||||
|
||||
|
||||
int height = 100;
|
||||
@@ -70,43 +72,50 @@
|
||||
float highestPyrePoint;
|
||||
float highestArmyPoint;
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
EconomyService.Subscribe(GenerateChart);
|
||||
BuildOrderService.Subscribe(GenerateChart);
|
||||
|
||||
GenerateChart();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
EconomyService.Unsubscribe(GenerateChart);
|
||||
BuildOrderService.Unsubscribe(GenerateChart);
|
||||
}
|
||||
|
||||
void GenerateChart() {
|
||||
void GenerateChart()
|
||||
{
|
||||
var economyOverTime = EconomyService.GetOverTime();
|
||||
|
||||
charts.Clear();
|
||||
|
||||
var alloyChart = new ChartModel {
|
||||
var alloyChart = new ChartModel
|
||||
{
|
||||
IntervalDisplayMax = width,
|
||||
ValueDisplayMax = 100,
|
||||
ChartColor = "Cyan"
|
||||
};
|
||||
var etherChart = new ChartModel {
|
||||
var etherChart = new ChartModel
|
||||
{
|
||||
Offset = width,
|
||||
IntervalDisplayMax = width,
|
||||
ValueDisplayMax = 100,
|
||||
ChartColor = "LightGreen"
|
||||
};
|
||||
|
||||
var pyreChart = new ChartModel {
|
||||
var pyreChart = new ChartModel
|
||||
{
|
||||
Offset = width * 2,
|
||||
IntervalDisplayMax = width,
|
||||
ValueDisplayMax = 100,
|
||||
ChartColor = "Red"
|
||||
};
|
||||
|
||||
var armyChart = new ChartModel {
|
||||
var armyChart = new ChartModel
|
||||
{
|
||||
Offset = width * 3,
|
||||
IntervalDisplayMax = width,
|
||||
ValueDisplayMax = 100,
|
||||
@@ -118,13 +127,15 @@
|
||||
highestPyrePoint = 0;
|
||||
highestArmyPoint = 0;
|
||||
|
||||
for (var interval = 0; interval < economyOverTime.Count(); interval++) {
|
||||
for (var interval = 0; interval < economyOverTime.Count(); interval++)
|
||||
{
|
||||
var army = from unit in BuildOrderService.GetCompletedBefore(interval)
|
||||
where unit.EntityType == EntityType.Army
|
||||
select unit;
|
||||
|
||||
var armyValue = 0;
|
||||
foreach (var unit in army) {
|
||||
foreach (var unit in army)
|
||||
{
|
||||
armyValue += unit.Production().Alloy + unit.Production().Ether;
|
||||
}
|
||||
|
||||
@@ -135,7 +146,8 @@
|
||||
}
|
||||
|
||||
|
||||
for (var interval = 0; interval < economyOverTime.Count(); interval++) {
|
||||
for (var interval = 0; interval < economyOverTime.Count(); interval++)
|
||||
{
|
||||
var alloyPoint = new PointModel { Interval = interval };
|
||||
var etherPoint = new PointModel { Interval = interval };
|
||||
var pyrePoint = new PointModel { Interval = interval };
|
||||
@@ -167,26 +179,32 @@
|
||||
|
||||
float economySpending = 0;
|
||||
|
||||
foreach (var alloyAutoHarvester in alloyAutomaticHarvesters) {
|
||||
foreach (var alloyAutoHarvester in alloyAutomaticHarvesters)
|
||||
{
|
||||
autoAlloy += alloyAutoHarvester.Harvest().Slots * alloyAutoHarvester.Harvest().HarvestedPerInterval;
|
||||
var production = alloyAutoHarvester.Production();
|
||||
if (production != null) {
|
||||
if (production != null)
|
||||
{
|
||||
economySpending += production.Alloy;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var alloyWorkerHarvester in alloyWorkerHarvesters) {
|
||||
foreach (var alloyWorkerHarvester in alloyWorkerHarvesters)
|
||||
{
|
||||
workerSlots += alloyWorkerHarvester.Harvest().Slots;
|
||||
var production = alloyWorkerHarvester.Production();
|
||||
if (production != null) {
|
||||
if (production != null)
|
||||
{
|
||||
economySpending += production.Alloy;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var etherWorkerHarvester in etherAutomaticHarvesters) {
|
||||
foreach (var etherWorkerHarvester in etherAutomaticHarvesters)
|
||||
{
|
||||
autoEther += etherWorkerHarvester.Harvest().Slots * etherWorkerHarvester.Harvest().HarvestedPerInterval;
|
||||
var production = etherWorkerHarvester.Production();
|
||||
if (production != null) {
|
||||
if (production != null)
|
||||
{
|
||||
economySpending += production.Alloy;
|
||||
}
|
||||
}
|
||||
@@ -200,7 +218,8 @@
|
||||
etherPoint.Value = autoEther;
|
||||
|
||||
|
||||
if (interval > 0) {
|
||||
if (interval > 0)
|
||||
{
|
||||
alloyPoint.TempValue += alloyChart.Points.Last().TempValue;
|
||||
etherPoint.Value += etherChart.Points.Last().Value;
|
||||
pyrePoint.Value = pyreChart.Points.Last().Value + 1;
|
||||
|
||||
@@ -1,35 +1,39 @@
|
||||
@implements IDisposable
|
||||
|
||||
<div style="overflow-y: scroll; width: 100%; overflow-x: hidden; height: 550px;">
|
||||
@if (Entity != null) {
|
||||
@if (entity != null)
|
||||
{
|
||||
<EntityViewComponent Entity=Entity></EntityViewComponent>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
EntityModel Entity;
|
||||
private EntityModel entity = default!;
|
||||
|
||||
[Inject]
|
||||
IKeyService KeyService { get; set; }
|
||||
IKeyService KeyService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
IImmortalSelectionService FilterService { get; set; }
|
||||
IImmortalSelectionService FilterService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
IBuildOrderService BuildOrderService { get; set; }
|
||||
IBuildOrderService BuildOrderService { get; set; } = default!;
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
KeyService.Subscribe(HandleClick);
|
||||
BuildOrderService.Subscribe(OnBuildOrderChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
KeyService.Unsubscribe(HandleClick);
|
||||
BuildOrderService.Unsubscribe(OnBuildOrderChanged);
|
||||
}
|
||||
|
||||
|
||||
protected void HandleClick() {
|
||||
protected void HandleClick()
|
||||
{
|
||||
var hotkey = KeyService.GetHotkey();
|
||||
var hotkeyGroup = KeyService.GetHotkeyGroup();
|
||||
var isHoldSpace = KeyService.IsHoldingSpace();
|
||||
@@ -38,13 +42,15 @@
|
||||
|
||||
var foundEntity = EntityModel.GetFrom(hotkey, hotkeyGroup, isHoldSpace, faction, immortal);
|
||||
|
||||
if (foundEntity != null) {
|
||||
Entity = foundEntity;
|
||||
if (foundEntity != null)
|
||||
{
|
||||
entity = foundEntity;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void OnBuildOrderChanged() {
|
||||
void OnBuildOrderChanged()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
<FormSelectComponent OnChange="@OnImmortalChanged">
|
||||
<FormLabelComponent>Immortal</FormLabelComponent>
|
||||
<ChildContent>
|
||||
@if (FilterService.GetFactionType() == FactionType.QRath) {
|
||||
@if (FilterService.GetFactionType() == FactionType.QRath)
|
||||
{
|
||||
<option value="@ImmortalType.Orzum" selected>Orzum</option>
|
||||
<option value="@ImmortalType.Ajari">Ajari</option>
|
||||
}
|
||||
@if (FilterService.GetFactionType() == FactionType.Aru) {
|
||||
@if (FilterService.GetFactionType() == FactionType.Aru)
|
||||
{
|
||||
<option value="@ImmortalType.Mala" selected>Mala</option>
|
||||
<option value="@ImmortalType.Xol">Xol</option>
|
||||
}
|
||||
@@ -25,14 +27,16 @@
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
public IImmortalSelectionService FilterService { get; set; }
|
||||
public IImmortalSelectionService FilterService { get; set; } = default!;
|
||||
|
||||
void OnFactionChanged(ChangeEventArgs e) {
|
||||
FilterService.SelectFactionType(e.Value.ToString());
|
||||
void OnFactionChanged(ChangeEventArgs e)
|
||||
{
|
||||
FilterService.SelectFactionType(e.Value!.ToString()!);
|
||||
}
|
||||
|
||||
void OnImmortalChanged(ChangeEventArgs e) {
|
||||
FilterService.SelectImmortalType(e.Value.ToString());
|
||||
void OnImmortalChanged(ChangeEventArgs e)
|
||||
{
|
||||
FilterService.SelectImmortalType(e.Value!.ToString()!);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,9 +4,12 @@
|
||||
<div>
|
||||
<div>Requested</div>
|
||||
|
||||
@for (var i = TimingService.GetTiming() - 1; i >= 0; i--) {
|
||||
@foreach (var order in BuildOrderService.GetOrdersAt(i)) {
|
||||
if (order.EntityType == EntityType.Worker) {
|
||||
@for (var i = TimingService.GetTiming() - 1; i >= 0; i--)
|
||||
{
|
||||
@foreach (var order in BuildOrderService.GetOrdersAt(i))
|
||||
{
|
||||
if (order.EntityType == EntityType.Worker)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
<div>
|
||||
@@ -22,9 +25,12 @@
|
||||
<div>
|
||||
<div>Finished</div>
|
||||
|
||||
@for (var i = TimingService.GetTiming() - 1; i >= 0; i--) {
|
||||
@foreach (var order in BuildOrderService.GetCompletedAt(i)) {
|
||||
if (order.EntityType == EntityType.Worker) {
|
||||
@for (var i = TimingService.GetTiming() - 1; i >= 0; i--)
|
||||
{
|
||||
@foreach (var order in BuildOrderService.GetCompletedAt(i))
|
||||
{
|
||||
if (order.EntityType == EntityType.Worker)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
<div>
|
||||
@@ -54,20 +60,22 @@
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
IEconomyService EconomyService { get; set; }
|
||||
IEconomyService EconomyService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
IBuildOrderService BuildOrderService { get; set; }
|
||||
IBuildOrderService BuildOrderService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
ITimingService TimingService { get; set; }
|
||||
ITimingService TimingService { get; set; } = default!;
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
EconomyService.Subscribe(StateHasChanged);
|
||||
BuildOrderService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
EconomyService.Unsubscribe(StateHasChanged);
|
||||
BuildOrderService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
<InputPanelComponent>
|
||||
<div class="keyContainer">
|
||||
@foreach (var hotkey in hotkeys) {
|
||||
if (hotkey.IsHidden) {
|
||||
@foreach (var hotkey in hotkeys)
|
||||
{
|
||||
if (hotkey.IsHidden)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -14,14 +16,17 @@
|
||||
var y = hotkey.PositionY * Size;
|
||||
|
||||
var border = "1px solid black";
|
||||
if (hotkey.KeyText.Equals(_key)) {
|
||||
if (hotkey.KeyText.Equals(_key))
|
||||
{
|
||||
border = "5px solid black";
|
||||
}
|
||||
if (hotkey.KeyText.Equals(_controlGroup)) {
|
||||
if (hotkey.KeyText.Equals(_controlGroup))
|
||||
{
|
||||
border = "5px solid green";
|
||||
}
|
||||
|
||||
if (hotkey.KeyText.Equals("SPACE") && KeyService.IsHoldingSpace()) {
|
||||
if (hotkey.KeyText.Equals("SPACE") && KeyService.IsHoldingSpace())
|
||||
{
|
||||
border = "5px solid green";
|
||||
}
|
||||
|
||||
@@ -39,16 +44,20 @@
|
||||
overflow: hidden;
|
||||
padding: 4px;">
|
||||
@hotkey.KeyText
|
||||
@foreach (var entity in data.Values) {
|
||||
if (!BuildOrderService.MeetsRequirements(entity, 9000)) {
|
||||
@foreach (var entity in data.Values)
|
||||
{
|
||||
if (!BuildOrderService.MeetsRequirements(entity, 9000))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (InvalidKey(entity, hotkey) || InvalidKeyGroup(entity, hotkey) || InvalidHoldSpace(entity)) {
|
||||
if (InvalidKey(entity, hotkey) || InvalidKeyGroup(entity, hotkey) || InvalidHoldSpace(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (InvalidFaction(entity) || InvalidVanguard(entity) || InvalidNonVanguard(entity)) {
|
||||
if (InvalidFaction(entity) || InvalidVanguard(entity) || InvalidNonVanguard(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -77,7 +86,7 @@
|
||||
@@media only screen and (max-width: 1025px) {
|
||||
.keyContainer {
|
||||
transform: scale(0.85) translateX(-20px);
|
||||
background-color: none;
|
||||
background-color: transparent;
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
@@ -89,13 +98,13 @@
|
||||
public int Size { get; set; } = 100;
|
||||
|
||||
[Inject]
|
||||
public IKeyService KeyService { get; set; }
|
||||
public IKeyService KeyService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
public IBuildOrderService BuildOrderService { get; set; }
|
||||
public IBuildOrderService BuildOrderService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
public IImmortalSelectionService FilterService { get; set; }
|
||||
public IImmortalSelectionService FilterService { get; set; } = default!;
|
||||
|
||||
readonly Dictionary<string, EntityModel> data = EntityModel.GetDictionary();
|
||||
readonly List<HotkeyModel> hotkeys = HotkeyModel.GetAll();
|
||||
@@ -103,21 +112,25 @@
|
||||
public string _controlGroup = "C";
|
||||
public string _key = "";
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
|
||||
KeyService.Subscribe(OnKeyPressed);
|
||||
FilterService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
KeyService.Unsubscribe(OnKeyPressed);
|
||||
FilterService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
// Move to Filter Service
|
||||
bool InvalidFaction(EntityModel entity) {
|
||||
if (entity.Faction() != null && entity.Faction()?.Faction != FilterService.GetFactionType() && FilterService.GetFactionType() != FactionType.Any) {
|
||||
bool InvalidFaction(EntityModel entity)
|
||||
{
|
||||
if (entity.Faction() != null && entity.Faction()?.Faction != FilterService.GetFactionType() && FilterService.GetFactionType() != FactionType.Any)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -125,8 +138,10 @@
|
||||
}
|
||||
|
||||
// Move to Filter Service
|
||||
bool InvalidVanguard(EntityModel entity) {
|
||||
if (entity.VanguardAdded() != null && entity.VanguardAdded()?.ImmortalId != FilterService.GetImmortalType() && FilterService.GetImmortalType() != ImmortalType.Any) {
|
||||
bool InvalidVanguard(EntityModel entity)
|
||||
{
|
||||
if (entity.VanguardAdded() != null && entity.VanguardAdded()?.ImmortalId != FilterService.GetImmortalType() && FilterService.GetImmortalType() != ImmortalType.Any)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -134,16 +149,21 @@
|
||||
}
|
||||
|
||||
// Move to Filter Service
|
||||
bool InvalidNonVanguard(EntityModel entity) {
|
||||
if (entity.Replaceds().Count > 0) {
|
||||
bool InvalidNonVanguard(EntityModel entity)
|
||||
{
|
||||
if (entity.Replaceds().Count > 0)
|
||||
{
|
||||
var isReplaced = false;
|
||||
foreach (var replaced in entity.Replaceds()) {
|
||||
if (FilterService.GetImmortalType() == replaced.ImmortalId) {
|
||||
foreach (var replaced in entity.Replaceds())
|
||||
{
|
||||
if (FilterService.GetImmortalType() == replaced.ImmortalId)
|
||||
{
|
||||
isReplaced = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isReplaced) {
|
||||
if (isReplaced)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -151,75 +171,96 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InvalidRequirements(EntityModel entity) {
|
||||
bool InvalidRequirements(EntityModel entity)
|
||||
{
|
||||
return !BuildOrderService.MeetsRequirements(entity, 9000);
|
||||
}
|
||||
|
||||
bool InvalidKey(EntityModel entity, HotkeyModel key) {
|
||||
if (entity.Hotkey()?.Hotkey == key.KeyText) {
|
||||
bool InvalidKey(EntityModel entity, HotkeyModel key)
|
||||
{
|
||||
if (entity.Hotkey()?.Hotkey == key.KeyText)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InvalidKeyGroup(EntityModel entity, HotkeyModel key) {
|
||||
if (entity.Hotkey()?.HotkeyGroup == _controlGroup) {
|
||||
bool InvalidKeyGroup(EntityModel entity, HotkeyModel key)
|
||||
{
|
||||
if (entity.Hotkey()?.HotkeyGroup == _controlGroup)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InvalidKey(EntityModel entity) {
|
||||
if (entity.Hotkey()?.Hotkey == _key) {
|
||||
bool InvalidKey(EntityModel entity)
|
||||
{
|
||||
if (entity.Hotkey()?.Hotkey == _key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InvalidKeyGroup(EntityModel entity) {
|
||||
if (entity.Hotkey()?.HotkeyGroup == _controlGroup) {
|
||||
bool InvalidKeyGroup(EntityModel entity)
|
||||
{
|
||||
if (entity.Hotkey()?.HotkeyGroup == _controlGroup)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InvalidHoldSpace(EntityModel entity) {
|
||||
if (entity.Hotkey()?.HoldSpace == KeyService.IsHoldingSpace()) {
|
||||
bool InvalidHoldSpace(EntityModel entity)
|
||||
{
|
||||
if (entity.Hotkey()?.HoldSpace == KeyService.IsHoldingSpace())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnKeyPressed() {
|
||||
if (KeyService.GetAllPressedKeys().Contains("Z")) {
|
||||
void OnKeyPressed()
|
||||
{
|
||||
if (KeyService.GetAllPressedKeys().Contains("Z"))
|
||||
{
|
||||
_controlGroup = "Z";
|
||||
}
|
||||
if (KeyService.GetAllPressedKeys().Contains("TAB")) {
|
||||
if (KeyService.GetAllPressedKeys().Contains("TAB"))
|
||||
{
|
||||
_controlGroup = "TAB";
|
||||
}
|
||||
if (KeyService.GetAllPressedKeys().Contains("C")) {
|
||||
if (KeyService.GetAllPressedKeys().Contains("C"))
|
||||
{
|
||||
_controlGroup = "C";
|
||||
}
|
||||
if (KeyService.GetAllPressedKeys().Contains("D")) {
|
||||
if (KeyService.GetAllPressedKeys().Contains("D"))
|
||||
{
|
||||
_controlGroup = "D";
|
||||
}
|
||||
if (KeyService.GetAllPressedKeys().Contains("1")) {
|
||||
if (KeyService.GetAllPressedKeys().Contains("1"))
|
||||
{
|
||||
_controlGroup = "1";
|
||||
}
|
||||
//TODO This could be better. Duplicated code
|
||||
if (KeyService.GetAllPressedKeys().Contains("2")) {
|
||||
if (KeyService.GetAllPressedKeys().Contains("2"))
|
||||
{
|
||||
_controlGroup = "2";
|
||||
}
|
||||
if (KeyService.GetAllPressedKeys().Contains("SHIFT")) {
|
||||
if (KeyService.GetAllPressedKeys().Contains("SHIFT"))
|
||||
{
|
||||
_controlGroup = "SHIFT";
|
||||
}
|
||||
|
||||
if (KeyService.GetAllPressedKeys().Contains("CONTROL")) {
|
||||
if (KeyService.GetAllPressedKeys().Contains("CONTROL"))
|
||||
{
|
||||
_controlGroup = "CONTROL";
|
||||
}
|
||||
|
||||
if (KeyService.GetAllPressedKeys().Count > 0) {
|
||||
if (KeyService.GetAllPressedKeys().Count > 0)
|
||||
{
|
||||
_key = KeyService.GetAllPressedKeys().First();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,16 +10,18 @@
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
public RenderFragment ChildContent { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
public IKeyService KeyService { get; set; }
|
||||
public IKeyService KeyService { get; set; } = default!;
|
||||
|
||||
private void HandleKeyDown(KeyboardEventArgs e) {
|
||||
private void HandleKeyDown(KeyboardEventArgs e)
|
||||
{
|
||||
KeyService.AddPressedKey(e.Key);
|
||||
}
|
||||
|
||||
private void HandleKeyUp(KeyboardEventArgs e) {
|
||||
private void HandleKeyUp(KeyboardEventArgs e)
|
||||
{
|
||||
KeyService.RemovePressedKey(e.Key);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
<br/>
|
||||
</div>
|
||||
<div>
|
||||
@foreach (var order in BuildOrderService.GetOrdersAt(economyAtSecond.Interval)) {
|
||||
@foreach (var order in BuildOrderService.GetOrdersAt(economyAtSecond.Interval))
|
||||
{
|
||||
<div>
|
||||
Requested: @order.Info().Name
|
||||
</div>
|
||||
}
|
||||
@foreach (var order in BuildOrderService.GetCompletedAt(economyAtSecond.Interval)) {
|
||||
@foreach (var order in BuildOrderService.GetCompletedAt(economyAtSecond.Interval))
|
||||
{
|
||||
<div>
|
||||
New: @order.Info().Name
|
||||
</div>
|
||||
@@ -42,17 +44,19 @@
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
IEconomyService EconomyService { get; set; }
|
||||
IEconomyService EconomyService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
IBuildOrderService BuildOrderService { get; set; }
|
||||
IBuildOrderService BuildOrderService { get; set; } = default!;
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
EconomyService.Subscribe(StateHasChanged);
|
||||
BuildOrderService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
EconomyService.Unsubscribe(StateHasChanged);
|
||||
BuildOrderService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
@@ -20,31 +20,36 @@
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
public ITimingService TimingService { get; set; }
|
||||
public ITimingService TimingService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
public IBuildOrderService BuildOrderService { get; set; }
|
||||
public IBuildOrderService BuildOrderService { get; set; } = default!;
|
||||
|
||||
|
||||
void OnTimingChanged(ChangeEventArgs changeEventArgs) {
|
||||
TimingService.SetTiming(int.Parse(changeEventArgs.Value.ToString()));
|
||||
void OnTimingChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
TimingService.SetTiming(int.Parse(changeEventArgs.Value!.ToString()!));
|
||||
}
|
||||
|
||||
void OnTimingChanged(int value) {
|
||||
void OnTimingChanged(int value)
|
||||
{
|
||||
TimingService.SetTiming(value);
|
||||
}
|
||||
|
||||
void OnNameChanged(ChangeEventArgs changeEventArgs) {
|
||||
BuildOrderService.SetName(changeEventArgs.Value.ToString());
|
||||
void OnNameChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
BuildOrderService.SetName(changeEventArgs.Value!.ToString()!);
|
||||
}
|
||||
|
||||
void OnColorChanged(ChangeEventArgs changeEventArgs) {
|
||||
BuildOrderService.SetColor(changeEventArgs.Value.ToString());
|
||||
void OnColorChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
BuildOrderService.SetColor(changeEventArgs.Value!.ToString()!);
|
||||
}
|
||||
|
||||
|
||||
void OnNotesChanged(ChangeEventArgs changeEventArgs) {
|
||||
BuildOrderService.SetNotes(changeEventArgs.Value.ToString());
|
||||
void OnNotesChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
BuildOrderService.SetNotes(changeEventArgs.Value!.ToString()!);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user