static void ShowWindow() { if (oneCutChecker == null) { oneCutChecker = GetWindow <OneCutChecker>(); oneCutChecker.titleContent = new GUIContent("One Cut Checker"); oneCutChecker.Show(); } }
void OnGUI() { if (oneCutChecker == null) { oneCutChecker = GetWindow <OneCutChecker>(); oneCutChecker.titleContent = new GUIContent("One Cut Checker"); oneCutChecker.Show(); } if (speed == 0) { speed = Application.targetFrameRate == -1 ? 60 : Application.targetFrameRate; } if (gameView == null) { var assembly = typeof(EditorWindow).Assembly; var type = assembly.GetType("UnityEditor.GameView"); gameView = GetWindow(type); } DoToolbar(); EditorGUILayout.LabelField("Shortcut key"); EditorGUILayout.BeginVertical("box"); var style = new GUIStyle(GUI.skin.label); style.wordWrap = true; EditorGUILayout.LabelField("p : Pause/Resume\n← : Previous frame\n→ : Next frame", style); EditorGUILayout.EndVertical(); useShortcutKey = EditorGUILayout.Toggle("Use shortcut key", useShortcutKey); if (!EditorApplication.isPaused || screenController == null) { return; } if (screenController.Texture2Ds.Count > 1) { EditorGUILayout.Space(); screenController.FramePosition = EditorGUILayout.IntSlider("Frame position", screenController.FramePosition, 0, screenController.Texture2Ds.Count - 1); gameView.Repaint(); EditorGUILayout.Space(); speed = EditorGUILayout.IntSlider("Speed (FPS)", speed, 1, 150); gameView.Repaint(); EditorGUILayout.Space(); if (GUILayout.Button("Play")) { isPlayingLoop = false; PlayAsync(); } if (GUILayout.Button(isPlayingLoop ? "Pause loop" : "Play loop")) { isPlayingLoop = !isPlayingLoop; if (isPlayingLoop) { PlayLoopAsync(); } } } }