Update score rounding to 100 when all correct

This commit is contained in:
Shavira 2025-06-11 09:27:35 +07:00
parent 77da2d468e
commit 8433cff12b
4 changed files with 16 additions and 8 deletions

View File

@ -35,7 +35,6 @@ public class AuntMenu : Menu<AuntMenu>
private void OnEnable() private void OnEnable()
{ {
AuthenticationService.Instance.SignedIn += NextToMenu; AuthenticationService.Instance.SignedIn += NextToMenu;
} }
private void Start() private void Start()

View File

@ -120,7 +120,6 @@ public class PostTestMenu : Menu<PostTestMenu>
} }
Image selectedImage = answerButtons[index].GetComponent<Image>(); Image selectedImage = answerButtons[index].GetComponent<Image>();
if (index == correctAnswerIndex) if (index == correctAnswerIndex)
{ {
@ -133,10 +132,22 @@ public class PostTestMenu : Menu<PostTestMenu>
selectedImage.sprite = falseAnswerSprite; selectedImage.sprite = falseAnswerSprite;
questionText.text = "Jawaban Salah"; questionText.text = "Jawaban Salah";
} }
saveData.postTestStatistik = (int)(((float)correctAnswers / totalQuestions) * 100f);
saveData.postTestStatistik = Mathf.RoundToInt(((float)correctAnswers / totalQuestions) * 100f);
float score = ((float)correctAnswers / totalQuestions) * 100f;
if (score >= 87f)
{
saveData.postTestStatistik = 100;
}
else
{
saveData.postTestStatistik = Mathf.RoundToInt(score);
}
} }
void ShowCorrectAnswer() void ShowCorrectAnswer()
{ {
isAnswering = false; isAnswering = false;

View File

@ -15,7 +15,6 @@ public class ProfileMenu : Menu<ProfileMenu>
[SerializeField] private Image dataPenyakitGigiImage; [SerializeField] private Image dataPenyakitGigiImage;
[SerializeField] private Image dataPreTestImage; [SerializeField] private Image dataPreTestImage;
[SerializeField] private Image dataPostTestImage; [SerializeField] private Image dataPostTestImage;
[SerializeField] private TextMeshProUGUI dataKesehatanGigiText; [SerializeField] private TextMeshProUGUI dataKesehatanGigiText;
[SerializeField] private TextMeshProUGUI dataPenyakitGigiText; [SerializeField] private TextMeshProUGUI dataPenyakitGigiText;
[SerializeField] private TextMeshProUGUI dataPreTestText; [SerializeField] private TextMeshProUGUI dataPreTestText;
@ -71,6 +70,5 @@ public class ProfileMenu : Menu<ProfileMenu>
public void StatisticProfileButton() public void StatisticProfileButton()
{ {
audioController.Instance.PlaySFX("TombolUmum", 0.5f); audioController.Instance.PlaySFX("TombolUmum", 0.5f);
} }
} }

View File

@ -802,11 +802,11 @@ PlayerSettings:
apiCompatibilityLevel: 6 apiCompatibilityLevel: 6
activeInputHandler: 0 activeInputHandler: 0
windowsGamepadBackendHint: 0 windowsGamepadBackendHint: 0
cloudProjectId: eb23755b-bad6-47c2-8913-d9a87307f7f0 cloudProjectId:
framebufferDepthMemorylessMode: 0 framebufferDepthMemorylessMode: 0
qualitySettingsNames: [] qualitySettingsNames: []
projectName: ToothyV projectName:
organizationId: shaviragirls organizationId:
cloudEnabled: 0 cloudEnabled: 0
legacyClampBlendShapeWeights: 0 legacyClampBlendShapeWeights: 0
playerDataPath: playerDataPath: