Exemplo n.º 1
0
 public PosterActivity(Poster poster, CentraProccessing cpu, string label)
 {
     st          = Game.OUG;
     this.label  = label;
     this.poster = poster;
     this.cpu    = cpu;
 }
Exemplo n.º 2
0
        public override void getKey(char key)
        {
            switch (key)
            {
            case Game.UP_KEY:
                itemUp();
                break;

            case Game.DOWN_KEY:
                itemDown();
                break;

            case Game.ZERO_KEY:
                cpu.createMapSourceTD("Tu do", source[index]);
                Poster    p      = new Poster(cpu.blankPoster);
                SpeedMenu spmenu = new SpeedMenu(p, cpu);
                cpu.pushStack(spmenu);
                cpu.topOfStackWork();
                break;

            case Game.BACK_KEY:
                cpu.popStack();
                cpu.drawTopOfStack();
                break;

            case Game.REFRESH_KEY:
                cpu.drawInfoFrame();
                drawAll();
                break;
            }
        }
Exemplo n.º 3
0
 public ChoseMapMenu(Poster poster, CentraProccessing cpu)
 {
     st          = Game.OUG;
     label       = "Map Menu";
     index       = 0;
     source      = new List <string>();
     item        = new List <string>();
     this.poster = poster;
     this.cpu    = cpu;
     try
     {
         string[] file = Directory.GetFiles("map").Where(n => n.EndsWith(".mp")).ToArray();
         if (file.Length == 0)
         {
             throw new Exception();
         }
         int i = 1;
         foreach (var s in file)
         {
             source.Add(s);
             item.Add(i + "." + Path.GetFileName(s).Split('.')[0]);
             i++;
         }
     }
     catch (Exception e)
     {
         Environment.Exit(1);
     }
 }
Exemplo n.º 4
0
 public FirstMenu(Poster poster, CentraProccessing cpu)
 {
     st          = Game.OUG;
     label       = "T.P.Menu";
     index       = 0;
     this.poster = poster;
     this.cpu    = cpu;
 }
Exemplo n.º 5
0
 public EndGame(Poster poster, CentraProccessing cpu, string label, string[] data)
 {
     st          = Game.OUG;
     this.label  = label;
     this.poster = poster;
     this.cpu    = cpu;
     this.data   = data;
 }
Exemplo n.º 6
0
 public SpeedMenu(Poster poster, CentraProccessing cpu)
 {
     this.poster = poster;
     this.cpu    = cpu;
     index       = 0;
     label       = "S.Menu";
     st          = Game.OUG;
 }
Exemplo n.º 7
0
 public Option(Poster poster, CentraProccessing cpu, string label)
 {
     st          = Game.OUG;
     this.label  = label;
     this.poster = poster;
     this.cpu    = cpu;
     key         = '\0';
     index       = 0;
 }
Exemplo n.º 8
0
 public MapNotification(Poster poster, CentraProccessing cpu, Map map, User user, string label, string[] data)
 {
     st          = Game.OUG;
     this.label  = label;
     this.poster = poster;
     this.cpu    = cpu;
     this.data   = data;
     this.map    = map;
     this.user   = user;
 }
Exemplo n.º 9
0
 public SettingMenu(Poster poster, CentraProccessing cpu)
 {
     st          = Game.OUG;
     label       = "Setting";
     menuType    = 0;
     clY         = Game.colorIndex;
     fiY         = Game.figureIndex;
     ctY         = Game.mapColorIndex;
     this.poster = poster;
     this.cpu    = cpu;
 }
Exemplo n.º 10
0
        //lay du lieu ban phim
        public override void getKey(char key)
        {
            switch (key)
            {
            case Game.UP_KEY:
                itemUp();
                break;

            case Game.DOWN_KEY:
                itemDown();
                break;

            case Game.ZERO_KEY:
                Poster p = new Poster(cpu.blankPoster);
                switch (index)
                {
                case 0:
                    cpu.setTypePlay(CentraProccessing.TypePlay.TUDO);
                    cpu.pushStack(new ChoseMapMenu(p, cpu));
                    break;

                case 1:
                    cpu.setTypePlay(CentraProccessing.TypePlay.CHIENDICH);
                    cpu.pushStack(new SpeedMenu(p, cpu));
                    break;

                case 2:
                    cpu.pushStack(new SettingMenu(p, cpu));
                    break;

                case 3:
                    Environment.Exit(0);
                    break;
                }
                cpu.topOfStackWork();

                break;

            case Game.BACK_KEY:
                cpu.popStack();
                cpu.drawTopOfStack();
                break;

            case Game.REFRESH_KEY:
                cpu.drawInfoFrame();
                drawAll();
                break;
            }
        }
