Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public void Test_New()
        {
            var ply = new SoundPlayer ();

            Assert.AreEqual (0, ply.ClipCount);
            Assert.AreEqual (0, ply.Clips.Count ());
        }
Exemplo n.º 2
0
        private void InitializeButtonEvents()
        {
            DialogShowButton.ButtonAction += (sender, e) =>
            {
                CustomDialog dialog = new CustomDialog();
                dialog.Show();
            };

            PopupListShowButton.ButtonAction += (sender, e) =>
            {
                Sound se = new Sound("/Application/assets/GAME_SE_01.wav");
                sp = se.CreatePlayer();
                sp.Play();
            };

            bgmButton.ButtonAction += (sender, e) =>
            {
                if (!bgm_play)
                {
                    bp.Play();
                    bgmButton.Text = "BGMStop";
                }
                else
                {
                    bp.Pause();
                    bgmButton.Text = "BGMPlay";
                }
                bgm_play = !bgm_play;
            };
        }
Exemplo n.º 3
0
 public int linie()
 {
     int ile = wysokosc - 1;
     int i;
     int liczba = 0;
     bool linia = true;
     while (ile > 0 && liczba < 4)
     {
         for (i = 0; i < szerokosc; i++)
             if (!tablica[i, ile].spr())
                 linia = false;
         if (linia)
         {
             liczba++;
             for (int k = ile - 1; k >= 0; k--)
                 przesun(k);
             Assembly assembly;
             SoundPlayer dzwiek;
             assembly = Assembly.GetExecutingAssembly();
             dzwiek = new SoundPlayer(assembly.GetManifestResourceStream("projekt.bridge2.wav"));
             dzwiek.Play();
         }
         else ile--;
         linia = true;
     }
     return liczba;
 }
Exemplo n.º 4
0
        public static void InitSound()
        {
            stage1 = new Bgm("/Application/resourses/stage1.mp3");
            stage1boss = new Bgm("/Application/resourses/stage1boss.mp3");
            title = new Bgm("/Application/resourses/title.mp3");
            gameover = new Bgm("/Application/resourses/gameover.mp3");

            bgmPlayer = stage1.CreatePlayer();

            sound = new Sound("/Application/resourses/shot.wav");
            shot = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/hidan.wav");
            hidan = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/siren.wav");
            siren = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/stageClear.wav");
            stageClear = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/system1.wav");
            ok = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/system2.wav");
            cancel = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/damage.wav");
            tekihidan = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/skillSE1.wav");
            skill1 = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/skillSE2.wav");
            skill2 = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/stageClear.wav");
            stageClear = sound.CreatePlayer();
            sound = new Sound("/Application/resourses/tick.wav");
            ticktuck = sound.CreatePlayer();
        }
 private void PlatformInitialize(byte[] buffer, int sampleRate, int channels)
 {            
     var audioData = AudioUtil.FormatWavData(buffer, sampleRate, channels);
     _audioBuffer = new Sound(audioData);
         
     _soundPlayer = _audioBuffer.CreatePlayer();
 }
Exemplo n.º 6
0
 public static void MakePoints()
 {
     string pointsPath = @"Sounds\MakePoint3.wav";
     using (SoundPlayer makePoint3 = new SoundPlayer(Path.Combine(path,pointsPath)))
         {
             makePoint3.Play();
         }
 }
Exemplo n.º 7
0
 public static void HitCenter()
 {
     string hitPath = @"Sounds\CenterHit.wav";
     using (SoundPlayer centerHit = new SoundPlayer(Path.Combine(path, hitPath)))
     {
         centerHit.Play();
     }
 }
Exemplo n.º 8
0
 public static void Clapping()
 {
     string clapPath = @"Sounds\Clapping.wav";
     using (SoundPlayer clapSound = new SoundPlayer(Path.Combine(path, clapPath)))
     {
         clapSound.Play();
     }
 }
Exemplo n.º 9
0
 public static void WallHit()
 {
     string wallPath = @"Sounds\Wall.wav";
     using (SoundPlayer wallHit = new SoundPlayer(Path.Combine(path,wallPath)))
     {
         wallHit.Play();
     }
 }
Exemplo n.º 10
0
 public static void WinThreeSets()
 {
     string hitPath = @"Sounds\WinWholeGame.wav";
     using (SoundPlayer winThreeSets = new SoundPlayer(Path.Combine(path, hitPath)))
     {
         winThreeSets.Play();
     }
 }
Exemplo n.º 11
0
 public void Play(string s, bool bAsync)
 {
     pl=new SoundPlayer(s);
     if (bAsync)
         pl.Play();
     else
         pl.PlaySync();
 }
Exemplo n.º 12
0
 public static void PadHit()
 {
     string ballPath = @"Sounds\Ball.wav";
     using (SoundPlayer padHit = new SoundPlayer(Path.Combine(path,ballPath)))
     {
         padHit.Play();
     }
 }
Exemplo n.º 13
0
    public SoundControl()
    {
        sound = new SoundPlayer();
        mainSound = new WMPLib.WindowsMediaPlayer();
        mainSound.URL = "1.mp3";
        mainSound.settings.setMode("loop", true);
        sound.SoundLocation = "2.wav";

    }
Exemplo n.º 14
0
	void Awake(){
		source = GetComponent<AudioSource>();

		if (Instance == null) {
			Instance = this;
		}else{
			throw new System.InvalidOperationException("Can not have multiple instances of ConfigurableInput");
		}
	}
Exemplo n.º 15
0
        /// <summary>
        /// Initialize sound manager
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            this.random = WaveServices.Random;
            this.soundPlayer = WaveServices.SoundPlayer;

            this.bank = new SoundBank(this.Assets) { MaxConcurrentSounds = 40 };
            this.soundPlayer.RegisterSoundBank(this.bank);

            this.LoadSounds();
        }
Exemplo n.º 16
0
 private void button1_Click(object sender, EventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         SoundPlayer s = new SoundPlayer(ofd.FileName);
         //s.Play();
         //s.PlayLooping(); //play on a loop
         //s.PlaySync(); //freezes the application while playing
     }
     SystemSounds.Asterisk.Play(); // SystemSounds. ..
 }
Exemplo n.º 17
0
    public void init()
    {
        soundPlayer = SoundPlayer.instance;
        WorkspaceEventManager.instance.onSoundButtonClick            += onSoundButtonClickListener;
        WorkspaceEventManager.instance.onExitFromSoundSettingsWindow += onExitFromSoundSettingsWindowListener;

        WorkspaceEventManager.instance.onSoundWindowMuteClick        += onSoundWindowMuteClickListener;
        WorkspaceEventManager.instance.onSoundWindowMusicMuteClick   += onSoundWindowMusicMuteClickListener;
        WorkspaceEventManager.instance.onSoundWindowSFXMuteClick     += onSoundWindowSFXMuteClickListener;
        WorkspaceEventManager.instance.onSoundWindowMusicLevelChange += onSoundWindowMusicLevelChangeListener;
        WorkspaceEventManager.instance.onSoundWindowSFXLevelChange   += onSoundWindowSFXLevelChangeListener;
    }
Exemplo n.º 18
0
        public void Test_AddClip()
        {
            var ply = new SoundPlayer ();
            var clip1 = new SoundClip ("PinPon.wav");
            var clip2 = new SoundClip ("nice_music.ogg");
            ply.AddClip (clip1);
            ply.AddClip (clip2);

            Assert.AreEqual (2, ply.ClipCount);
            Assert.AreEqual (2, ply.Clips.Count ());
            Assert.AreEqual (clip1, ply["PinPon.wav"]);
            Assert.AreEqual (clip2, ply["nice_music.ogg"]);
        }
Exemplo n.º 19
0
        public void Play(WaveAudio a, bool bAsync)
        {
            m = new MemoryStream();
            bw = new BinaryWriter(m);
            a.SaveWaveFile(bw);

            pl = new SoundPlayer(m);
            pl.Stream.Position = 0; // This line is necessary 

            if (bAsync)
                pl.Play();
            else
                pl.PlaySync();
        }
Exemplo n.º 20
0
        public static Node Create()
        {
            var clip = new SoundClip ("BattleScene");
            clip.AddTrack(new MusicTrack("media/BGM-BattleScene.ogg"));
            clip.Play ();
            clip.Volume = 0.5f;

            var ply = new SoundPlayer ();
            ply.AddClip (clip);

            var node = new Node ("BGM");
            node.Attach (ply);

            return node;
        }
Exemplo n.º 21
0
        private void PlatformDispose(bool disposing)
        {
		    if (disposing)
            {
                if (_soundPlayer != null)
                {
                    _soundPlayer.Stop();
                    _soundPlayer.Dispose();
                }
                if (_audioBuffer != null)
                    _audioBuffer.Dispose();
            }
            _soundPlayer = null;
            _audioBuffer = null;
            soundState = SoundState.Stopped;
        }
