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); } }
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; }
// 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)); }
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(); } }
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); }
public override bool Beat(IPlayStrategy strategy) { return(strategy.Simbol == new Scissors().Simbol); }
private void MakePlay(IPlayer player) { IPlayStrategy playStrategy = _playStrategyFactory.GetPlayStrategy(player); playStrategy.Play(player); }
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); }
public void Play(IPlayStrategy strategy, IVideoPlayerController videoPlayer) { strategy.Play(new List<FileNode>() { File }, videoPlayer); // TODO : Remove this print Console.WriteLine("Playable File: {0}", Name); }
public abstract bool Beat(IPlayStrategy strategy);
public Playing(IPlayStrategy playStrategy) { _playStrategy = playStrategy; }
public override bool Beat(IPlayStrategy strategy) { return(strategy.Simbol == new Paper().Simbol); }
public GameEntry(string playerName, string playerMove) { PlayerName = playerName; PlayerMove = PlayStrategyCreator.CreatePlayStrategy(playerMove); }