Ejemplo n.º 1
0
        private void OnGUI()
        {
            EditorGUILayout.HelpBox("To set the resolution, this has to be done within Unity. " +
                                    "\n\nFirst select Edit / Project Settings / Player. Then, ensure you set the Default Screen Width and Height in Resolution and Presentation for the PC and Mac Standalone in the inspector. " +
                                    "\n\nThen change the aspect ratio using the drop down box at top left of the game Window. You'll then need to resize the window so that there is a border around the rendering area.", MessageType.Info);

            var presetsList       = USRecordRuntimePreferences.GetPresetInfo();
            var presetNames       = presetsList.Select(preset => preset.Name).ToArray();
            var newSelectedPreset = EditorGUILayout.Popup("Preset", USRecordRuntimePreferences.SelectedPreset, presetNames);

            if (newSelectedPreset != USRecordRuntimePreferences.SelectedPreset)
            {
                USRecordRuntimePreferences.SetNewPreset(newSelectedPreset);
            }

            USRecordRuntimePreferences.PresetName = EditorGUILayout.TextField("Preset Name", USRecordRuntimePreferences.PresetName);
            using (new Shared.GUIBeginHorizontal())
            {
                USRecordRuntimePreferences.CapturePath = EditorGUILayout.TextField("Capture Path", USRecordRuntimePreferences.CapturePath);
                if (GUILayout.Button("Select", GUILayout.Width(60)))
                {
                    USRecordRuntimePreferences.CapturePath = EditorUtility.OpenFolderPanel("Select Image Path", "", "");
                }
            }

            USRecordRuntimePreferences.UpscaleAmount = (USRecord.Upscaling)EditorGUILayout.EnumPopup("Upscale Amount", USRecordRuntimePreferences.UpscaleAmount);
            USRecordRuntimePreferences.FrameRate     = (USRecord.FrameRate)EditorGUILayout.EnumPopup("Capture FrameRate", USRecordRuntimePreferences.FrameRate);

            using (new Shared.GUIBeginHorizontal())
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Save As New Preset"))
                {
                    USRecordRuntimePreferences.SaveAsNewPreset(USRecordRuntimePreferences.PresetName, USRecordRuntimePreferences.CapturePath, USRecordRuntimePreferences.UpscaleAmount, USRecordRuntimePreferences.FrameRate);
                    USRecordRuntimePreferences.SelectedPreset = presetsList.Count();
                }
                if (GUILayout.Button("Apply to existing Preset"))
                {
                    presetsList[USRecordRuntimePreferences.SelectedPreset].Name          = USRecordRuntimePreferences.PresetName;
                    presetsList[USRecordRuntimePreferences.SelectedPreset].CapturePath   = USRecordRuntimePreferences.CapturePath;
                    presetsList[USRecordRuntimePreferences.SelectedPreset].UpscaleAmount = USRecordRuntimePreferences.UpscaleAmount;
                    presetsList[USRecordRuntimePreferences.SelectedPreset].FrameRate     = USRecordRuntimePreferences.FrameRate;

                    USRecordRuntimePreferences.SavePresets(presetsList);
                }
                if (GUILayout.Button("Delete Preset"))
                {
                    USRecordRuntimePreferences.DeletePreset();
                }
                GUILayout.FlexibleSpace();
            }
        }