diff --git a/inf3.csproj b/inf3.csproj index a690624..f575cd9 100644 --- a/inf3.csproj +++ b/inf3.csproj @@ -81,6 +81,7 @@ + diff --git a/music/splashscreen.ogg b/sounds/splashscreen.ogg similarity index 100% rename from music/splashscreen.ogg rename to sounds/splashscreen.ogg diff --git a/src/Gui/Gui.cs b/src/Gui/Gui.cs index cb2140a..a9b08fe 100644 --- a/src/Gui/Gui.cs +++ b/src/Gui/Gui.cs @@ -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) diff --git a/src/Gui/Splashscreen.cs b/src/Gui/Splashscreen.cs index 86f21c9..3d87009 100644 --- a/src/Gui/Splashscreen.cs +++ b/src/Gui/Splashscreen.cs @@ -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) diff --git a/src/Music.cs b/src/Music.cs new file mode 100644 index 0000000..7a84c87 --- /dev/null +++ b/src/Music.cs @@ -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 (); + } + } +} +