示例#1
0
    public void OnGUI()
    {
        // Show navigation information on the middle lower screen
        if (null != whiteboardController &&
            null != whiteboardController.SelectedLecture &&
            null != whiteboardController.SelectedLecture.Contents)
        {
            GUI.Label(new Rect(Screen.width / 2f - 50f, Screen.height - 50f, 100f, 50f), string.Format("{0}/{1}", whiteboardController.CurrentContentIndex + 1, whiteboardController.SelectedLecture.Contents.Count), textStyle);
        }

        // Show lecture menu when activated
        if (showMenu)
        {
            // Begin the ScrollView
            scrollViewVector = GUI.BeginScrollView(new Rect(Screen.width / 2f - 225f, 50f, 450f, Screen.height - 125f), scrollViewVector, new Rect(0f, 0f, 430f, 2000f));

            // Put something inside the ScrollView
            GUILayout.BeginArea(new Rect(0, 0, 430f, 2000f));
            GUILayout.Box("PLEASE SELECT A LECTURE");
            selectedLectureIndex = GUILayout.SelectionGrid(selectedLectureIndex, lectureNames, 1);
            GUILayout.EndArea();

            // End the ScrollView
            GUI.EndScrollView();
        }

        if (GUI.changed)
        {
            Debug.Log("Selected Lecture Index: " + selectedLectureIndex);
            if (null != whiteboardController)
            {
                showMenu = false;
                whiteboardController.SelectLecture(selectedLectureIndex);
                whiteboardController.Refresh();
            }
        }
    }