Exemplo n.º 22
0
 public janelaPrincipal()
     : base(Gtk.WindowType.Toplevel)
 {
     Build ();
     UsaOpcoes();
     MudaCor(opcoes[3]);
     GLib.Timeout.Add(20, new GLib.TimeoutHandler(OnTimer));
     Randomizador(ref yBolinha, ref velocidadeX, ref velocidadeY);
     TamanhoTela();
     somRaquete = new SoundPlayer("raquete.wav");
     somPonto = new SoundPlayer("ponto.wav");
     somParede = new SoundPlayer("parede.wav");
     darea.GrabFocus();
     barraStatus.Push(0, "Bem-vindo ao bPong, pressione [ENTER] para jogar!");
     pausarJogo.ShortLabel = "Pause";
 }
Exemplo n.º 23
0
	void Awake()
	{
		// If soundPlayer doesn't exist, this is it
		if (soundPlayer == null) {
			soundPlayer = this;
			DontDestroyOnLoad (this.gameObject);
			// If soundPlayer exists, destory this
		} else if (soundPlayer != this) {
			Destroy(gameObject);
		}

		soundBites = new Dictionary<string, AudioClip[]> ();
		for (int i = 0; i < audioClips.Length; i++) {
			soundBites.Add (audioClips [i].name, audioClips [i].clips);
		}

		music = GetComponent<AudioSource> ();
	}
Exemplo n.º 24
0
        public GameScene()
        {
            this.Camera.SetViewFromViewport();
            _physics = new PongPhysics();

            ball = new Ball(_physics.SceneBodies[(int)PongPhysics.BODIES.Ball]);
            _player = new Paddle(Paddle.PaddleType.PLAYER,
                                 _physics.SceneBodies[(int)PongPhysics.BODIES.Player]);
            _ai = new Paddle(Paddle.PaddleType.AI,
                             _physics.SceneBodies[(int)PongPhysics.BODIES.Ai]);
            _scoreboard = new Scoreboard();

            this.AddChild(_scoreboard);
            this.AddChild(ball);
            this.AddChild(_player);
            this.AddChild(_ai);

            // This is debug routine that will draw the physics bounding box around the players paddle
            if(DEBUG_BOUNDINGBOXS)
            {
                this.AdHocDraw += () => {
                    var bottomLeftPlayer = _physics.SceneBodies[(int)PongPhysics.BODIES.Player].AabbMin;
                    var topRightPlayer = _physics.SceneBodies[(int)PongPhysics.BODIES.Player].AabbMax;
                    Director.Instance.DrawHelpers.DrawBounds2Fill(
                        new Bounds2(bottomLeftPlayer*PongPhysics.PtoM,topRightPlayer*PongPhysics.PtoM));

                    var bottomLeftAi = _physics.SceneBodies[(int)PongPhysics.BODIES.Ai].AabbMin;
                    var topRightAi = _physics.SceneBodies[(int)PongPhysics.BODIES.Ai].AabbMax;
                    Director.Instance.DrawHelpers.DrawBounds2Fill(
                        new Bounds2(bottomLeftAi*PongPhysics.PtoM,topRightAi*PongPhysics.PtoM));

                    var bottomLeftBall = _physics.SceneBodies[(int)PongPhysics.BODIES.Ball].AabbMin;
                    var topRightBall = _physics.SceneBodies[(int)PongPhysics.BODIES.Ball].AabbMax;
                    Director.Instance.DrawHelpers.DrawBounds2Fill(
                        new Bounds2(bottomLeftBall*PongPhysics.PtoM,topRightBall*PongPhysics.PtoM));
                };
            }

            //Now load the sound fx and create a player
            _pongSound = new Sound("/Application/audio/pongblip.wav");
            _pongBlipSoundPlayer = _pongSound.CreatePlayer();

            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);
        }
Exemplo n.º 25
0
        protected override void Initialize()
        {
            base.Initialize();
            this.soundPlayer = WaveServices.SoundPlayer;

            // fill sound info
            sounds = new Dictionary<SoundType, SoundInfo>();
            sounds[SoundType.Coin] = new SoundInfo(WaveContent.Assets.Sound.coin_wav);
            sounds[SoundType.Contact] = new SoundInfo(WaveContent.Assets.Sound.contact_wav);
            sounds[SoundType.CrateDrop] = new SoundInfo(WaveContent.Assets.Sound.crateDrop_wav);
            sounds[SoundType.Crash] = new SoundInfo(WaveContent.Assets.Sound.crash_wav);
            sounds[SoundType.Jump] = new SoundInfo(WaveContent.Assets.Sound.jump_wav);
            sounds[SoundType.Victory] = new SoundInfo(WaveContent.Assets.Sound.victory_wav);

            this.bank = new SoundBank(this.Assets);
            this.soundPlayer.RegisterSoundBank(bank);
            foreach (var item in this.sounds)
            {
                this.bank.Add(item.Value);
            }
        }
