예제 #1
0
 public bool KeyPressed(Grille grille)
 {
     while (true)
     {
         ConsoleKeyInfo cki;
         cki = Console.ReadKey(true);
         this.userCommand(cki);
     }
 }
예제 #2
0
        public GameManager(String ipAddress, int portNum)
        {
            _client = new TcpClient();
            _client.Connect(ipAddress, portNum);
            StreamReader reader = new StreamReader(_client.GetStream(), Encoding.ASCII);

            string [] str = splitInfos(reader);
            this.column           = Convert.ToInt32(str[0]);
            this.maxNumberOfLines = Convert.ToInt32(str[1]);
            this.delaySpeed       = Convert.ToInt32(str[2]);

            //init grille
            this.grille = new Grille(maxNumberOfLines, column);

            this.refresh         = 25;
            this.finishGame      = false;
            this.finishWithPiece = false;
            this.threadDisplay   = new Thread(() => display(this));
            //     this.threadDelete = new Thread(() => deleteLine());
            this.threadKey = new Thread(() => KeyPressed(grille));
            this.setGameManager();
        }
예제 #3
0
 public void goDown(Grille grille)
 {
     grille.suppressionPiece();
     grille.descendrePiece();
     Thread.Sleep(this.delaySpeed);
 }
예제 #4
0
 public void goLeft(Grille grille)
 {
     grille.suppressionPiece();
     grille.deplacementPiece(false);
 }
예제 #5
0
 public void goRight(Grille grille)
 {
     grille.suppressionPiece();
     grille.deplacementPiece(true);
 }
예제 #6
0
 public void addPiece(Grille grille, int id)
 {
     //Ajout Piece
     grille.AjoutPiece(new Piece(id));
 }