Add LogicKeyListenerWidget for binding keys to UI logic.

This commit is contained in:
Paul Chote
2014-03-22 22:20:51 +13:00
parent 2c8fc4603a
commit 8beb9ffc57
2 changed files with 26 additions and 0 deletions

View File

@@ -489,6 +489,7 @@
<Compile Include="Widgets\Logic\LobbyMapPreviewLogic.cs" />
<Compile Include="Widgets\Logic\ButtonTooltipLogic.cs" />
<Compile Include="Orders\BeaconOrderGenerator.cs" />
<Compile Include="Widgets\LogicKeyListenerWidget.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -0,0 +1,25 @@
#region Copyright & License Information
/*
* 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,
* see COPYING.
*/
#endregion
using System;
using OpenRA.Widgets;
namespace OpenRA.Mods.RA.Widgets
{
public class LogicKeyListenerWidget : Widget
{
public Func<KeyInput, bool> OnKeyPress = _ => false;
public override bool HandleKeyPress(KeyInput e)
{
return OnKeyPress(e);
}
}
}