From f4987f72580473be221e0e3c285ac19650c32271 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 22 Feb 2015 15:22:55 +0000 Subject: [PATCH] Add support for multiple logic objects on a widget. --- OpenRA.Game/Widgets/Widget.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 8723bae336..39bd0e3415 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -143,8 +143,8 @@ namespace OpenRA.Widgets public string Y = "0"; public string Width = "0"; public string Height = "0"; - public string Logic = null; - public object LogicObject { get; private set; } + public string[] Logic = { }; + public object[] LogicObjects { get; private set; } public bool Visible = true; public bool IgnoreMouseOver; public bool IgnoreChildMouseOver; @@ -232,12 +232,13 @@ namespace OpenRA.Widgets public void PostInit(WidgetArgs args) { - if (Logic == null) + if (!Logic.Any()) return; args["widget"] = this; - LogicObject = Game.ModData.ObjectCreator.CreateObject(Logic, args); + LogicObjects = Logic.Select(l => Game.ModData.ObjectCreator.CreateObject(l, args)) + .ToArray(); args.Remove("widget"); }