Example #1
0
    //// GUI GUI

    void OnGUI()
    {
        //boxStyle = ;
        GUI.skin.label.normal.textColor  = Color.black;
        GUI.skin.toggle.normal.textColor = Color.black;

        // LOGO
        GUI.BeginGroup(new Rect(0, 0, 1024, 200));
        GUI.Label(new Rect(0, 0, 1024, 163), logo);
        GUI.EndGroup();


        GUI.BeginGroup(new Rect(Screen.width / 2 - 400, 100, 800, 600));
        //GUILayout.BeginVertical();
        GUI.Box(new Rect(0, 0, 800, 600), "");



        /*
         *    GUILayout.BeginVertical();
         *
         *    GUILayout.TextField("Im a textfield");
         *
         *    blnToggleState = GUILayout.Toggle(blnToggleState, "Im a Toggle button");
         *    GUILayout.EndVertical();
         *    GUILayout.BeginVertical();
         *
         *
         *
         * //   fltScrollerValue = GUILayout.VerticalScrollbar(fltScrollerValue, 0.1f, 0.0f, 1.1f, GUILayout.Height(290));
         *
         * GUILayout.EndVertical();
         * GUILayout.EndHorizontal();
         */



        GUI.BeginGroup(new Rect(20, 80, 800, 600));
        GUI.skin = thisMetalGUISkin;
        //	GUILayout.Label("3D Graphics Settings");

        //toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings);

        GUILayout.BeginHorizontal();
        GUILayout.Label("Experiments:");
        GUILayout.Space(90);
        GUILayout.Label("Subjects:");

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        GUILayout.BeginVertical();
        GUI.Box(new Rect(0, 25, 300, 300), "");
        scrollLevelListPosition  = GUILayout.BeginScrollView(scrollLevelListPosition, GUILayout.Width(300), GUILayout.Height(300));
        newCurrentLevelSelection = SelectList.List(levelList, currentLevelSelection, listStyle, listSelectedStyle);
        if (newCurrentLevelSelection != currentLevelSelection)
        {
            currentLevelSelection = newCurrentLevelSelection;
            initSubjects();
            errorText = "";
        }
        currentLevelSelection = newCurrentLevelSelection;
        GUILayout.EndScrollView();

        GUILayout.BeginHorizontal();
        GUILayout.Label("New Subject:");
        subject = GUILayout.TextField(subject);
        subject = subject.Trim();

        GUILayout.EndHorizontal();


        GUILayout.BeginHorizontal();
        GUILayout.Label("Config File:");
        configfile = GUILayout.TextField(configfile);
        configfile = configfile.Trim();

        GUILayout.EndHorizontal();



        if (GUI.Button(new Rect(0, 450, 200, 30), "Start New Experiment"))
        {
            startNewExperiment();
        }

        if (GUI.Button(new Rect(405, 450, 200, 30), "Resume Experiment"))
        {
            if (subjectslist.Length > 0)
            {
                config.runMode = ConfigRunMode.RESUME;
                //run();
            }
            else
            {
                errorText = "Please select a subject";
            }
        }



        GUILayout.EndVertical();


        //SUBJECTS
        GUILayout.Space(100);
        GUILayout.BeginVertical();
        GUI.Box(new Rect(400, 25, 300, 300), "");
        scrollSubjectListPosition  = GUILayout.BeginScrollView(scrollSubjectListPosition, GUILayout.Width(300), GUILayout.Height(300));
        newCurrentSubjectSelection = SelectList.List(subjectslist, currentSubjectSelection, listStyle, listSelectedStyle);
        if (newCurrentSubjectSelection != currentSubjectSelection)
        {
            currentSubjectSelection = newCurrentSubjectSelection;
            initSessions();
            errorText = "";
        }
        currentSubjectSelection = newCurrentSubjectSelection;
        GUILayout.EndScrollView();

        //draw last so it's on top

        if (PopupList.List(
                new Rect(405, 330, 120, 20),
                ref showSessList,
                ref sessEntry,
                new GUIContent(selectSession),
                sesslist,
                popupStyle))
        {
            sesspicked = true;
        }

        GUI.Label(new Rect(512, 333, 16, 16), pulldown);

        //Debug.Log(sessEntry);
        if (sesspicked)
        {
            selectSession = sesslist[sessEntry].text;
        }


        if (GUI.Button(new Rect(530, 330, 150, 20), "Playback Session"))
        {
            if (subjectslist.Length > 0)
            {
                config.runMode = ConfigRunMode.PLAYBACK;

                subject = subjectslist[currentSubjectSelection].text;
                ///Debug.Log(sub);
                run();
            }
            else
            {
                errorText = "Please select a subject";
            }
        }

        GUILayout.EndVertical();



        GUILayout.EndHorizontal();
        GUI.Label(new Rect(0, 495, 325, 30), errorText, errorStyle);
        GUI.EndGroup();


        ///////////////////
        /// top section
        ///////////////////

        GUI.BeginGroup(new Rect(20, 20, 900, 600));
        GUILayout.BeginVertical();
        GUILayout.BeginHorizontal();
        fsToggleState      = GUI.Toggle(new Rect(260, 0, 100, 20), fsToggleState, "No Full Screen");
        noEEGToggleState   = GUI.Toggle(new Rect(380, 0, 100, 20), noEEGToggleState, "No EEG");
        showFPSToggleState = GUI.Toggle(new Rect(490, 0, 100, 20), showFPSToggleState, "Show FPS");
        //enableSkipStateToggleState = GUI.Toggle(new Rect (580, 0, 100, 20),showFPSToggleState, "Enable Skip Task Key");
        GUILayout.EndHorizontal();


        //GUI.Label(new Rect (0, 30, 125, 20), "Working Directory:");

        //home2 = GUI.TextField(new Rect(120,30, 550, 20),home);
        if (home2 != home)
        {
            initSubjects();
        }
        home = home2;

        //draw last so it's on top
        GUI.Label(new Rect(0, 0, 145, 20), "Screen Resolution:");
        if (PopupList.List(
                new Rect(120, 0, 120, 20),
                ref showList,
                ref listEntry,
                new GUIContent(selectRes),
                reslist,
                popupStyle))
        {
            picked = true;
        }

        GUI.Label(new Rect(226, 3, 16, 16), pulldown);

        if (picked)
        {
            selectRes = reslist[listEntry].text;
        }

        GUILayout.EndVertical();
        GUI.EndGroup();


        GUI.EndGroup();

        GUI.Label(new Rect(Screen.width / 2 + 330, 705, 300, 30), "Version: " + config.version);
    }