public void DisplayText(string textToDisplay) { textWrapper.linesPerTextbox = textSettings.linesPerTextbox; IList <string> readyToDisplay = WrapText(textToDisplay) as List <string>; textDisplayer.textSettings = textSettings; textDisplayer.DisplayText(readyToDisplay); }
public void ShowText(string tag, string text, string color) { if (textDisplayer == null) { throw new Exception("No text displayer in current scene"); } else { Color myColor = Color.clear; ColorUtility.TryParseHtmlString(color, out myColor); textDisplayer.ChangeColor(myColor); textDisplayer.DisplayText(tag, text); } }
public void ShowWarning(string warnMsg, int duration) { warning.SetActive(true); TextDisplayer warnText = warning.GetComponent <TextDisplayer>(); warnText.DisplayText("warning", warnMsg); DoIn(new EventBase(() => { warnText.ClearText(); warning.SetActive(false); }), duration); }
IEnumerator Start() { //this is a coroutine which can be used to display words via the text displayer //for example: string[] stimuli = new string[] { "Apple", "Banana", "Pear" }; for (int i = 0; i < stimuli.Length; i++) { textDisplayer.DisplayText("fruit stimulus", stimuli [i]); yield return(new WaitForSecondsRealtime(1)); textDisplayer.ClearText(); yield return(new WaitForSecondsRealtime(1)); } }
public override void Notify(Exception e) { Debug.Log("Popup now displayed... invisibly"); Debug.Log(e); // FIXME warning.SetActive(true); TextDisplayer warnText = warning.GetComponent <TextDisplayer>(); warnText.DisplayText("warning", e.Message); DoIn(new EventBase(() => { warnText.ClearText(); warning.SetActive(false); }), 5000); }
protected IEnumerator PressAnyKey(string displayText, KeyCode[] keyCodes, TextDisplayer pressAnyTextDisplayer) { yield return(null); pressAnyTextDisplayer.DisplayText("press any key prompt", displayText); Dictionary <KeyCode, bool> keysPressed = new Dictionary <KeyCode, bool>(); foreach (KeyCode keycode in keyCodes) { keysPressed.Add(keycode, false); } while (true) { yield return(null); foreach (KeyCode keyCode in keyCodes) { if (Input.GetKeyDown(keyCode)) { keysPressed[keyCode] = true; } if (Input.GetKeyUp(keyCode)) { keysPressed[keyCode] = false; } } bool done = true; foreach (bool pressed in keysPressed.Values) { if (!pressed) { done = false; } } if (done) { break; } } pressAnyTextDisplayer.ClearText(); }
protected IEnumerator DoSubjectSessionQuitPrompt(int sessionNumber, string message) { yield return(null); SetRamulatorState("WAITING", true, new Dictionary <string, object>()); textDisplayer.DisplayText("subject/session confirmation", message); while (!Input.GetKeyDown(KeyCode.Y) && !Input.GetKeyDown(KeyCode.N)) { yield return(null); } textDisplayer.ClearText(); SetRamulatorState("WAITING", false, new Dictionary <string, object>()); if (Input.GetKey(KeyCode.N)) { Quit(); } }
protected IEnumerator DoSubjectSessionQuitPrompt(int sessionNumber) { yield return(null); SetRamulatorState("WAITING", true, new Dictionary <string, object>()); textDisplayer.DisplayText("subject/session confirmation", "Running " + UnityEPL.GetParticipants()[0] + " in session " + sessionNumber.ToString() + " of " + UnityEPL.GetExperimentName() + ".\n Press Y to continue, N to quit."); while (!Input.GetKeyDown(KeyCode.Y) && !Input.GetKeyDown(KeyCode.N)) { yield return(null); } textDisplayer.ClearText(); SetRamulatorState("WAITING", false, new Dictionary <string, object>()); if (Input.GetKey(KeyCode.N)) { Quit(); } }
private IEnumerator RunExperiment() { textDisplayer.DisplayText("subject name prompt", "Please enter the subject name and then press enter."); yield return(new WaitForSeconds(3f)); textDisplayer.ClearText(); inputField.gameObject.SetActive(true); inputField.Select(); do { yield return(null); while (!Input.GetKeyDown(KeyCode.Return)) { yield return(null); } }while (!inputField.text.Equals("TEST") && (inputField.text.Length != 7 || !inputField.text[0].Equals('P') || !inputField.text[1].Equals('L') || !inputField.text[2].Equals('T') || !inputField.text[3].Equals('P'))); UnityEPL.AddParticipant(inputField.text); SetSessionNumber(); inputField.gameObject.SetActive(false); Cursor.visible = false; //Add part here which calls eeg file checking script yield return(PressAnyKey(UnityEPL.GetParticipants()[0] + "\nsession " + UnityEPL.GetSessionNumber(), new KeyCode[] { KeyCode.Return }, textDisplayer)); yield return(PressAnyKey("Researcher:\nPlease confirm that the \nimpedance window is closed\nand that sync pulses are showing", new KeyCode[] { KeyCode.Y }, textDisplayer)); yield return(PressAnyKey("Researcher:\nPlease begin the EEG recording now\nand confirm that it is running.", new KeyCode[] { KeyCode.R }, textDisplayer)); yield return(EEGVerificationScript(UnityEPL.GetExperimentName(), UnityEPL.GetParticipants()[0], UnityEPL.GetSessionNumber())); scriptedEventReporter.ReportScriptedEvent("microphone test begin", new Dictionary <string, object>()); yield return(DoMicrophoneTest()); scriptedEventReporter.ReportScriptedEvent("microphone test end", new Dictionary <string, object>()); fullscreenTextDisplayer.textElements[0].alignment = TextAnchor.MiddleLeft; yield return(PressAnyKey(FIRST_INSTRUCTIONS_MESSAGE, new KeyCode[] { KeyCode.Return }, fullscreenTextDisplayer)); yield return(PressAnyKey(SECOND_INSTRUCTIONS_MESSAGE, new KeyCode[] { KeyCode.Return }, fullscreenTextDisplayer)); fullscreenTextDisplayer.textElements[0].alignment = TextAnchor.MiddleCenter; // Begin free recall trials for (int i = 0; i < numberOfLists; i++) { if (i != 0) { yield return(PressAnyKey("Press SPACE to continue.", new KeyCode[] { KeyCode.Space }, textDisplayer)); } textDisplayer.DisplayText("list count", "List " + (i + 1)); yield return(new WaitForSeconds(3f)); textDisplayer.ClearText(); yield return(DoCountdown()); string[] trialWords = new string[lengthOfList]; System.Array.Copy(words, i * lengthOfList, trialWords, 0, lengthOfList); Debug.Log(trialWords); yield return(PerformTrial(trialWords, i, false)); } //over textDisplayer.DisplayText("end message", "Yay, the session is over!"); }