示例#1
0
文件: GameForm.cs 项目: Bakkes/Karo
 private void loadToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LoadBox loadBox = new LoadBox();
     DialogResult result = loadBox.ShowDialog(this);
     if (result == System.Windows.Forms.DialogResult.OK)
     {
         CancelCommunication();
         _manager = new KaroGameManager();
         _manager.Board.LoadFromString(loadBox.BoardString, loadBox.LeftTopX, loadBox.LeftTopY);
         _manager.CurrentPlayer = loadBox.CurrentPlayer;
         karoPanel.NewGame(_manager);
     }
 }
示例#2
0
文件: GameForm.cs 项目: Bakkes/Karo
        private void showBoardStringToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_manager == null)
                return;

            string boardString = _manager.Board.ToString();

            // Format string to be entered in C++ Unit test project
            boardString = '"' + boardString.Replace("\n", "\\n\"\r\n\"");
            boardString = boardString.Substring(0, boardString.Length - 1);

            Vector2DWrapper topLeft = _manager.Board.GetRelativeCellAt(new Vector2DWrapper(0, 0)).GetAbsolutePosition();

            LoadBox loadBox = new LoadBox(false);
            loadBox.BoardString = boardString;
            loadBox.LeftTopX = (int)topLeft.X;
            loadBox.LeftTopY = (int)topLeft.Y;
            loadBox.CurrentPlayer = _manager.CurrentPlayer;

            loadBox.ShowDialog();
        }