Quick and dirty music controller on shellmap
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -296,6 +296,7 @@
|
|||||||
<Compile Include="Traits\World\SmudgeLayer.cs" />
|
<Compile Include="Traits\World\SmudgeLayer.cs" />
|
||||||
<Compile Include="Widgets\Delegates\IngameChromeDelegate.cs" />
|
<Compile Include="Widgets\Delegates\IngameChromeDelegate.cs" />
|
||||||
<Compile Include="Widgets\SpecialPowerBinWidget.cs" />
|
<Compile Include="Widgets\SpecialPowerBinWidget.cs" />
|
||||||
|
<Compile Include="Widgets\Delegates\MusicPlayerDelegate.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
47
OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs
Normal file
47
OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -314,3 +314,36 @@ Container:
|
|||||||
Height:25
|
Height:25
|
||||||
Text:Quit
|
Text:Quit
|
||||||
Delegate:IngameChromeDelegate
|
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
|
||||||
Reference in New Issue
Block a user