Exemplo n.º 11
0
        public override void getKey(char c)
        {
            switch (c)
            {
            case Game.ZERO_KEY:
                Poster    p      = new Poster("poster/menu.mp");
                FirstMenu tpmenu = new FirstMenu(p, cpu);
                cpu.pushStack(tpmenu);
                cpu.topOfStackWork();
                break;

            case Game.REFRESH_KEY:
                cpu.drawInfoFrame();
                drawAll();
                break;
            }
        }
Exemplo n.º 12
0
        public CentraProccessing()
        {
            Console.SetWindowSize(Game.W_WIDTH, Game.W_HEIGHT);
            Console.BackgroundColor = Game.W_COLOR;
            Game.mapColor           = ConsoleColor.Yellow;
            Game.snake_color        = ConsoleColor.Cyan;
            Game.snake_fig          = '▓';
            firstPoster             = new Poster("poster/poster.mp");
            blankPoster             = new Poster("poster/menu.mp");
            win  = new Poster("poster/Win.mp");
            info = new InfoTable("control/control.mp");
            info.showFrame();

            notification = new Stack <Activity>();
            sourceMap    = new Stack <string[]>();
            activity     = new Stack <Activity>();
            Poster         p = new Poster(firstPoster);
            PosterActivity s = new PosterActivity(p, this, "Poster");

            activity.Push(s);
            topOfStack = activity.First();
            topOfStack.work();
        }
Exemplo n.º 13
0
        //lam gi khi co phim nhap vao
        private bool reactKey()
        {
            if (key == '\0')
            {
                return(false);
            }
            UserSnake n   = canvas.getSnake;
            int       dir = n.getDir;

            switch (key)
            {
            //di len
            case Game.UP_KEY:
                if (st == Game.PLAY && dir != Snake.UP && dir != Snake.DOWN)
                {
                    n.setDir(Snake.UP);
                }
                break;

            //di xuong
            case Game.DOWN_KEY:
                if (st == Game.PLAY && dir != Snake.UP && dir != Snake.DOWN)
                {
                    n.setDir(Snake.DOWN);
                }
                break;

            //qua trai
            case Game.LEFT_KEY:
                if (st == Game.PLAY && dir != Snake.RIGHT && dir != Snake.LEFT)
                {
                    n.setDir(Snake.LEFT);
                }
                break;

            //qua phai
            case Game.RIGHT_KEY:
                if (st == Game.PLAY && dir != Snake.RIGHT && dir != Snake.LEFT)
                {
                    n.setDir(Snake.RIGHT);
                }
                break;

            case Game.ZERO_KEY:
                if (st == Game.G_OVER)         //choi lai
                {
                    reset();
                    workFirst();
                }
                else if (st == Game.PAUSE)      //tiep tuc
                {
                    if (canvas.isGameOver)
                    {
                        st = Game.G_OVER;
                        cpu.addInfomation(InfoTable.TYPE.STATE, Game.G_OVER_DESCRIPTION, ConsoleColor.Red);
                    }
                    else
                    {
                        st = Game.PLAY;
                        cpu.addInfomation(InfoTable.TYPE.STATE, Game.PLAY_DESCRIPTION, ConsoleColor.Magenta);
                    }
                }
                else if (st == Game.PLAY)       //tam ngung
                {
                    st = Game.PAUSE;
                    cpu.addInfomation(InfoTable.TYPE.STATE, Game.PAUSE_DESCRIPTION, ConsoleColor.Magenta);
                }
                break;

            case Game.BACK_KEY:              //Mo bang option
                Poster p   = new Poster(cpu.blankPoster);
                Option ntf = new Option(p, cpu, "Option");
                cpu.pushStack(ntf);
                cpu.topOfStackWork();
                key = '\0';
                return(true);

            case Game.REFRESH_KEY:           //ve lai toan bo game
                cpu.drawInfoFrame();
                drawAll();
                break;
            }
            key = '\0';
            return(false);
        }
Exemplo n.º 14
0
 public Poster(Poster p)
 {
     this.data = p.data;
 }