Exemplo n.º 1
0
        public int SearchandDestroy(bool reset)
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.kachu);
            System.Media.SoundPlayer playerInf = new System.Media.SoundPlayer(Properties.Resources.pikapika);

            TargetManager tm = TargetManager.GetInstance();
            Controller controller = Controller.GetInstance();

            int i = 0;
            foreach (Target target in tm.TMTargets)
            {
                i++;

                controller.MoveTo(target.x, target.y);

                player.Play();
                controller.Fire();
                controller.SetNum(controller.GetNum() - 1);

                playerInf.PlayLooping();

                if (i != tm.TMTargets.Count)
                {
                    if (reset == true)
                    {
                        controller.Launcher.Reset();
                    }
                }

                Thread.Sleep(250);
            }

            return i;
        }
Exemplo n.º 2
0
        private void Start_Animals_Click(object sender, EventArgs e)
        {
            var strButton_Text=Start_Animals.Text;
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = "C:\\temp\\play.wav";
            if (strButton_Text == "Start_Animals")
            {
                player.LoadAsync();
                player.PlayLooping();
                Start_Animals.Text = "Stop";
                timer_animals.Enabled = true;
                //listfile[j].Remove(0);
                //animals.Image = Image.FromFile("c:\\temp\\dog.png");
                //anim
                //Timer timer = new Timer();
                //timer.Interval = 500;
                //timer.Enabled = true;
                //timer.Start();

            }
            else
            {
                player.Stop();
                Start_Animals.Text = "Start_Animals";
                timer_animals.Enabled = false;
            }
            //

            //animals.SizeMode = "StretchImage";
        }
Exemplo n.º 3
0
        public AVForm(Jid to_Jid)
        {
            try
            {
                callSoundPlayer = new System.Media.SoundPlayer(CSS.IM.UI.Util.Path.CallPath);//视频的呼叫声音;
            }
            catch (Exception)
            {

            }

            InitializeComponent();
            this.Text = "正在与" + to_Jid.User + "视频通话中";
            aVcommunicationEx1.UDPListen();
            if (CSS.IM.UI.Util.Path.CallSwitch)
            {
                try
                {
                      callSoundPlayer.PlayLooping();
                }
                catch (Exception)
                {

                }
            }
        }
Exemplo n.º 4
0
 private void bgMusic()
 {
     _bgplayer = new System.Media.SoundPlayer(@"C:\Users\Tjark\Dropbox\Bezirksjugendtreffen 2012\Abendprogramm\bgmusic-loop.wav");
     Random rnd = new Random();
     if (rnd.Next(2) == 1)
     {
         _bgplayer.PlayLooping();
     }
 }
Exemplo n.º 5
0
 public static void Main(string[] args)
 {
     bool infinito = args[1] == "-i";
     System.Media.SoundPlayer player = new System.Media.SoundPlayer(args[0]);
     Console.WriteLine("Plaing:"+args[0]);
     if (!infinito)
         player.PlaySync();
     else{
         player.PlayLooping();
         for(;;);
     }
 }
Exemplo n.º 6
0
 public void game_over(int wynik)
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = "loose.wav";
     if (muzik == true)
     {
     player.PlayLooping();
     }
     Console.Clear();
     for (int i = 0, j= 0 ; i < 25; i++)
     {
     if (i >= j) Clear_line_of_numbers(i - j, 7); if (j<6) j++;
     if (i > 3) { Console.SetCursorPosition(75, i - 4); Console.Write("  ____                         ___                 "); }
     if (i > 2) { Console.SetCursorPosition(75, i - 3); Console.Write(" / ___| __ _ _ __ ___   ___   / _ \\__   _____ _ __ "); }
     if (i > 1) { Console.SetCursorPosition(75, i - 2); Console.Write("| |  _ / _` | '_ ` _ \\ / _ \\ | | | \\ \\ / / _ \\ '__|"); }
     if (i > 0) { Console.SetCursorPosition(75, i - 1); Console.Write("| |_| | (_| | | | | | |  __/ | |_| |\\ V /  __/ |   ");}
     if (i > -1) {Console.SetCursorPosition(75, i);    Console.Write(" \\____|\\__,_|_| |_| |_|\\___|  \\___/  \\_/ \\___|_|   ");}
     Thread.Sleep(60);
     }
     Console.ForegroundColor = ConsoleColor.DarkGray;
     int hoffset = 78;
     int voffset = 30;
     Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╔══════════════════════════════════════════╗"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╠─────────────Podaj swoje imię─────────────╣"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╠══════════════════════════════════════════╣"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("║                                          ║"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╠══════════════════════════════════════════╣"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╠───────────────Twój wynik to──────────────╣"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("║                                          ║"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╚══════════════════════════════════════════╝"); Console.SetCursorPosition(hoffset + 20, 36);
     Console.Write(wynik);
     Console.SetCursorPosition(hoffset+2, 33);
     Console.ForegroundColor = ConsoleColor.White;
     Console.CursorVisible=true;
     string name = Console.ReadLine();
     Console.CursorVisible = false;
     Scoreboard scoreboard = new Scoreboard();
     if (name != "")
     {
     Player winner = new Player();
     winner.name = name;
     winner.score = wynik;
     scoreboard.dodaj(winner);
     }
     Thread.Sleep(500);
     player.Stop();
     scoreboard.muzik = this.muzik;
     scoreboard.wypisz(muzik);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Play sound
 /// </summary>
 public void play()
 {
     if (missing || !render.music_opt)
     {
         return;
     }
     if (looper)
     {
         player.PlayLooping();
     }
     else
     {
         player.Play();
     }
 }
Exemplo n.º 8
0
 private void PlaySound()
 {
     try
     {
         string file = CurrentSetting.FilePath;
         if (string.IsNullOrEmpty(file))
         {
             file = "alarm0";
         }
         string filePath = $@"{AppDomain.CurrentDomain.BaseDirectory}data\{file}.wav";
         player = new System.Media.SoundPlayer(filePath);
         player.PlayLooping();
     }
     catch (Exception ex) { }
 }