Exemplo n.º 26
0
        public Speaker(RenderWindow window, VirtualMachine virtualMachine, XElement config)
        {
            var errorMsg = "";

            try
            {
                errorMsg = "Bad Port";
                devPort = short.Parse(Util.ElementValue(config, "Port", null));

                errorMsg = "Bad SampleRate";
                sampleRate = uint.Parse(Util.ElementValue(config, "SampleRate", null));

                errorMsg = "Bad UpdateFrequency";
                var updateFreq = uint.Parse(Util.ElementValue(config, "UpdateFrequency", null));
                if (updateFreq == 0)
                    throw new Exception("UpdateFrequency must be above 0");

                errorMsg = "Init failed";
                player = new SoundPlayer(sampleRate, updateFreq);

                generators = new List<ISoundGenerator>();
                generators.Add(new Square());
                generators.Add(new Square());
                generators.Add(new Sine());
                generators.Add(new Noise());

                mixer = new SoundMixer();
                generators.ForEach(mixer.AddSource);

                Reset();

                player.Source = mixer;
                player.Play();
            }
            catch (Exception e)
            {
                throw new Exception(string.Format("Speaker: {0}", errorMsg), e);
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Initialize of Scene.
        /// </summary>
        public override Scene Initialize()
        {
            //sceneはオブジェクトの追加や削除のためにも描画メソッドの外で作ったほうが良い

            scene.Camera.SetViewFromViewport();

            description = WriteString.DrawSprite("上下キー:ピッチ/左右キー:volume/L:BgmStop/R:BgmStart" +
                "/○:効果音/Start:戻る",
                                        0.5f*Const.FIX,
                                        0.5f*Const.FIX,
                                        20,
                                        new ImageColor(255,255,255,255),
                                        scene);

            //効果音のセット
            this.soundPlayer = Audio.SetEffect("/Application/sound/Bullet.wav");
            //Bgmのセット
            Audio.SetBgm("/Application/sound/GameBgm.mp3");
            Audio.StartBgm();

            return scene;
        }
Exemplo n.º 28
0
        public PhrasesPresenterIml(PhrasesView view, SoundPlayer player, Database db, int lessonNumber, State initialState)
        {
            this.view = view;
            this.player = player;
            this.db = db;
            this.lessonNumber = lessonNumber;

            player.PlayingFinished += (s, e) =>
            {
                HandlePlaySoundStopEvent ();
            //				new DelayedAction (() => {
            //					//	HandleNextEvent ();
            //				}, 5000);
                HandleTimeoutEvent ();
            };

            stateMachine = new StateMachine (this, initialState);

            var phrases = db.GetPhrasesByLesson (lessonNumber);

            enumerator = phrases.GetLoopedTwoWayEnumerator ();
            HandleNextEvent ();
        }
Exemplo n.º 29
0
 public void Bark()
 {
     var sound = new SoundPlayer(@"bark.wav");
     sound.PlaySync();
 }
Exemplo n.º 30
0
        public void OnClick_Minimize()
        {
            Debug.LogWarning("Minimize not supported on this platform!");

            SoundPlayer.PlaySound(ClickSound);
        }
        private void openButton_Click(object sender, EventArgs e)
        {
            Graphics formGraphics = this.CreateGraphics();

            SoundPlayer player = new SoundPlayer(Properties.Resources.dingSound);

            //Plays sound when card is initially opened

            player.Play();

            Thread.Sleep(900);

            //makes opening title card invisible

            openButton.Visible    = false;
            greetingLabel.Visible = false;
            nameLabel.Visible     = false;
            dateLabel.Visible     = false;

            //Clears Screen

            formGraphics.Clear(Color.Black);

            Pen        drawPen   = new Pen(Color.White, 1);
            SolidBrush drawBrush = new SolidBrush(Color.White);

            //Creates Constellation

            formGraphics.FillEllipse(drawBrush, 45, 171, 15, 15);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 65, 207, 10, 10);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 101, 194, 10, 10);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 176, 184, 30, 30);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 182, 145, 10, 10);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 204, 102, 20, 20);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 141, 139, 15, 15);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 177, 91, 12, 12);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 149, 61, 20, 20);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 102, 147, 10, 10);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);

            Thread.Sleep(500);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 65, 212, 101, 200);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 101, 200, 180, 195);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 187, 195, 188, 150);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 187, 195, 145, 145);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 188, 150, 212, 102);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 232, 78, 253, 45);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 145, 145, 104, 149);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 145, 145, 182, 91);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 180, 93, 210, 102);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 180, 93, 153, 65);

            Thread.Sleep(500);

            formGraphics.DrawLine(drawPen, 105, 150, 50, 175);

            //Plays "twinkle" sound

            SoundPlayer twinkle = new SoundPlayer(Properties.Resources.twinkle);

            twinkle.Play();

            Thread.Sleep(1600);

            //Color Change

            drawPen   = new Pen(Color.Blue);
            drawBrush = new SolidBrush(Color.Gold);

            formGraphics.FillEllipse(drawBrush, 45, 171, 15, 15);

            formGraphics.FillEllipse(drawBrush, 65, 207, 10, 10);
            formGraphics.DrawLine(drawPen, 65, 212, 101, 200);

            formGraphics.FillEllipse(drawBrush, 101, 194, 10, 10);
            formGraphics.DrawLine(drawPen, 101, 200, 180, 195);

            formGraphics.FillEllipse(drawBrush, 176, 184, 30, 30);
            formGraphics.DrawLine(drawPen, 187, 195, 188, 150);
            formGraphics.DrawLine(drawPen, 187, 195, 145, 145);

            formGraphics.FillEllipse(drawBrush, 182, 145, 10, 10);
            formGraphics.DrawLine(drawPen, 188, 150, 212, 102);

            formGraphics.FillEllipse(drawBrush, 204, 102, 20, 20);
            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);
            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);
            formGraphics.DrawLine(drawPen, 232, 78, 253, 45);

            formGraphics.FillEllipse(drawBrush, 141, 139, 15, 15);
            formGraphics.DrawLine(drawPen, 145, 145, 104, 149);
            formGraphics.DrawLine(drawPen, 145, 145, 182, 91);

            formGraphics.FillEllipse(drawBrush, 177, 91, 12, 12);
            formGraphics.DrawLine(drawPen, 180, 93, 210, 102);

            formGraphics.FillEllipse(drawBrush, 149, 61, 20, 20);
            formGraphics.DrawLine(drawPen, 180, 93, 153, 65);

            formGraphics.FillEllipse(drawBrush, 102, 147, 10, 10);
            formGraphics.DrawLine(drawPen, 105, 150, 50, 175);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);

            Thread.Sleep(200);

            //Color Change

            drawPen   = new Pen(Color.Yellow);
            drawBrush = new SolidBrush(Color.Purple);

            formGraphics.FillEllipse(drawBrush, 45, 171, 15, 15);

            formGraphics.FillEllipse(drawBrush, 65, 207, 10, 10);
            formGraphics.DrawLine(drawPen, 65, 212, 101, 200);

            formGraphics.FillEllipse(drawBrush, 101, 194, 10, 10);
            formGraphics.DrawLine(drawPen, 101, 200, 180, 195);

            formGraphics.FillEllipse(drawBrush, 176, 184, 30, 30);
            formGraphics.DrawLine(drawPen, 187, 195, 188, 150);
            formGraphics.DrawLine(drawPen, 187, 195, 145, 145);

            formGraphics.FillEllipse(drawBrush, 182, 145, 10, 10);
            formGraphics.DrawLine(drawPen, 188, 150, 212, 102);

            formGraphics.FillEllipse(drawBrush, 204, 102, 20, 20);
            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);
            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);
            formGraphics.DrawLine(drawPen, 232, 78, 253, 45);

            formGraphics.FillEllipse(drawBrush, 141, 139, 15, 15);
            formGraphics.DrawLine(drawPen, 145, 145, 104, 149);
            formGraphics.DrawLine(drawPen, 145, 145, 182, 91);

            formGraphics.FillEllipse(drawBrush, 177, 91, 12, 12);
            formGraphics.DrawLine(drawPen, 180, 93, 210, 102);

            formGraphics.FillEllipse(drawBrush, 149, 61, 20, 20);
            formGraphics.DrawLine(drawPen, 180, 93, 153, 65);

            formGraphics.FillEllipse(drawBrush, 102, 147, 10, 10);
            formGraphics.DrawLine(drawPen, 105, 150, 50, 175);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);

            Thread.Sleep(200);

            //Color Change

            drawPen   = new Pen(Color.LimeGreen);
            drawBrush = new SolidBrush(Color.RoyalBlue);

            formGraphics.FillEllipse(drawBrush, 45, 171, 15, 15);

            formGraphics.FillEllipse(drawBrush, 65, 207, 10, 10);
            formGraphics.DrawLine(drawPen, 65, 212, 101, 200);

            formGraphics.FillEllipse(drawBrush, 101, 194, 10, 10);
            formGraphics.DrawLine(drawPen, 101, 200, 180, 195);

            formGraphics.FillEllipse(drawBrush, 176, 184, 30, 30);
            formGraphics.DrawLine(drawPen, 187, 195, 188, 150);
            formGraphics.DrawLine(drawPen, 187, 195, 145, 145);

            formGraphics.FillEllipse(drawBrush, 182, 145, 10, 10);
            formGraphics.DrawLine(drawPen, 188, 150, 212, 102);

            formGraphics.FillEllipse(drawBrush, 204, 102, 20, 20);
            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);
            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);
            formGraphics.DrawLine(drawPen, 232, 78, 253, 45);

            formGraphics.FillEllipse(drawBrush, 141, 139, 15, 15);
            formGraphics.DrawLine(drawPen, 145, 145, 104, 149);
            formGraphics.DrawLine(drawPen, 145, 145, 182, 91);

            formGraphics.FillEllipse(drawBrush, 177, 91, 12, 12);
            formGraphics.DrawLine(drawPen, 180, 93, 210, 102);

            formGraphics.FillEllipse(drawBrush, 149, 61, 20, 20);
            formGraphics.DrawLine(drawPen, 180, 93, 153, 65);

            formGraphics.FillEllipse(drawBrush, 102, 147, 10, 10);
            formGraphics.DrawLine(drawPen, 105, 150, 50, 175);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);

            Thread.Sleep(200);

            //Color Change

            drawPen   = new Pen(Color.Blue);
            drawBrush = new SolidBrush(Color.Gold);

            formGraphics.FillEllipse(drawBrush, 45, 171, 15, 15);

            formGraphics.FillEllipse(drawBrush, 65, 207, 10, 10);
            formGraphics.DrawLine(drawPen, 65, 212, 101, 200);

            formGraphics.FillEllipse(drawBrush, 101, 194, 10, 10);
            formGraphics.DrawLine(drawPen, 101, 200, 180, 195);

            formGraphics.FillEllipse(drawBrush, 176, 184, 30, 30);
            formGraphics.DrawLine(drawPen, 187, 195, 188, 150);
            formGraphics.DrawLine(drawPen, 187, 195, 145, 145);

            formGraphics.FillEllipse(drawBrush, 182, 145, 10, 10);
            formGraphics.DrawLine(drawPen, 188, 150, 212, 102);

            formGraphics.FillEllipse(drawBrush, 204, 102, 20, 20);
            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);
            formGraphics.DrawLine(drawPen, 216, 102, 232, 78);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);
            formGraphics.DrawLine(drawPen, 232, 78, 253, 45);

            formGraphics.FillEllipse(drawBrush, 141, 139, 15, 15);
            formGraphics.DrawLine(drawPen, 145, 145, 104, 149);
            formGraphics.DrawLine(drawPen, 145, 145, 182, 91);

            formGraphics.FillEllipse(drawBrush, 177, 91, 12, 12);
            formGraphics.DrawLine(drawPen, 180, 93, 210, 102);

            formGraphics.FillEllipse(drawBrush, 149, 61, 20, 20);
            formGraphics.DrawLine(drawPen, 180, 93, 153, 65);

            formGraphics.FillEllipse(drawBrush, 102, 147, 10, 10);
            formGraphics.DrawLine(drawPen, 105, 150, 50, 175);

            formGraphics.FillEllipse(drawBrush, 251, 41, 10, 10);

            formGraphics.FillEllipse(drawBrush, 227, 78, 10, 10);

            Thread.Sleep(200);

            //Plays "Whoop" Sound

            SoundPlayer sounds = new SoundPlayer(Properties.Resources.whoop);

            sounds.Play();

            Graphics fg = this.CreateGraphics();

            Font       drawFont  = new Font("Courier Serif", 9, FontStyle.Bold);
            SolidBrush fontBrush = new SolidBrush(Color.HotPink);

            //Writes text explain constellation

            fg.DrawString("Virgo is one of the constellations of the zodiac.", drawFont, fontBrush, 5, 350);
            fg.DrawString("It's name is Latin for 'virgin', and its symbol is ♍.", drawFont, fontBrush, 5, 370);
            fg.DrawString("Lying between Leo to the west and Libra to the east,", drawFont, fontBrush, 5, 385);
            fg.DrawString("it is the second largest constellation in the sky.", drawFont, fontBrush, 5, 400);
        }
Exemplo n.º 32
0
 static private void PlayAlarm(SoundPlayer player)
 {
     player.Play();
     Task.Delay(new TimeSpan(0, 0, 3)).Wait();
     player.Stop();
 }
