Move hardcoded screenshot hotkey into yaml.

This commit is contained in:
Paul Chote
2017-09-03 18:02:52 +00:00
committed by reaperrr
parent 8c4afa414a
commit c759a68492
11 changed files with 53 additions and 16 deletions

View File

@@ -822,6 +822,7 @@
<Compile Include="Lint\CheckChromeHotkeys.cs" />
<Compile Include="UtilityCommands\LintInterfaces.cs" />
<Compile Include="Widgets\Logic\SingleHotkeyBaseLogic.cs" />
<Compile Include="Widgets\Logic\ScreenshotHotkeyLogic.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild">

View File

@@ -0,0 +1,31 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Collections.Generic;
using OpenRA.Mods.Common.Lint;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
{
[ChromeLogicArgsHotkeys("TakeScreenshotKey")]
public class ScreenshotHotkeyLogic : SingleHotkeyBaseLogic
{
[ObjectCreator.UseCtor]
public ScreenshotHotkeyLogic(Widget widget, Dictionary<string, MiniYaml> logicArgs)
: base(widget, "TakeScreenshotKey", "GLOBAL_KEYHANDLER", logicArgs) { }
protected override bool OnHotkeyActivated(KeyInput e)
{
Game.TakeScreenshot();
return true;
}
}
}