//public Player player; //public Ai ai; #endregion public GameWindow() { instance = this; InitializeFileWatcher(); InitializeComponent(); // initialize Board and custom UserControls InitializeGUIPins(); // If we have a saved game state then load from that instead of starting from scratch if ( DoesFileExist(filesavelocation) ) { GameData gameData = JsonConvert.DeserializeObject<GameData>(File.ReadAllText(filesavelocation)); engine = new GameEngine(gameData.WhosCodeMaker); engine.CurrentLevel = gameData.CurrentLevel; engine.createdCode = gameData.createdCode; engine.GuessesLeft = gameData.GuessesLeft; engine.IsGameOver = gameData.IsGameOver; LoadGameAtStartup(gameData); } else { engine = new GameEngine("Ai"); } rules = new RulesEngine(); #region context setting for properties GuessesLeft.DataContext = engine; WhosCodeMaker.DataContext = engine; WhosCodeBreaker.DataContext = engine; GuessButton.DataContext = engine; #endregion DetermineStartGUILayout(); }
public RulesEngine() { instance = this; }