public void EditorMode() { if (!editorEnabled) { EditorManagerScript editorManager = GameObject.Find("EditorManager").GetComponent <EditorManagerScript>(); editorManager.EnableInput(); UniversalHelperScript.Instance.Editor = true; editorEnabled = true; Pause(); } }
public void PlayMode() { if (editorEnabled) { EditorManagerScript editorManager = GameObject.Find("EditorManager").GetComponent <EditorManagerScript>(); editorManager.DisableInput(); UniversalHelperScript.Instance.Editor = false; editorEnabled = false; } Pause(); }
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>(); }