Exemplo n.º 9
0
        //bool awalcek = true;
        private void G2WrongPormBajuAdat_Load(object sender, EventArgs e)
        {
            this.CenterToScreen();
            tmrG2.Enabled = true;
            SoundMain.PlayLooping();
            tmrWait.Enabled = true;
            //label1.BackColor = Color.FromArgb(80, 100, 84, 66);
            //label9.BackColor = Color.FromArgb(80, 100, 84, 66);

            picTiraiKiri.Visible  = true;
            picTiraiKanan.Visible = true;
            tiraiKi        = picTiraiKiri.Location;
            tiraiKa        = picTiraiKanan.Location;
            timer2.Enabled = true;
        }
Exemplo n.º 10
0
 /// <summary>
 /// Metoda wysterowywuje przycisk wyciszBtn oraz zatrzymuje i odtwarza dzwiek w zaleznosci od pola wycisz
 /// </summary>
 private void WyciszDzwiek()
 {
     if (wycisz)
     {
         wyciszBtn.BackgroundImage = Properties.Resources.playSound;
         odtDzwiek.Stop();
         wycisz = false;
     }
     else
     {
         wyciszBtn.BackgroundImage = Properties.Resources.muteSound;
         odtDzwiek.PlayLooping();
         wycisz = true;
     }
 }
Exemplo n.º 11
0
 //private
 public GamePanel(Controller c)
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = ZombiesVsPlants.FilesPath.AudioLong;
     player.Load();
     player.PlayLooping();
     this.c = c;
     initSubPanel();
     this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw |
                   ControlStyles.AllPaintingInWmPaint, true);
     this.BorderStyle = BorderStyle.Fixed3D;
     this.Paint      += new PaintEventHandler(GamePanel_Paint);
     this.MouseClick += new MouseEventHandler(GamePanel_MouseClick);
     this.MouseMove  += new MouseEventHandler(GamePanel_MouseMove);
 }
Exemplo n.º 12
0
        private void Form_Peta_Load(object sender, EventArgs e)
        {
            this.BackgroundImage = Image.FromFile(Application.StartupPath + "\\Peta\\map.jpg");
            picBack.Image        = Image.FromFile(Application.StartupPath + "\\Button\\tombol-07.png");
            picExit.Image        = Image.FromFile(Application.StartupPath + "\\Button\\tombol-04.png");

            if (rumah == 1)
            {
                picRumah1.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolGudang.png");
                picRumah2.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolTamanTerkunci.png");
                picRumah3.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolRKTerkunci.png");
            }
            else if (rumah == 2)
            {
                picRumah1.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolGudangSelesai.png");
                picRumah2.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolTaman.png");
                picRumah3.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolRKTerkunci.png");
            }
            else if (rumah == 3)
            {
                picRumah1.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolGudangSelesai.png");
                picRumah2.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolTamanSelesai.png");
                picRumah3.Image = Image.FromFile(Application.StartupPath + "\\Peta\\tombolRK.png");
            }

            if (sound == 1)
            {
                SoundMap.PlayLooping();
                picSound.Image = Image.FromFile(Application.StartupPath + "\\Button\\tombolSoundOn.png");
            }
            else if (sound == 0)
            {
                SoundMap.Stop();
                picSound.Image = Image.FromFile(Application.StartupPath + "\\Button\\tombolSoundOff.png");
            }
        }
Exemplo n.º 13
0
 public static void PlaySound(string pvTrack, bool pvLoop)
 {
     if (Properties.Settings.Default.PlaySounds)
     {
         MediaPlayer.SoundLocation = SoundFolder + pvTrack;
         if (pvLoop)
         {
             MediaPlayer.PlayLooping();
         }
         else
         {
             MediaPlayer.Play();
         }
     }
 }
Exemplo n.º 14
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     if (playing)
     {
         pictureBox1.Image = Properties.Resources.musicOFF;
         playing           = false;
         player.Stop();
     }
     else
     {
         pictureBox1.Image = Properties.Resources.musicON;
         playing           = true;
         player.PlayLooping();
     }
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, Welcom to C# World!");
            // Console.Beep(37, 10000);
            Console.Beep();
            // string audioPath = "http://www.wavsource.com/snds_2018-06-03_5106726768923853/music/such_a_state_x.wav";
            string audioPath = "C:/Windows/media/Ring06.wav";

            System.Media.SoundPlayer player = new System.Media.SoundPlayer(audioPath);
            player.Load();
            player.PlayLooping();
            Console.WriteLine("Now playlooping:-> {0}", audioPath);

            Console.ReadKey();
        }
        private void Form_Count_The_Plants_Load(object sender, EventArgs e)
        {
            if (sound == 1)
            {
                SoundGame2.PlayLooping();
                picSound.Image = Image.FromFile(Application.StartupPath + "\\Button\\tombolSoundOn.png");
            }
            else if (sound == 0)
            {
                SoundGame2.Stop();
                picSound.Image = Image.FromFile(Application.StartupPath + "\\Button\\tombolSoundOff.png");
            }


            this.BackgroundImage = Image.FromFile(Application.StartupPath + "\\Game2\\2-6-INGAME.jpg");
            picNext.Image        = Image.FromFile(Application.StartupPath + "\\Button\\tombolMulaiBermain.png");
            //picNext2.Image = Image.FromFile(Application.StartupPath + "\\Button\\tombol-06.png");
            picBack.Image      = Image.FromFile(Application.StartupPath + "\\Button\\tombol-07.png");
            picExit.Image      = Image.FromFile(Application.StartupPath + "\\Button\\tombol-04.png");
            pictureBox21.Image = Image.FromFile(Application.StartupPath + "\\Button\\tombol-06.png");
            //picNext2.Visible = false;
            picCheck.Image   = Image.FromFile(Application.StartupPath + "\\Button\\cek hasil-03.png");
            picCheck.Visible = false;

            pic1.Image  = Image.FromFile(Application.StartupPath + "\\Button\\1-02.png");
            pic2.Image  = Image.FromFile(Application.StartupPath + "\\Button\\2-02.png");
            pic3.Image  = Image.FromFile(Application.StartupPath + "\\Button\\3-02.png");
            pic4.Image  = Image.FromFile(Application.StartupPath + "\\Button\\4-02.png");
            pic5.Image  = Image.FromFile(Application.StartupPath + "\\Button\\5-02.png");
            pic6.Image  = Image.FromFile(Application.StartupPath + "\\Button\\6-02.png");
            pic7.Image  = Image.FromFile(Application.StartupPath + "\\Button\\7-02.png");
            pic8.Image  = Image.FromFile(Application.StartupPath + "\\Button\\8-02.png");
            pic9.Image  = Image.FromFile(Application.StartupPath + "\\Button\\9-02.png");
            pic0.Image  = Image.FromFile(Application.StartupPath + "\\Button\\0-02.png");
            picAC.Image = Image.FromFile(Application.StartupPath + "\\Button\\ac-02.png");
        }
