protected override void Initialize() { Directory.CreateDirectory(AppDirectory); Settings = FileManager.LoadSettings(SettingsPath); Scores = FileManager.LoadHighscores(ScoresPath); CompressScores(); // TODO temp solution (see below) MySqlHelper.Instance.Sync(this); FileManager.SaveHighscores(ScoresPath, Scores); if (Settings == null) { Settings = CreateDefaultSettings(); } base.Initialize(); }
protected override void Init() { font = Content.Load <SpriteFont>("fonts/menu_font"); blank = Content.Load <Texture2D>("textures/blank"); background = new ImageItem(blank); background.HGrow = background.VGrow = 1; background.Color = Color.Black; background.Alpha = 0.5f; TextItem gameOver = new TextItem(font, "Game Over"); gameOver.HAlign = HAlignment.Center; gameOver.VAlign = VAlignment.Center; gameOver.IsSizeScaled = true; gameOver.Scale = 2; HPane hGameOver = new HPane(gameOver); hGameOver.HGrow = hGameOver.VGrow = 1; ImageItem bTop = new ImageItem(blank); bTop.HGrow = bTop.VGrow = 1; bTop.Color = Color.DarkGray; bTop.Alpha = 0.5f; ImageItem bBot = new ImageItem(blank); bBot.HGrow = bBot.VGrow = 1; bBot.Color = Color.Black; bBot.Alpha = 0.5f; StackPane sTop = new StackPane(bTop, hGameOver); sTop.VAlign = VAlignment.Center; sTop.HAlign = HAlignment.Center; sTop.HGrow = 0.5f; sTop.VGrow = 1; mainPane = new StackPane(bBot); mainPane.HAlign = HAlignment.Center; mainPane.VAlign = VAlignment.Center; mainPane.HGrow = 0.5f; mainPane.VGrow = 1; VPane vPane = new VPane(sTop, mainPane); vPane.HGrow = vPane.VGrow = 1; ViewPane.Clear(); RootPane = new StackPane(background, vPane); RootPane.HGrow = RootPane.VGrow = 1; ViewPane.Add(RootPane); Task.Run(() => { Game.Scores = FileManager.LoadHighscores(Game.ScoresPath); int pos = Game.AddHighscore(score, out kicked); if (score.MinesHit < score.TotalMines && pos <= Minestory.MAX_SCORES_PER_DIFF) { message = "New Highscore! Rank " + pos + ". Enter your Name:"; mainPane.Add(CreateTextInputPane(message)); } else { mainPane.Add(CreateNavPane()); } }); }