public Scores() { scoresData = new ScoresData(); team1s = new List<string>(); team2s = new List<string>(); getScores(); }
public Scores() { scoresData = new ScoresData(); team1s = new List <string>(); team2s = new List <string>(); getScores(); }
private void BtnRead_Click(object sender, RoutedEventArgs e) { scoresData = ReadInScoresBinFile(scoresbinFilePath); if (scoresData == null) { logger.Log("ERROR - Scores Data is empty"); } else { //verify here if (IsFileModelCompatible(scoresBinFileOrig, scoresData.GenerateByteData())) { if (!string.IsNullOrEmpty(songcachebinFilePath)) { ReadInSongCacheBinFile(songcachebinFilePath); logger.Log("Enriching song entries with folder path names"); scoresData.ScoreEntries.ForEach(x => x.SongFolderName = FilepathEnricher.Enrich(x.GetSongIdentifierAsBytes(), songCacheBinFile)); logger.Log("Finished enriching song entries with folder path names"); } grdScores.ItemsSource = scoresData.ScoreEntries; } else { //provide error message and contact info logger.Log("Error, the scores file is not compatible with the program, will cause data loss or worse, not loading. Please contact the developer to resolve this mismatch."); } } }
/** * Handler für das Dücken des "Zurück" Buttons */ private void BackButton_Click(object sender, RoutedEventArgs e) { tmpScoresData = null; normalModeRadioButton.IsChecked = false; spezialModeRadioButton.IsChecked = false; kretschmerModeRadioButton.IsChecked = false; errorBlock.Text = ""; ownScoreBlock.Text = ""; iv.rootContainer.Child = iv.LayoutRoot; }
public static void Save() { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/save.xggg"; FileStream stream = new FileStream(path, FileMode.Create); ScoresData data = new ScoresData(scores.ToArray()); formatter.Serialize(stream, data); stream.Close(); }
/** * Highscoreanzeige nach einem Spiel * * Wird noch zusätzlich der erreichte Score angezeigt */ public void update(ScoresData scoresData) { tmpScoresData = scoresData; switch (scoresData.mode) { case 1: normalModeRadioButton.IsChecked = true; break; case 2: spezialModeRadioButton.IsChecked = true; break; case 3: kretschmerModeRadioButton.IsChecked = true; break; } sqlClient.requestScoreEntry(callbackEntry, error, scoresData.score, scoresData.mode); }
/** * Handler für das Drücken des "Score" Button */ private void ScoreButton_Click(object sender, RoutedEventArgs e) { ExitGame(); ScoresData sd = new ScoresData(); sd.level = boardModel.getLevel(); sd.mode = mod; sd.playerName = playerName; sd.score = boardModel.getScore(); sd.time = new DateTime(time).ToLongTimeString(); iv.getHighScoreView().update(sd); iv.rootContainer.Child = iv.getHighScoreView(); }
public static List <Score> Load() { string path = Application.persistentDataPath + "/save.xggg"; if (File.Exists(path)) { Debug.Log("File Exist"); BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); ScoresData data = formatter.Deserialize(stream) as ScoresData; stream.Close(); Debug.Log(data.data); return(new List <Score>(data.data)); } return(new List <Score>()); }
// Use this for initialization void Start() { highScoresScreen = false; hasDisplayedDialog = false; if (defaultHighScoreName.Length > 4) { defaultHighScoreName = defaultHighScoreName.Substring(0, 4); } gameName = Application.productName; if ((createHighScoresDisplayForMe || usesLegacyScoreDisplay || usesLegacyTimer) && displayfont == null) { displayfont = Resources.GetBuiltinResource <Font>("Arial.ttf"); } isGameOver = false; #region "High Scores" // Since this script reloads every scene. if (highScoreData == null) { highScoreData = new ScoresData(defaultHighScoreName); highScoreData.GameName = gameName; //CHANGE CCStarter2018 TO NAME OF YOUR GAME sceneNames = new List <string>(); #if UNITY_STANDALONE if (!isOneScene) { scenesData = ReadSceneData(); foreach (string sceneName in scenesData.Split(',')) { sceneNames.Add(sceneName); } } #endif #if UNITY_EDITOR if (!isOneScene) { sceneNames.Clear(); foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes) { sceneNames.Add(scene.path.Substring(scene.path.LastIndexOf("/") + 1, (scene.path.LastIndexOf(".") - scene.path.LastIndexOf("/")) - 1)); } WriteSceneData(); } WriteManagerIni(); #endif timeTicker = 0; highScoreData.ReadData(); } if (!isOneScene) { //if the scene is the first or last scene if (SceneManager.GetActiveScene().name == sceneNames[0] || SceneManager.GetActiveScene().name == sceneNames[sceneNames.Count - 1]) { //if the game is the opening scene, set the usesPauseSystem var to the static var if (SceneManager.GetActiveScene().name == sceneNames[0]) { usesPauseSystem = usePauseSystem; } //create the score display if checked if (createHighScoresDisplayForMe) { CreateHighScoresDisplay(); } if (GameObject.Find("btn_Play") != null) { GameObject.Find("btn_Play").GetComponent <Button>().onClick.AddListener(PlayGame); } else if (playButton != null) { playButton.GetComponent <Button>().onClick.AddListener(PlayGame); } DisplayScoresDisplay(); } else if (SceneManager.GetActiveScene().name != sceneNames[0] && SceneManager.GetActiveScene().name != sceneNames[sceneNames.Count - 1]) { //this is a game scene, it isn't the first or last scene in the project, call reset to default all values if (!retainScoreBetweenGameScenes) { ResetGame(); } else { if (usesLegacyTimer) { guiTime = gameCountDownTime; } } //the game doesn't start paused isPaused = false; //make all of the UI elements invisible foreach (GameObject gO in pauseUI) { gO.SetActive(false); } } } else { titleScreen = true; if (createHighScoresDisplayForMe) { CreateHighScoresDisplay(); } //if the whole project is in one scene, then all you need is to put the information into the boxes. DisplayScoresDisplay(); } #endregion }