Exemplo n.º 1
0
        public static void PlayFunc(IPlayable player1, IRecordable player2)
        {
            player1.Play();
            Console.WriteLine("Please select the next command: record, pause or stop!");
            string action = Console.ReadLine();

            switch (action)
            {
            case "record": player2.Record(); RecordFunc(player1, player2); break;

            case "pause": player1.Pause();
                Console.WriteLine("Please select your next step: stop or play again!");
                string actionNext = Console.ReadLine();
                switch (actionNext)
                {
                case "stop": player1.Stop(); break;

                case "play": PlayFunc(player1, player2); break;

                default: Console.WriteLine("Please select a valid command!"); break;
                }
                break;

            case "stop": player1.Stop(); break;

            default: Console.WriteLine("Please select a valid command!"); break;
            }
        }
Exemplo n.º 2
0
 public void PlayNextItem(Queue<FileNode> queue, VideoPlayerController controller, IPlayStrategy strategy, IPlayable previous)
 {
     if (!controller.Queue.IsEmpty())
     {
         var file = queue.Dequeue();
         controller.Play(file);
         if (file.Type == FileType.Audio && queue.Peek().Type != FileType.Audio)
         {
             controller.Play(queue.Dequeue());
         }
     }
     else if (strategy.Repeat)
     {
         previous.Play(strategy, controller);
     }
     else if (previous is Player)
     {
         var playlist = _processor.Process(new GetGoalPlayListQuery());
         if (playlist == null) return;
         controller.Play(playlist, new PlayListPlayStrategy());
     }
     else if (controller.AutoPlayList)
     {
         var playlist = _processor.Process(new GetAutoPlayListQuery());
         if (playlist == null) return;
         playlist.Play(null, controller);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// There's a slight delay to Play()'s effects occurring, so we wait for
        /// Play() to be completely finished, and then perform our action.
        ///
        /// If we don't do this, then item counts won't be updated since it'll go in this order:
        /// Play coroutine started
        /// Item buttons get setup
        /// Used item is decremented in count by 1
        /// </summary>
        /// <param name="playgroup">PlayGroup</param>
        /// <param name="postAction">Action to perform after PlayGroup is finished.</param>
        /// <returns></returns>
        private static IEnumerator PerformInOrder(Page page, IPlayable play, Action postAction)
        {
            yield return(play.Play());

            page.AddText(play.Text);
            postAction.Invoke();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.Write("Select the mode: ");
            string mode   = Console.ReadLine();
            Player player = new Player();

            switch (mode.ToLower())
            {
            case "record":
                Console.WriteLine("Available action in this mode:");
                IRecodable recodable = player as IRecodable;
                recodable.Record();
                recodable.Pause();
                recodable.Stop();
                break;

            case "play":
                Console.WriteLine("Available action in this mode:");
                IPlayable playable = player as IPlayable;
                playable.Play();
                playable.Pause();
                playable.Stop();
                break;

            default:
                Console.WriteLine("The mode is not exist.");
                break;
            }
        }
Exemplo n.º 5
0
 public void Play(IPlayable card)
 {
     card.Play();
     if (CardPlayed != null)
     {
         CardPlayed(this, card);
     }
 }
Exemplo n.º 6
0
 public void Play(IPlayable playable)
 {
     if (playable is Playlist)
     {
         (playable as Playlist).AllAboutMedia();
     }
     playable.Play();
 }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            Player     player    = new Player();
            IPlayable  playable  = player;
            IRecodable recodable = player as IRecodable;

            playable.Play();
            playable.Pause();
            recodable.Record();
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            Player     player    = new Player();
            IRecodable recodable = player as IRecodable;

            recodable.Record();
            recodable.Pause();
            recodable.Stop();
            Console.WriteLine(new string('-', 50));
            IPlayable playable = player as IPlayable;

            playable.Play();
            playable.Pause();
            playable.Stop();
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            Player pl = new Player();

            IPlayable  ipl = pl;
            IRecodable irc = pl;

            ipl.Play();
            irc.Record();

            Console.WriteLine(ipl.GetHashCode());
            Console.WriteLine(irc.GetHashCode());
            Console.WriteLine(pl.GetHashCode());
            Console.ReadKey();
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            Player      player       = new Player();
            IRecordable recordDevice = player;
            IPlayable   playerDevice = player;

            recordDevice.Record();
            recordDevice.Pause();
            recordDevice.Stop();

            playerDevice.Play();
            playerDevice.Pause();
            playerDevice.Stop();

            Console.ReadLine();
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            Player    player = new Player();
            IPlayable music  = player;

            music.Play();
            music.Pause();
            music.Stop();

            IRecordable recorder = player;

            recorder.Record();
            recorder.Pause();
            recorder.Stop();

            Console.ReadKey();
        }
Exemplo n.º 12
0
        private static void Main(string[] args)
        {
            Player    player     = new Player();
            IPlayable playPlayes = player;

            playPlayes.Play();
            playPlayes.Pause();
            playPlayes.Stop();

            IRecodable recordPlayes = player;

            recordPlayes.Record();
            recordPlayes.Pause();
            recordPlayes.Stop();

            Console.Read();
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            Player player = new Player();

            IRecordable irec = player;
            IPlayable   ipl  = player;

            irec.Record();
            irec.Pause();
            irec.Stop();
            Console.WriteLine();
            ipl.Play();
            ipl.Pause();
            ipl.Stop();

            Console.WriteLine();
            Console.ReadLine();
        }
Exemplo n.º 14
0
        /* Створіть 2 інтерфейсу IPlayable і IRecodable. У кожному з інтерфейсів створіть по 3 методу
         * voidPlay () / voidPause () / voidStop () і voidRecord () / voidPause () / voidStop () відповідно.
         * Створіть похідний клас Player від базових інтерфейсів IPlayable і IRecodable. Написати програму, яка виконує програвання і запис.*/

        static void Main(string[] args)
        {
            Player myPlay = new Player();

            IPlayable myPlayer = myPlay as IPlayable;

            myPlayer.Play();
            myPlayer.Pause();
            myPlayer.Stop();

            IRecodable myRecorder = myPlay as IRecodable;

            myRecorder.Record();
            myRecorder.Pause();
            myRecorder.Stop();

            Console.ReadKey();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Plays the video
        /// </summary>
        /// <param name="button">Button to set styles to</param>
        public void Play(Button button, IPlayable playable)
        {
            this.SwitchButtonStyle(button);
            if (CheckException.CheckNull(playable))
            {
                if (!this.MainScreenInstance.timerForProgress.Enabled)
                {
                    this.MainScreenInstance.timerForProgress.Start();
                }

                playable.Play();
            }

            if (this.MainScreenInstance.timerForRF.Enabled)
            {
                this.MainScreenInstance.timerForRF.Stop();
                playable.PlayBackSpeed = 0;
            }
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            Player    player = new Player();
            IPlayable ip     = player as IPlayable;

            ip.Play();
            ip.Pause();
            ip.Stop();

            Console.WriteLine();

            IRecodable ir = player as IRecodable;

            ir.Record();
            ir.Pause();
            ir.Stop();

            Console.ReadLine();
        }
Exemplo n.º 17
0
        public void PlayGame(Game Game)
        {
            Game.Player1.Choice.Keep(x => x.Cost <= 2);
            Game.Player2.Choice.Keep(x => x.Cost <= 2);

            for (int i = 0; i < 20; i++)
            {
                Game.EndTurn();
            }

            if (Game.CurrentPlayer != Game.Player1)
            {
                Game.EndTurn();
            }

            var cardsInHand = Game.CurrentPlayer.Hand.Count;

            // Acolyte is in deck, should not trigger
            Game.CurrentPlayer.Give("Whirlwind").Play();
            System.Diagnostics.Debug.Assert(cardsInHand == Game.CurrentPlayer.Hand.Count);

            // Acolyte is in hand, should not trigger
            acolyte.Zone = Game.CurrentPlayer.Hand;
            cardsInHand++;
            Game.CurrentPlayer.Give("Whirlwind").Play();
            System.Diagnostics.Debug.Assert(cardsInHand == Game.CurrentPlayer.Hand.Count);

            // Acolyte is in hand, trigger should be checked but not fire
            Game.CurrentPlayer.Give("War Golem").Play();
            Game.CurrentPlayer.Give("Whirlwind").Play();
            System.Diagnostics.Debug.Assert(cardsInHand == Game.CurrentPlayer.Hand.Count);

            // Acolyte is on board, trigger should be checked and fire
            acolyte.Play();
            cardsInHand--;
            Game.CurrentPlayer.Give("Whirlwind").Play();
            System.Diagnostics.Debug.Assert(cardsInHand + 1 == Game.CurrentPlayer.Hand.Count);

            // Acolyte is in graveyard, should not trigger
            acolyte.Zone = Game.CurrentPlayer.Graveyard;
            Game.CurrentPlayer.Give("Whirlwind").Play();
            System.Diagnostics.Debug.Assert(cardsInHand + 1 == Game.CurrentPlayer.Hand.Count);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Plays the video
        /// </summary>
        /// <param name="button">Button to set styles to</param>
        public void Play(Button button, IPlayable playable)
        {
            this.SwitchButtonStyle(button);
            if (CheckException.CheckNull(playable))
            {
                if (!this.MainScreenInstance.timerForProgress.Enabled)
                {
                    this.MainScreenInstance.timerForProgress.Start();
                }

                playable.Play();
            }

            if (this.MainScreenInstance.timerForRF.Enabled)
            {
                this.MainScreenInstance.timerForRF.Stop();
                playable.PlayBackSpeed = 0;
            }
        }
Exemplo n.º 19
0
        public void TestTriggerAttachment()
        {
            var       game    = new Game(HeroClass.Hunter, HeroClass.Warlock, PowerHistory: true, ActionHistory: true);
            var       p1      = game.Player1;
            var       p2      = game.Player2;
            IPlayable acolyte = p1.Deck.Add(new Minion("Acolyte of Pain"));

            p1.Deck.Fill();
            p2.Deck.Fill();
            game.Start(1);

            p1.Choice.Keep(x => x.Cost <= 2);
            p2.Choice.Keep(x => x.Cost <= 2);
            var cardsInHand = p1.Hand.Count;

            // Acolyte is in deck, should not trigger
            p1.Give("Whirlwind").Play();
            Assert.That(cardsInHand == p1.Hand.Count);

            // Acolyte is in hand, should not trigger
            acolyte.Zone = p1.Hand;
            cardsInHand++;
            p1.Give("Whirlwind").Play();
            Assert.That(cardsInHand == p1.Hand.Count);

            // Acolyte is in hand, trigger should be checked but not fire
            p1.Give("War Golem").Play();
            p1.Give("Whirlwind").Play();
            Assert.That(cardsInHand == p1.Hand.Count);

            // Acolyte is on board, trigger should be checked and fire
            acolyte.Play();
            cardsInHand--;
            p1.Give("Whirlwind").Play();
            cardsInHand++;
            Assert.That(cardsInHand == p1.Hand.Count);

            // Acolyte is in graveyard, should not trigger
            acolyte.Zone = p1.Graveyard;
            p1.Give("Whirlwind").Play();
            Assert.That(cardsInHand == p1.Hand.Count);
        }
Exemplo n.º 20
0
            public static void Show(IPlayable player)
            {
                string answer = String.Empty;

                do
                {
                    Console.WriteLine("Выберите действие с проигрыванием:");
                    Console.WriteLine("0 - Выход");
                    Console.WriteLine("1 - Проиграть музыку");
                    Console.WriteLine("2 - Приостановить музыку");
                    Console.WriteLine("3 - Остановить музыку");

                    answer = Console.ReadLine();
                    Console.WriteLine("\n");

                    switch (answer)
                    {
                    case "0":
                        Console.WriteLine("Выполняем выход...");
                        break;

                    case "1":
                        player.Play();
                        break;

                    case "2":
                        player.Pause();
                        break;

                    case "3":
                        player.Stop();
                        break;

                    default:
                        Console.WriteLine("Некорректное действие, попробуйте еще раз...");
                        break;
                    }
                    Console.WriteLine("\n");
                } while (answer != "0");
            }
        static void Main(string[] args)
        {
            Player player = new Player();

            Console.WriteLine("***Player***");
            IPlayable player1 = player;

            player1.Play();
            player1.Pause();
            player1.Stop();

            Console.WriteLine();

            Console.WriteLine("***Recorder***");
            IRecordable recorder = player;

            recorder.Record();
            recorder.Pause();
            recorder.Stop();

            Console.ReadKey();
        }
        /// <summary>
        /// Установить действия плеера в режиме проигрывания музики
        /// </summary>
        /// <param name="playerPlaying">Режим проигрывания музики</param>
        /// <param name="action"> Действие</param>
        private static void SetPlayingActions(IPlayable playerPlaying, int action)
        {
            switch (action)
            {
            case 1:
            {
                playerPlaying.Play();
                break;
            }

            case 2:
            {
                playerPlaying.Pause();
                break;
            }

            default:
            {
                playerPlaying.Stop();
                break;
            }
            }
        }
        private void Run()
        {
            soundManager = new SoundManager(new AudioDevice(), ManagerGlue.JMOD, 1, 30);
            soundManager.ContentPath = "Data/Sound/";
            soundManager.LoadSounds(true);

            playable = soundManager.GetSFX(SFX.SwordSwish1);
            //playable = soundManager.GetStream(Stream.MainMenuMusic1);
            channel = playable.Play(new Client.Sound.PlayArgs { Looping = true });
            //channel.Looping = true;
            //channel.PlaybackStopped += new EventHandler(channel_PlaybackStopped);
            //channel.PlaybackStopped += (sender, ea) => { Console.WriteLine("Playback ended. Restarting..."); channel = p.Play(); };

            float dtime = 1 / 60f;
            while (true)
            {
                soundManager.Update(dtime, Vector3.Zero, Vector3.Zero, Vector3.UnitX, Vector3.UnitZ);
                System.Threading.Thread.Sleep((int)(dtime * 1000));
                //VolumeTest(dtime / 4f);
                //PauseTest(dtime / 4f);
                //GlobalMuteTest(dtime / 4f);
            }
        }
Exemplo n.º 24
0
        private IEnumerator PerformActions(List <IPlayable> plays)
        {
            // Shuffle first, then do a stable sort to make speed ties random
            plays.Shuffle();
            plays = plays.OrderBy(p => p).ToList();
            for (int i = 0; i < plays.Count; i++)
            {
                yield return(new WaitForSeconds(0.10f));

                IPlayable play  = plays[i];
                Spell     spell = play.MySpell;

                // Dead characters cannot unleash spells
                if (CharacterCanCast(play.MySpell.Caster))   // Death check
                {
                    string spellMessage = string.Empty;

                    // Do a different message if the spell cannot be cast on the target
                    if (play.IsPlayable)
                    {
                        spellMessage = play.Text;
                        MakeEveryonesBuffsReactToSpell(spell);
                    }
                    else
                    {
                        spellMessage = Spell.GetCastMessage(spell.Caster, spell.Target, spell.Book, ResultType.FAILED);
                    }
                    AddText(new TextBox(
                                spellMessage,
                                play.MySpell.Book.TextboxTooltip));
                    yield return(play.Play());

                    yield return(CharacterDialogue(spell.Target, spell.Target.Brain.ReactToSpell(spell)));
                }
            }
        }
Exemplo n.º 25
0
        public void Play(IPlayable playable, IPlayStrategy strategy)
        {
            _delayStrategy.StopTimer();

            if (playable is PlayableFile)
            {
                var playableFile = playable as PlayableFile;
                if (playableFile.File.Type == FileType.Audio)
                {
                    _previousMusicPlayable = playableFile;
                } else
                {
                    _previousVideoPlayable = playableFile;
                    _videoPlayStrategy = strategy;
                }
            } else
            {
                _previousVideoPlayable = playable;
                _videoPlayStrategy = strategy;
            }

            playable.Play(strategy, this);

            // TODO : Remove this print
            Console.WriteLine("Video Player Controller: {0}", playable.Name);
        }
Exemplo n.º 26
0
 public Move Play()
 {
     return(playStrategy.Play(this));
 }
Exemplo n.º 27
0
 public override void Init()
 {
     playable = SoundManager.GetStream(Stream.ScoreScreenVictoryMusic1);
     channel = playable.Play(new PlayArgs { Looping = true, FadeInTime = 1f });
 }
Exemplo n.º 28
0
 private void btPlay_Click(object sender, EventArgs e) => _player.Play();