예제 #1
0
        /// <summary>
        /// Draws the configuration.
        /// </summary>
        public void DrawConfiguration()
        {
            // Show current view size
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Current View Size: ", _column1);
                var size = SceneMainPanelUtility.GetGameViewSize();
                EditorGUILayout.LabelField(string.Format("{0} x {1}", size.x, size.y));
            }
            EditorGUILayout.EndHorizontal();

            // Show current scale
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Screenshot Scale: ", _column1);
                _screenShotScale = EditorGUILayout.IntSlider(_screenShotScale, 1, 10);
            }
            EditorGUILayout.EndHorizontal();

            // Show estimated size
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Estimated Size: ", _column1);
                var size = SceneMainPanelUtility.GetGameViewSize();
                EditorGUILayout.LabelField(string.Format("{0} x {1}", size.x * _screenShotScale, size.y * _screenShotScale));
            }
            EditorGUILayout.EndHorizontal();
        }
예제 #2
0
 /// <summary>
 /// Draws the open button.
 /// </summary>
 /// <param name="entity">Entity.</param>
 private void DrawOpenButton(ISceneEntity entity)
 {
     _colorStack.Push(ColorPalette.GetColor(entity));
     GUI.skin.button.alignment = TextAnchor.MiddleLeft;
     if (GUILayout.Button(GetContent(entity)) && !entity.IsActive)
     {
         SceneMainPanelUtility.OpenScene(entity);
     }
     GUI.skin.button.alignment = TextAnchor.MiddleCenter;
     _colorStack.Pop();
 }
예제 #3
0
 private void GoToFuture()
 {
     if (_forwardSelected != 0 && !SceneMainPanelUtility.IsPlaying)
     {
         for (int i = 0; i <= _forwardSelected; ++i)
         {
             _history.Forward();
         }
         SceneMainPanelUtility.OpenScene(_history.CurrentScene);
         _forwardSelected = 0;
     }
 }
예제 #4
0
 private void GoToPast()
 {
     if (_backSelected != 0 && !SceneMainPanelUtility.IsPlaying)
     {
         for (int i = 0; i < _backSelected; ++i)
         {
             _history.Back();
         }
         SceneMainPanelUtility.OpenScene(_history.CurrentScene);
         _backSelected = 0;
     }
 }
예제 #5
0
 private void DeleteAllGeneralScreenshots()
 {
     _history.AutoSave = false;
     while (_history.Count > 0)
     {
         var screenshot = _history.Pop();
         SceneMainPanelUtility.DeleteFileIfExist(screenshot);
     }
     _history.Clear();
     _textureDatabase.Clear();
     _history.AutoSave = true;
     _history.Save();
 }
예제 #6
0
        private void DrawOpenFolderButton(string dataPath)
        {
            bool validPath = SceneMainPanelUtility.ExistFile(dataPath);

            _colorStack.Push((validPath) ? ColorPalette.SnapshotOpenButton_ON : ColorPalette.SnapshotOpenButton_OFF);
            if (GUILayout.Button(GetContent("Open Folder", TooltipSet.SCREENSHOT_OPEN_FOLDER_BUTTON_TOOLTIP), _column1))
            {
                if (validPath)
                {
                    EditorUtility.RevealInFinder(dataPath);
                }
            }
            _colorStack.Pop();
        }
예제 #7
0
        /// <summary>
        /// Restores from play.
        /// </summary>
        public void RestoreFromPlay()
        {
            if (!_justLoaded)
            {
                return;
            }
            if (!_restoreOnStop)
            {
                return;
            }

            var item = _history.CurrentScene;

            SceneMainPanelUtility.OpenScene(item);
            _justLoaded = false;
        }
