Rework global music hotkey bindings.
This commit is contained in:
@@ -559,7 +559,7 @@
|
|||||||
<Compile Include="UtilityCommands\ExtractZeroBraneStudioLuaAPI.cs" />
|
<Compile Include="UtilityCommands\ExtractZeroBraneStudioLuaAPI.cs" />
|
||||||
<Compile Include="UtilityCommands\ExtractTraitDocsCommand.cs" />
|
<Compile Include="UtilityCommands\ExtractTraitDocsCommand.cs" />
|
||||||
<Compile Include="UtilityCommands\ExtractWeaponDocsCommand.cs" />
|
<Compile Include="UtilityCommands\ExtractWeaponDocsCommand.cs" />
|
||||||
<Compile Include="Widgets\Logic\Ingame\MusicControllerLogic.cs" />
|
<Compile Include="Widgets\Logic\MusicHotkeyLogic.cs" />
|
||||||
<Compile Include="WorldExtensions.cs" />
|
<Compile Include="WorldExtensions.cs" />
|
||||||
<Compile Include="UtilityCommands\GetMapHashCommand.cs" />
|
<Compile Include="UtilityCommands\GetMapHashCommand.cs" />
|
||||||
<Compile Include="UtilityCommands\Glob.cs" />
|
<Compile Include="UtilityCommands\Glob.cs" />
|
||||||
|
|||||||
@@ -10,22 +10,19 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.GameRules;
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
using OpenRA.Mods.Common.Lint;
|
using OpenRA.Mods.Common.Lint;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||||
{
|
{
|
||||||
[ChromeLogicArgsHotkeys("StopMusicKey", "PauseMusicKey", "PrevMusicKey", "NextMusicKey")]
|
[ChromeLogicArgsHotkeys("StopMusicKey", "PauseMusicKey", "PrevMusicKey", "NextMusicKey")]
|
||||||
public class MusicControllerLogic : ChromeLogic
|
public class MusicHotkeyLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
readonly MusicPlaylist musicPlaylist;
|
readonly MusicPlaylist musicPlaylist;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MusicControllerLogic(Widget widget, World world, Dictionary<string, MiniYaml> logicArgs)
|
public MusicHotkeyLogic(Widget widget, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||||
{
|
{
|
||||||
musicPlaylist = world.WorldActor.Trait<MusicPlaylist>();
|
musicPlaylist = world.WorldActor.Trait<MusicPlaylist>();
|
||||||
|
|
||||||
@@ -48,8 +45,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
if (logicArgs.TryGetValue("NextMusicKey", out yaml))
|
if (logicArgs.TryGetValue("NextMusicKey", out yaml))
|
||||||
nextKey = new NamedHotkey(yaml.Value, ks);
|
nextKey = new NamedHotkey(yaml.Value, ks);
|
||||||
|
|
||||||
var keyhandler = widget.Get<LogicKeyListenerWidget>("MUSICCONTROLLER_KEYHANDLER");
|
var keyhandler = widget.Get<LogicKeyListenerWidget>("GLOBAL_KEYHANDLER");
|
||||||
keyhandler.OnKeyPress = e =>
|
keyhandler.OnKeyPress += e =>
|
||||||
{
|
{
|
||||||
if (e.Event == KeyInputEvent.Down)
|
if (e.Event == KeyInputEvent.Down)
|
||||||
{
|
{
|
||||||
@@ -5,14 +5,6 @@ Container@NEW_MAP_BG:
|
|||||||
Width: 300
|
Width: 300
|
||||||
Height: 125
|
Height: 125
|
||||||
Children:
|
Children:
|
||||||
Container@MUSICBUTTONS:
|
|
||||||
Logic: MusicControllerLogic
|
|
||||||
StopMusicKey: StopMusic
|
|
||||||
PauseMusicKey: PauseMusic
|
|
||||||
PrevMusicKey: PrevMusic
|
|
||||||
NextMusicKey: NextMusic
|
|
||||||
Children:
|
|
||||||
LogicKeyListener@MUSICCONTROLLER_KEYHANDLER:
|
|
||||||
Label@TITLE:
|
Label@TITLE:
|
||||||
Text: New Map
|
Text: New Map
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
@@ -199,6 +191,12 @@ ScrollPanel@MAP_SAVE_VISIBILITY_PANEL:
|
|||||||
Container@EDITOR_ROOT:
|
Container@EDITOR_ROOT:
|
||||||
Logic: LoadMapEditorLogic
|
Logic: LoadMapEditorLogic
|
||||||
Children:
|
Children:
|
||||||
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
|
Logic: MusicHotkeyLogic
|
||||||
|
StopMusicKey: StopMusic
|
||||||
|
PauseMusicKey: PauseMusic
|
||||||
|
PrevMusicKey: PrevMusic
|
||||||
|
NextMusicKey: NextMusic
|
||||||
Container@WORLD_ROOT:
|
Container@WORLD_ROOT:
|
||||||
Container@MENU_ROOT:
|
Container@MENU_ROOT:
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
Container@INGAME_ROOT:
|
Container@INGAME_ROOT:
|
||||||
Logic: LoadIngamePlayerOrObserverUILogic
|
Logic: LoadIngamePlayerOrObserverUILogic
|
||||||
Children:
|
Children:
|
||||||
Container@MUSICBUTTONS:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicControllerLogic
|
Logic: MusicHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
Children:
|
|
||||||
LogicKeyListener@MUSICCONTROLLER_KEYHANDLER:
|
|
||||||
Container@WORLD_ROOT:
|
Container@WORLD_ROOT:
|
||||||
Logic: LoadIngamePerfLogic
|
Logic: LoadIngamePerfLogic
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -3,14 +3,12 @@ Container@MENU_BACKGROUND:
|
|||||||
Height: WINDOW_BOTTOM
|
Height: WINDOW_BOTTOM
|
||||||
Logic: MainMenuLogic
|
Logic: MainMenuLogic
|
||||||
Children:
|
Children:
|
||||||
Container@MUSICBUTTONS:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicControllerLogic
|
Logic: MusicHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
Children:
|
|
||||||
LogicKeyListener@MUSICCONTROLLER_KEYHANDLER:
|
|
||||||
Container@SHELLMAP_DECORATIONS:
|
Container@SHELLMAP_DECORATIONS:
|
||||||
Children:
|
Children:
|
||||||
Image@NOD:
|
Image@NOD:
|
||||||
|
|||||||
@@ -5,14 +5,6 @@ Background@NEW_MAP_BG:
|
|||||||
Width: 300
|
Width: 300
|
||||||
Height: 185
|
Height: 185
|
||||||
Children:
|
Children:
|
||||||
Container@MUSICBUTTONS:
|
|
||||||
Logic: MusicControllerLogic
|
|
||||||
StopMusicKey: StopMusic
|
|
||||||
PauseMusicKey: PauseMusic
|
|
||||||
PrevMusicKey: PrevMusic
|
|
||||||
NextMusicKey: NextMusic
|
|
||||||
Children:
|
|
||||||
LogicKeyListener@MUSICCONTROLLER_KEYHANDLER:
|
|
||||||
Label@LABEL_TITLE:
|
Label@LABEL_TITLE:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 20
|
Y: 20
|
||||||
@@ -190,6 +182,12 @@ ScrollPanel@MAP_SAVE_VISIBILITY_PANEL:
|
|||||||
Container@EDITOR_ROOT:
|
Container@EDITOR_ROOT:
|
||||||
Logic: LoadMapEditorLogic
|
Logic: LoadMapEditorLogic
|
||||||
Children:
|
Children:
|
||||||
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
|
Logic: MusicHotkeyLogic
|
||||||
|
StopMusicKey: StopMusic
|
||||||
|
PauseMusicKey: PauseMusic
|
||||||
|
PrevMusicKey: PrevMusic
|
||||||
|
NextMusicKey: NextMusic
|
||||||
Container@WORLD_ROOT:
|
Container@WORLD_ROOT:
|
||||||
Container@MENU_ROOT:
|
Container@MENU_ROOT:
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
Container@INGAME_ROOT:
|
Container@INGAME_ROOT:
|
||||||
Logic: LoadIngamePlayerOrObserverUILogic
|
Logic: LoadIngamePlayerOrObserverUILogic
|
||||||
Children:
|
Children:
|
||||||
Container@MUSICBUTTONS:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicControllerLogic
|
Logic: MusicHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
Children:
|
|
||||||
LogicKeyListener@MUSICCONTROLLER_KEYHANDLER:
|
|
||||||
Container@WORLD_ROOT:
|
Container@WORLD_ROOT:
|
||||||
Logic: LoadIngamePerfLogic
|
Logic: LoadIngamePerfLogic
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
Container@MAINMENU:
|
Container@MAINMENU:
|
||||||
Logic: MainMenuLogic
|
Logic: MainMenuLogic
|
||||||
Children:
|
Children:
|
||||||
Container@MUSICBUTTONS:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicControllerLogic
|
Logic: MusicHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
Children:
|
|
||||||
LogicKeyListener@MUSICCONTROLLER_KEYHANDLER:
|
|
||||||
Background@BORDER:
|
Background@BORDER:
|
||||||
Background: mainmenu-border
|
Background: mainmenu-border
|
||||||
X: 0 - 15
|
X: 0 - 15
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
Container@MAINMENU:
|
Container@MAINMENU:
|
||||||
Logic: MainMenuLogic
|
Logic: MainMenuLogic
|
||||||
Children:
|
Children:
|
||||||
Container@MUSICBUTTONS:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicControllerLogic
|
Logic: MusicHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
Children:
|
|
||||||
LogicKeyListener@MUSICCONTROLLER_KEYHANDLER:
|
|
||||||
Label@VERSION_LABEL:
|
Label@VERSION_LABEL:
|
||||||
X: WINDOW_RIGHT - 10
|
X: WINDOW_RIGHT - 10
|
||||||
Y: WINDOW_BOTTOM - 20
|
Y: WINDOW_BOTTOM - 20
|
||||||
|
|||||||
Reference in New Issue
Block a user