예제 #1
0
 internal static bool OpenSaveFile(GameBoard board)
 {
     OpenFileDialog d = new OpenFileDialog();
     d.Filter = "Kvj Save File (*.kvj)|*.kvj";
     if (d.ShowDialog(board) != DialogResult.Cancel)
     {
         try
         {
             using (FileStream fs = (System.IO.FileStream)d.OpenFile())
             {
                 byte[] bytes = new byte[fs.Length];
                 fs.Read(bytes, 0, bytes.Length);
                 board.Deserialize(bytes);
             }
             return true;
         }
         catch (Exception)
         {
             return false;
         }
     }
     else
     {
         return false;
     }
 }
예제 #2
0
 public StartGameMenu(GameBoard board, bool fromCommonLauncher)
 {
     InitializeComponent();
     if (!fromCommonLauncher)
         btnBack.Enabled = false;
     this.board = board;
     this.canExitToGameSelect = fromCommonLauncher;
 }
예제 #3
0
 public GameWindow(GameBoard board, NetworkInterface comm, bool canExitToGameSelect)
 {
     InitializeComponent(board);
     network = (comm != null);
     exitChoice = ExitType.DESKTOP;
     board.SetFrameComponents(turnIndicator, sessionStatus, moveIndicator, mnuForfeit, mnuAskTie, mnuRestart, new GameSpecificMenuEntries(mnuStrip));
     if (network)
     {
         this.mnuOpen.Enabled = false;
         this.mnuSave.Enabled = false;
     }
     if (!canExitToGameSelect)
         this.mnuExitToChooseGame.Enabled = false;
 }