From ea478e8e7f5eb365ae6a81e7207cd6a7968e9b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 20 Jul 2014 13:54:29 +0200 Subject: [PATCH] configurable and self-documenting BuildPaletteWidgetName --- OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs b/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs index 8c95e2e5e6..6962ceba73 100644 --- a/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs +++ b/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, @@ -17,21 +17,25 @@ namespace OpenRA.Mods.RA { class ChooseBuildTabOnSelectInfo : ITraitInfo { - public object Create(ActorInitializer init) { return new ChooseBuildTabOnSelect(init); } + public readonly string BuildPaletteWidgetName = "INGAME_BUILD_PALETTE"; + + public object Create(ActorInitializer init) { return new ChooseBuildTabOnSelect(init, this); } } class ChooseBuildTabOnSelect : INotifySelection { readonly World world; + readonly ChooseBuildTabOnSelectInfo info; - public ChooseBuildTabOnSelect(ActorInitializer init) + public ChooseBuildTabOnSelect(ActorInitializer init, ChooseBuildTabOnSelectInfo info) { world = init.world; + this.info = info; } public void SelectionChanged() { - var palette = Ui.Root.GetOrNull("INGAME_BUILD_PALETTE"); + var palette = Ui.Root.GetOrNull(info.BuildPaletteWidgetName); if (palette == null) return;