configurable and self-documenting BuildPaletteWidgetName
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#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
|
* 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
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -17,21 +17,25 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class ChooseBuildTabOnSelectInfo : ITraitInfo
|
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
|
class ChooseBuildTabOnSelect : INotifySelection
|
||||||
{
|
{
|
||||||
readonly World world;
|
readonly World world;
|
||||||
|
readonly ChooseBuildTabOnSelectInfo info;
|
||||||
|
|
||||||
public ChooseBuildTabOnSelect(ActorInitializer init)
|
public ChooseBuildTabOnSelect(ActorInitializer init, ChooseBuildTabOnSelectInfo info)
|
||||||
{
|
{
|
||||||
world = init.world;
|
world = init.world;
|
||||||
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectionChanged()
|
public void SelectionChanged()
|
||||||
{
|
{
|
||||||
var palette = Ui.Root.GetOrNull<BuildPaletteWidget>("INGAME_BUILD_PALETTE");
|
var palette = Ui.Root.GetOrNull<BuildPaletteWidget>(info.BuildPaletteWidgetName);
|
||||||
if (palette == null)
|
if (palette == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user