|
|
|
|
@ -343,34 +343,32 @@
|
|
|
|
|
{ |
|
|
|
|
var hotkey = KeyService.GetHotkey(); |
|
|
|
|
|
|
|
|
|
if (hotkey == "") |
|
|
|
|
{ |
|
|
|
|
if(hotkey is "`") |
|
|
|
|
HandleCancelEntity(); |
|
|
|
|
|
|
|
|
|
if (EntityFromKey(hotkey, out var entity)) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (hotkey == "`") |
|
|
|
|
{ |
|
|
|
|
BuildOrderService.RemoveLast(); |
|
|
|
|
if (BuildOrderService.Add(entity!, EconomyService)) |
|
|
|
|
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void HandleCancelEntity() |
|
|
|
|
{ |
|
|
|
|
BuildOrderService.RemoveLast(); |
|
|
|
|
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private bool EntityFromKey(string? hotkey, out EntityModel? entity) |
|
|
|
|
{ |
|
|
|
|
var hotkeyGroup = KeyService.GetHotkeyGroup(); |
|
|
|
|
var isHoldSpace = KeyService.IsHoldingSpace(); |
|
|
|
|
var faction = FilterService.GetFaction(); |
|
|
|
|
var immortal = FilterService.GetImmortal(); |
|
|
|
|
|
|
|
|
|
var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal); |
|
|
|
|
entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal); |
|
|
|
|
|
|
|
|
|
if (entity == null) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (BuildOrderService.Add(entity, EconomyService)) |
|
|
|
|
{ |
|
|
|
|
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval()); |
|
|
|
|
} |
|
|
|
|
return entity == null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void ButtonClicked(MouseEventArgs mouseEventArgs, HotkeyModel hotkey) |
|
|
|
|
|