Beispiel #1
0
        public static int Main()
        {
            Menu.MenuPrincipal menuPrincipal = new MenuPrincipal();
            menuPrincipal.ImprimeMenu2();
            menuPrincipal.SetChosed();

            //Teste de Save
            Save      memoria     = new Save();
            Caretaker armazenador = new Caretaker(memoria);

            /*
             * memoria.SetState("Estado 1");
             * armazenador.SaveState();
             * Console.WriteLine(memoria.GetState());
             *
             * memoria.SetState("Estado 2");
             * Console.WriteLine(memoria.GetState());
             *
             * armazenador.RestoreState();
             * Console.WriteLine(memoria.GetState());
             */


            return(0);
        }
Beispiel #2
0
        public static int Main()
        {
            bool win   = false;
            int  state = 1;

            MenuPrincipal menuPrincipal = Instance;

            menuPrincipal.ImprimeMenu2();

            Tema oTema = new Forest();
            Hero oHero = menuPrincipal.SetChosed();

            Save      memoria     = new Save();
            Caretaker armazenador = new Caretaker(memoria);

            memoria.SetState(state);

            //Fase 1
            while (!win)
            {
                armazenador.SaveState();
                oHero.revive();
                Stage oStage = new Stage(state, oTema, oHero);

                //Inicia prologo
                oStage.createGraph();
                win = oStage.startStage();
                if (!win)
                {
                    menuPrincipal.TryAgain();
                    armazenador.RestoreState();
                }
            }
            library.slowWrite("You got the SINGLETON scroll. The Singleton is a powerful pattern that lock an object to be unique on the context.", Constants.TEXT_SPEED2, true);
            library.slowWrite("End of Chapter 1.", Constants.TEXT_SPEED2, true);

            return(0);
        }