Пример #1
0
    // Use this for initialization
    void Start()
    {
        recorder        = gameObject.GetComponent <FlashbackRecorder>();
        inputController = GameObject.Find("IOController").GetComponent <InputController>();
        eventManager    = GameObject.Find("BehaviorController").GetComponent <EventManager>();
        objSelector     = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>();
        commBridge      = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
        preds           = GameObject.Find("BehaviorController").GetComponent <Predicates>();

        refExpGenerator = GameObject.Find("ReferringExpressionGenerator")
                          .GetComponent <ReferringExpressionGenerator>();

        captureVideo   = (PlayerPrefs.GetInt("Capture Video") == 1);
        captureParams  = (PlayerPrefs.GetInt("Capture Params") == 1);
        captureMode    = (VideoCaptureMode)PlayerPrefs.GetInt("Video Capture Mode");
        filenameScheme = (VideoCaptureFilenameType)PlayerPrefs.GetInt("Video Capture Filename Type");
        sortByEvent    = (PlayerPrefs.GetInt("Sort By Event String") == 1);
        filenamePrefix = PlayerPrefs.GetString("Custom Video Filename Prefix");
        dbFile         = PlayerPrefs.GetString("Video Capture DB");
        videoDir       = PlayerPrefs.GetString("Video Output Directory");

        if ((!captureVideo) && (!captureParams))
        {
            return;
        }

        if (videoDir != string.Empty)
        {
            recorder.SetOutputDirectory(Path.GetFullPath(Application.dataPath + videoDir));
        }

        if (captureMode == VideoCaptureMode.PerEvent)
        {
            refExpGenerator.ItemsSituated += StartCaptureProcess;

            intervalWaitTimer          = new Timer(intervalWaitTime);
            intervalWaitTimer.Enabled  = false;
            intervalWaitTimer.Elapsed += WaitComplete;

            eventTimeoutTimer          = new Timer(eventTimeoutTime);
            eventTimeoutTimer.Enabled  = false;
            eventTimeoutTimer.Elapsed += StopCapture;

            FileWritten += CaptureComplete;
        }
    }
