private int getScore(PlayRecordSaveData data) { int score = data.perfect * 1000 + data.great * 500 + data.good * 300 + data.safe * 100; // data.throughMiss - // data.uselessMiss; return(score); }
public void Setup(string text, PlayRecordSaveDataDictionary data) { this.stageNameText.text = text; this.practiceClearRatioText.text = 0.ToString("D") + "%"; this.standardClearRatioText.text = 0.ToString("D") + "%"; this.practiceFullCombo.SetActive(false); this.standardFullCombo.SetActive(false); if (data != null) { if (data.practicePlayRecordSaveDataDictionary.ContainsKey(text)) { PlayRecordSaveData practiceData = data.practicePlayRecordSaveDataDictionary[text]; Debug.Log_cyan("perfect = " + practiceData.perfect); float clearRatio = 100 * (practiceData.perfect * 100 + practiceData.great * 50 + practiceData.good * 30 + practiceData.safe * 10) / ((practiceData.perfect + practiceData.great + practiceData.good + practiceData.safe + practiceData.throughMiss) * 100); this.practiceClearRatioText.text = ((int)clearRatio).ToString("D") + "%"; if (practiceData.throughMiss == 0) { this.practiceFullCombo.SetActive(true); } } if (data.standardPlayRecordSaveDataDictionary.ContainsKey(text)) { PlayRecordSaveData standardData = data.standardPlayRecordSaveDataDictionary[text]; float clearRatio = 100 * (standardData.perfect * 100 + standardData.great * 50 + standardData.good * 30 + standardData.safe * 10) / ((standardData.perfect + standardData.great + standardData.good + standardData.safe + standardData.throughMiss) * 100); this.standardClearRatioText.text = ((int)clearRatio).ToString("D") + "%"; if (standardData.throughMiss == 0) { this.standardFullCombo.SetActive(true); } } } else { Debug.Log_red("data is null " + text, this); } }
private void savePlayData() { PlayRecordSaveDataDictionary data = DataManager.Load <PlayRecordSaveDataDictionary>(DataManager.PLAY_RECORD_DATA); if (data == null) { data = new PlayRecordSaveDataDictionary(); data.practicePlayRecordSaveDataDictionary = new Dictionary <string, PlayRecordSaveData>(); data.standardPlayRecordSaveDataDictionary = new Dictionary <string, PlayRecordSaveData>(); } string stageName = RhythmGameDataManager.masterStageRecordData.stageName; PlayRecordSaveData newData = new PlayRecordSaveData(); newData.perfect = this.perfectCount; newData.great = this.greatCount; newData.good = this.goodCount; newData.safe = this.safeCount; newData.throughMiss = this.throughMissCount; newData.uselessMiss = this.uselessMissCount; if (RhythmGameDataManager.isPracticeMode) { bool existData = data.practicePlayRecordSaveDataDictionary.ContainsKey(stageName); if (existData == false) { data.practicePlayRecordSaveDataDictionary.Add(stageName, newData); } else { PlayRecordSaveData oldData = data.practicePlayRecordSaveDataDictionary[stageName]; int oldScore = getScore(oldData); int newScore = getScore(newData); if (newScore > oldScore) { data.practicePlayRecordSaveDataDictionary.Remove(stageName); data.practicePlayRecordSaveDataDictionary.Add(stageName, newData); } } } else { bool existData = data.standardPlayRecordSaveDataDictionary.ContainsKey(stageName); if (existData == false) { data.standardPlayRecordSaveDataDictionary.Add(stageName, newData); } else { PlayRecordSaveData oldData = data.standardPlayRecordSaveDataDictionary[stageName]; int oldScore = getScore(oldData); int newScore = getScore(newData); if (newScore > oldScore) { data.standardPlayRecordSaveDataDictionary.Remove(stageName); data.standardPlayRecordSaveDataDictionary.Add(stageName, newData); } } } DataManager.Save <PlayRecordSaveDataDictionary>(DataManager.PLAY_RECORD_DATA, data); }
private bool checkNewRecord() { Debug.Log_cyan("checkNewRecord"); PlayRecordSaveDataDictionary data = DataManager.Load <PlayRecordSaveDataDictionary>(DataManager.PLAY_RECORD_DATA); if (data == null) { return(true); } PlayRecordSaveData newData = new PlayRecordSaveData(); newData.perfect = this.perfectCount; newData.great = this.greatCount; newData.good = this.goodCount; newData.safe = this.safeCount; newData.throughMiss = this.throughMissCount; newData.uselessMiss = this.uselessMissCount; string stageName = RhythmGameDataManager.masterStageRecordData.stageName; if (RhythmGameDataManager.isPracticeMode) { bool existData = data.practicePlayRecordSaveDataDictionary.ContainsKey(stageName); if (existData == false) { return(true); } else { PlayRecordSaveData oldData = data.practicePlayRecordSaveDataDictionary[stageName]; int oldScore = getScore(oldData); int newScore = getScore(newData); Debug.Log_cyan("checkNewRecord > old=" + oldScore + ", new=" + newScore); if (newScore >= oldScore) { return(true); } } } else { bool existData = data.standardPlayRecordSaveDataDictionary.ContainsKey(stageName); if (existData == false) { return(true); } else { PlayRecordSaveData oldData = data.standardPlayRecordSaveDataDictionary[stageName]; int oldScore = getScore(oldData); int newScore = getScore(newData); Debug.Log_cyan("checkNewRecord > old=" + oldScore + ", new=" + newScore); if (newScore >= oldScore) { return(true); } } } Debug.Log_cyan("checkNewRecord > false"); return(false); }