コード例 #1
0
            private void ExecuteNewGameCommand(byte[] commandParameters)
            {
                int height     = commandParameters[0];
                int width      = commandParameters[1];
                int minesCount = commandParameters[2];
                int x          = commandParameters[3];
                int y          = commandParameters[4];
                NewGameEventArgs e;

                if (commandParameters.Length == 9)//Seed is sent
                {
                    byte[] seedBytes = new byte[4];
                    commandParameters.CopyTo(seedBytes, 3);
                    int seed = ByteArrayConverter.ToInt32(seedBytes);
                    model.NewGame(height, width, minesCount, seed);
                    e = new NewGameEventArgs(height, width, minesCount, seed);
                }
                else//Seed is not sent
                {
                    model.NewGame(height, width, minesCount);
                    e = new NewGameEventArgs(height, width, minesCount);
                }

                model.OnNewGame(e);
                List <Sector>          initialList = model.RevealSector(x, y);
                RevealSectorsEventArgs ee          = new RevealSectorsEventArgs(initialList);

                model.OnRevealSectors(ee);
            }
コード例 #2
0
 /// <summary>
 /// added
 /// </summary>
 /// <param name="e"></param>
 public void OnRevealSectors(RevealSectorsEventArgs e)
 {
     if (RevealSectorRequested != null && !blockMode)
     {
         RevealSectorRequested(this, e);
     }
 }