示例#1
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);
        }
示例#2
0
        //Faz login em uma conta ja existente
        public int Login()
        {
            string save = "noSave";

            while (save == "noSave")
            {
                Console.Clear();
                Senha = "";
                library.slowWrite("Username: "******"Password: "******"*");
                }

                save = this.Load(Username, Senha);
            }
            Console.Clear();
            string RespMenu = ImprimeLoadMenu();

            switch (Int32.Parse(RespMenu))
            {
            case 1:
                if (save == "fase1")
                {
                    //Carregar fase 1
                }
                else if (save == "fase2")
                {
                    //Carregar fase 2
                }

                break;

            case 2:
                MenuPrincipal menuPrincipal = MenuPrincipal.Instance;
                menuPrincipal.NewChar(this);
                break;

            case 3:
                Console.Clear();
                library.slowWrite("Thank you for playing! Goodbye.", Constants.TEXT_SPEED3, true);
                Environment.Exit(1);
                break;
            }

            return(1);
        }