예제 #1
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);
     }
 }
예제 #2
0
 public AiPlayerFactory(IPlayStrategy playStrategy, IDecisionStrategy decisionStrategy)
 {
     if (playStrategy == null) throw new ArgumentNullException(nameof(playStrategy));
     if (decisionStrategy == null) throw new ArgumentNullException(nameof(decisionStrategy));
     _playStrategy = playStrategy;
     _decisionStrategy = decisionStrategy;
 }
예제 #3
0
 // sends events when the play mode is changed
 public void SetPlayMode(PlayMode playMode)
 {
     if (playMode.Equals(PlayMode.Default))
     {
         _playNext = new DefaultNextSong();
     }
     else
     {
         _playNext = new ShuffleNextSong();
     }
     //PlayModeNotification(new object(), new PlayModeEventArgs(playMode));
 }
예제 #4
0
        public void Handle(FileNode file, IVideoPlayerController controller, IPlayStrategy playStrategy, IQueryProcessor processor, IFileDelayStrategy delay)
        {
            var isStatFile = processor.Process(new IsStatFileQuery()
            {
                File = file
            });

            var isStatStrategy = playStrategy is PlayerStatPlayStrategy;

            if (isStatFile)
            {
                controller.ShowStats();
                delay.StartTimer();
            }
            else if (file.Type == FileType.Picture && isStatStrategy)
            {
                delay.StartTimer();
            }
        }
예제 #5
0
        public static IPlayStrategy CreatePlayStrategy(string strategy)
        {
            IPlayStrategy result = null;

            ValidateStrategy(strategy);

            switch (strategy)
            {
            case "S":
                result = new Scissors();
                break;

            case "P":
                result = new Paper();
                break;

            case "R":
                result = new Rock();
                break;
            }

            return(result);
        }
예제 #6
0
 public override bool Beat(IPlayStrategy strategy)
 {
     return(strategy.Simbol == new Scissors().Simbol);
 }
예제 #7
0
        private void MakePlay(IPlayer player)
        {
            IPlayStrategy playStrategy = _playStrategyFactory.GetPlayStrategy(player);

            playStrategy.Play(player);
        }
예제 #8
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);
        }
예제 #9
0
 public void Play(IPlayStrategy strategy, IVideoPlayerController videoPlayer)
 {
     strategy.Play(new List<FileNode>() { File }, videoPlayer);
     // TODO : Remove this print
     Console.WriteLine("Playable File: {0}", Name);
 }
예제 #10
0
 public abstract bool Beat(IPlayStrategy strategy);
예제 #11
0
파일: Playing.cs 프로젝트: stovpyak/Words
 public Playing(IPlayStrategy playStrategy)
 {
     _playStrategy = playStrategy;
 }
예제 #12
0
 public override bool Beat(IPlayStrategy strategy)
 {
     return(strategy.Simbol == new Paper().Simbol);
 }
 public GameEntry(string playerName, string playerMove)
 {
     PlayerName = playerName;
     PlayerMove = PlayStrategyCreator.CreatePlayStrategy(playerMove);
 }