-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fe13fe
commit 88bd693
Showing
7 changed files
with
188 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/EditorMoveActorHotkeyLogic.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#region Copyright & License Information | ||
/* | ||
* Copyright (c) The OpenRA Developers and Contributors | ||
* 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.Widgets; | ||
|
||
namespace OpenRA.Mods.Common.Widgets.Logic.Ingame | ||
{ | ||
public class EditorMoveActorHotkeyLogic : ChromeLogic | ||
{ | ||
EditorViewportControllerWidget editor; | ||
|
||
[ObjectCreator.UseCtor] | ||
public EditorMoveActorHotkeyLogic(Widget widget, ModData modData, Dictionary<string, MiniYaml> logicArgs) | ||
{ | ||
var keyhandler = widget.Get<LogicKeyListenerWidget>("GLOBAL_KEYHANDLER"); | ||
keyhandler.AddHandler(e => | ||
{ | ||
// Hotkeys do not support only a modifier key; actor move override key will have to be hardcoded for now | ||
if (e.Key != Keycode.LSHIFT) | ||
return false; | ||
if (editor == null) | ||
{ | ||
var worldRoot = Ui.Root.Get<ContainerWidget>("EDITOR_WORLD_ROOT"); | ||
editor = worldRoot.Get<EditorViewportControllerWidget>("MAP_EDITOR"); | ||
} | ||
editor.DefaultBrush.ActorFreeMove = e.Event == KeyInputEvent.Down; | ||
return false; | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters