コード例 #1
0
 public override void PlayWholeMovie()
 {
     if (currentTime > 0 && InputUtil.GetInputBoolYesNo("The cassette is not set to play from the beginning. Rewind? (y/n)"))
     {
         Rewind();
     }
     //play from current position to end of movie
     for (; currentTime < scenes.Count; currentTime++)
     {
         Console.WriteLine($"{scenes[currentTime]}");
     }
 }
コード例 #2
0
        public void CheckOut()
        {
            PrintMovies();
            int   movieIndex    = InputUtil.ReadInteger("\nWhat movie would you like to watch? ", 1, movies.Count);
            Movie selectedMovie = movies[movieIndex - 1];

            selectedMovie.PrintInfo();

            string[] watchMoreYes  = { "y", "yes" };
            string[] watchMoreNo   = { "n", "no" };
            bool     watchMovieNow = InputUtil.GetInputBool("\nDo you want to watch the movie? Y/N", watchMoreYes, watchMoreNo);

            if (watchMovieNow)
            {
                selectedMovie.Play();
            }
        }
コード例 #3
0
        public static void RunApp()
        {
            Console.WriteLine("Welcome to GC Blockbuster Lab!\n");

            BlockBuster gcbb = new BlockBuster();

            bool keepWatching;

            string[] watchMoreYes = { "y", "yes" };
            string[] watchMoreNo  = { "n", "no" };
            do
            {
                gcbb.CheckOut();
                keepWatching = InputUtil.GetInputBool("Watch another movie?", watchMoreYes, watchMoreNo);
            } while (keepWatching);
            Console.WriteLine("\nThank you and come again!\n");
        }
コード例 #4
0
 public override void Play()
 {
     if (InputUtil.GetInputBoolYesNo("Would you like to play the entire movie? (y/n)"))
     {
         this.PlayWholeMovie();
         return;
     }
     try
     {
         Console.WriteLine($"\tplaying scene {currentTime}: {scenes[currentTime]}");
         currentTime++;
     }
     catch
     {
         Console.WriteLine("\nYou've reached the final scene! Please be kind and rewind.\nWait! Modernly, we auto-rewind.\n");
         Rewind();
     }
 }
コード例 #5
0
        public override void Play()
        {
            if (InputUtil.GetInputBoolYesNo("Play entire movie? (y/n)"))
            {
                PlayWholeMovie();
                return;
            }
            bool watchMoreScenes = true;

            PrintScenes();
            while (watchMoreScenes)
            {
                int sceneIndex = InputUtil.ReadInteger(
                    $"What scene of the DVD, {title}, would you like to watch? ", 1, scenes.Count);
                Console.WriteLine($"\tplaying scene {sceneIndex}: {scenes[sceneIndex - 1]}");
                string[] watchMoreYes = { "y", "yes" };
                string[] watchMoreNo  = { "n", "no" };
                watchMoreScenes = InputUtil.GetInputBool("Watch another scene?", watchMoreYes, watchMoreNo);
            }
        }