Пример #2
0
                void LoadPrefs()
                {
                    inPort        = PlayerPrefs.GetString("Listener Port");
                    makeLogs      = (PlayerPrefs.GetInt("Make Logs") == 1);
                    logsPrefix    = PlayerPrefs.GetString("Logs Prefix");
                    actionsOnly   = (PlayerPrefs.GetInt("Actions Only Logs") == 1);
                    fullState     = (PlayerPrefs.GetInt("Full State Info") == 1);
                    logTimestamps = (PlayerPrefs.GetInt("Timestamps") == 1);

                    numUrls = 0;
                    string urlsString = PlayerPrefs.GetString("URLs");

                    foreach (string urlString in urlsString.Split(';'))
                    {
                        // e.g., Fusion|FusionSocket=tarski.cs-i.brandeis.edu:9126,true;EpiSim|EpiSimSocket=localhost:5000,false
                        if (urlString.Contains("|"))
                        {
                            urlTypes.Add(urlString.Split('|')[1].Split('=')[0]);
                            if (urlString.Contains("="))
                            {
                                urlLabels.Add(urlString.Split('|')[0]);
                                if (urlString.Contains(","))
                                {
                                    urls.Add(urlString.Split('=')[1].Split(',')[0]);
                                    urlActiveStatuses.Add(Convert.ToBoolean(urlString.Split('=')[1].Split(',')[1]));
                                }
                                else
                                {
                                    urls.Add(urlString.Split('=')[1]);
                                    urlActiveStatuses.Add(false);
                                }
                            }
                            else
                            {
                                urlTypes.Add(urlString.Split('|')[1]);
                                urlLabels.Add(urlString.Split('|')[0]);
                                urls.Add(string.Empty);
                                if (urlString.Contains(","))
                                {
                                    urlActiveStatuses.Add(Convert.ToBoolean(urlString.Split('|')[1].Split(',')[1]));
                                }
                                else
                                {
                                    urlActiveStatuses.Add(false);
                                }
                            }
                        }
                        else
                        {
                            urlTypes.Add(string.Empty);
                            if (urlString.Contains("="))
                            {
                                urlLabels.Add(urlString.Split('=')[0]);
                                if (urlString.Contains(","))
                                {
                                    urls.Add(urlString.Split('=')[1].Split(',')[0]);
                                    urlActiveStatuses.Add(Convert.ToBoolean(urlString.Split('=')[1].Split(',')[0]));
                                }
                                else
                                {
                                    urls.Add(urlString.Split('=')[1]);
                                    urlActiveStatuses.Add(false);
                                }
                            }
                            else
                            {
                                urlLabels.Add(string.Empty);
                                urls.Add(string.Empty);
                                if (urlString.Contains(","))
                                {
                                    urlActiveStatuses.Add(Convert.ToBoolean(urlString.Split('|')[1].Split(',')[0]));
                                }
                                else
                                {
                                    urlActiveStatuses.Add(false);
                                }
                            }
                        }
                        numUrls++;
                    }

                    captureVideo              = (PlayerPrefs.GetInt("Capture Video") == 1);
                    captureParams             = (PlayerPrefs.GetInt("Capture Params") == 1);
                    videoCaptureMode          = (VideoCaptureMode)PlayerPrefs.GetInt("Video Capture Mode");
                    resetScene                = (PlayerPrefs.GetInt("Reset Between Events") == 1);
                    eventResetCounter         = PlayerPrefs.GetInt("Event Reset Counter").ToString();
                    videoCaptureFilenameType  = (VideoCaptureFilenameType)PlayerPrefs.GetInt("Video Capture Filename Type");
                    sortByEventString         = (PlayerPrefs.GetInt("Sort By Event String") == 1);
                    customVideoFilenamePrefix = PlayerPrefs.GetString("Custom Video Filename Prefix");
                    autoEventsList            = PlayerPrefs.GetString("Auto Events List");
                    startIndex                = PlayerPrefs.GetInt("Start Index").ToString();
                    captureDB       = PlayerPrefs.GetString("Video Capture DB");
                    videoOutputDir  = PlayerPrefs.GetString("Video Output Directory");
                    editableVoxemes = (PlayerPrefs.GetInt("Make Voxemes Editable") == 1);
                    eulaAccepted    = (PlayerPrefs.GetInt("EULA Accepted") == 1);
                }
	// Use this for initialization
	void Start() {
		recorder = gameObject.GetComponent<FlashbackRecorder>();
		inputController = GameObject.Find("IOController").GetComponent<InputController>();
		eventManager = GameObject.Find("BehaviorController").GetComponent<EventManager>();
		objSelector = GameObject.Find("VoxWorld").GetComponent<ObjectSelector>();
		commBridge = GameObject.Find("CommunicationsBridge").GetComponent<CommunicationsBridge>();
		preds = GameObject.Find("BehaviorController").GetComponent<Predicates>();

		captureVideo = (PlayerPrefs.GetInt("Capture Video") == 1);
		captureParams = (PlayerPrefs.GetInt("Capture Params") == 1);
		captureMode = (VideoCaptureMode) PlayerPrefs.GetInt("Video Capture Mode");
		resetScene = (PlayerPrefs.GetInt("Reset Between Events") == 1);
		eventResetCounter = PlayerPrefs.GetInt("Event Reset Counter");
		filenameScheme = (VideoCaptureFilenameType) PlayerPrefs.GetInt("Video Capture Filename Type");
		sortByEvent = (PlayerPrefs.GetInt("Sort By Event String") == 1);
		filenamePrefix = PlayerPrefs.GetString("Custom Video Filename Prefix");
		dbFile = PlayerPrefs.GetString("Video Capture DB");
		inputFile = PlayerPrefs.GetString("Auto Events List");
		eventIndex = PlayerPrefs.GetInt("Start Index");
		videoDir = PlayerPrefs.GetString("Video Output Directory");

		if ((!captureVideo) && (!captureParams)) {
			return;
		}

		if (videoDir != string.Empty) {
			recorder.SetOutputDirectory(Path.GetFullPath(Application.dataPath + videoDir));
		}

		InitObjectDisabling();

		eventObjs = new List<GameObject>();

		if (captureMode == VideoCaptureMode.PerEvent) {
            // TODO: Default Listener Port no longer active, switch to Commander
			commBridge.PortOpened += StartAutoInput;

			inputController.InputReceived += PrepareScene;
			inputController.InputReceived += InputStringReceived;
			inputController.ParseComplete += ParseReceived;

			eventManager.ObjectsResolved += ObjectsResolved;
			eventManager.ObjectsResolved += FilterSpecifiedManner;
			eventManager.ObjectsResolved += EnableAffectedObjects;
			eventManager.ObjectsResolved += InsertWaitPeriod;
			//eventManager.ObjectsResolved += StartCapture;
			eventManager.SatisfactionCalculated += SatisfactionCalculated;
			eventManager.SatisfactionCalculated += EnableAffectedObjects;
			eventManager.SatisfactionCalculated += InsertWaitPeriod;
			//eventManager.SatisfactionCalculated += StartCapture;
			//eventManager.ExecuteEvent += EnableAffectedObjects;
			//eventManager.EventInserted += EventInserted;
			eventManager.ExecuteEvent += StartCapture;
			eventManager.QueueEmpty += EventComplete;

			preds.waitTimer.Elapsed += WaitComplete;
			preds.PrepareLog += PrepareLog;
			preds.ParamsCalculated += ParametersCalculated;

			eventTimeoutTimer = new Timer(eventTimeoutTime);
			eventTimeoutTimer.Enabled = false;
			eventTimeoutTimer.Elapsed += EventTimedOut;
			eventTimeoutTimer.Elapsed += StopCapture;

			eventCompleteWaitTimer = new Timer(eventCompleteWaitTime);
			eventCompleteWaitTimer.Enabled = false;
			eventCompleteWaitTimer.Elapsed += StopCapture;

			FileWritten += CaptureComplete;
		}
	}
