/// <summary> /// The add comment button pressed. /// </summary> /// <remarks>Validates the input GUI elements are not empty, then adds a new comment to SCORM and the GUI</remarks> public void ButtonAddCommentPressed() { GameObject inputFieldComment = GameObject.Find("InputFieldComment"); GameObject inputFieldCommentLocation = GameObject.Find("InputFieldCommentLocation"); string commentText = inputFieldComment.GetComponent <InputField> ().text; string commentLocation = inputFieldCommentLocation.GetComponent <InputField> ().text; if (commentText == "" | commentLocation == "") // Validate the Input Elements { if (commentText == "") { inputFieldComment.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "You must enter a comment!"; } if (commentLocation == "") { inputFieldCommentLocation.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "You must enter a location!"; } } else // Add the Comment { StudentRecord.CommentsFromLearner comment = new StudentRecord.CommentsFromLearner(); comment.comment = commentText; comment.location = commentLocation; ScormManager.AddCommentFromLearner(comment); comment.timeStamp = DateTime.Now; AddCommentFromLearnerToList(comment); //Reset Fields inputFieldComment.GetComponent <InputField> ().text = ""; inputFieldCommentLocation.GetComponent <InputField> ().text = ""; inputFieldComment.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "New Learner Comment..."; inputFieldCommentLocation.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "Comment Location..."; } }