Exemplo n.º 33
0
        public static void Start()
        {
            do
            {
                Console.SetCursorPosition(Variables.XCursor, Variables.YCursor); // Set cursor position

                ConsoleKeyInfo PressedKey = Console.ReadKey();                   // Player press key

                SoundPlayer player = new SoundPlayer();

                switch (PressedKey.Key)
                {
                case ConsoleKey.LeftArrow:


                    player.Stream = GameFolder.Misc.Music.run;
                    player.Play();

                    Collision.Left();

                    break;

                case ConsoleKey.RightArrow:

                    player.Stream = GameFolder.Misc.Music.run;
                    player.Play();

                    Collision.Right();

                    break;

                case ConsoleKey.Spacebar:

                    if (!ShiftVariable.SpaceThread)
                    {
                        player.Stream = GameFolder.Misc.Music.smolJump;
                        player.Play();

                        SpacePlayer.Num = 0;
                        ThreadingSpace  = new Thread(SpacePlayer.Start);
                        ThreadingSpace.Start();
                    }

                    break;

                case ConsoleKey.UpArrow:

                    Collision.Up();

                    break;

                case ConsoleKey.DownArrow:

                    Collision.Down();

                    break;

                case ConsoleKey.F:

                    Variables.Dead = 0;

                    if (Maps.NumMap == 1)
                    {
                        Variables.XPlayerStart = Maps.Map0X;
                        Variables.YPlayerStart = Maps.Map0Y;
                    }
                    else if (Maps.NumMap == 2)
                    {
                        Variables.XPlayerStart = Maps.Map1X;
                        Variables.YPlayerStart = Maps.Map1Y;
                    }
                    else if (Maps.NumMap == 3)
                    {
                        Variables.XPlayerStart = Maps.Map2X;
                        Variables.YPlayerStart = Maps.Map2Y;
                    }
                    else if (Maps.NumMap == 4)
                    {
                        Variables.XPlayerStart = Maps.Map3X;
                        Variables.YPlayerStart = Maps.Map3Y;
                    }
                    else if (Maps.NumMap == 5)
                    {
                        Variables.XPlayerStart = Maps.Map4X;
                        Variables.YPlayerStart = Maps.Map4Y;
                    }
                    else if (Maps.NumMap == 6)
                    {
                        Variables.XPlayerStart = Maps.Map5X;
                        Variables.YPlayerStart = Maps.Map5Y;
                    }
                    Maps.EnumMap(false);

                    ReTitle.Counter();
                    break;

                case ConsoleKey.R:

                    Maps.EnumMap(false);
                    break;

                default:
                    ReDrawing.Draw();
                    break;
                }
            } while (true);
        }
Exemplo n.º 34
0
        //play sound
        public void playSound(string soundName)
        {
            SoundPlayer sound = new SoundPlayer(soundName);

            sound.Play();
        }
Exemplo n.º 35
0
            // Constructor that takes one argument:
            public Zoom(string[,] classess)
            {
                if (getCollums(classess) == 0)
                {
                    throwErr("Didnt recieve any class data!"); return;
                }
                throwSuccess("Waiting for class to start, sit back relax");
                //Console.WriteLine("Amount of rows = " + getRows(classess));
                //Console.WriteLine("Amount of Collums = " + getCollums(classess));


                string[] className    = new string[classess.Length / 4];
                string[] mondayTimes  = new string[classess.Length / 4];
                string[] regularTimes = new string[classess.Length / 4];
                string[] classLinks   = new string[classess.Length / 4];

                //for (int rowID = 0; rowID < getRows(classess); rowID++)
                //{
                //Console.WriteLine("RowID = " + rowID);
                for (int collumID = 0; collumID < getCollums(classess); collumID++)
                {
                    //Console.WriteLine("CollumID = " + collumID);

                    className[collumID]    = classess[collumID, 0].ToString();
                    mondayTimes[collumID]  = AmpmTo24(Convert.ToDateTime(classess[collumID, 1].ToString()));
                    regularTimes[collumID] = AmpmTo24(Convert.ToDateTime(classess[collumID, 2].ToString()));
                    classLinks[collumID]   = classess[collumID, 3].ToString();
                    //Console.WriteLine("{0} {1} {2} {3}",className[collumID], mondayTimes[collumID], regularTimes[collumID], classLinks[collumID] );

                    if (DateTime.Now.DayOfWeek == DayOfWeek.Monday)
                    {
                        Console.WriteLine("Waiting to join {0} at {1}", className[collumID], MilitaryToAmPm(Convert.ToDateTime(mondayTimes[collumID])));
                    }
                    else
                    {
                        Console.WriteLine("Waiting to join {0} at {1}", className[collumID], MilitaryToAmPm(Convert.ToDateTime(regularTimes[collumID])));
                    }
                }



                //}

                /*
                 * foreach(string result in mondayTimes)
                 * {
                 *  Console.WriteLine(result);
                 * }
                 */

                /*
                 * string[] className = { classess[0,0], classess[1,0], classess[2,0] };
                 * string[] mondayTimes = { AmpmTo24(Convert.ToDateTime(classess[0, 1])), AmpmTo24(Convert.ToDateTime(classess[1, 1])), AmpmTo24(Convert.ToDateTime(classess[2, 1])) };
                 * string[] regularTimes = { AmpmTo24(Convert.ToDateTime(classess[0, 2])), AmpmTo24(Convert.ToDateTime(classess[1, 2])), AmpmTo24(Convert.ToDateTime(classess[2, 2])) };
                 * string[] classLinks = { classess[0, 3], classess[1, 3], classess[2, 3] };
                 */
                while (true)
                {
                    if (DateTime.Now.DayOfWeek == DayOfWeek.Monday)
                    {
                        for (int x = 0; x < mondayTimes.Length; x++)
                        {
                            if (isItClassTime(mondayTimes[x]))
                            {
                                if (DateTime.Now.DayOfWeek == DayOfWeek.Monday)
                                {
                                    //Console.WriteLine("Today is monday, using mondays schedule!");
                                    // Add a check to see if sounds disabled and if custom sound
                                    if (String.IsNullOrWhiteSpace(JoinSound))
                                    {
                                        SoundPlayer audio = new SoundPlayer(Zoom_Auto_Join.Properties.Resources.intro);
                                        if (enableSounds)
                                        {
                                            audio.Play();
                                        }
                                    }
                                    else
                                    {
                                        SoundPlayer audio = new SoundPlayer(JoinSound);
                                        if (enableSounds)
                                        {
                                            audio.Play();
                                        }
                                    }
                                    Console.WriteLine("{0} has started, joinning link", className[x]);
                                    SendWebHook(DateTime.Now.ToString("HH:mm:ss tt"), classLinks[x]);
                                    joinClass(classLinks[x]);
                                    //Console.Write(" DEBUG: PASS ");
                                    break;
                                }
                            }
                            //Console.WriteLine(" DEBUG: CHECKING {0} CLASS {1}", mondayTimes[x], className[x]);
                        }
                    }
                    else
                    {
                        for (int y = 0; y < regularTimes.Length; y++)
                        {
                            if (isItClassTime(regularTimes[y]))
                            {
                                Console.WriteLine("{0} has started, joinning link {1}", className[y], classLinks[y]);

                                if (String.IsNullOrWhiteSpace(JoinSound))
                                {
                                    SoundPlayer audio = new SoundPlayer(Zoom_Auto_Join.Properties.Resources.intro);
                                    if (enableSounds)
                                    {
                                        audio.Play();
                                    }
                                }
                                else
                                {
                                    SoundPlayer audio = new SoundPlayer(JoinSound);
                                    if (enableSounds)
                                    {
                                        audio.Play();
                                    }
                                }
                                SendWebHook(DateTime.Now.ToString("HH:mm:ss tt"), classLinks[y]);
                                joinClass(classLinks[y]);
                                break;
                            }
                        }
                    }

                    Thread.Sleep(100);
                }
            }
Exemplo n.º 36
0
        private void playaudio()                                                                                 // defining the function
        {
            SoundPlayer audio = new SoundPlayer(WindowsFormsApplication1.Properties.Resources.dt_16bars_102rap); // here WindowsFormsApplication1 is the namespace and Connect is the audio file name

            audio.Play();
        }
