Music klasser erstellt und eingebaut.
This commit is contained in:
@@ -81,6 +81,7 @@
|
|||||||
<Compile Include="src\Gui\SplashScreen.cs" />
|
<Compile Include="src\Gui\SplashScreen.cs" />
|
||||||
<Compile Include="src\Gui\OnlinePlayerList.cs" />
|
<Compile Include="src\Gui\OnlinePlayerList.cs" />
|
||||||
<Compile Include="src\Gui\IPlayer.cs" />
|
<Compile Include="src\Gui\IPlayer.cs" />
|
||||||
|
<Compile Include="src\Music.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace WorldOfPeacecraft
|
|||||||
private ChatPanel ChatPanel;
|
private ChatPanel ChatPanel;
|
||||||
private OnlinePlayerList OnlinePlayerList;
|
private OnlinePlayerList OnlinePlayerList;
|
||||||
|
|
||||||
|
private Music m = new Music();
|
||||||
|
|
||||||
public Gui ()
|
public Gui ()
|
||||||
{
|
{
|
||||||
//AllocConsole();
|
//AllocConsole();
|
||||||
@@ -62,6 +64,8 @@ namespace WorldOfPeacecraft
|
|||||||
this.Controls.Add (ChatPanel);
|
this.Controls.Add (ChatPanel);
|
||||||
|
|
||||||
this.ResumeLayout();
|
this.ResumeLayout();
|
||||||
|
|
||||||
|
m.Playmusic ("overworld");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnClosing (System.ComponentModel.CancelEventArgs e)
|
protected override void OnClosing (System.ComponentModel.CancelEventArgs e)
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ namespace WorldOfPeacecraft
|
|||||||
{
|
{
|
||||||
private string ImagesFolder = "textures/";
|
private string ImagesFolder = "textures/";
|
||||||
private Image Logo;
|
private Image Logo;
|
||||||
|
private Music m = new Music();
|
||||||
|
|
||||||
public SplashScreen ()
|
public SplashScreen ()
|
||||||
{
|
{
|
||||||
Logo = Image.FromFile (ImagesFolder + "splashscreen.png");
|
Logo = Image.FromFile (ImagesFolder + "splashscreen.png");
|
||||||
//TODO: Play "splashscreen.ogg"
|
m.Playmusic ("splashscreen");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPaint (PaintEventArgs e)
|
protected override void OnPaint (PaintEventArgs e)
|
||||||
|
|||||||
30
src/Music.cs
Normal file
30
src/Music.cs
Normal 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 ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user