Exemplo n.º 17
0
 /// <summary>
 /// Play a sound
 /// </summary>
 /// <param name="audioPath"></param>
 public void playSound(bool loop = false)
 {
     try
     {
         _soundPlayer.Play();
         if (loop == true)
         {
             _soundPlayer.PlayLooping();
             _playing = true;
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 18
0
        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
            timer3.Stop();
            label2.Text      = "Please make sure to wear headphones and stay seated at all times.";
            label4.ForeColor = Color.Red;
            label5.ForeColor = Color.Red;
            label6.ForeColor = Color.Red;
            button1.Enabled  = false;
            button2.Enabled  = false;
            button3.Enabled  = false;
            label1.ForeColor = Color.Red;
            string path      = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string directory = Path.GetDirectoryName(path);

            path = Path.Combine(directory, "halt.wav");
            System.Media.SoundPlayer sound = new System.Media.SoundPlayer(path);
            sound.PlayLooping();
            label7.Text         = "Learn the components";
            label7.ForeColor    = Color.Red;
            label8.Visible      = false;
            label9.Visible      = false;
            label10.Visible     = false;
            label11.Visible     = false;
            label12.Visible     = false;
            label13.Visible     = false;
            label14.Visible     = false;
            label15.Visible     = false;
            label16.Visible     = false;
            label17.Visible     = false;
            label18.Visible     = false;
            label19.Visible     = false;
            label20.Visible     = false;
            label21.Visible     = false;
            label22.Visible     = false;
            label23.Visible     = false;
            label24.Visible     = false;
            label25.Visible     = false;
            label26.Visible     = false;
            label27.Visible     = false;
            notepad.Visible     = false;
            pictureBox3.Visible = false;
            pictureBox1.Visible = false;
            a1textbox.Visible   = false;
            pictureBox2.Visible = false;
            button4.Visible     = false;
            attempt1.Visible    = false;
        }
Exemplo n.º 19
0
 public GameMain()
 {
     InitializeComponent();
     Cursor.Hide();
     ReadLevel(file);
     GenerateLevel();
     ShowLevel();
     width  = this.ClientRectangle.Width;
     height = this.ClientRectangle.Height;
     System.Media.SoundPlayer sp = new System.Media.SoundPlayer("HeyYou.wav");
     sp.PlayLooping();
     if (ok[9] == 1)
     {
         sp.Stop();
     }
 }
Exemplo n.º 20
0
        public Form1()
        {
            // aborts the load to allow the splash screen to be shown first
            Thread load = new Thread(new ThreadStart(StartSplash));

            load.Start();
            Thread.Sleep(2600);
            load.Abort();

            // assign the sound file to the variable
            backSound.SoundLocation = "Victory.wav";
            InitializeComponent();

            // play background sound.
            backSound.PlayLooping();
        }
Exemplo n.º 21
0
        public SuperAdventure()
        {
            InitializeComponent();

            _player = new Player(10, 10, 20, 0, 1);
            MoveTo(World.LocationByID(World.LOCATION_ID_HOME));
            _player.Inventory.Add(new InventoryItem(World.ItemByID(World.ITEM_ID_RUSTY_SWORD), 1));

            lblHitPoints.Text       = _player.CurrentHitPoints.ToString();
            lblGold.Text            = _player.Gold.ToString();
            lblExperience.Text      = _player.ExperiencePoints.ToString();
            lblLevel.Text           = _player.Level.ToString();
            PlayMusic.SoundLocation = "rpg.wav";
            PlayMusic.PlayLooping();
            //PlayMusic.Play();
        }
Exemplo n.º 22
0
        public static void PlayWav(string fileName)
        {
            Player = null ?? new System.Media.SoundPlayer();
            string wavPath = string.Format(AppDomain.CurrentDomain.BaseDirectory + "Wave\\{0}", fileName);

            try
            {
                Player.SoundLocation = wavPath;
                Player.Load();
                Player.PlayLooping();
            }
            catch (Exception ex)
            {
                LogHelper.ErrorLog(ex);
            }
        }
Exemplo n.º 23
0
        private void Music_Click(object sender, EventArgs e)
        {
            if (!musicloop)
            {
                BackgroundMusic.PlayLooping();
                musicloop  = true;
                Music.Text = "Slå av Stämning";
            }

            else
            {
                BackgroundMusic.Stop();
                musicloop  = false;
                Music.Text = "Slå på Stämning";
            }
        }
Exemplo n.º 24
0
        public StartMeun()
        {
            String Words = "免责声明:此项目修改仅用于个人好玩\n      欢迎进入曾晨宇的修改的游戏\n                祝您游戏愉快\n     修改不易请勿抄袭\n警告:\n    请勿修改文件夹内任何内容";

            if (ZombiesVsPlants.PlansTime.flag == false)
            {
                MessageBox.Show(Words);
            }
            ZombiesVsPlants.PlansTime.flag = true;
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = ZombiesVsPlants.FilesPath.AudioShort;
            player.Load();
            player.PlayLooping();
            InitializeComponent();
            //this.ControlBox = false;   // 设置不出现关闭按钮
        }
Exemplo n.º 25
0
        private void Draw()
        {
            // LoadContent has been called at this point
            for (int y = 0; y < 32; y++)
            {
                for (int x = 0; x < 64; x++)
                {
                    int index = (y * 64) + x;
                    if (_chip8.Graphics[index] == 1 || _displayBuffer[index] > 0)
                    {
                        _bmp.SetPixel(x, y, Color.White);
                        _displayBuffer[index] |= (uint)((_chip8.Graphics[index] << 15) & 0x8000);   //If _chip8.Graphics[index] == 1, set the first bit in displayBuffer[index] to 1
                    }
                    else
                    {
                        _bmp.SetPixel(x, y, Color.Black);
                    }

                    _displayBuffer[index] = (uint)((_displayBuffer[index] >> 1) & _bufferedFrameMask);  //Shift buffered frames right, apply mask to cap amount of buffered frames
                }
            }

            _renderImage.Dispatcher.Invoke(new Action(() => {
                _wbmp.WritePixels(new System.Windows.Int32Rect(0, 0, 64, 32), _bmp.Bits, _bmp.Width, 0);
                //_wbmp.Lock();
                //Marshal.Copy(_bmp.Bits, 0, _wbmp.BackBuffer, _bmp.Bits.Length);
                //_wbmp.AddDirtyRect(new System.Windows.Int32Rect(0, 0, _bmp.Width, _bmp.Height));
                //_wbmp.Unlock();
            }));

            if (_chip8.SoundFlag)
            {
                if (_audioTime != 0)
                {
                    _soundPlayer.PlayLooping();
                }
                _audioTime = 0;
            }
            else if (_audioTime < _minAudioTime)
            {
                _audioTime++;
            }
            else
            {
                _soundPlayer.Stop();
            }
        }
 private void gameSounds()
 {
     if (!keyPressed)     //Note that these Booleans are either true/false
     {
         player = new System.Media.SoundPlayer(@"C:\Users\Parker\Desktop\Game\car_still.wav");
         player.PlayLooping();
     }
     else
     {
         player2 = new System.Media.SoundPlayer(@"C:\Users\Parker\Desktop\Game\car_speeding.wav");
         player2.PlayLooping();
         if (player != null)
         {
             player.Stop();
         }
     }
 }
Exemplo n.º 27
0
        public static void Play()
        {
            if (File.Exists(STYLE.MUSIC_FILE_PATH))
            {
                if (player == null)
                {
                    player = new System.Media.SoundPlayer();
                    player.SoundLocation = STYLE.MUSIC_FILE_PATH;
                }

                if (MUSIC_IS_STOPPED)
                {
                    player.PlayLooping();
                    MUSIC_IS_STOPPED = false;
                }
            }
        }
 private void Pause_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (soundFlag) //music is being playing
     {
         player.Stop();
         //pause.Source = new ImageSourceConverter().ConvertFromString("C:/Users/riki/Documents/לוסטיג/שנה_ב/סמסטר_א/מיני_פרוייקט/project/Project01_5982_6824_dotNet5779/WpfUI/images/play.jpg") as ImageSource;
         pause.Source = new ImageSourceConverter().ConvertFromString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "play.jpg")) as ImageSource;  // to get relative location
         soundFlag    = false;
     }
     else //music is not being playing
     {
         player.PlayLooping();
         //pause.Source = new ImageSourceConverter().ConvertFromString("C:/Users/riki/Documents/לוסטיג/שנה_ב/סמסטר_א/מיני_פרוייקט/project/Project01_5982_6824_dotNet5779/WpfUI/images/pause.jpg") as ImageSource;
         pause.Source = new ImageSourceConverter().ConvertFromString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "pause.jpg")) as ImageSource;  // to get relative location
         soundFlag    = true;
     }
 }