Exemplo n.º 37
0
        public void Run()
        {
            EncounterEvents encounter = new EncounterEvents();
            Player          playerOne = new Player(1, 6);
            Room            levelOne  = new Room(10, 10, 8, 3);
            LevelTwo        levelTwo  = new LevelTwo();
            // 10 enemies: 1 boss, 2 hard, 3 medium, 4 easy
            Enemy cockroachOne = new Enemy("Cockroach", 1, 5, 1, 3, 2, 50, 1, 2, 3);
            Enemy cockroachTwo = new Enemy("Cockroach", 1, 5, 1, 3, 2, 50, 1, 4, 8);
            Enemy rat          = new Enemy("Blood Rat", 1, 7, 1, 5, 2, 75, 1, 4, 4);
            Enemy slime        = new Enemy("Crimson Slime", 1, 7, 1, 5, 1, 75, 1, 2, 9);
            Enemy skeleton     = new Enemy("Marrow Skeleton", 2, 12, 0.9, 8, 1, 125, 2, 7, 8);
            Enemy ghost        = new Enemy("Hungry Ghost", 2, 13, 0.8, 7, 1, 125, 4, 6, 2);
            Enemy witch        = new Enemy("Wilting Witch", 2, 12, 0.9, 8, 1, 125, 2, 5, 10);
            Enemy vampireOne   = new Enemy("Vampire", 3, 17, 0.8, 13, 2, 175, 3, 8, 6);
            Enemy vampireTwo   = new Enemy("Vampire", 3, 17, 0.8, 13, 2, 175, 3, 10, 2);
            Enemy levelOneBoss = new Enemy("GRIGORE STRIGOI", 5, 25, 0.7, 20, 1, 250, 4, 9, 4);

            List <Enemy> enemyList = new List <Enemy>()
            {
                cockroachOne, cockroachTwo, rat, slime, skeleton, ghost, witch, vampireOne, vampireTwo, levelOneBoss
            };


            void GamePlay()
            {
                Console.WriteLine("Welcome\n\n" +
                                  "-Use WASD to move around.\n" +
                                  "-Use arrow keys to step by one tile only.\n" +
                                  "-Press \"M\" at any time to view your stats.\n" +
                                  "-Press \"Q\" at any time to quit.\n\n\n" +
                                  "Enter a name:");
                playerOne.Name = Console.ReadLine();
                Console.Clear();
                Console.WriteLine("Level One\n" +
                                  "The smell of iron fills the air...");

                var myPlayer = new SoundPlayer();

                myPlayer.SoundLocation = AppDomain.CurrentDomain.BaseDirectory + "\\LevelOne.wav";
                myPlayer.PlayLooping();

                while (true)
                {
                    if (playerOne.GameOver)
                    {
                        myPlayer.Stop();
                        Console.WriteLine("\nGAME OVER");
                        return;
                    }
                    else
                    {
                        playerOne.Move(levelOne);
                        foreach (Enemy enemy in enemyList)
                        {
                            enemy.Move(levelOne);
                        }
                        if (playerOne.PositionX == levelOne.StairX && playerOne.PositionY == levelOne.StairY)
                        {
                            myPlayer.Stop();
                            levelTwo.Run(playerOne);
                            return;
                        }
                        foreach (Enemy enemy in enemyList)
                        {
                            if (playerOne.PositionX == enemy.PositionX && playerOne.PositionY == enemy.PositionY)
                            {
                                encounter.Encounter(playerOne, enemy);
                            }
                        }
                        Console.WriteLine(levelOne.ExitProximity(playerOne));
                    }
                }
            }

            GamePlay();
        }
