private void HandleInput() { if (Input.GetButtonDown("B")) { this.mainPanel.gameObject.SetActive(true); this.studentPanel.gameObject.SetActive(false); } int num = 0; int num2 = this.students.Length - 1; bool tappedUp = this.inputManager.TappedUp; bool tappedDown = this.inputManager.TappedDown; if (tappedUp) { this.studentIndex = ((this.studentIndex > num) ? (this.studentIndex - 1) : num2); } else if (tappedDown) { this.studentIndex = ((this.studentIndex < num2) ? (this.studentIndex + 1) : num); } if (tappedUp || tappedDown) { this.bodyLabel.text = StudentEditorScript.GetStudentText(this.students[this.studentIndex]); } }
private void Awake() { Dictionary <string, object>[] array = EditorManagerScript.DeserializeJson("Students.json"); this.students = new StudentEditorScript.StudentData[array.Length]; for (int i = 0; i < this.students.Length; i++) { this.students[i] = StudentEditorScript.StudentData.Deserialize(array[i]); } Array.Sort <StudentEditorScript.StudentData>(this.students, (StudentEditorScript.StudentData a, StudentEditorScript.StudentData b) => a.id - b.id); for (int j = 0; j < this.students.Length; j++) { StudentEditorScript.StudentData studentData = this.students[j]; UILabel uilabel = UnityEngine.Object.Instantiate <UILabel>(this.studentLabelTemplate, this.listLabelsOrigin); uilabel.text = "(" + studentData.id.ToString() + ") " + studentData.name; Transform transform = uilabel.transform; transform.localPosition = new Vector3(transform.localPosition.x + (float)(uilabel.width / 2), transform.localPosition.y - (float)(j * uilabel.height), transform.localPosition.z); uilabel.gameObject.SetActive(true); } this.studentIndex = 0; this.bodyLabel.text = StudentEditorScript.GetStudentText(this.students[this.studentIndex]); this.inputManager = UnityEngine.Object.FindObjectOfType <InputManagerScript>(); }