Esempio n. 1
0
 private void Game_OnGameOver(Game2048Args e)
 {
     if (e.IsWin)
     {
         lbReply.Enabled = true;
     }
     lbGameOver.Visible   = true;
     lbGameOver.ForeColor = e.IsWin ? Color.Green : Color.Red;
     lbGameOver.Text      = "Game " + (e.IsWin ? "Win" : "Lost") + "!";
 }
Esempio n. 2
0
 private void Game2048_OnScore(Game2048Args e)
 {
     if (e.GetLastScore().CountScore > Record.CountScore)
     {
         Record = e.GetLastScore();
         OnRecord?.Invoke(args);
     }
     if (e.MaxNumberNow >= NumberForWin && !InfinityMode)
     {
         IsWin = true;
         GameOver();
     }
 }
Esempio n. 3
0
        public _2048Controller(Game2048 game, Form Form, Point Location, Size CageSize, Action <Move> Callback)
        {
            args            = new Game2048Args();
            Game            = game;
            MainForm        = Form;
            this.Location   = Location;
            this.CageSize   = CageSize;
            this.Callback   = Callback;
            BackgroundCages = new List <Cage>();
            //Cages = new List<Cage>();
            //setFreeCages();

            //OnScore += Game2048_OnScore;
        }
Esempio n. 4
0
        public Game2048(Form Form, Point Location, Point CellSize, Size CageSize, Action <Move> Callback)
        {
            args            = new Game2048Args();
            MainForm        = Form;
            this.Location   = Location;
            this.CellSize   = CellSize;
            this.CageSize   = CageSize;
            this.Callback   = Callback;
            BackgroundCages = new List <Cage>();
            Cages           = new List <Cage>();
            setFreeCages();

            OnScore += Game2048_OnScore;
        }
Esempio n. 5
0
 private void Game_OnScore(Game2048Args e) => lbScore.Text = e.GetLastScore().CountScore.ToString();
Esempio n. 6
0
 private void Game_OnRecord(Game2048Args e) => lbRecord.Text = e.GetLastRecord().CountScore.ToString();
Esempio n. 7
0
 private void Game_OnMove(Game2048Args e) => lbCountMove.Text = e.CountMove.ToString();