Exemplo n.º 29
0
        private void btn_mod_Click(object sender, EventArgs e)
        {
            actualVersion        = modBox.Text;
            Gamepath             = System.IO.Path.GetFullPath("../Domino-s-Pizza-C/" + actualVersion + "/Imagens/Button_01.jpg");
            btn_play.Image       = Image.FromFile(Gamepath);
            Gamepath             = System.IO.Path.GetFullPath("../Domino-s-Pizza-C/" + actualVersion + "/Imagens/Button_02.jpg");
            btn_mod.Image        = Image.FromFile(Gamepath);
            Gamepath             = System.IO.Path.GetFullPath("../Domino-s-Pizza-C/" + actualVersion + "/Imagens/Background.jpg");
            this.BackgroundImage = Image.FromFile(Gamepath);
            Gamepath             = System.IO.Path.GetFullPath("../Domino-s-Pizza-C/" + actualVersion + "/Imagens/Icone.ico");
            this.Icon            = new Icon(Gamepath);
            MessageBox.Show("Mod " + actualVersion + " selecionado.");

            System.Media.SoundPlayer backmusic = new System.Media.SoundPlayer("../Domino-s-Pizza-C/" + actualVersion + "/Imagens/Backmusic.wav");
            backmusic.PlayLooping();
            //sbackmusic.Play();
        }
Exemplo n.º 30
0
        uint score         = 0;                   //分數

        public Form1()
        {
            InitializeComponent();
            block_type      = (uint)rander.Next(0, 7) + 1; //產生1~7之間的亂數
            block_type_pre  = block_type;                  //因為是第一個,所以指定為跟現在一樣的類型
            block_type_next = block_type;                  //因為是第一個,所以沒有之後的類型

            for (int i = 0; i < 20; i++)                   //遊戲範圍 黑框
            {
                for (int j = 0; j < 10; j++)
                {
                    grids[i, j]             = new Label();
                    grids[i, j].Width       = 30;                      //方塊寬度
                    grids[i, j].Height      = 30;                      //方塊高度
                    grids[i, j].BorderStyle = BorderStyle.FixedSingle; //單行邊線
                    grids[i, j].BackColor   = Color.Black;             //顏色為黑色
                    grids[i, j].Left        = 150 + 30 * j;
                    grids[i, j].Top         = 600 - i * 30;
                    grids[i, j].Visible     = true;
                    this.Controls.Add(grids[i, j]);
                }
            }

            for (int i = 0; i < 4; i++)//提示框範圍 白框
            {
                for (int j = 0; j < 3; j++)
                {
                    next[i, j]             = new Label();
                    next[i, j].Width       = 20;
                    next[i, j].Height      = 20;
                    next[i, j].BorderStyle = BorderStyle.FixedSingle;
                    next[i, j].BackColor   = Color.White;
                    next[i, j].Left        = 515 + 20 * j;
                    next[i, j].Top         = 150 - i * 20;
                    next[i, j].Visible     = true;
                    this.Controls.Add(next[i, j]);
                }
            }

            init_game();

            System.Media.SoundPlayer player = new System.Media.SoundPlayer();//音效
            player.SoundLocation = "xblocks.wav";
            player.Load();
            player.PlayLooping();
        }
