Exemplo n.º 1
0
        public void LoadGame(string Path)
        {
            GameHistory history = new GameHistory();

            if (history.LoadHistoryFromDisk(Path))
            {
                GameInfo info = history.History.Keys.First <GameInfo>();
                this.moveGenerator.NewGame(info);
                history.MoveGenerator               = this.moveGenerator;
                this.moveGenerator.History          = history;
                this.moveGenerator.CurrentGameState = history.History[info][history.History[info].Count - 1];
                history.History[info].Remove(this.moveGenerator.CurrentGameState);
                this.gameRunning = true;
                this.moveGenerator.GameRunning = true;
                LoadResources();
                this.ActiveColor = history.ActiveColor;
                FireChangeEvent("Game loaded", this.moveGenerator.CurrentGameState.SquarsBlocked);
                this.Invalidate();
            }
            else
            {
                MessageBox.Show("Loading failed");
            }
        }