Exemplo n.º 1
0
        /*internal SegmentState play(Segment segment, int ms)
         * {
         *  //throw new Exception("The method or operation is not implemented.");
         *  segment.play(ms);
         * }*/

        //internal void play(Segment segment, int ms)
        internal void play(SdlDotNet.Audio.Sound segment, int ms)
        {
            try
            {
                segment.Play();
            }
            catch (SdlException e)
            {
                e.Message.ToString();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Plays a sound effect.
 /// </summary>
 /// <param name="soundEffectName">Name of the sound effect.</param>
 public static void PlaySoundEffect(string soundEffectName)
 {
     if (IO.Options.Sound)
     {
         soundEffectName = FileNameConverter(IO.Paths.SfxPath, soundEffectName);
         if (IO.IO.FileExists(IO.Paths.SfxPath + soundEffectName))
         {
             SdlAudio.Sound sound = new SdlDotNet.Audio.Sound(IO.Paths.SfxPath + soundEffectName);
             sound.Play();
         }
     }
 }
Exemplo n.º 3
0
        public void PlayMetalClash(int volume)
        {
            try
            {
                Sound Metal = new Sound("crash_metal.ogg");
                Metal.Volume = volume;
                Metal.FadeIn(50);
                Metal.Play();
            }
            catch
            {

            }
        }
Exemplo n.º 4
0
        public void playBoem()
        {
            try
            {
                Sound Boem = new Sound("boem.ogg");
                Boem.Volume = 100;
                Boem.FadeIn(50);
                Boem.Play();
            }
            catch
            {

            }
        }
        // called at the end of turn
        private void onTurnEnd(object sender, EventArgs a)
        {
            int ms = 0;

            for (; queue > 0; queue--, ms += intervalTime)
            {
                //SegmentState st = Core.soundEffectManager.play(segment,ms);
                //if(st!=null)	states.Add(st);
                try
                {
                    segment.Play();
                }
                catch (SdlDotNet.Core.SdlException e)
                {
                    e.Message.ToString();
                }
            }
        }
Exemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fileName"></param>
 public static void PlayAsynchronousSound(string fileName)
 {
     //if( Core.options.enableSoundEffect && Core.soundEffectManager.IsAvailable )
     //	sndPlaySound(fileName,1);
     //SDL.net.Audio.play(fileName);
     try
     {
         if (sounds.Contains(fileName))
         {
             ((SdlDotNet.Audio.Sound)sounds[fileName]).Play();
         }
         else
         {
             SdlDotNet.Audio.Sound newSound = new SdlDotNet.Audio.Sound(fileName);
             sounds.Add(fileName, newSound);
             newSound.Play();
         }
     }
     catch (SdlException e)
     {
         e.Message.ToString();
     }
 }
Exemplo n.º 7
0
        public void Init()
        {
            //Init position of items in list
            /*
            itemY[0] = startY;
            itemY[1] = startY+12;//+12
            itemY[2] = startY+27;//+15
            itemY[3] = startY+42;//+15
            itemY[4] = startY+60;//+18
            itemY[5] = startY+80;//+20
            itemY[6] = startY+102;//+22
            itemY[7] = startY+126;//+24
            itemY[8] = startY+152;//+26
            itemY[9] = startY+184;//+32
            itemY[10] = startY+220;//+36 // center item
            itemY[11] = startY+266;//+46
            itemY[12] = startY+302;//+36
            itemY[13] = startY+334;//+32
            itemY[14] = startY+360;//+26
            itemY[15] = startY+384;//+24
            itemY[16] = startY+406;//+22
            itemY[17] = startY+426;//+20
            itemY[18] = startY+444;//+18
            itemY[19] = startY+459;//+15
            itemY[20] = startY+471;//+12
            */

            itemY[0] = startY;
            itemY[1] = startY+16;//+16
            itemY[2] = startY+35;//+19
            itemY[3] = startY+54;//+19
            itemY[4] = startY+76;//+22
            itemY[5] = startY+100;//+24
            itemY[6] = startY+126;//+26
            itemY[7] = startY+154;//+28
            itemY[8] = startY+184;//+30
            itemY[9] = startY+220;//+36
            itemY[10] = startY+260;//+40 // center item
            itemY[11] = startY+310;//+50
            itemY[12] = startY+350;//+40
            itemY[13] = startY+386;//+36
            itemY[14] = startY+416;//+30
            itemY[15] = startY+444;//+28
            itemY[16] = startY+470;//+26
            itemY[17] = startY+494;//+24
            itemY[18] = startY+516;//+22
            itemY[19] = startY+535;//+19
            itemY[20] = startY+554;//+19

            itemX[0] = startX;
            itemX[1] = startX+3;
            itemX[2] = startX+6;
            itemX[3] = startX+9;
            itemX[4] = startX+12;
            itemX[5] = startX+15;
            itemX[6] = startX+18;
            itemX[7] = startX+21;
            itemX[8] = startX+24;
            itemX[9] = startX+27;
            itemX[10] = startX+30;// center item
            itemX[11] = startX+27;
            itemX[12] = startX+24;
            itemX[13] = startX+21;
            itemX[14] = startX+18;
            itemX[15] = startX+15;
            itemX[16] = startX+12;
            itemX[17] = startX+9;
            itemX[18] = startX+6;
            itemX[19] = startX+3;
            itemX[20] = startX;

            sfError = new Surface (new Size (1, 1));
            sfErrorBackground = new Surface (new Size (1, 1));
            try {
                changeGame = new Sound (ConfigurationSettings.AppSettings ["ChangeGameSound"]);
                changeEmulator = new Sound (ConfigurationSettings.AppSettings ["ChangeEmulatorSound"]);
                music = new Sound (ConfigurationSettings.AppSettings ["MusicSound"]);
            } catch (Exception ex) {
                displayError = true;
                errorMessage += "Problem loading sounds, file may be missing... \n";
            }
            if (ConfigurationSettings.AppSettings ["PlayMusic"] == "true") {
                music.Play (true);
            }
            time = SdlDotNet.Core.Timer.TicksElapsed;
            emulators [0] = "Mame";
            emulators [1] = "Snes";
            rand = new Random ();
            currentEmulator = 0;
            try {
                _sfTitle = new Surface (ConfigurationSettings.AppSettings ["ApplicationLogo"]);
            } catch (Exception ex) {
                displayError = true;
                errorMessage += "Problem loading logo, file may be missing... \n";
                _sfTitle = new Surface (new Size (1, 1));
            }
            _ptTitle.X = (ScreenManager.ScreenSize.Width -
                _sfTitle.Width) / 2;
            _ptTitle.Y = 10;
            sfBackgroundImage = new Surface (ConfigurationSettings.AppSettings ["BackgroundImage"]);
            currentIndex = 0;
            // We load the mame game list
            switchEmulator ();
            fontXXSmall = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 8);
            fontXSmall = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 10);
            fontSmall = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 13);
            fontNormal = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 16);
            fontMedium = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 20);
            fontLarge = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 24);
            fontXL = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 32);
            fontXXL = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 44);

            font8 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 8);
            font10 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 10);
            font12 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 12);
            font14 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 14);
            font16 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 16);
            font18 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 18);
            font20 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 20);
            font24 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 24);
            font28 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 28);
            font32 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 32);
            font36 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 36);
            font40 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 40);
            //init starfield
            for (int i=0; i<512; i++) {
                starsX [i] = rand.Next (-1000, 1000);
                starsY [i] = rand.Next (-1000, 1000);
                starsZ [i] = rand.Next (100, 1000);
                starsZV [i] = rand.Next (1, 8);
            }
            pixels = new Surface (new Size (1280, 1024));
            if (displayError == true) {
                sfError = fontNormal.Render (errorMessage, Color.White);
                sfErrorBackground = new Surface (new Size (sfError.Width + 40, sfError.Height + 40));
                sfErrorBackground.Fill (Color.Gray);
                sfErrorBackground.Blit (sfError, new Point (((sfErrorBackground.Width - sfError.Width) / 2), 20));
                ScreenManager.MainScreen.Blit (sfErrorBackground, new Point (((ScreenManager.MainScreen.Width - sfErrorBackground.Width) / 2), 250));
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Plays a sound effect.
 /// </summary>
 /// <param name="soundEffectName">Name of the sound effect.</param>
 public static void PlaySoundEffect(string soundEffectName)
 {
     if (IO.Options.Sound) {
         soundEffectName = FileNameConverter(IO.Paths.SfxPath, soundEffectName);
         if (IO.IO.FileExists(IO.Paths.SfxPath + soundEffectName)) {
             SdlAudio.Sound sound = new SdlDotNet.Audio.Sound(IO.Paths.SfxPath + soundEffectName);
             sound.Play();
         }
     }
 }
Exemplo n.º 9
0
        void Events_Tick(object sender, TickEventArgs e)
        {
            // randomly start "animations"
            if (--next < 0)
            {
                var flash = new Flash { Surface = next_surface(), Point = next_point(), Tick = random.Next(100, 1000) };
                flash.Surface.Alpha = (byte)random.Next(100, 255);
                flash.Surface.AlphaBlending = true;
                flash.Surface.Fill(next_color());

                flashes.Add(flash);
                next = next_gen();
            }

            screen.Blit(background);

            var keep = new List<Flash>();
            foreach (var flash in flashes)
            {
                if (--flash.Tick > 0)
                {
                    keep.Add(flash);
                }
                else
                {
                    var snd = new Sound("resources/cow4.wav");
                    snd.Volume = 40;
                    snd.Play();
                }
                screen.Blit(flash.Surface, flash.Point);
                flash.Tick--;
            }
            flashes = keep;

            screen.Update();
            tick++;
        }
Exemplo n.º 10
0
        public void YheayBaby()
        {
            try
            {
                Sound Yheah = new Sound("YeahBaby.ogg");
                Yheah.FadeIn(50);
                Yheah.Play();
            }
            catch
            {

            }
        }