Use pattern matching syntax in AddFactionSuffixLogic
This commit is contained in:
committed by
abcdefg30
parent
64e76e1a90
commit
9687988976
@@ -23,16 +23,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
faction = world.LocalPlayer.Faction.InternalName;
|
faction = world.LocalPlayer.Faction.InternalName;
|
||||||
var suffix = "-" + faction;
|
var suffix = "-" + faction;
|
||||||
|
|
||||||
if (widget is ButtonWidget)
|
if (widget is ButtonWidget bw)
|
||||||
((ButtonWidget)widget).Background += suffix;
|
bw.Background += suffix;
|
||||||
else if (widget is ImageWidget)
|
else if (widget is ImageWidget iw)
|
||||||
((ImageWidget)widget).ImageCollection += suffix;
|
iw.ImageCollection += suffix;
|
||||||
else if (widget is BackgroundWidget)
|
else if (widget is BackgroundWidget bgw)
|
||||||
((BackgroundWidget)widget).Background += suffix;
|
bgw.Background += suffix;
|
||||||
else if (widget is ProductionTabsWidget)
|
else if (widget is ProductionTabsWidget ptw)
|
||||||
{
|
{
|
||||||
((ProductionTabsWidget)widget).Button += suffix;
|
ptw.Button += suffix;
|
||||||
((ProductionTabsWidget)widget).Background += suffix;
|
ptw.Background += suffix;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new InvalidOperationException("AddFactionSuffixLogic only supports ButtonWidget, ImageWidget, BackgroundWidget and ProductionTabsWidget");
|
throw new InvalidOperationException("AddFactionSuffixLogic only supports ButtonWidget, ImageWidget, BackgroundWidget and ProductionTabsWidget");
|
||||||
|
|||||||
Reference in New Issue
Block a user