Exemplo n.º 31
0
 /// <summary>
 /// Play a sound
 /// </summary>
 /// <param name="audioPath"></param>
 public void playSound(bool loop)
 {
     try
     {
         _soundPlayer.Play();
         if (loop == true)
         {
             _soundPlayer.PlayLooping();
             _playing = true;
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine($"Error playing Sound File: {_audioFile} \n");
         Console.WriteLine(ex.Message);
     }
 }
Exemplo n.º 32
0
        public Form1()
        {
            InitializeComponent();
            block_type      = (uint)rander.Next(0, 7) + 1;
            block_type_pre  = block_type;
            block_type_next = block_type;
            // generate 20x10 labels for "main" area, dynamically.
            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    grids[i, j]             = new Label();
                    grids[i, j].Width       = 30;
                    grids[i, j].Height      = 30;
                    grids[i, j].BorderStyle = BorderStyle.FixedSingle;
                    grids[i, j].BackColor   = Color.Black;
                    grids[i, j].Left        = 150 + 30 * j;
                    grids[i, j].Top         = 600 - i * 30;
                    grids[i, j].Visible     = true;
                    this.Controls.Add(grids[i, j]);
                }
            }
            // generate 4x3 labels for "next" area, dynamically.
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    next[i, j]             = new Label();
                    next[i, j].Width       = 20;
                    next[i, j].Height      = 20;
                    next[i, j].BorderStyle = BorderStyle.FixedSingle;
                    next[i, j].BackColor   = Color.White;
                    next[i, j].Left        = 515 + 20 * j;
                    next[i, j].Top         = 150 - i * 20;
                    next[i, j].Visible     = true;
                    this.Controls.Add(next[i, j]);
                }
            }
            // init variables of the game
            init_game();

            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = "xblocks.wav";
            player.Load();
            player.PlayLooping();
        }
Exemplo n.º 33
0
        static public void Woods(CharacterClass character) // Done
        {
            Console.ForegroundColor = ConsoleColor.Gray;


            character.SpecialAttackCounter = 3;
            bool   battleOutcome = false;
            string keepMoving;
            Random rand1        = new Random();
            int    creatureType = rand1.Next(1, 4);

            Console.WriteLine("Going out in the woods to find a monster.");
            Console.ReadKey();

            int monsterSize = rand1.Next(1, 4);


            Console.WriteLine("Look ahead... You see a monster.. ");
            Console.ReadKey();
            Console.Clear();
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = Environment.CurrentDirectory + @"\Woods.wav";
            player.PlayLooping();
            Console.ForegroundColor = ConsoleColor.White;
            Creature monster = new Creature(monsterSize, creatureType);

            battleOutcome = Battle(monster, character, 1);
            if (battleOutcome)
            {
                Console.WriteLine("Do you want to go deeper in the woods?? (y/n)"); // kanske hoppar över denna checken och så får han möta en ny direkt..
                keepMoving = Console.ReadLine();
                if (keepMoving == "y")
                {
                    Console.WriteLine("get ready..");
                    Woods(character);
                }
                else
                {
                    Console.WriteLine("you seem nervous, you should probably head back to the city...");
                    Console.Read();
                    Console.Clear();
                }
            }
            player.Stop();
        }
