using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; public class TypingController : ActController { public List submissions; [Header("Prefabs")] public GameObject actNamePrefab; public GameObject actDescriptionPrefab; public GameObject timerPrefab; public GameObject submissionFieldPrefab; public GameObject submitPrefab; public GameObject submittedCountPrefab; [Header("Objects")] protected Text actName; protected Text actDescription; protected Timer actTimer; protected InputField submissionField; protected Submit submit; protected Text submittedCount; [Serializable] public class TypingSettings : ActSettings { public float timeLimit = 99f; public string actName = "Untitled"; public string actDescription = "This Act is missing a description."; public TypingSettings(float timeLimit, string actName, string actDescription) { this.type = "Typing"; this.timeLimit = timeLimit; this.actName = actName; this.actDescription = actDescription; } } [Serializable] public class TypingResults : ActResults { public List submissions; public TypingResults(List submissions) { this.submissions = submissions; } } protected override void Start() { base.Start(); submissions = new List(); } public override void ActInit() { base.ActInit(); //Load settings TypingSettings typingSettings = settings as TypingSettings; //Init actName Text actName = Instantiate(actNamePrefab, canvas.transform).GetComponent(); actName.text = typingSettings.actName; //Init actDescription Text actDescription = Instantiate(actDescriptionPrefab, canvas.transform).GetComponent(); actDescription.text = typingSettings.actDescription; //Init actTimer actTimer = Instantiate(timerPrefab, canvas.transform).GetComponent(); actTimer.TimerSet(typingSettings.timeLimit); //Init submissionInputField submissionField = Instantiate(submissionFieldPrefab, canvas.transform).GetComponent(); //Init submit Button submit = Instantiate(submitPrefab, canvas.transform).GetComponent(); submit.typingController = this; submit.inputField = submissionField; //Init submissionCount Text submittedCount = Instantiate(submittedCountPrefab, canvas.transform).GetComponent(); submittedCount.text = ""; } public override void ActStart() { base.ActStart(); //Enable submissionField and submit Button submissionField.interactable = true; submit.GetComponent