Pushed down the MouseInput handling to the OrderGenerators and made a base class for handling the basic logic

This commit is contained in:
teinarss
2019-03-30 20:07:11 +01:00
committed by reaperrr
parent 9ec8d25dff
commit 1dd90a1d7b
13 changed files with 120 additions and 77 deletions

View File

@@ -82,6 +82,14 @@ namespace OpenRA.Mods.Common.Widgets
var multiClick = mi.MultiTapCount >= 2;
if (!(World.OrderGenerator is UnitOrderGenerator))
{
ApplyOrders(World, mi);
isDragging = false;
YieldMouseFocus(mi);
return true;
}
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down)
{
if (!TakeMouseFocus(mi))
@@ -89,15 +97,6 @@ namespace OpenRA.Mods.Common.Widgets
dragStart = mousePos;
isDragging = true;
// Place buildings, use support powers, and other non-unit things
if (!(World.OrderGenerator is UnitOrderGenerator))
{
ApplyOrders(World, mi);
isDragging = false;
YieldMouseFocus(mi);
return true;
}
}
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up)