Exemplo n.º 34
0
        public void Call()
        {
            try
            {
                //Get the IP we want to call.
                //otherPartyIP = new IPEndPoint(IPAddress.Parse(txtCallToIP.Text), 1450);
                string ipAddress = Program.secConv.listView1.SelectedItems[0].SubItems[1].Text.ToString();
                otherPartyIP = new IPEndPoint(IPAddress.Parse(ipAddress), 14450);
                otherPartyEP = (EndPoint)otherPartyIP;

                //Get the vocoder to be used.

                /* if (cmbCodecs.SelectedText == "A-Law")
                 * {
                 *   vocoder = Vocoder.ALaw;
                 * }
                 * else if (cmbCodecs.SelectedText == "u-Law")
                 * {
                 *   vocoder = Vocoder.uLaw;
                 * }
                 * else if (cmbCodecs.SelectedText == "None")*/
                {
                    vocoder = Vocoder.None;
                }

                //Send an invite message.
                char   comm    = (char)10;
                string message = comm + " " + Program.userLogin + " " + vocoder + " <EOF>";

                SendMessage(message, otherPartyEP);
                player        = new System.Media.SoundPlayer();
                player.Stream = Properties.Resources.Wait;
                player.PlayLooping();

                //if (callOut.ShowDialog(Program.secConv) == DialogResult.No)
                //{
                //    message = (char)6 + " <EOF>"; //FAIL
                //    SendMessage(message, otherPartyEP);
                //}
            }
            catch (Exception)
            {
                MessageBox.Show("Wystąpił problem z nawiązaniem połączenia!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 35
0
 //methods to play different song types
 public static void PlayWAV(String Location, Boolean Repeat)
 {
     //Declare player as a new SoundPlayer with SoundLocation as the sound location
     System.Media.SoundPlayer player = new System.Media.SoundPlayer(Location);
     //If the user has Repeat equal to true
     if (Repeat == true)
     {
         //Play the sound continuously
         player.PlayLooping();
     }
     else
     {
         //Play the sound once
         player.Play();
         System.Media.SystemSound sound = System.Media.SystemSounds.Beep;
         sound.Play();
     }
 }
Exemplo n.º 36
0
        /// <summary>
        /// Jakmile je upozornění načteno, tak se zapne alarm a pro danou událost se nastaví, že na ni bylo upozorněno, v případě narozenin se upozornění posune o rok
        /// </summary>
        private void Upozorneni_Load(object sender, EventArgs e)
        {
            Prehravac.PlayLooping();
            Databaze db = new Databaze();

            if (Typ != (int)Obecne.UdalostiTypy.narozeniny)
            {
                db.Dotaz("UPDATE udalosti SET Upozorneno=" + ((int)Obecne.UpozorneniTypy.upozornenoAutomaticky).ToString() + " WHERE ID=" + Udalost.ToString() + " AND Upozorneno=" + ((int)Obecne.UpozorneniTypy.upozornitAutomaticky).ToString() + ";");
                db.Dotaz("UPDATE udalosti SET Upozorneno=" + ((int)Obecne.UpozorneniTypy.upozornenoVlastni).ToString() + " WHERE ID=" + Udalost.ToString() + " AND Upozorneno=" + ((int)Obecne.UpozorneniTypy.upozornitVlastni).ToString() + ";");
            }
            else
            {
                db.Dotaz("UPDATE udalosti SET Upozorneni=DATE_ADD(Upozorneni, INTERVAL 1 YEAR) WHERE ID=" + Udalost.ToString() + ";");
                comboBoxPosun.Items.Remove("Hodinu");
                comboBoxPosun.Items.Remove("Rok");
            }
            db.Close();
        }
Exemplo n.º 37
0
        // キャラ選択画面
        private void Form1_Load(object sender, EventArgs e)
        {
            // ループBGMの再生開始
            selectBGM          = new SpStream(Properties.Resources.BGMselect1);
            selectBGM.Volume   = mm.Volume;
            sliderVolume.Value = mm.Volume;
            selectBGMplayer    = new System.Media.SoundPlayer(selectBGM);
            selectBGMplayer.PlayLooping();

            // カーソルをオリジナルのものに変更
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            Cursor myCursor = new Cursor(asm.GetManifestResourceStream(asm.GetName().Name + ".Resources.hand_cursor.cur"));

            this.Cursor = myCursor;

            // キャラクタの初期化
            mm.chara = 0;
        }
Exemplo n.º 38
0
        public Form1()
        {
            InitializeComponent();

            //Sets all labels that track user progress to 0.
            lblAttempt.Text = "0";
            lblCorrect.Text = "0";
            lblWrong.Text = "0";
            lblPercent.Text = "0%";
            lblAnswer.Text = "";

            //Names the form.
            this.Text = "Rondinelli - Math";

            //Plays music and loops.
            System.Media.SoundPlayer music = new System.Media.SoundPlayer(@"01-main-theme-overworld.wav");
            music.PlayLooping();
            music.Play();
        }
Exemplo n.º 39
0
        // Start serving up frames
        private void StartWebcam(Webcam cam, ConnectionManager conManager, StreamWriter sw, ImageCodecInfo myImageCodecInfo, EncoderParameters myEncoderParameters)
        {
            MemoryStream m = new MemoryStream(20000);
            Bitmap image = null;
            IntPtr ip = IntPtr.Zero;
            Font fontOverlay = new Font("Times New Roman", 14, System.Drawing.FontStyle.Bold,
                System.Drawing.GraphicsUnit.Point);
            MotionDetector motionDetector = new MotionDetector();
            DateTime lastMotion = DateTime.Now;
            int interval = 5;

            stopCondition = false;
            isRecording = false;
            player = new System.Media.SoundPlayer();

            motionDetector.MotionLevelCalculation = true;
            player.LoadCompleted += new System.ComponentModel.AsyncCompletedEventHandler((obj, arg) => player.PlayLooping());

            cam.Start();

            while (!stopCondition)
            {
                try
                {
                    // capture image
                    ip = cam.GetBitMap();
                    image = new Bitmap(cam.Width, cam.Height, cam.Stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, ip);
                    image.RotateFlip(RotateFlipType.RotateNoneFlipY);
                    
                    motionDetector.ProcessFrame(ref image);
                   
                    if (motionDetector.MotionLevel >= alarmLevel)
                    {
                        if (!isRecording && (DateTime.Now.Second % interval == 0))
                            conManager.SendMessage("record");

                        lastMotion = DateTime.Now;
                    }
                    else
                    {
                        if (DateTime.Now.Subtract(lastMotion).Seconds > interval)
                        {
                            if (isRecording)
                            {
                                conManager.SendMessage("stop-record");
                                isRecording = false;
                            }
                            if (isAlarming)
                            {
                                player.Stop();
                                isAlarming = false;
                            }
                        }
                    }

                    // add text that displays date time to the image
                    image.AddText(fontOverlay, 10, 10, DateTime.Now.ToString());

                    // save it to jpeg using quality options
                    image.Save(m, myImageCodecInfo, myEncoderParameters);
                    
                    // send the jpeg image if server requests it
                    if (requested)
                        conManager.SendImage(m);
                }
                catch (Exception ex)
                {
                    try
                    {
                        sw.WriteLine(DateTime.Now.ToString());
                        sw.WriteLine(ex);
                    }
                    catch { }
                }
                finally
                {
                    // Empty the stream
                    m.SetLength(0);

                    // remove the image from memory
                    if (image != null)
                    {
                        image.Dispose();
                        image = null;
                    }

                    if (ip != IntPtr.Zero)
                    {
                        Marshal.FreeCoTaskMem(ip);
                        ip = IntPtr.Zero;
                    }
                }
            }
            
            cam.Pause();
            player.Stop();
            fontOverlay.Dispose();
        }
Exemplo n.º 40
0
 public void alarm()
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.mtl);
     player.Load();
     player.PlayLooping();
 }
Exemplo n.º 41
0
 public void Musicapresentacion()
 {
     musicapre = new System.Media.SoundPlayer("musicaconecta4/jugarnormal.wav");
     musicapre.PlayLooping();
     MusicaON = true;
 }
Exemplo n.º 42
0
 public void playSound(string soundName, bool looping)
 {
     string path = "..\\..\\Resources\\sounds\\" + soundName + ".wav";
     var sound = new System.Media.SoundPlayer(path);
     if (looping)
     {
         sound.PlayLooping();
     }
     else
     {
         sound.Play();
     }
 }
Exemplo n.º 43
0
 private void ToPaly()
 {
     string Sound = Application.StartupPath + "\\扫书成功.wav";
     //clsPalyWave.Play(Sound);
     System.Media.SoundPlayer sndPlayer = new System.Media.SoundPlayer(Sound);
     sndPlayer.PlayLooping();
     Tpaly.Abort();
 }
Exemplo n.º 44
0
 private void Music(bool turn_on)
 {
     string soundsRoot = "music";
     Random rand = new Random();
     var soundFiles = Directory.GetFiles(soundsRoot, "*.wav");
     var playSound = soundFiles[rand.Next(0, soundFiles.Length)];
     player = new System.Media.SoundPlayer(playSound);
     if (turn_on)
     {
         player.PlayLooping();
     }
     else
     {
         player.Stop();
     }
 }
Exemplo n.º 45
0
 /*------------------------------------------
  * MUSICA ROCKY
  * Fecha inicio: 18/11/2010
  * Última modificación: 01/12/2010
  * ---------------------------------------*/
 static void Musicarocky()
 {
     musicarocky = new System.Media.SoundPlayer(ubicacion + "rock2.wav");
     musicarocky.PlayLooping();
 }
Exemplo n.º 46
0
 /*------------------------------------------
  * MUSICA MENU
  * Fecha inicio: 18/11/2010
  * Última modificación: 01/12/2010
  * ---------------------------------------*/
 static void Musicamenu()
 {
     musicamenu = new System.Media.SoundPlayer(ubicacion + "menu.wav");
     musicamenu.PlayLooping();
 }
Exemplo n.º 47
0
 /*------------------------------------------
  * MUSICA QUE SALE CUANDO JUEGAS, ALEATORIA ENTRE 6 CANCIONES
  * Fecha inicio: 18/11/2010
  * Última modificación: 01/12/2010
  * ---------------------------------------*/
 static void Musicajugar(Random elegir)
 {
     int musica;
     musica = elegir.Next(0, 6);
     switch (musica)
     {
         case 1:
             musicajugar = new System.Media.SoundPlayer(ubicacion + "jugarnormal2.wav");
             break;
         case 2:
             musicajugar = new System.Media.SoundPlayer(ubicacion + "jugarnormal.wav");
             break;
         case 3:
             musicajugar = new System.Media.SoundPlayer(ubicacion + "jugarbond.wav");
             break;
         case 4:
             musicajugar = new System.Media.SoundPlayer(ubicacion + "jugarkarate.wav");
             break;
         case 5:
             musicajugar = new System.Media.SoundPlayer(ubicacion + "jugarryu.wav");
             break;
         default:
             musicajugar = new System.Media.SoundPlayer(ubicacion + "jugarnormal3.wav");
             break;
     }
     musicajugar.PlayLooping();
 }
Exemplo n.º 48
0
 /*------------------------------------------
  * MUSICA FINAL
  * Fecha inicio: 18/11/2010
  * Última modificación: 01/12/2010
  * ---------------------------------------*/
 static void Musicaganador()
 {
     musicaganador = new System.Media.SoundPlayer(ubicacion + "ganar_1.wav");
     musicaganador.PlayLooping();
 }
Exemplo n.º 49
0
 //private static AxWMPLib.AxWindowsMediaPlayer mediaPlayer = null;
 //private static int mediaPlayerLoop = 1;
 //声音播放
 //public static void playSound(AxWMPLib.AxWindowsMediaPlayer mediaPlayerT,String url,int loopCount)
 //{
 //    mediaPlayer = mediaPlayerT;
 //    mediaPlayer.PlayStateChange -= instance.mediaPlayer_PlayStateChange;
 //    mediaPlayer.PlayStateChange += instance.mediaPlayer_PlayStateChange;
 //    mediaPlayerLoop = loopCount;
 //    if (mediaPlayerLoop != 0)
 //    {
 //        mediaPlayer.URL = url;
 //    }
 //}
 //private void mediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
 //{
 //    if (e.newState == 1)
 //    {
 //        if (mediaPlayerLoop < 0)
 //        {
 //            Console.WriteLine("===============restart===============");
 //            mediaPlayer.Ctlcontrols.play();
 //        }
 //        else
 //        {
 //            mediaPlayerLoop--;
 //            if (mediaPlayerLoop > 0)
 //            {
 //                mediaPlayer.Ctlcontrols.play();
 //            }
 //        }
 //    }
 //}
 public static void playSound(String sound)
 {
     System.Media.SoundPlayer sndPlayer = new System.Media.SoundPlayer(sound);
     sndPlayer.PlayLooping(); 
 }
Exemplo n.º 50
0
        private void ScreenSaverForm_Load(object sender, EventArgs e)
        {
            // Use double buffering to improve drawing performance
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);

            if (m_parentWindowHandle == IntPtr.Zero)
            {
                // Screen saver is in full screen mode (i.e., not the preview window) - make form span all available system screens
                Left = ScreenArea.LeftMostBound;
                Top = ScreenArea.TopMostBound;
                Width = ScreenArea.TotalWidth;
                Height = ScreenArea.TotalHeight;
                TopMost = true;

                // Capture the mouse
                Capture = true;

                // Hide the mouse
                Cursor.Hide();
            }
            else
            {
                // Screen saver is in the preview window, set the new parent window
                WinAPI.SetParent(Handle, m_parentWindowHandle);

                // Make this a child window
                WinAPI.SetWindowLong(Handle, WinAPI.GWL_STYLE,
                    WinAPI.GetWindowLong(Handle, WinAPI.GWL_STYLE) | WinAPI.WS_CHILD);

                // Get the parent window size
                Rectangle rect;
                WinAPI.GetClientRect(m_parentWindowHandle, out rect);
                Size = rect.Size;
                Location = new Point(0, 0);
            }

            // Draw background from screen shot
            Bitmap bmpScreenshot = new Bitmap(ScreenArea.TotalWidth, ScreenArea.TotalHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
            gfxScreenshot.CopyFromScreen(ScreenArea.LeftMostBound, ScreenArea.TopMostBound, 0, 0, ScreenArea.RectangleMostBound.Size, CopyPixelOperation.SourceCopy);
            BackgroundImage = bmpScreenshot;

            // Codes only run when not in preview mode
            if (!Global.IsPreviewMode)
            {
                // Set opacity
                Opacity = Settings.BackgroundOpacity;

                // Try to play background music if exist
                if (System.IO.File.Exists(BG_MUSIC))
                    try
                    {
                        System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                        player.SoundLocation = BG_MUSIC;
                        player.PlayLooping();
                    }
                    catch (Exception) { }

                // Create JX3 Form
                for (int i = Screen.AllScreens.GetLowerBound(0); i <= Screen.AllScreens.GetUpperBound(0); i++)
                {
                    int index = i;
                    (new System.Threading.Thread(delegate() { System.Windows.Forms.Application.Run(new JX3ClientForm(index)); })).Start();
                }
            }

            // Record current mouse position
            m_mouseLocation = Control.MousePosition;

            // Set Timer
            DrawingTimer.Interval = Settings.CreateInterval;
            DrawingTimer.Enabled = !Global.IsPreviewMode;
        }
Exemplo n.º 51
0
 public void MusicaGanar()
 {
     musicapre = new System.Media.SoundPlayer("musicaconecta4/ganar.wav");
     musicapre.PlayLooping();
 }
Exemplo n.º 52
0
 /*------------------------------------------
  * MUSICA SUPERMAN
  * Fecha inicio: 18/11/2010
  * Última modificación: 01/12/2010
  * ---------------------------------------*/
 static void Musicasuper()
 {
     musicasuper = new System.Media.SoundPlayer(ubicacion + "superman.wav");
     musicasuper.PlayLooping();
 }
Exemplo n.º 53
0
 private void Home_Load(object sender, EventArgs e)
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer(path + @"\Sound\TitleSound.wav");
     player.PlayLooping();
 }
