public void SetCurrentCase(int caseNumber) { if (caseNumber != CurrentCase) { // currentCaseButtonUnpressed CaseButtons[CurrentCase].GetComponent <CaseButton>().SetButtonDefault(); CurrentCase = Mathf.Clamp(caseNumber, 0, numberOfCases); CaseFlash.Instance.HideFlash(); if (numberOfCases > 1) { CaseFlash.Instance.ShowNewCaseFlash(CurrentCase); } } // currentCaseButtonPressed CaseButtons[CurrentCase].GetComponent <CaseButton>().SetButtonActive(); // Call every implemented event foreach (var ev in UISingleton.FindInterfaces <IPMCaseSwitched>()) { ev.OnPMCaseSwitched(CurrentCase); } }
private IEnumerator ShowAnswerBubble(int lineNumber, string answer, bool correct) { compilerHasBeenStopped = false; UISingleton.instance.answerBubble.ShowMessage(lineNumber); UISingleton.instance.answerBubble.SetAnswerMessage("Svar: " + answer); yield return(new WaitForSeconds(3 * (1 - PMWrapper.speedMultiplier))); if (compilerHasBeenStopped) { AbortCase(); yield break; } if (correct) { // Call every implemented event foreach (var ev in UISingleton.FindInterfaces <IPMCorrectAnswer>()) { ev.OnPMCorrectAnswer(answer); } } else { UISingleton.instance.levelHandler.currentLevel.caseHandler.CaseFailed(); // Call every implemented event foreach (var ev in UISingleton.FindInterfaces <IPMWrongAnswer>()) { ev.OnPMWrongAnswer(answer); } } }
public void LoadLevel(int level) { PMWrapper.StopCompiler(); // TODO Save mainCode to database UISingleton.instance.saveData.ClearPreAndMainCode(); currentLevel.levelSetting.UseSettings(); // Call every implemented event foreach (var ev in UISingleton.FindInterfaces <IPMLevelChanged>()) { ev.OnPMLevelChanged(); } }