Exemplo n.º 38
0
 private void InitDefault()
 {
     var music = new SoundPlayer[] { new SoundPlayer(@"default/defMusic.mp3") }.ToList();
     var sound = new SoundPlayer[] { new SoundPlayer(@"default/nya.wav") }.ToList();
     var spr = new (string, int?, int?, int?, string)[] { ("Алиса", 300, 300, 1, @"default /alice.png") }.ToList();
Exemplo n.º 39
0
 void Start()
 {
     soundPlayer = GameObject.FindGameObjectWithTag("SoundPlayer")
                   .GetComponent <SoundPlayer>();
     EnnemiStart();
 }
 /// <summary>
 /// </summary>
 /// <param name="notifySoundPath">通知で再生する音声ファイルパス</param>
 public BookUseNotificator(string notifySoundPath)
 {
     _soundPlayer = CreateSoundPlayer(notifySoundPath);
 }
Exemplo n.º 41
0
        /// <summary>
        /// This method is the game engine loop that updates the position of all elements
        /// and checks for collisions.
        /// </summary>
        private void gameUpdateLoop_Tick(object sender, EventArgs e)
        {
            //sound player to be used for all in game sounds initially set to collision sound
            SoundPlayer player, paddlehit, score = new SoundPlayer();

            player    = new SoundPlayer(Properties.Resources.collision);
            paddlehit = new SoundPlayer(Properties.Resources.collision);    //can't seem to reference "wall bounce.wav" "or paddlehit.wav"
            score     = new SoundPlayer(Properties.Resources.score);

            #region update ball position

            // TODO create code to move ball either left or right based on ballMoveRight and BALL_SPEED
            if (ballMoveRight)
            {
                ballX += BALL_SPEED;
            }
            else if (!ballMoveRight)
            {
                ballX -= BALL_SPEED;
            }
            // TODO create code move ball either down or up based on ballMoveDown and BALL_SPEED
            if (ballMoveDown)
            {
                ballY += BALL_SPEED + 1;
            }
            else if (!ballMoveDown)
            {
                ballY -= BALL_SPEED + 1;
            }

            #endregion

            #region update paddle positions

            if (aKeyDown == true && paddle1Y > 0)   //paddle 1 movement logic
            {
                paddle1Y -= PADDLE_SPEED;
            }
            if (zKeyDown == true && paddle1Y + PADDLE_LENGTH < this.Height)
            {
                paddle1Y += PADDLE_SPEED;
            }

            if (jKeyDown == true && paddle2Y > 0)   //paddle 2 movement logic
            {
                paddle2Y -= PADDLE_SPEED;
            }
            if (mKeyDown == true && paddle2Y + PADDLE_LENGTH < this.Height)
            {
                paddle2Y += PADDLE_SPEED;
            }

            #endregion

            #region ball collision with top and bottom lines

            if (ballY < 0) // if ball hits top line
            {
                ballMoveDown = true;
                player.Play();
            }
            else if (ballY + BALL_SIZE > this.Height) // if ball hits bottom line
            {
                ballMoveDown = false;
                player.Play();
            }

            #endregion

            #region ball collision with paddles

            ballBox    = new Rectangle(ballX, ballY, BALL_SIZE, BALL_SIZE);
            paddle1Box = new Rectangle(paddle1X, paddle1Y, PADDLE_WIDTH, PADDLE_LENGTH);
            paddle2Box = new Rectangle(paddle2X, paddle2Y, PADDLE_WIDTH, PADDLE_LENGTH);

            if (ballBox.IntersectsWith(paddle1Box)) //left paddle contact
            {
                ballMoveRight = true;
                paddlehit.Play();
            }

            if (ballBox.IntersectsWith(paddle2Box)) //right paddle contact
            {
                ballMoveRight = false;
                paddlehit.Play();
            }

            #endregion

            #region ball collision with side walls (point scored)

            if (ballX < 0)  // TODO ball hits left wall logic
            {
                score.Play();
                player2Score++;

                if (player2Score >= gameWinScore)
                {
                    GameOver("Player 2 Win!");
                    score.Stop();
                }
                else if (player2Score < gameWinScore)
                {
                    ballMoveRight = true; BALL_SPEED++; SetParameters();
                }
            }

            if (ballX + BALL_SIZE > this.Width)  // TODO ball hits right wall logic
            {
                score.Play();
                player1Score++;

                if (player1Score >= gameWinScore)
                {
                    GameOver("Player 1 Win!");
                    score.Stop();
                }
                else if (player1Score < gameWinScore)
                {
                    ballMoveRight = false; BALL_SPEED++; SetParameters();
                }
            }

            // TODO same as above but this time check for collision with the right wall

            #endregion

            //refresh the screen, which causes the Form1_Paint method to run
            this.Refresh();
        }
Exemplo n.º 42
0
        private void mainWindow_Load(object sender, EventArgs e)
        {
            //Instantiate list and bind it to listbox
            questionList       = new BindingList <Question>();
            repeatingQuestions = new BindingList <int>();
            LoadSampleData();
            questionListBox.DataSource = questionList;

            backgroundMusic = new SoundPlayer("hpMusic2.wav");
            backgroundMusic.Load();
            backgroundMusic.PlayLooping();

            //Create the four buttons and set their properties for the
            //Main Menu: Play, View, Save, Load
            #region
            //Create Play Button
            playButton          = new Button();
            playButton.Font     = new Font("Microsoft Sans Serif", 40F, FontStyle.Regular);
            playButton.Location = new Point(150, 150);
            playButton.Size     = new Size(400, 100);
            playButton.Text     = "&Play Quiz";
            //Wire it
            Controls.Add(playButton);
            playButton.Click += new EventHandler(playButton_Click);

            //Create a View Question Button on form for Main Menu
            viewButton          = new Button();
            viewButton.Font     = new Font("Microsoft Sans Serif", 24F, FontStyle.Regular);
            viewButton.Location = new Point(200, 275);
            viewButton.Size     = new Size(300, 75);
            viewButton.Text     = "&View Questions";
            //Wire it to show a listbox with options to alter
            Controls.Add(viewButton);
            viewButton.Click += new EventHandler(viewButton_Click);

            //Create a Save Button on Main Menu
            mainSaveButton          = new Button();
            mainSaveButton.Font     = new Font("Microsoft Sans Serif", 24F, FontStyle.Regular);
            mainSaveButton.Location = new Point(200, 350);
            mainSaveButton.Size     = new Size(150, 50);
            mainSaveButton.Text     = "&Save";
            //Wire it
            Controls.Add(mainSaveButton);
            mainSaveButton.Click += new EventHandler(mainSaveButton_Click);

            //Create an Open Button on Main Menu
            mainOpenButton          = new Button();
            mainOpenButton.Font     = new Font("Microsoft Sans Serif", 24F, FontStyle.Regular);
            mainOpenButton.Location = new Point(350, 350);
            mainOpenButton.Size     = new Size(150, 50);
            mainOpenButton.Text     = "&Open";
            //Wire it
            Controls.Add(mainOpenButton);
            mainOpenButton.Click += new EventHandler(mainOpenButton_Click);

            //Button to quit program
            mainExitButton          = new Button();
            mainExitButton.Font     = new Font("Microsoft Sans Serif", 24F, FontStyle.Regular);
            mainExitButton.Location = new Point(275, 400);
            mainExitButton.Size     = new Size(150, 50);
            mainExitButton.Text     = "E&xit";
            //Wire it
            Controls.Add(mainExitButton);
            mainExitButton.Click += new EventHandler(mainExitButton_Click);
            #endregion

            //Hide the secondary, viewMenu, by default
            DefaultMainMenu();

            //Wire duplicate menu options for easy access options
            editToolStripMenuItem.Click += new EventHandler(viewButton_Click);
            exitToolStripMenuItem.Click += new EventHandler(mainExitButton_Click);
            saveToolStripMenuItem.Click += new EventHandler(mainSaveButton_Click);
            openToolStripMenuItem.Click += new EventHandler(mainOpenButton_Click);
            questionListBox.DoubleClick += new EventHandler(detailsButton_Click);
            editButton.Click            += new EventHandler(detailsButton_Click);
            playToolStripMenuItem.Click += new EventHandler(playButton_Click);
        }
Exemplo n.º 43
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sp">SoundPlayer对象</param>
 public static void StopWAV(SoundPlayer sp)
 {
     sp.Stop();
 }
Exemplo n.º 44
0
        public void DisplayPage()
        {
            //create a universal switch statement
            switch (page)
            {
            case 1:
                musicPlayer = new SoundPlayer(Properties.Resources.opening);
                musicPlayer.Play();

                imageBox.Image = Properties.Resources.lake_mountain;

                outputLabel.Text  = "You have landed in the vast world of the Fairy Tales. Shall you:";
                option1Label.Text = "Adventure the SilverLake Forest";
                option2Label.Text = "Explore Winged Mountain";
                break;

            case 2:
                musicPlayer = new SoundPlayer(Properties.Resources.Silverlake);
                musicPlayer.Play();

                imageBox.Image = Properties.Resources.silver_lake;

                outputLabel.Text  = "You come upon the infamous Silver Lake. Do you take a drink?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 3:
                imageBox.Image = Properties.Resources.winged_men;

                outputLabel.Text  = "You come across a group of Winged Men, do you follow them to their King?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 4:
                imageBox.Image = Properties.Resources.died;

                outputLabel.Text  = "You have died! The Sirens dragged you to the bottom of the lake. Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 5:
                imageBox.Image = Properties.Resources.picnic;

                outputLabel.Text  = "You came upon a group of faeries and dwarves having a picnic! They ask you to join them!";
                option1Label.Text = "Accept";
                option2Label.Text = "Decline";
                break;

            case 6:
                imageBox.Image = Properties.Resources.win;

                outputLabel.Text  = "You are saved! The King has allowed you to take refuge in his castle. Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 7:
                imageBox.Image = Properties.Resources.lake_mountain;

                outputLabel.Text  = "As you wander up the mountain you come across various creatures with wings. Do you try to ride one?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 8:
                imageBox.Image = Properties.Resources.picnic;

                outputLabel.Text  = "You have a lovely meal with the group and are exhuasted from the delicious food Do you:";
                option1Label.Text = "Build your own shelter to sleep in";
                option2Label.Text = "Ask the faeries and dwarves if you can rest in their village";
                break;

            case 9:
                imageBox.Image = Properties.Resources.died;

                outputLabel.Text  = "Oh no! You have died of starvation! Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 10:
                imageBox.Image = Properties.Resources.riding_dragon;

                outputLabel.Text  = "Success! You were able to ride one of the creatures and are soaring in the sky! Do you try to do a loop-de-loop?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 11:
                imageBox.Image = Properties.Resources.dragons;

                outputLabel.Text  = "Oh dear! The winged creatures closer to the peak of the mountain are dragons! Do you:";
                option1Label.Text = "Attempt to get closer to them";
                option2Label.Text = "Run for your life!";
                break;

            case 12:
                imageBox.Image = Properties.Resources.died;

                outputLabel.Text  = "You have died! Your shelter collasped and crushed you! Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 13:
                imageBox.Image = Properties.Resources.village;

                outputLabel.Text  = "The dwarves take you to their village and find you a guest house. They offer you a permanent residence in the village";
                option1Label.Text = "Accept";
                option2Label.Text = "Accept for the night and continue adventuring the forest";
                break;

            case 14:
                imageBox.Image = Properties.Resources.win;

                outputLabel.Text  = " You live a happy life in the village of the Forest Folk. Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 15:
                imageBox.Image = Properties.Resources.wolves;

                outputLabel.Text  = "You bid your new friends goodbye and continue to explore the forest. You come upon a pack of werewolves, they offer to turn you!";
                option1Label.Text = "Become a werewolf";
                option2Label.Text = "Decline";
                break;

            case 16:
                musicPlayer = new SoundPlayer(Properties.Resources.dragonFire);
                musicPlayer.Play();

                imageBox.Image = Properties.Resources.died;

                outputLabel.Text  = "The dragons notice you and shoot fire, burning you! Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 17:
                imageBox.Image = Properties.Resources.died;

                outputLabel.Text  = "As you run away you slip on a loose rock and fall over the side of the cliff! Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 18:
                musicPlayer = new SoundPlayer(Properties.Resources.werewolf);
                musicPlayer.Play();

                imageBox.Image = Properties.Resources.win;

                outputLabel.Text  = "You have successfully become a werewolf and are now a member of the pack! Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 19:
                imageBox.Image = Properties.Resources.died;

                outputLabel.Text  = "You have died! During your journy you fell into a sinkhole! Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 20:
                imageBox.Image = Properties.Resources.died;

                outputLabel.Text  = "The creature shakes you off its back! You fall to your death. Play Again";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 21:
                imageBox.Image = Properties.Resources.died;

                outputLabel.Text  = "Oh no1 You lost your grip and fell off! Play Again?";
                option1Label.Text = "Yes";
                option2Label.Text = "No";
                break;

            case 50:
                imageBox.Image = Properties.Resources.thankYou;

                outputLabel.Text  = "Thank You For Playing!";
                option1Label.Text = "";
                option2Label.Text = "";

                Refresh();
                Thread.Sleep(2000);
                Application.Exit();
                break;

            default:
                break;
            }
        }
Exemplo n.º 45
0
        private void playSimpleSound()
        {
            SoundPlayer simpleSound = new SoundPlayer(@"C:\Users\ant\Documents\Visual Studio 2013\Projects\QEV1_config\QEV1_config\Resources\aw_crap.wav");

            simpleSound.Play();
        }
Exemplo n.º 46
0
        private static void stopSound()
        {
            SoundPlayer stopSound = new SoundPlayer("sounds/stopSound.wav");

            stopSound.Play();
        }
Exemplo n.º 47
0
 public BasicAudio()
 {
     m_objPlayer = new SoundPlayer();
     m_objPlayer.LoadCompleted        += new AsyncCompletedEventHandler(player_LoadCompleted);
     m_objPlayer.SoundLocationChanged += new EventHandler(player_LocationChanged);
 }
Exemplo n.º 48
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray ray = _camera.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out RaycastHit hit, float.MaxValue, LayerMask.GetMask("PickableItem")))
            {
                PickableItem pickedItem = hit.transform.parent.GetComponent <PickableItem>();
                if (!CheckCoveringItems(pickedItem))
                {
                    _pickedItem = pickedItem;
                    if (_pickedItem != null)
                    {
                        SoundPlayer.Play("tink", 0.5f);
                        _pickedItem.OnPicked();
                        _pickedItem.SetPositionAnimated(GetPosOnPickedPlane(_pickedItem));
                        if (_pickedItem.initialPositionState == PickableItem.InitialPositionState.OnInitialPosition ||
                            _pickedItem.initialPositionState == PickableItem.InitialPositionState.MovingToInitialPosition)
                        {
                            _pickedItem.initialPositionState = PickableItem.InitialPositionState.PickedFromInitialPosition;
                        }
                    }
                }
            }
        }

        if (Input.GetMouseButtonUp(0) && _pickedItem != null)
        {
            SoundPlayer.Play("tink", 0.5f);
            _pickedItem.OnReleased();
            _pickedItem = null;
        }

        if (_pickedItem != null && (!Mathf.Approximately(Input.GetAxis("Mouse X"), 0f) || !Mathf.Approximately(Input.GetAxis("Mouse Y"), 0f)))
        {
            Ray  ray = _camera.ScreenPointToRay(Input.mousePosition);
            bool interactedWithGhost = false;
            if (Physics.Raycast(ray, out RaycastHit hit, float.MaxValue, LayerMask.GetMask("PickableItemGhost")))
            {
                PickableItemGhost ghost = hit.transform.parent.GetComponent <PickableItemGhost>();
                if (!CheckCoveringItems(ghost.transform.GetComponent <PickableItem>()))
                {
                    if (_pickedItem.initialPositionState == PickableItem.InitialPositionState.CanBeReturnedToInitialPosition)
                    {
                        _pickedItem.SetPositionAnimated(ghost.transform.position, pickedItem =>
                        {
                            pickedItem.initialPositionState = PickableItem.InitialPositionState.OnInitialPosition;
                            pickedItem.isBroken             = false;
                        });
                        _pickedItem.initialPositionState = PickableItem.InitialPositionState.MovingToInitialPosition;
                    }
                    else if (_pickedItem.initialPositionState == PickableItem.InitialPositionState.PickedFromInitialPosition)
                    {
                        _pickedItem.SetPosition(GetPosOnPickedPlane(_pickedItem));
                    }

                    interactedWithGhost = true;
                }
            }

            if (!interactedWithGhost)
            {
                if (_pickedItem.initialPositionState == PickableItem.InitialPositionState.PickedFromInitialPosition)
                {
                    _pickedItem.SetPositionAnimated(GetPosOnPickedPlane(_pickedItem));
                    _pickedItem.initialPositionState = PickableItem.InitialPositionState.CanBeReturnedToInitialPosition;
                }
                else
                {
                    _pickedItem.SetPosition(GetPosOnPickedPlane(_pickedItem));
                    if (_pickedItem.initialPositionState == PickableItem.InitialPositionState.OnInitialPosition ||
                        _pickedItem.initialPositionState == PickableItem.InitialPositionState.MovingToInitialPosition)
                    {
                        _pickedItem.initialPositionState = PickableItem.InitialPositionState.CanBeReturnedToInitialPosition;
                    }
                }
            }
        }
    }
Exemplo n.º 49
0
 public Form1()
 {
     InitializeComponent();
     ButtonSound = new SoundPlayer("ButtonSound.wav");
 }
Exemplo n.º 50
0
        private void superSecret()
        {
            SoundPlayer superSecret = new SoundPlayer(Properties.Resources.superSecret);

            superSecret.Play();
        }
Exemplo n.º 51
0
        public void SyncJobs(String fileName)
        {
            if (syncInProgress)
            {
                return;
            }
            syncInProgress = true;


            ILog lg = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            lg.Debug("Start syncing");
            try
            {
                String folderPathGameSiiZero = fileName;
                String folderPathSave        = Path.GetDirectoryName(fileName);
                String folderPathGameSii     = Path.Combine(folderPathSave, "game.sii");


                try
                {
                    if (Rn.Config.General.PlaySound)
                    {
                        SoundPlayer sp = new SoundPlayer(@"sound\sound_send.wav");
                        sp.Play();
                    }


                    if (Rn.Config.General.BackupSaveGame)
                    {
                        File.Move(folderPathGameSii, folderPathGameSii + "." + DateTime.Now.ToFileTime() + ".bak");
                    }
                }
                catch (Exception e)
                {
                }


                // Get PHP Session ID
                HTTPRequest http = new HTTPRequest();
                http.BaseUrl = "http://www.ets2sync.com/de/";
                http.Request();


                http.CreateFullUrl("file_upload.php?uploadfile=game.sii.0");
                http.UploadFile(folderPathGameSiiZero, "uploadfile", "application/octet-stream");

                Response.UploadFile resp = fastJSON.JSON.ToObject <Response.UploadFile>(http.Response);

                List <String> dlcs = new List <String>();
                if (this.DlcGoingEast)
                {
                    dlcs.Add("east");
                }
                if (this.DlcHighPowerCargoes)
                {
                    dlcs.Add("hpower");
                }
                if (this.DlcScandinavia)
                {
                    dlcs.Add("north");
                }

                String dlcPost = String.Join(",", dlcs);

                http.CreateFullUrl("engine.php");
                http.Post = "dlcs=" + dlcPost + "&f_path_orig=" + resp.file_path + "&f_path_synced=" + resp.f_path_synced;
                http.Request();
                //http://www.ets2sync.com/de/downloader.php?file=synced

                http.CreateFullUrl("file_list.php");
                http.Post = "file=synced";
                http.Request();


                //http://www.ets2sync.com/de/downloader.php?file=synced
                http.CreateFullUrl("downloader.php?file=synced");
                http.DownloadFile(folderPathGameSii);


                try
                {
                    if (Rn.Config.General.PlaySound)
                    {
                        SoundPlayer sp = new SoundPlayer(@"sound\sound_receive.wav");
                        sp.Play();
                    }
                }
                catch (Exception e)
                {
                }
            }
            catch (Exception e)
            {
                if (Rn.Config.General.PlaySound)
                {
                    SoundPlayer sp = new SoundPlayer(@"sound\sound_error.wav");
                    sp.Play();
                }
            }


            lg.Debug("End syncing");
            syncInProgress = false;
        }
    protected virtual IEnumerator AllPlayerCharacterDiedContinueFunction()
    {
        if (base.hierarchyData.isPossibleContinue)
        {
            base.stateManager.uiControl.SetMenuAuto2xButtonEnabled(false);
            base.stateManager.SetBattleScreen(BattleScreen.Continue);
            SoundPlayer.PlayMenuOpen();
            if (base.battleStateData.isShowMenuWindow)
            {
                base.stateManager.callAction.OnHideMenu();
                while (base.battleStateData.isShowMenuWindow)
                {
                    yield return(null);
                }
            }
            base.battleStateData.isContinueFlag = false;
            List <CharacterParams> characters = new List <CharacterParams>();
            int counted = 0;
            for (int i = 0; i < base.battleStateData.playerCharacters.Length; i++)
            {
                if (base.battleStateData.isRevivalReservedCharacter[i])
                {
                    counted++;
                }
                else
                {
                    characters.Add(base.battleStateData.playerCharacters[i].CharacterParams);
                    base.battleStateData.isRevivalReservedCharacter[i] = true;
                    base.stateManager.threeDAction.PlayAlwaysEffectAction(base.battleStateData.revivalReservedEffect[i], AlwaysEffectState.In);
                }
            }
            base.stateManager.uiControl.ApplyDigiStoneNumber(base.battleStateData.beforeConfirmDigiStoneNumber - counted);
            base.battleStateData.isShowContinueWindow = true;
            base.battleStateData.isShowRetireWindow   = false;
            base.stateManager.uiControl.ApplyContinueNeedDigiStone(characters.Count + 2, base.battleStateData.beforeConfirmDigiStoneNumber - counted, false);
            base.stateManager.threeDAction.PlayIdleAnimationUndeadCharactersAction(base.battleStateData.enemies);
            string cameraKey = "0002_command";
            base.stateManager.cameraControl.PlayCameraMotionAction(cameraKey, base.battleStateData.stageSpawnPoint, true);
            yield return(null);

            base.stateManager.uiControl.ShowCharacterHUDFunction(base.battleStateData.enemies);
            base.stateManager.uiControl.RepositionCharacterHUDPosition(base.battleStateData.enemies);
            while (!base.battleStateData.isContinueFlag)
            {
                yield return(null);
            }
            while (base.onServerConnect && base.stateManager.values.IsNotEnoughDigistoneForContinue())
            {
                while (!base.battleStateData.isContinueFlag)
                {
                    yield return(null);
                }
                IEnumerator wait = base.stateManager.serverControl.ContinueBuyDigistoneFunction(true);
                while (wait.MoveNext())
                {
                    object obj = wait.Current;
                    yield return(obj);
                }
                base.stateManager.uiControl.ApplyDigiStoneNumber(base.battleStateData.beforeConfirmDigiStoneNumber - counted);
                if (base.stateManager.values.IsNotEnoughDigistoneForContinue())
                {
                    base.stateManager.uiControl.ApplyContinueNeedDigiStone(characters.Count + 2, base.battleStateData.beforeConfirmDigiStoneNumber - counted, false);
                    base.battleStateData.isContinueFlag = false;
                }
            }
            base.battleStateData.turnUseDigiStoneCount = 5;
            base.stateManager.cameraControl.StopCameraMotionAction(cameraKey);
            base.stateManager.uiControl.HideCharacterHUDFunction();
            IEnumerator waitDialogClose = base.stateManager.uiControl.HideContinueDialog();
            while (waitDialogClose.MoveNext())
            {
                object obj2 = waitDialogClose.Current;
                yield return(obj2);
            }
            base.battleStateData.isShowContinueWindow = false;
            base.SetState(typeof(SubStateCharacterRevivalFunction));
            while (base.isWaitState)
            {
                yield return(null);
            }
            this.isContinue = true;
            yield break;
        }
        base.battleStateData.unFightLoss = true;
        for (int j = base.battleStateData.currentWaveNumber + 1; j < base.hierarchyData.batteWaves.Length; j++)
        {
            base.battleStateData.currentWaveNumber++;
            base.stateManager.uiControl.ApplyWaveAndRound(base.battleStateData.currentWaveNumber, base.battleStateData.currentRoundNumber);
        }
        this.isContinue = false;
        yield break;
    }
Exemplo n.º 53
0
 public void CompileFinished()
 {
     _player = new SoundPlayer(string.Format("{0}/{1}/ding.wav", Environment.CurrentDirectory, SoundLibrary.SoundBankLocation));
     _player.Play();
     _player.StreamChanged += _player_StreamChanged;
 }