예제 #8
0
 private string DrawTakeScreenshotButton(string dataPath, bool enableShot, string suggestedFolder, string suggestedName)
 {
     // Take Snapshot
     _colorStack.Push(enableShot ? ColorPalette.SnapshotButton_ON : ColorPalette.SnapshotButton_OFF);
     if (GUILayout.Button(GetContentIcon(IconSet.CAMERA_ICON, TooltipSet.SCREENSHOT_BUTTON_TOOLTIP), _column1))
     {
         if (enableShot)
         {
             if (string.IsNullOrEmpty(dataPath))
             {
                 SceneMainPanelUtility.EnsureDirectory(suggestedFolder);
             }
             dataPath = SceneMainPanelUtility.TakeSnapshot(dataPath, _screenShotScale, suggestedFolder, suggestedName);
         }
     }
     _colorStack.Pop();
     return(dataPath);
 }
예제 #9
0
 public void DrawSceneDatabaseExport()
 {
     EditorGUILayout.LabelField("Scenes List Export", GUILayout.Width(120));
     EditorGUILayout.BeginHorizontal();
     {
         if (GUILayout.Button(GetContent("Generate JSON", TooltipSet.GENERATE_JSON_BUTTON_TOOLTIP)))
         {
             _database.Refresh();
             Debug.Log(_database.GenerateJSON());
         }
         if (GUILayout.Button(GetContent("Save to JSON File", TooltipSet.SAVE_JSON_BUTTON_TOOLTIP)))
         {
             var path = EditorUtility.SaveFilePanel("Save scene list", "", "scenes.json", "json");
             if (!string.IsNullOrEmpty(path))
             {
                 _database.Refresh();
             }
             SceneMainPanelUtility.SaveText(_database.GenerateJSON(), path);
         }
     }
     EditorGUILayout.EndHorizontal();
 }
예제 #10
0
        /// <summary>
        /// Draws the general controls.
        /// - Play from start
        /// - Play
        /// - Pause
        /// - Stop
        /// </summary>
        public void DrawGeneralControls()
        {
            EditorGUILayout.BeginVertical();
            {
                EditorGUILayout.BeginHorizontal();
                {
                    // Play From Start
                    _colorStack.Push(GetPlayFromStartButtonColor());
                    if (GUILayout.Button(GetContent(IconSet.PLAY_START_ICON, TooltipSet.PLAY_START_TOOLTIP)))
                    {
                        if (!IsPlaying && SceneMainPanelUtility.OpenFirstScene())
                        {
                            _hittedPlay = true;
                            EditorApplication.isPlaying = true;
                        }
                    }
                    _colorStack.Pop();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                {
                    if (!IsPlaying)
                    {
                        // Play Current
                        _colorStack.Push(GetPlayButtonColor());
                        if (GUILayout.Button(GetContent(IconSet.PLAY_ICON, TooltipSet.PLAY_TOOLTIP)))
                        {
                            _hittedPlay = true;
                            EditorApplication.isPlaying = true;
                        }
                        _colorStack.Pop();
                    }
                    else
                    {
                        // Stop
                        _colorStack.Push(GetStopButtonColor());
                        if (GUILayout.Button(GetContent(IconSet.STOP_ICON, TooltipSet.STOP_TOOLTIP)))
                        {
                            EditorApplication.isPlaying = false;
                        }
                        _colorStack.Pop();
                    }

                    // Pause
                    _colorStack.Push(GetPauseButtonColor());
                    if (GUILayout.Button(GetContent(IconSet.PAUSE_ICON, TooltipSet.PAUSE_TOOLTIP)))
                    {
                        EditorApplication.isPaused = !EditorApplication.isPaused;
                    }
                    _colorStack.Pop();

                    // Step
                    _colorStack.Push(GetStepButtonColor());
                    if (GUILayout.Button(GetContent(IconSet.STEP_ICON, TooltipSet.STEP_TOOLTIP)))
                    {
                        if (IsPlaying)
                        {
                            _performStep = true;
                        }
                    }
                    _colorStack.Pop();
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();

            // Perform at the end
            if (_performStep)
            {
                EditorApplication.Step();
                EditorApplication.isPaused = true;
                _performStep = false;
            }
        }
예제 #11
0
        private void ForwardButtonAction()
        {
            var item = _history.Forward();

            SceneMainPanelUtility.OpenScene(item);
        }
예제 #12
0
        private void BackButtonAction()
        {
            var item = _history.Back();

            SceneMainPanelUtility.OpenScene(item);
        }