public float getHighestCountBack() { float highestCount = -1; FMC_Statistics.Statistics statistics = FMC_GameDataController.instance.getCurrentStatistics(); if (currentDataShown == possibleDataShown.correctlySolved) { for (int i = 0; i < statistics.dailyData.Count; i++) { if (statistics.dailyData[i].calculatedTasksTotalWithoutBombs > highestCount || highestCount == -1) { highestCount = statistics.dailyData[i].calculatedTasksTotalWithoutBombs; } } } else if (currentDataShown == possibleDataShown.correctInPercent) { //for (int i = 0; i < statistics.dailyData.Count; i++) // if (statistics.dailyData[i].correctlyCalculatedInPercent > highestCount || highestCount == -1) // highestCount = statistics.dailyData[i].correctlyCalculatedInPercent; highestCount = 100; } else if (currentDataShown == possibleDataShown.timePerTask) { //for (int i = 0; i < statistics.dailyData.Count; i++) // if (statistics.dailyData[i].timeNeededPerTask > highestCount || highestCount == -1) // highestCount = statistics.dailyData[i].timeNeededPerTask; highestCount = 0; } return(highestCount); }
public void renewStatisticsData() { FMC_Statistics.Statistics statistics = FMC_GameDataController.instance.getCurrentStatistics(); for (int i = months.Count - 1, j = 0; i >= 0; i--, j++) { if (statistics.dailyData.Count > j) { months[i].text = statistics.dailyData[j].date.ToString("dd") + "\n" + statistics.dailyData[j].date.ToString("MM"); } else { months[i].text = "00\n00"; } } if (currentDataShown == possibleDataShown.correctlySolved) { setBarsForCorrectlySolved(); } else if (currentDataShown == possibleDataShown.correctInPercent) { setBarsForCorrectInPercent(); } else if (currentDataShown == possibleDataShown.timePerTask) { setBarsForTimePerTask(); } }
private string convertTimeSpanToString(FMC_Statistics.Statistics statistics) { string output = ""; if (statistics.lifeTimeTotalTime.Days != 0) { output += statistics.lifeTimeTotalTime.Days + "d "; } if (statistics.lifeTimeTotalTime.Hours != 0) { output += statistics.lifeTimeTotalTime.Hours + "h "; } if (statistics.lifeTimeTotalTime.Minutes != 0) { output += statistics.lifeTimeTotalTime.Minutes + "m "; } if (statistics.lifeTimeTotalTime.Seconds != 0 && statistics.lifeTimeTotalTime.Hours == 0 && statistics.lifeTimeTotalTime.Days == 0) { output += statistics.lifeTimeTotalTime.Seconds + "s "; } if (output == "") { output = "0" + "s"; } return(output); }
private void setBarsForCorrectlySolved() { FMC_Statistics.Statistics statistics = FMC_GameDataController.instance.getCurrentStatistics(); if (FMC_GameDataController.instance && FMC_GameDataController.instance.subscriptionIsActive() && statistics.dailyData.Count > 0) { //float highestCount = getHighestCount(); float highestCount = getHighestCountBack(); if (highestCount != 0) { for (int i = graphBarsFront.Count - 1, j = 0; i >= 0; i--, j++) { float height = 0.0f; float height02 = 0.0f; if (statistics.dailyData.Count > j) { height = (statistics.dailyData[j].correctlyCalculatedTasks * 2.52f) / highestCount; // 2.52 == Maximale Ausdehnung in Units height02 = (statistics.dailyData[j].calculatedTasksTotalWithoutBombs * 2.52f) / highestCount; bottomTexts01[i].text = statistics.dailyData[j].correctlyCalculatedTasks.ToString(); bottomTexts02[i].text = statistics.dailyData[j].calculatedTasksTotalWithoutBombs.ToString(); } else // Nicht genutzte Balken nicht beschriften { bottomTexts01[i].text = ""; bottomTexts02[i].text = ""; height = 0; height02 = 0; } height = Mathf.Clamp(height, 0.0f, 2.52f); height02 = Mathf.Clamp(height02, 0.0f, 2.52f); tweenGraphBars(i, height); tweenGraphBarsBack(i, height02); } } else { resetStatisticBars(); } } else { resetStatisticBars(); } if (FMC_GameDataController.instance) { textHeaderText.text = FMC_GameDataController.instance.fullTranslation[FMC_Translation.translations.statistics][8]; } else { textHeaderText.text = "Lösungen/Sitzung"; } }
private void setBarsForTimePerTask() { FMC_Statistics.Statistics statistics = FMC_GameDataController.instance.getCurrentStatistics(); if (FMC_GameDataController.instance && FMC_GameDataController.instance.subscriptionIsActive() && statistics.dailyData.Count > 0) { float highestCount = getHighestCount(); if (highestCount != 0) { for (int i = graphBarsFront.Count - 1, j = 0; i >= 0; i--, j++) { float height = 0.0f; float height02 = 0.0f; if (statistics.dailyData.Count > j) { height = (statistics.dailyData[j].timeNeededPerTask * 2.52f) / highestCount; // 2.52 == Maximale Ausdehnung in Units height02 = 0; bottomTexts01[i].text = statistics.dailyData[j].timeNeededPerTask.ToString("F1"); bottomTexts02[i].text = ""; } else { bottomTexts01[i].text = ""; bottomTexts02[i].text = ""; height = 0; height02 = 0; } height = Mathf.Clamp(height, 0.0f, 2.52f); height02 = Mathf.Clamp(height02, 0.0f, 2.52f); tweenGraphBars(i, height); tweenGraphBarsBack(i, height02); } } else { resetStatisticBars(); } } else { resetStatisticBars(); } if (FMC_GameDataController.instance) { textHeaderText.text = FMC_GameDataController.instance.fullTranslation[FMC_Translation.translations.statistics][10]; } else { textHeaderText.text = "Zeit pro Aufgabe"; } }
public void renewStatisticsData() { FMC_Statistics.Statistics statistics = FMC_GameDataController.instance.getCurrentStatistics(); if (FMC_GameDataController.instance.subscriptionIsActive()) { string dataString = ""; dataString += statistics.lifeTimeAnswers + "\n"; if (statistics.lifeTimeAnswers > 0) { dataString += ((statistics.lifeTimeNotCorrect * 100) / statistics.lifeTimeAnswers).ToString("F0") + "%\n"; } else { dataString += "\n"; } dataString += statistics.lifeTimeCorrect + "\n"; dataString += statistics.lifeTimeNotCorrect + "\n"; dataString += convertTimeSpanToString(statistics) + "\n"; dataString += Mathf.RoundToInt(statistics.lifeTimeAverageTime) + "s" + "\n"; dataString += Persistence.moneyLifetime + "\n"; dataString += Persistence.GetPurchaseNumber() + " / 39" + "\n"; data.text = dataString; } else { string dataString = ""; dataString += statistics.lifeTimeAnswers + "\n"; dataString += "<color=#D4D4D4FF>33%\n"; dataString += "2585\n"; dataString += "833\n"; dataString += "2h 5m\n"; dataString += "12s\n"; dataString += "1200\n"; dataString += "12/30</color>\n"; data.text = dataString; } }
public void renewStatisticsData() { Text text = null; FMC_Statistics.Statistics statistics = FMC_GameDataController.instance.getCurrentStatistics(); talentsProblems = FMC_Statistics.Statistics.getTalentsAndProblems(statistics.dailyData[0].dailyTalentProblemData); //if (FMC_GameDataController.instance) // talentsProblems = FMC_GameDataController.instance.getTalentProblemData(); if (talentsBox) { text = talentsBox.GetComponent <Text>(); text.text = ""; if (text) { foreach (string s in talentsProblems.talents) { text.text += s; } } } text = null; if (problemsBox) { problemsBox.position = new Vector3(Mathf.Abs(talentsBox.position.x), problemsBox.position.y, problemsBox.position.z); text = problemsBox.GetComponent <Text>(); text.text = ""; if (text) { foreach (string s in talentsProblems.problems) { text.text += s; } } } // Create Custom Exercises etc. foreach (GameObject g in allCustomExercises) { Destroy(g); } allCustomExercises.Clear(); int counterText = talentsProblems.talentsInfo.Count > talentsProblems.problemsInfo.Count ? talentsProblems.talentsInfo.Count : talentsProblems.problemsInfo.Count; if (talentsProblems.problemsInfo.Count == 0) { customExercises.gameObject.SetActive(false); } else { customExercises.gameObject.SetActive(true); } if (counterText < 1) { counterText = 1; } float textSizeY = 0.45f; float textPadding = (counterText - 1) * textSizeY; if (talentsProblems.problemsInfo.Count == 0) { dynamicallyMoving.transform.localPosition = new Vector3(dynamicallyMoving.transform.localPosition.x, originaldynamicMovingPosY - textPadding, dynamicallyMoving.transform.localPosition.z); } else { customExercises.transform.localPosition = new Vector3(customExercises.transform.localPosition.x, originialCustomExercisePosY - textPadding, customExercises.localPosition.z); } int counterProblems = talentsProblems.problemsInfo.Count; GameObject go; FMC_PracticeButton practiceButton; for (int i = 0; i < counterProblems; i++) { go = GameObject.Instantiate(customButtonPrefab); go.transform.parent = exercicesParents[i]; go.transform.localPosition = new Vector3(0, 0, 0); go.name = "Custom Exercise " + i; allCustomExercises.Add(go); practiceButton = go.GetComponent <FMC_PracticeButton>(); practiceButton.text.text = talentsProblems.problems[i]; practiceButton.initialiseCustomExercise(practiceBoxLayout, menuController, talentsProblems.problemsInfo[i]); practiceButton.setLayout(cameraWidth, cameraPosition); } if (allCustomExercises.Count > 0) { dynamicallyMoving.transform.position = new Vector3(dynamicallyMoving.transform.position.x, allCustomExercises[allCustomExercises.Count - 1].transform.position.y - 1.0f, dynamicallyMoving.transform.position.z); if (iapButton && !FMC_GameDataController.instance.subscriptionIsActive()) { iapButton.gameObject.SetActive(true); iapButton.transform.position = new Vector3(iapButtonPositionX.position.x, Mathf.Lerp(allCustomExercises[0].transform.position.y, allCustomExercises[allCustomExercises.Count - 1].transform.position.y, 0.5f), iapButton.position.z); } } else if (iapButton) { iapButton.gameObject.SetActive(false); } }