예제 #1
0
        public static void StartScreenshot(ScreenAndLanguages settings, string screenshotName,
                                           float timeForLanguageSwitch, float timeForGamePrepare, Format format)
        {
            if (settings.Dimensions.Length == 0 || settings.Dimensions[0].Dimensions.Length == 0)
            {
                return;
            }

            _settings              = settings;
            _timeForGamePrepare    = timeForGamePrepare;
            _timeForLanguageSwitch = timeForLanguageSwitch;

            WaitForNextStep = false;
            ScreenshotTime  = true;

            screenshotInfo = new ScreenshotInfo
            {
                Format = format,
                Name   = screenshotName
            };
            GameViewUtils.SetSize(0);

            _lastTime  = EditorApplication.timeSinceStartup;
            _coroutine = CaptureScreenshot();
            EditorApplication.update += ExecuteCoroutine;
        }
예제 #2
0
        private void OnGUI()
        {
            _settings = (ScreenAndLanguages)EditorGUILayout.ObjectField("Settings", _settings, typeof(ScreenAndLanguages), false, null);
            _camera   = (Camera)EditorGUILayout.ObjectField("Settings", _camera, typeof(Camera), true, null);
            _format   = (Format)EditorGUILayout.EnumPopup("Image Format", _format);

            _timeForLanguageSwitch = EditorGUILayout.FloatField("Time for language switch", _timeForLanguageSwitch);
            _timeForGamePrepare    = EditorGUILayout.FloatField("Time for game prepare", _timeForGamePrepare);
            _screenshotName        = EditorGUILayout.TextField("Screenshot name", _screenshotName);
            ScreenshotUtils.NeedWaitForNextStep = EditorGUILayout.Toggle("Need wait for click", ScreenshotUtils.NeedWaitForNextStep);
            if (!ScreenshotUtils.ScreenshotTime)
            {
                if (GUILayout.Button("Make screenshot"))
                {
                    if (!_settings)
                    {
                        Debug.LogError("Please, set settings");
                        return;
                    }

                    if (!_camera)
                    {
                        _camera = Camera.main;
                        if (!_camera)
                        {
                            Debug.LogError("Please, set camera");
                            return;
                        }
                    }
                    ScreenshotUtils.StartScreenshot(_settings, _screenshotName, _timeForLanguageSwitch, _timeForGamePrepare, _format);
                }
            }
            else
            {
                if (ScreenshotUtils.ScreenshotTime)
                {
                    if (ScreenshotUtils.WaitForNextStep && GUILayout.Button("Next Screenshot", GUILayout.MinHeight(20)))
                    {
                        ScreenshotUtils.NextStep();
                    }
                    if (GUILayout.Button("Stop Screenshot", GUILayout.MinHeight(20)))
                    {
                        ScreenshotUtils.StopScreenshot();
                    }
                }
            }
        }