Merge branch 'master' of manuel-voegele.de:inf3

Conflicts:
	inf3.csproj
This commit is contained in:
2014-05-12 18:28:13 +02:00
5 changed files with 44 additions and 6 deletions

View File

@@ -9,28 +9,29 @@
<OutputType>Exe</OutputType>
<RootNamespace>inf3</RootNamespace>
<AssemblyName>inf3</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<ConsolePause>false</ConsolePause>
<ConsolePause>False</ConsolePause>
<additionalargs>/unsafe</additionalargs>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<ConsolePause>false</ConsolePause>
<ConsolePause>False</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
@@ -77,8 +78,10 @@
<Compile Include="src\Gui\MapPanel.cs" />
<Compile Include="src\Pathfinder.cs" />
<Compile Include="src\Gui\IEntity.cs" />
<Compile Include="src\Gui\SplashScreen.cs" />
<Compile Include="src\Gui\OnlinePlayerList.cs" />
<Compile Include="src\Gui\IPlayer.cs" />
<Compile Include="src\Music.cs" />
<Compile Include="src\Gui\Splashscreen.cs" />
<Compile Include="src\Gui\Dummytile.cs" />
</ItemGroup>

View File

@@ -16,6 +16,8 @@ namespace WorldOfPeacecraft
private ChatPanel ChatPanel;
private OnlinePlayerList OnlinePlayerList;
private Music m = new Music();
public Gui ()
{
//AllocConsole();
@@ -62,6 +64,8 @@ namespace WorldOfPeacecraft
this.Controls.Add (ChatPanel);
this.ResumeLayout();
m.Playmusic ("overworld");
}
protected override void OnClosing (System.ComponentModel.CancelEventArgs e)

View File

@@ -9,11 +9,12 @@ namespace WorldOfPeacecraft
{
private string ImagesFolder = "textures/";
private Image Logo;
private Music m = new Music();
public SplashScreen ()
{
Logo = Image.FromFile (ImagesFolder + "splashscreen.png");
//TODO: Play "splashscreen.ogg"
m.Playmusic ("splashscreen");
}
protected override void OnPaint (PaintEventArgs e)

30
src/Music.cs Normal file
View File

@@ -0,0 +1,30 @@
using System;
using System.Media;
namespace WorldOfPeacecraft
{
public class Music
{
string musicpath = "./music/";
string soundpath = "./sounds/";
SoundPlayer overworldplayer = new SoundPlayer(musicpath + "overworld.wav");
SoundPlayer minigameplayer = new SoundPlayer(musicpath + "minigame.wav");
SoundPlayer splashscreenplayer = new SoundPlayer (soundpath + "splashscreen.wav");
SoundPlayer walkplayer = new SoundPlayer(soundpath + "step.wav");
public Music ()
{
}
public void Playmusic (string sound){
if (sound == "overworld")
overworldplayer.PlayLooping ();
if (sound == "minigame")
minigameplayer.PlayLooping ();
if (sound == "splashscreen")
splashscreenplayer.PlaySync ();
if (sound == "walk")
walkplayer.Play ();
}
}
}