rationalize queue cycling
This commit is contained in:
@@ -377,11 +377,9 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
{
|
{
|
||||||
Sound.Play(CurrentQueue.Info.CancelledAudio);
|
Sound.Play(CurrentQueue.Info.CancelledAudio);
|
||||||
int numberToCancel = Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1;
|
int numberToCancel = Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1;
|
||||||
if (Game.GetModifierKeys().HasModifier(Modifiers.Shift) &&
|
|
||||||
Game.GetModifierKeys().HasModifier(Modifiers.Ctrl))
|
if (Game.GetModifierKeys().HasModifier(Modifiers.Shift | Modifiers.Ctrl))
|
||||||
{
|
|
||||||
numberToCancel = -1; //cancel all
|
numberToCancel = -1; //cancel all
|
||||||
}
|
|
||||||
world.IssueOrder(Order.CancelProduction(CurrentQueue.self, item, numberToCancel));
|
world.IssueOrder(Order.CancelProduction(CurrentQueue.self, item, numberToCancel));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -518,25 +516,12 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
|
|
||||||
void TabChange(bool shift)
|
void TabChange(bool shift)
|
||||||
{
|
{
|
||||||
int size = VisibleQueues.Count();
|
var queues = VisibleQueues.Concat(VisibleQueues);
|
||||||
if (size > 0)
|
if (shift) queues.Reverse();
|
||||||
{
|
var nextQueue = queues.SkipWhile( q => q != CurrentQueue )
|
||||||
int current = VisibleQueues.IndexOf(CurrentQueue);
|
.ElementAtOrDefault(1);
|
||||||
if (!shift)
|
if (nextQueue != null)
|
||||||
{
|
SetCurrentTab( nextQueue );
|
||||||
if (current + 1 >= size)
|
|
||||||
SetCurrentTab(VisibleQueues.FirstOrDefault());
|
|
||||||
else
|
|
||||||
SetCurrentTab(VisibleQueues[current + 1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (current - 1 < 0)
|
|
||||||
SetCurrentTab(VisibleQueues.LastOrDefault());
|
|
||||||
else
|
|
||||||
SetCurrentTab(VisibleQueues[current - 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user