diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index abd048acd7..fc48d49f12 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -1,4 +1,4 @@ - + Debug @@ -296,6 +296,7 @@ + diff --git a/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs b/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs new file mode 100644 index 0000000000..e9e80d8173 --- /dev/null +++ b/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs @@ -0,0 +1,47 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it 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. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion +using System; +namespace OpenRA.Widgets.Delegates +{ + public class MusicPlayerDelegate : IWidgetDelegate + { + public MusicPlayerDelegate() + { + var bg = Chrome.rootWidget.GetWidget("MUSIC_BG"); + bg.GetWidget("BUTTON_PLAY").OnMouseUp = mi => { + Sound.MusicPaused = false; + bg.GetWidget("BUTTON_PLAY").Visible = false; + bg.GetWidget("BUTTON_PAUSE").Visible = true; + return true; + }; + bg.GetWidget("BUTTON_PAUSE").OnMouseUp = mi => { + Sound.MusicPaused = true; + bg.GetWidget("BUTTON_PAUSE").Visible = false; + bg.GetWidget("BUTTON_PLAY").Visible = true; + return true; + }; + bg.GetWidget("BUTTON_STOP").OnMouseUp = mi => { + Sound.MusicStopped = true; + bg.Visible = false; + return true; + }; + } + } +} diff --git a/mods/ra/menus.yaml b/mods/ra/menus.yaml index 163f9a86c6..836209b346 100644 --- a/mods/ra/menus.yaml +++ b/mods/ra/menus.yaml @@ -313,4 +313,37 @@ Container: Width:160 Height:25 Text:Quit - Delegate:IngameChromeDelegate \ No newline at end of file + Delegate:IngameChromeDelegate + Background@MUSIC_BG: + Id:MUSIC_BG + X:WINDOW_RIGHT - 100 + Y:WINDOW_BOTTOM - 65 + Width: 90 + Height: 55 + Visible: true + Children: + Button@BUTTON_PLAY: + Id:BUTTON_PLAY + Visible:false + X:15 + Y:15 + Width:25 + Height:25 + Text:|> + Delegate:MusicPlayerDelegate + Button@BUTTON_PAUSE: + Id:BUTTON_PAUSE + X:15 + Y:15 + Width:25 + Height:25 + Text:|| + Delegate:MusicPlayerDelegate + Button@BUTTON_STOP: + Id:BUTTON_STOP + X:50 + Y:15 + Width:25 + Height:25 + Text:[] + Delegate:MusicPlayerDelegate \ No newline at end of file