private void LoadMapData(string FriendlyName, string FilePath, string FileName, string FileExtension) { // make sure resource exists var fullDirectory = ReadWrite.CreateIfNotExists(FilePath, FileName, FileExtension, false); if (!string.IsNullOrEmpty(fullDirectory)) { var mapData = ReadWrite.ReadJson <LevelObj>(FilePath, FileName, FileExtension, false); if (mapData != null) { MapData.Add(FriendlyName, mapData); } else { ReadWrite.WriteToLog(String.Format("LoadMapData - Data is null. FriendlyName: {0}. Root: {1}. Path: {2}. FileName: {3}. FileExtension: {4}", FriendlyName, ReadWrite.GetRoot, FilePath, FileName, FileExtension)); throw new FileLoadException("Could not Load resource"); } } else { ReadWrite.WriteToLog(String.Format("LoadMapData - Could not load resource. FriendlyName: {0}. Root: {1}. Path: {2}. FileName: {3}. FileExtension: {4}", FriendlyName, ReadWrite.GetRoot, FilePath, FileName, FileExtension)); throw new FileLoadException("Could not Load resource"); } }
public void LoadSound() { try { Sound = Audio.Library.Sound.Instance; //var initSuccess = Sound.init(); //Sound.loadSound("uno.wav"); //Sound.loopSound("uno.wav"); //Sound.loadSound("Click.wav"); //Sound.loadSound("puttekong.wav"); //Sound.loopSound("Click.wav"); //Sound.play("Piano.wav"); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.Jump); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.Land); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.Damage); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.DamageHero); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.PickUp); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGSoundWorld); Sound.loopSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGSoundWorld); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGSoundGame); Sound.loopSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGSoundGame); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGSoundFinalStage); Sound.loopSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGSoundFinalStage); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGSoundEnd); Sound.loopSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGSoundEnd); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGNearPerfectEnd); Sound.loopSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGNearPerfectEnd); Sound.loadSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGPerfectEnd); Sound.loopSound(OlcSideScrollingConsoleGame.Global.GlobalNamespace.SoundRef.BGPerfectEnd); // pefect end? // just done? if (Settings != null) { if (Settings.AudioOn) { Sound.unMute(); } else if (!Settings.AudioOn) { Sound.mute(); } } } catch (Exception ex) { ReadWrite.WriteToLog(String.Format("LoadSound - Could not load sound. {0}", ex.ToString())); Sound = null; } }
public void TestWriteToLog() { //Arrange var init = new OlcSideScrollingConsoleGame.Core.ReadWrite(); //Act init.WriteToLog("Unit test write to log"); //Assert }
private void LoadSprite(string FriendlyName, string FilePath, string FileName, string FileExtension) { // make sure resource exists var fullDirectory = ReadWrite.CreateIfNotExists(FilePath, FileName, FileExtension, false); if (!string.IsNullOrEmpty(fullDirectory)) { var sprite = Sprite.Load(fullDirectory); MapSprites.Add(FriendlyName, sprite); } else { ReadWrite.WriteToLog(String.Format("LoadSprite - Could not load resource. FriendlyName: {0}. Root: {1}. Path: {2}. FileName: {3}. FileExtension: {4}", FriendlyName, ReadWrite.GetRoot, FilePath, FileName, FileExtension)); throw new FileLoadException("Could not Load resource"); } }