Exemplo n.º 54
0
Arquivo: SE.cs Projeto: Jkank/sister
        /* ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ */
        /* ■ 関数名:PlayBGM                     ■ */
        /* ■ 内容:BGMを鳴動する処理					         ■ */
        /* ■ 入力:wavefilename                                ■ */
        /* ■ 出力:		                                     ■ */
        /* ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ */
        //WAVEファイルを再生する
        private static void PlayBGM(string wavefilename)
        {
            System.IO.UnmanagedMemoryStream music;
            music = GetwaveFile(wavefilename);
            //再生されているときは止める
            if (player != null)
                StopSound();

            //読み込む
            player = new System.Media.SoundPlayer(music);
            //ループ再生する(DON'T KNOW 非同期とは?)
            player.PlayLooping();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var path = System.IO.Path.Combine(
              System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
             , "主畫面final.wav");
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(path);

            //player.Stream = Properties.Resources.主畫面_final;
            try
            {
                //player.Load();
                player.PlayLooping();
            }
            catch (System.IO.FileNotFoundException err)
            {
                MessageBox.Show("找不到音效檔" + err.FileName);
            }
            catch (InvalidOperationException err)
            {
                MessageBox.Show("播放發生錯誤:" + err.Message);
            }
        }
Exemplo n.º 56
0
        public void playWav(int type)
        {
            m_wavfile = new System.Media.SoundPlayer();
            switch(type)
            {
                case 0: //Dclone
                    if (textBox2.Text.Equals(""))
                    {
                        m_wavfile.Stream = Properties.Resources.death1;
                    }
                    else if (textBox2.Text != null)
                    {
                        wavFile = textBox2.Text;
                        m_wavfile.SoundLocation = wavFile;
                    }
                    try
                    {
                        if (checkBox5.Checked == true && !_paused)
                        {
                            if (radioButton3.Checked)
                            {
                                m_wavfile.PlayLooping();
                            }
                            else if (radioButton4.Checked)
                            {
                                m_wavfile.Play();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    break;

                case 1 : //Hostile               
                    if (textBox6.Text.Equals(""))
                    {
                        m_wavfile.Stream = Properties.Resources.death1;
                    }
                    else if (textBox6.Text != null)
                    {
                        wavFile = textBox6.Text;

                        m_wavfile.SoundLocation = wavFile;
                    }
                    try
                    {
                        if (checkBox6.Checked == true && !_paused)
                        {
                            if (radioButton3.Checked)
                            {
                                m_wavfile.PlayLooping();
                            }
                            else if (radioButton4.Checked)
                            {
                                m_wavfile.Play();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    break;

                case 2 : //Embedded Moo
                    try
                    {
                        m_wavfile.Stream = Properties.Resources.death1;

                        if (radioButton3.Checked)
                        {
                            m_wavfile.PlayLooping();
                        }
                        else if (radioButton4.Checked)
                        {
                            m_wavfile.Play();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    break;

                case 3: //Embedded Beep
                    try
                    {
                        m_wavfile.Stream = Properties.Resources.beep;

                        if (radioButton3.Checked)
                        {
                            m_wavfile.PlayLooping();
                        }
                        else if (radioButton4.Checked)
                        {
                            m_wavfile.Play();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    break;
            }
        }
Exemplo n.º 57
0
 /*------------------------------------------
  * MUSICA QUE SALE CUANDO JUEGAS 1VS1, ALEATORIA ENTRE 3 CANCIONES
  * Fecha inicio: 18/11/2010
  * Última modificación: 01/12/2010
  * ---------------------------------------*/
 static void Musica1vs1(Random elegir)
 {
     int musica;
     musica = elegir.Next(1, 4);
     switch (musica)
     {
         case 1:
             musicajugar1vs1 = new System.Media.SoundPlayer(ubicacion + "1vs1wars.wav");
             break;
         case 2:
             musicajugar1vs1 = new System.Media.SoundPlayer(ubicacion + "1vs1exc.wav");
             break;
         default:
             musicajugar1vs1 = new System.Media.SoundPlayer(ubicacion + "1vs1ev.wav");
             break;
     }
     musicajugar1vs1.PlayLooping();
 }
 private void Notification_Load(object sender, EventArgs e)
 {
     player = new System.Media.SoundPlayer("beep.wav");
     player.PlayLooping();
 }
Exemplo n.º 59
0
 private void startTask(int posicion, bool turn_on)
 {
     if (posicion != -1)
     {
         int output = Convert.ToInt32(Math.Pow(2, posicion));
         int total = PortControl.PortControl.Input(888);
         if (turn_on)
         {
             if (((byte)PortControl.PortControl.Input(888) & (byte)output) == (byte)0)
                 PortControl.PortControl.Output(888, total + output);
         }
         else
             if (((byte)PortControl.PortControl.Input(888) & (byte)output) == output)
                 PortControl.PortControl.Output(888, total - output);
     }
     else
     {
         string soundsRoot = "music";
         Random rand = new Random();
         var soundFiles = Directory.GetFiles(soundsRoot, "*.wav");
         var playSound = soundFiles[rand.Next(0, soundFiles.Length)];
         player = new System.Media.SoundPlayer(playSound);
         player.PlayLooping();
         if (turn_on)
         {
             player.PlayLooping();
         }
         else {
             player.Stop();
         }
     }
 }
Exemplo n.º 60
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.Stream = Properties.Resources.主畫面_final;
     try
     {
         //player.Load();
         player.PlayLooping();
     }
     catch (System.IO.FileNotFoundException err)
     {
         MessageBox.Show("找不到音效檔" + err.FileName);
     }
     catch (InvalidOperationException err)
     {
         MessageBox.Show("播放發生錯誤:" + err.Message);
     }
 }