Cleanup
This commit is contained in:
@@ -343,34 +343,32 @@
|
||||
{
|
||||
var hotkey = KeyService.GetHotkey();
|
||||
|
||||
if (hotkey == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(hotkey is "`")
|
||||
HandleCancelEntity();
|
||||
|
||||
if (hotkey == "`")
|
||||
{
|
||||
BuildOrderService.RemoveLast();
|
||||
if (EntityFromKey(hotkey, out var entity))
|
||||
return;
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user