public GameManager(int columns, int maxRows, int numberOfBlockTypes) { MaxRows = maxRows; NumberOfColumns = columns; _numberOfBlockTypes = numberOfBlockTypes; Scoreboard = Scoreboard.Load("Columns.Scoreboard.txt"); OnlineScoreBoard = new Scoreboard(); }
internal static Scoreboard LoadFromServer() { var scoreboard = new Scoreboard(); var client = new scoreswsdlPortTypeClient(); string scores = client.getscores("normal"); string[] scoresArray = scores.Split(','); foreach (string entry in scoresArray) { string[] entryArray = entry.Split('#'); scoreboard.Add(new ScoreboardEntry(entryArray[1], Convert.ToInt32(entryArray[0]), entryArray[2])); } return(scoreboard); }
private void GameManagerPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "GameOver") { if (GameManager.GameOver) { _showOverlay = true; } else { startButton.IsEnabled = false; } NotifyPropertyChanged("GameoverPopupVisibility"); NotifyPropertyChanged("HasHighScoreVisibility"); } if (e.PropertyName == "Scoreboard") { Scoreboard.Clear(); GameManager.Scoreboard.ForEach(score => Scoreboard.Add(score)); } }
public void AddScore(string name) { Scoreboard.Add(new ScoreboardEntry(name, TotalScore)); Scoreboard.Save(); NotifyPropertyChanged("Scoreboard"); }