Пример #4
0
                void OnGUI()
                {
                    if (!Draw)
                    {
                        return;
                    }

                    labelStyle     = new GUIStyle("Label");
                    textFieldStyle = new GUIStyle("TextField");
                    buttonStyle    = new GUIStyle("Button");
                    bgLeft         = Screen.width / 6;
                    bgTop          = Screen.height / 12;
                    bgWidth        = 4 * Screen.width / 6;
                    bgHeight       = 10 * Screen.height / 12;
                    margin         = 0;

                    GUI.Box(new Rect(bgLeft, bgTop, bgWidth, bgHeight), "");

                    masterScrollPosition = GUI.BeginScrollView(new Rect(bgLeft + 5, bgTop + 5, bgWidth - 10, bgHeight - 70),
                                                               masterScrollPosition,
                                                               new Rect(bgLeft + margin, bgTop + 5, bgWidth - 10, bgHeight - 70));

#if UNITY_IOS
                    if (GUI.Button(new Rect(bgLeft + 165, bgTop + 35, GUI.skin.label.CalcSize(new GUIContent(ipContent)).x + 10, 25 * fontSizeModifier),
                                   new GUIContent(ipContent)))
                    {
                        if (ipContent == "IP")
                        {
                            ipContent = ip;
                        }
                        else
                        {
                            ipContent = "IP";
                        }
                    }
#endif

#if !UNITY_IOS
                    GUI.Label(new Rect(bgLeft + 10, bgTop + 35, 90 * fontSizeModifier, 25 * fontSizeModifier), "Make Logs");
                    makeLogs = GUI.Toggle(new Rect(bgLeft + 100, bgTop + 35, 25, 25 * fontSizeModifier), makeLogs, string.Empty);

                    if (makeLogs)
                    {
                        GUILayout.BeginArea(new Rect(bgLeft + 10, bgTop + 60, 290 * fontSizeModifier, 45 * fontSizeModifier),
                                            GUI.skin.box);
                        logsPrefsBoxScrollPosition = GUILayout.BeginScrollView(logsPrefsBoxScrollPosition, false, false);
                        GUILayout.BeginVertical(GUI.skin.box);

                        //GUILayout.Label("Video Capture Mode", GUILayout.Width(GUI.skin.label.CalcSize(new GUIContent("Video Capture Mode")).x + 10));

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Prefix", GUILayout.Width(150 * fontSizeModifier));
                        logsPrefix = GUILayout.TextField(logsPrefix, GUILayout.Width(80 * fontSizeModifier));
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Actions Only Logs", GUILayout.Width(150 * fontSizeModifier));
                        actionsOnly = GUILayout.Toggle(actionsOnly, string.Empty, GUILayout.Width(20 * fontSizeModifier));
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Full State Info", GUILayout.Width(150 * fontSizeModifier));
                        fullState = GUILayout.Toggle(fullState, string.Empty, GUILayout.Width(20 * fontSizeModifier));
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Timestamps", GUILayout.Width(150 * fontSizeModifier));
                        logTimestamps = GUILayout.Toggle(logTimestamps, string.Empty, GUILayout.Width(20 * fontSizeModifier));
                        GUILayout.EndHorizontal();

                        GUILayout.EndVertical();
                        GUILayout.EndScrollView();
                        GUILayout.EndArea();
                    }
#endif

                    GUILayout.BeginArea(new Rect(bgLeft + 10, bgTop + 110, 290 * fontSizeModifier, 120 * fontSizeModifier),
                                        GUI.skin.box);
                    Vector2 connectionsLabelDimensions = GUI.skin.label.CalcSize(new GUIContent("Connections"));
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Connections", GUILayout.Width(connectionsLabelDimensions.x));
                    GUILayout.Button(new GUIContent("*", "IP: " + ip), GUILayout.Width(10 * fontSizeModifier), GUILayout.Height(10 * fontSizeModifier));
                    if (GUI.tooltip != string.Empty)
                    {
                        GetMyIP();
                        GUILayout.Label(GUI.tooltip, GUILayout.MaxWidth(GUI.skin.label.CalcSize(new GUIContent("IP: " + ip)).x + 10), GUILayout.ExpandWidth(false));
                    }
                    else
                    {
                        GUILayout.Label(string.Empty);
                    }
                    GUILayout.EndHorizontal();
                    urlBoxScrollPosition = GUILayout.BeginScrollView(urlBoxScrollPosition, false, false);
                    GUILayout.BeginVertical(GUI.skin.box);

                    for (int i = 0; i < urls.Count; i++)
                    {
                        GUILayout.BeginVertical(GUI.skin.box);
                        GUILayout.BeginHorizontal();
                        urlLabels[i]         = GUILayout.TextField(urlLabels[i], GUILayout.Width(80 * fontSizeModifier));
                        urls[i]              = GUILayout.TextField(urls[i], GUILayout.Width(140 * fontSizeModifier));
                        urlActiveStatuses[i] = GUILayout.Toggle(urlActiveStatuses[i], string.Empty, GUILayout.Width(20 * fontSizeModifier));
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        urlTypes[i] = GUILayout.TextField(urlTypes[i], GUILayout.Width(80 * fontSizeModifier));
                        removeUrl.Add(-1);
                        removeUrl[i] = GUILayout.SelectionGrid(removeUrl[i], new string[] { "-" }, 1, GUI.skin.button,
                                                               GUILayout.ExpandWidth(true));
                        GUILayout.EndHorizontal();
                        GUILayout.EndVertical();

                        if (removeUrl[i] == 0)
                        {
                            removeUrl[i] = -1;
                            urlLabels.RemoveAt(i);
                            urlTypes.RemoveAt(i);
                            urls.RemoveAt(i);
                            urlActiveStatuses.RemoveAt(i);
                            numUrls--;
                        }
                    }

                    addUrl = GUILayout.SelectionGrid(addUrl, new string[] { "+" }, 1, GUI.skin.button, GUILayout.ExpandWidth(true));
                    if (addUrl == 0)
                    {
                        // add new url
                        numUrls++;
                        for (int j = 1; j <= urls.Count + 1; j++)
                        {
                            if (!urlLabels.Contains(string.Format("URL {0}", j)))
                            {
                                urlLabels.Add(string.Format("URL {0}", j));
                                urlTypes.Add("");
                                urls.Add("");
                                urlActiveStatuses.Add(true);
                                break;
                            }
                        }

                        addUrl = -1;
                    }

                    GUILayout.EndVertical();
                    GUILayout.EndScrollView();

                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("Load Socket Config", GUILayout.Width(135 * fontSizeModifier)))
                    {
                        // read in the socket config file and deserialize it to an instance of VoxSimSocketConfig
                        XmlSerializer serializer = new XmlSerializer(typeof(VoxSimSocketConfig));
                        try {
                            using (var stream = new FileStream("local_config/socket_config.xml", FileMode.Open)) {
                                VoxSimSocketConfig config = serializer.Deserialize(stream) as VoxSimSocketConfig;

                                urlLabels.Clear();
                                urlTypes.Clear();
                                urls.Clear();
                                urlActiveStatuses.Clear();
                                numUrls = 0;

                                foreach (VoxSimSocket socket in config.Sockets)
                                {
                                    urlLabels.Add(socket.Name);
                                    urlTypes.Add(socket.Type);
                                    urls.Add(socket.URL);
                                    urlActiveStatuses.Add(socket.Enabled);
                                    numUrls++;
                                }
                            }
                        }
                        catch (FileNotFoundException ex) {
                            // if local_config/socket_config.xml has been removed or renamed
                            //  create a new, empty one
                            using (var stream = new FileStream("local_config/socket_config.xml", FileMode.Create)) {
                                serializer.Serialize(stream, new VoxSimSocketConfig());

                                urlLabels.Clear();
                                urlTypes.Clear();
                                urls.Clear();
                                urlActiveStatuses.Clear();
                                numUrls = 0;
                            }
                        }
                    }
                    if (GUILayout.Button("Save Socket Config", GUILayout.Width(135 * fontSizeModifier)))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(VoxSimSocketConfig));
                        using (var stream = new FileStream("local_config/socket_config.xml", FileMode.Create)) {
                            VoxSimSocketConfig socketConfig = new VoxSimSocketConfig();
                            for (int i = 0; i < numUrls; i++)
                            {
                                VoxSimSocket socket = new VoxSimSocket();
                                socket.Name    = urlLabels[i];
                                socket.Type    = urlTypes[i];
                                socket.URL     = urls[i];
                                socket.Enabled = urlActiveStatuses[i];
                                socketConfig.Sockets.Add(socket);
                            }

                            List <string> urlStrings = new List <string>();
                            string        urlsString = string.Empty;
                            for (int i = 0; i < numUrls; i++)
                            {
                                urlStrings.Add(string.Format("{0}|{1}={2},{3}", urlLabels[i], urlTypes[i], urls[i], urlActiveStatuses[i].ToString()));
                            }
                            urlsString = string.Join(";", urlStrings);

                            PlayerPrefs.SetString("URLs", urlsString);

                            serializer.Serialize(stream, socketConfig);
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.EndArea();

            #if !UNITY_IOS
                    GUI.Label(new Rect(bgLeft + 10, bgTop + 230, 90 * fontSizeModifier, 25 * fontSizeModifier), "Capture Video");
                    captureVideo = GUI.Toggle(new Rect(bgLeft + 100, bgTop + 230, 20, 25 * fontSizeModifier), captureVideo,
                                              string.Empty);

                    if (captureVideo)
                    {
                        captureParams = false;
                    }

                    GUI.Label(new Rect(bgLeft + 135, bgTop + 230, 150 * fontSizeModifier, 25 * fontSizeModifier), "Capture Params");
                    captureParams = GUI.Toggle(new Rect(bgLeft + 235, bgTop + 230, 20, 25 * fontSizeModifier), captureParams,
                                               string.Empty);

                    if (captureParams)
                    {
                        captureVideo = false;
                    }

                    if (captureVideo)
                    {
                        GUILayout.BeginArea(new Rect(bgLeft + 10, bgTop + 255,
                                                     (((13 * Screen.width / 24) - 20 * fontSizeModifier) - bgLeft < 395 * fontSizeModifier)
                                                ? ((13 * Screen.width / 24) - 20 * fontSizeModifier) - (bgLeft)
                                                : 395 * fontSizeModifier,
                                                     (bgTop + bgHeight - 80) - (bgTop + 245) < 210 * fontSizeModifier
                                                ? (bgTop + bgHeight - 80) - (bgTop + 245)
                                                : 210 * fontSizeModifier), GUI.skin.box);
                        videoPrefsBoxScrollPosition = GUILayout.BeginScrollView(videoPrefsBoxScrollPosition, false, false,
                                                                                GUILayout.ExpandWidth(true), GUILayout.MaxWidth((13 * Screen.width / 24) - 20 * fontSizeModifier));
                        GUILayout.BeginVertical(GUI.skin.box);

                        string warningText = "Enabling this option may affect performance";
                        GUILayout.TextArea(warningText,
                                           GUILayout.Width(GUI.skin.label.CalcSize(new GUIContent(warningText)).x + 10),
                                           GUILayout.Height(20 * fontSizeModifier));

                        GUILayout.BeginHorizontal();
                        GUILayout.BeginVertical();
                        GUILayout.Label("Video Capture Mode",
                                        GUILayout.Width(GUI.skin.label.CalcSize(new GUIContent("Video Capture Mode")).x + 10));

                        string[] videoCaptureModeLabels = new string[] { "Manual", "Full-Time", "Per Event" };
                        videoCaptureMode = (VideoCaptureMode)GUILayout.SelectionGrid((int)videoCaptureMode,
                                                                                     videoCaptureModeLabels, 1, "toggle",
                                                                                     GUILayout.Width(150 * fontSizeModifier));
                        GUILayout.EndVertical();

                        GUILayout.BeginVertical();
                        GUILayout.Label("Capture Filename Type",
                                        GUILayout.Width(GUI.skin.label.CalcSize(new GUIContent("Capture Filename Type")).x + 10));

                        string[] videoCaptureFilenameTypeLabels = new string[] { "Flashback Default", "Event String", "Custom" };
                        videoCaptureFilenameType =
                            (VideoCaptureFilenameType)GUILayout.SelectionGrid((int)videoCaptureFilenameType,
                                                                              videoCaptureFilenameTypeLabels, 1, "toggle");

                        // EventString can only be used with PerEvent
                        if (videoCaptureMode != VideoCaptureMode.PerEvent)
                        {
                            if (videoCaptureFilenameType == VideoCaptureFilenameType.EventString)
                            {
                                videoCaptureFilenameType = VideoCaptureFilenameType.FlashbackDefault;
                            }
                        }

                        if (videoCaptureFilenameType == VideoCaptureFilenameType.EventString)
                        {
                            GUILayout.BeginHorizontal();
                            sortByEventString =
                                GUILayout.Toggle(sortByEventString, string.Empty, GUILayout.Width(20 * fontSizeModifier));
                            GUILayout.Label("Sort Videos By Event String", GUILayout.Width(120 * fontSizeModifier));
                            GUILayout.EndHorizontal();
                        }
                        else if (videoCaptureFilenameType == VideoCaptureFilenameType.Custom)
                        {
                            customVideoFilenamePrefix =
                                GUILayout.TextField(customVideoFilenamePrefix, GUILayout.Width(150 * fontSizeModifier));
                        }

                        GUILayout.EndVertical();
                        GUILayout.EndHorizontal();

                        if (videoCaptureMode == VideoCaptureMode.PerEvent)
                        {
                            GUILayout.BeginVertical();
                            GUILayout.BeginHorizontal();
                            resetScene = GUILayout.Toggle(resetScene, string.Empty, GUILayout.Width(20 * fontSizeModifier));
                            GUILayout.BeginVertical();
                            GUILayout.Label("Reset Scene Between", GUILayout.Width(130 * fontSizeModifier));
                            GUILayout.BeginHorizontal();
                            GUILayout.Label("Every", GUILayout.Width(35 * fontSizeModifier));
                            eventResetCounter =
                                Regex.Replace(GUILayout.TextField(eventResetCounter, GUILayout.Width(25 * fontSizeModifier)),
                                              @"[^0-9]", "");
                            GUILayout.Label("Events");
                            GUILayout.EndHorizontal();
                            GUILayout.EndVertical();
                            GUILayout.EndHorizontal();
                            GUILayout.EndVertical();

                            GUILayout.BeginVertical();
                            GUILayout.BeginHorizontal();
                            GUILayout.Label("Auto-Input Script", GUILayout.Width(120 * fontSizeModifier));
                            autoEventsList = GUILayout.TextField(autoEventsList, GUILayout.Width(150 * fontSizeModifier));
                            GUILayout.Label(".py : ", GUILayout.Width(30 * fontSizeModifier));
                            startIndex = Regex.Replace(GUILayout.TextField(startIndex, GUILayout.Width(40 * fontSizeModifier)),
                                                       @"[^0-9]", "");
                            GUILayout.EndHorizontal();
                            GUILayout.Label("(Leave empty to input events manually)");
                            GUILayout.EndVertical();
                        }

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Video Output Folder", GUILayout.Width(120 * fontSizeModifier));
                        videoOutputDir = GUILayout.TextField(videoOutputDir, GUILayout.Width(150 * fontSizeModifier));
                        GUILayout.EndHorizontal();

                        GUILayout.BeginVertical();
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Video Database File", GUILayout.Width(120 * fontSizeModifier));
                        captureDB = GUILayout.TextField(captureDB, GUILayout.Width(150 * fontSizeModifier));
                        GUILayout.Label(".db", GUILayout.Width(25 * fontSizeModifier));
                        GUILayout.EndHorizontal();
                        GUILayout.Label("(Leave empty to omit video info from database)", GUILayout.Width(300 * fontSizeModifier));
                        GUILayout.EndVertical();

                        GUILayout.EndVertical();
                        GUILayout.EndScrollView();
                        GUILayout.EndArea();
                    }
                    else if (captureParams)
                    {
                        GUILayout.BeginArea(new Rect(bgLeft + 10, bgTop + 255,
                                                     (((13 * Screen.width / 24) - 20 * fontSizeModifier) - bgLeft < 380 * fontSizeModifier)
                                                ? ((13 * Screen.width / 24) - 20 * fontSizeModifier) - (bgLeft)
                                                : 380 * fontSizeModifier,
                                                     (bgTop + bgHeight - 80) - (bgTop + 245) < 170 * fontSizeModifier
                                                ? (bgTop + bgHeight - 80) - (bgTop + 245)
                                                : 170 * fontSizeModifier), GUI.skin.box);
                        paramPrefsBoxScrollPosition = GUILayout.BeginScrollView(paramPrefsBoxScrollPosition, false, false);
                        GUILayout.BeginVertical(GUI.skin.box);

                        GUILayout.BeginVertical();
                        GUILayout.BeginHorizontal();
                        resetScene = GUILayout.Toggle(resetScene, string.Empty, GUILayout.Width(20 * fontSizeModifier));
                        GUILayout.BeginVertical();
                        GUILayout.Label("Reset Scene Between", GUILayout.Width(130 * fontSizeModifier));
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Every", GUILayout.Width(35 * fontSizeModifier));
                        eventResetCounter =
                            Regex.Replace(GUILayout.TextField(eventResetCounter, GUILayout.Width(25 * fontSizeModifier)), @"[^0-9]",
                                          "");
                        GUILayout.Label("Events");
                        GUILayout.EndHorizontal();
                        GUILayout.EndVertical();
                        GUILayout.EndHorizontal();
                        GUILayout.EndVertical();

                        GUILayout.BeginVertical();
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Auto-Input Script", GUILayout.Width(120 * fontSizeModifier));
                        autoEventsList = GUILayout.TextField(autoEventsList, GUILayout.Width(150 * fontSizeModifier));
                        GUILayout.Label(".py : ", GUILayout.Width(30 * fontSizeModifier));
                        startIndex = Regex.Replace(GUILayout.TextField(startIndex, GUILayout.Width(40 * fontSizeModifier)),
                                                   @"[^0-9]", "");
                        GUILayout.EndHorizontal();
                        GUILayout.Label("(Leave empty to input events manually)");
                        GUILayout.EndVertical();

                        GUILayout.BeginVertical();
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Capture Database", GUILayout.Width(120 * fontSizeModifier));
                        captureDB = GUILayout.TextField(captureDB, GUILayout.Width(150 * fontSizeModifier));
                        GUILayout.Label(".db", GUILayout.Width(25 * fontSizeModifier));
                        GUILayout.EndHorizontal();
                        GUILayout.Label("(Leave empty to omit param info from database)", GUILayout.Width(300 * fontSizeModifier));
                        GUILayout.EndVertical();

                        GUILayout.EndVertical();
                        GUILayout.EndScrollView();
                        GUILayout.EndArea();
                    }
            #endif

                    GUILayout.BeginArea(new Rect(13 * Screen.width / 24, bgTop + 35, 3 * Screen.width / 12, 3 * Screen.height / 6),
                                        GUI.skin.window);
                    sceneBoxScrollPosition = GUILayout.BeginScrollView(sceneBoxScrollPosition, false, false);
                    GUILayout.BeginVertical(GUI.skin.box);

                    customStyle = GUI.skin.button;
                    //customStyle.active.background = Texture2D.whiteTexture;
                    //customStyle.onActive.background = Texture2D.whiteTexture;
                    //customStyle.active.textColor = Color.black;
                    //customStyle.onActive.textColor = Color.black;

                    selected = GUILayout.SelectionGrid(selected, listItems, 1, customStyle, GUILayout.ExpandWidth(true));

                    if (selected >= 0)
                    {
                        // extract the scene name (alone) from the path that's displayed in the scene selection list
                        sceneSelected = listItems[selected].Split('/').Last();
                    }

                    GUILayout.EndVertical();
                    GUILayout.EndScrollView();
                    GUILayout.EndArea();

                    GUI.Label(
                        new Rect(13 * Screen.width / 24, bgTop + 35 + (3 * Screen.height / 6) + 10 * fontSizeModifier,
                                 150 * fontSizeModifier, 25 * fontSizeModifier), "Make Voxemes Editable");
                    editableVoxemes =
                        GUI.Toggle(
                            new Rect((13 * Screen.width / 24) + (150 * fontSizeModifier),
                                     bgTop + 35 + (3 * Screen.height / 6) + 10 * fontSizeModifier, 150, 25 * fontSizeModifier),
                            editableVoxemes, string.Empty);

                    //		GUI.Label (new Rect ((13*Screen.width/24 + 3*Screen.width/12) - (150*fontSizeModifier), bgTop + 35 + (3*Screen.height/6) + 10*fontSizeModifier, 150*fontSizeModifier, 25*fontSizeModifier), "Use Teaching Agent");
                    //		teachingAgent = GUI.Toggle (new Rect ((13*Screen.width/24 + 3*Screen.width/12) - (25*fontSizeModifier), bgTop + 35 + (3*Screen.height/6) + 10*fontSizeModifier, 150, 25*fontSizeModifier), teachingAgent, string.Empty);

                    Vector2 scenesLabelDimensions = GUI.skin.label.CalcSize(new GUIContent("Scenes"));

                    GUI.Label(new Rect(2 * Screen.width / 3 - scenesLabelDimensions.x / 2, bgTop + 35, scenesLabelDimensions.x, 25), "Scenes");
                    GUI.EndScrollView();

                    if (GUI.Button(
                            new Rect((Screen.width / 2 - 50) - 125, bgTop + bgHeight - 60, 100 * fontSizeModifier,
                                     50 * fontSizeModifier), "Revert Prefs"))
                    {
                        LoadPrefs();
                    }

                    if (GUI.Button(
                            new Rect(Screen.width / 2 - 50, bgTop + bgHeight - 60, 100 * fontSizeModifier, 50 * fontSizeModifier),
                            "Save Prefs"))
                    {
                        SavePrefs();
                    }

                    if (GUI.Button(
                            new Rect((Screen.width / 2 - 50) + 125, bgTop + bgHeight - 60, 100 * fontSizeModifier,
                                     50 * fontSizeModifier), "Save & Launch"))
                    {
                        if (sceneSelected != "")
                        {
                            SavePrefs();

                            if (eulaAccepted)
                            {
                                Debug.Log(string.Format("Launching scene {0}", sceneSelected));
                                StartCoroutine(SceneHelper.LoadScene(sceneSelected));
                            }
                            else
                            {
                                PopUpEULAWindow();
                            }
                        }
                    }

                    scenesLabelDimensions = GUI.skin.label.CalcSize(new GUIContent(launcherTitle));
                    GUI.Label(new Rect(((2 * bgLeft + bgWidth) / 2) - scenesLabelDimensions.x / 2, bgTop, scenesLabelDimensions.x, 25),
                              launcherTitle);
                }