Exemplo n.º 54
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Point pt = ball1.Location;

            pt.X          += speed / 3 * ballx;
            pt.Y          += speed / 3 * bally;
            ball1.Location = pt;
            label1.Text    = "Score: " + score;
            if (goRight)
            {
                Player.Left += speed + 1;
            }
            if (goLeft)
            {
                Player.Left -= speed + 1;
            }
            if (Player.Left < 1)
            {
                goLeft = false;
            }
            if (Player.Left + Player.Width > ClientSize.Width)
            {
                goRight = false;
            }
            if (pt.X < 0 || pt.X > ClientRectangle.Width - ball1.Width)
            {
                ballx = -ballx;
            }
            if (pt.Y < 0 || ball1.Bounds.IntersectsWith(Player.Bounds))
            {
                bally = -bally;
            }
            if (pt.Y > ClientRectangle.Height)
            {
                gameOver();
                MessageBox.Show("game over!");
            }
            foreach (Control x in this.Controls)
            {
                if (x is PictureBox && x.Tag == "block")
                {
                    if (ball1.Bounds.IntersectsWith(x.Bounds))
                    {
                        if (ball1.Location.Y <= x.Location.Y - (x.Height / 2))
                        {
                            bally = -bally;
                        }
                        else
                        if (ball1.Location.Y >= x.Location.Y + (x.Height / 2))
                        {
                            bally = -bally;
                        }
                        else
                        if (ball1.Location.X < x.Location.X)
                        {
                            ballx = -ballx;
                            bally = -bally;
                        }
                        else
                        if (ball1.Location.X > x.Location.X)
                        {
                            ballx = -ballx;
                            bally = -bally;
                        }
                        x.Tag = "Hit";
                        Image myimage = new Bitmap("blue_block.png");
                        x.BackgroundImage       = myimage;
                        x.BackgroundImageLayout = ImageLayout.Stretch;
                        SoundPlayer hit = new SoundPlayer("Ball_Bounce.wav");
                        hit.Play();
                    }
                }
                else
                {
                    if (x is PictureBox && x.Tag == "Hit")
                    {
                        if (ball1.Bounds.IntersectsWith(x.Bounds))
                        {
                            if (ball1.Location.Y <= x.Location.Y - (x.Height / 2))
                            {
                                bally = -bally;
                            }
                            else
                            if (ball1.Location.Y >= x.Location.Y + (x.Height / 2))
                            {
                                bally = -bally;
                            }
                            else
                            if (ball1.Location.X < x.Location.X)
                            {
                                ballx = -ballx;
                                bally = -bally;
                            }
                            else
                            if (ball1.Location.X > x.Location.X)
                            {
                                ballx = -ballx;
                                bally = -bally;
                            }
                            score = score + 1;
                            this.Controls.Remove(x);
                            if (score <= 5)
                            {
                                speed = speed + 1;
                            }
                            SoundPlayer dest = new SoundPlayer("Block_Destroy.wav");
                            dest.Play();
                        }
                    }
                }
            }
            if (score == 35)
            {
                gameOver();
                MessageBox.Show("you win");
            }
        }
Exemplo n.º 55
0
        public void OnClick_Minimize()
        {
            ShowWindow(GetActiveWindow(), 2);

            SoundPlayer.PlaySound(ClickSound);
        }
Exemplo n.º 56
0
 SoundPlayer sp;            //音乐播放器的对象
 private void Form1_Load(object sender, EventArgs e)
 {
     listSongs = new List <string>();
     sp        = new SoundPlayer();
 }
Exemplo n.º 57
0
        /// <summary>
        /// function that triggers when the first done button is clicked
        /// The function gets which radio button is checked and then greets them with their snow name.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            #region get user name
            // check to see if the jeff radio button is checkded
            if (radioButton1.Checked == true)
            {
                // set the user name to jeff
                user_name = "jeff";
            }

            // check to see if the susie radiobutton is checkded
            if (radioButton2.Checked == true)
            {
                // sets the user name to susie
                user_name = "susie";
            }

            // checks to see if the maddi radio button is checked
            if (radioButton3.Checked == true)
            {
                // sets the user name to maddie
                user_name = "maddie";
            }
            #endregion

            // create a tuple that holds the user's two nick names
            Tuple <string, string> user_nick_names = get_nick_name(user_name);

            // set the text on the how is ___ today with ____ blank being the current users mund name
            radioButton8.Text = string.Format("How is {0} today?", user_nick_names.Item2);

            #region picturebox
            // initialize a variable to hold the img for the picturebox
            Image img = null;

            // check witch user
            switch (user_name)
            {
            case "jeff":
                // set the img to me in my flapper hat
                img = Properties.Resources.me_flapper;
                break;

            case "susie":
                // set the img to me in my santa hat
                img = Properties.Resources.me_santa;
                break;

            case "maddie":
                // set the image to me in maddies bear hat
                img = Properties.Resources.me_bear;
                break;
            }

            // rotate the picture
            img.RotateFlip(RotateFlipType.Rotate90FlipNone);

            // set the picture box image as img
            pictureBox1.Image = img;

            // set the picturebox size mode to zoom
            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            #endregion

            #region greeting
            // display the greeting in label 2
            label2.Text = string.Format("Hi, {0}. It's Snow Buddy!", user_nick_names.Item1);

            // update the form so the message get's printed
            this.Update();

            #region get greeting sound clip
            // initialize a variable that will hold the path to the audio greeting resource
            UnmanagedMemoryStream greeting_audio = null;

            // checks who is using the program and which greeting to play
            switch (user_name)
            {
            case "jeff":
                greeting_audio = Properties.Resources.snow_papa;
                break;

            case "susie":
                greeting_audio = Properties.Resources.snow_angel;
                break;

            case "maddie":
                greeting_audio = Properties.Resources.snow_monster;
                break;
            }
            #endregion
            // plays an audio clip
            SoundPlayer player = new SoundPlayer(greeting_audio);
            player.Play();

            #region show the rest of form1
            // sleep before controls become visible
            Thread.Sleep(3000);

            // make the what do youw want to label visible
            label3.Visible = true;

            // make the groupbox visible
            groupBox1.Visible = true;
            #endregion
            #endregion
        }
Exemplo n.º 58
0
        //定时扫描数据库,找到未读信息
        private void tmrMessage_Tick(object sender, EventArgs e)
        {
            ShowFriendList();      //刷新好友列表
            int messageTypeId = 1; //消息类型
            int messageState  = 1; //消息状态
            //找出未读消息对应的好友Id
            string     sql = string.Format("SELECT Top 1 FromUserId,MessageTypeId,MessageState FROM Messages WHERE ToUserId={0}AND MessageState=0", UserHelper.LoginId);
            SqlCommand command;

            //消息有两种类型:聊天消息、添加好友消息
            try
            {
                command = new SqlCommand(sql, DBHelper.connection);
                DBHelper.connection.Open();
                SqlDataReader dataReader = command.ExecuteReader();
                //循环读出一个未读消息
                if (dataReader.Read())
                {
                    this.fromUserId = (int)dataReader["FromUserId"];
                    messageTypeId   = (int)dataReader["MessageTypeId"];
                    messageState    = (int)dataReader["MessageState"];
                }
                dataReader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.message);
            }
            finally
            {
                DBHelper.connection.Close();
            }
            //判断消息类型,如果是添加好友消息,就启动喇叭timer,让小喇叭闪烁
            if (messageTypeId == 2 && messageState == 0)
            {
                SoundPlayer player = new SoundPlayer("sysytem.wav");
                player.Play();
                tmrAddFriend.Start();
            }
            //如果是聊天消息,就启动聊天timer,让好友头像闪烁
            else if (messageTypeId == 1 && messageState == 0)
            {
                //获取发消息人的头像Id
                sql = "SELECT FaceId FROM Users WHEREId=" + this.fromUserId;
                try
                {
                    command = new SqlCommand(sql, DBHelper.connection);
                    DBHelper.connection.Open();
                    this.friendFaceId = Convert.ToInt32(command.ExecuteScalar());//设置发消息的好友的头像索引
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    DBHelper.connection.Close();
                }
                //如果发消息的人没有在列表中就添加到陌生人列表中
                if (!HasShowUser(fromUserId))
                {
                    UpdateStranger(fromUserId);
                }
                SoundPlayer player = new SoundPlayer("msg.wav");
                player.Play();
                tmrChatRequest.Start();//启动闪烁头像定时器
            }
        }
Exemplo n.º 59
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        protected override void Initialize()
        {
            this.musicPlayer = WaveServices.MusicPlayer;
            this.soundPlayer = WaveServices.SoundPlayer;

            this.soundsBank = new SoundBank();
            this.soundsBank.MaxConcurrentSounds = 5;
            this.soundPlayer.RegisterSoundBank(this.soundsBank);

            // Create SoundInfo array
            this.sounds = new SoundInfo[Enum.GetValues(typeof(Audio.Sfx)).Length];

            //this.uniqueLoopedSounds = new Dictionary<Audio.SfxLoop, SoundInstance>();
            //this.playLoopedSoundRequests = new Dictionary<Audio.SfxLoop, int>();

            this.LoadAllSounds();
        }
Exemplo n.º 60
0
        //点击“播放”按钮
        private void playButton_Click(object sender, EventArgs e)
        {
            SoundPlayer playSound = new SoundPlayer(tempFile);

            playSound.Play();
        }