Beispiel #1
0
        public void Draw()
        {
            if (!_isVisible)
            {
                return;
            }

            _Styles.Init();
            _area = _process.relativeArea.SetWidth(_IcoSize * 6 + _IcosDistance * 5 + _HPadding * 2)
                    .SetHeight(_HeaderHeight + _IcoSize + _VPadding * 2);
            _area   = _area.SetX(_process.relativeArea.xMax - _area.width - _Margin).Shift(0, _Margin, 0, 0);
            _area.x = (int)_area.x;
            _area.y = (int)_area.y;

            // Background
            DeGUI.DrawColoredSquare(_area, Color.black);
            using (new DeGUI.ColorScope(DeGUI.colors.global.blue)) GUI.Box(_area.Expand(1), "", DeGUI.styles.box.outline01);

            // Header
            Rect headerR = _area.SetHeight(_HeaderHeight);

            GUI.Label(headerR, string.Format("{0} nodes selected", _process.selection.selectedNodes.Count), _Styles.headerLabel);

            // Align buttons
            for (int i = 0; i < 6; ++i)
            {
                Rect icoR = new Rect(_area.x + _HPadding + (_IcoSize + _IcosDistance) * i, _area.y + _VPadding + _HeaderHeight, _IcoSize, _IcoSize);
                if (GUI.Button(icoR, IndexToIcon(i), _Styles.btIco) && Event.current.button == 0)
                {
                    AlignSelectedNodes(IndexToGroupAlignment(i));
                }
            }
        }
        override public void OnInspectorGUI()
        {
            Undo.RecordObject(_src, "DeAudioCollection");
            DeGUI.BeginGUI();

            GUILayout.Space(4);

            serializedObject.Update();
            _dataList.DoLayoutList();
            serializedObject.ApplyModifiedProperties();
        }
Beispiel #3
0
        void DrawRuntimeSourceBar(Color color, float percentage, float?markerPercentage = null, float?truePercentage = null, Color?trueColor = null)
        {
            int  totLines = Mathf.Max(1, Mathf.CeilToInt(percentage)); // Volume can go beyond 1, so add more lines
            Rect lineRect = GUILayoutUtility.GetRect(0, 2 * totLines + totLines - 1, GUILayout.ExpandWidth(true));

            lineRect.x     += 15;
            lineRect.y     -= 1;
            lineRect.width -= 15;
            Color guiOrColor = GUI.color;

            for (int i = 0; i < totLines; ++i)
            {
                Rect  r = new Rect(lineRect.x, lineRect.y + (2 * i + i), lineRect.width, 2);
                float p = percentage <= 1 ? percentage
                    : i < totLines - 1 ? 1 : percentage % 1;
                GUI.color = Color.black;
                GUI.Box(r, "", DeGUI.styles.box.flat);
                if (p <= 0)
                {
                    continue;
                }
                r.width  *= p;
                GUI.color = color;
                GUI.Box(r, "", DeGUI.styles.box.flat);
                if (i == 0 && truePercentage != null)
                {
                    // True bar
                    float truePerc = (float)truePercentage;
                    p         = lineRect.width * truePerc;
                    r         = new Rect(lineRect.x, lineRect.y, p, 2);
                    GUI.color = trueColor == null ? Color.green : (Color)trueColor;
                    GUI.Box(r, "", DeGUI.styles.box.flat);
                    if (!Mathf.Approximately(truePerc, percentage) && truePerc > 0 && truePerc < 1)
                    {
                        // Black divider
                        r = new Rect(lineRect.x + (p < 2 ? 0 : p - 2), r.y, 2, r.height);
                        DeGUI.DrawColoredSquare(r, Color.black);
                    }
                    if (markerPercentage != null)
                    {
                        // Marker
                        p = lineRect.width * (float)markerPercentage;
                        r = new Rect(lineRect.x + (p < 2 ? 0 : p - 2), r.y, 2, r.height);
                        DeGUI.DrawColoredSquare(r, Color.white);
                    }
                }
            }
            GUI.color = guiOrColor;
            GUILayout.Space(2);
        }
Beispiel #4
0
        public override void OnInspectorGUI()
        {
            Undo.RecordObject(_src, "DeAudioManager");
            DeGUI.BeginGUI();

            GUILayout.Label("v" + DeAudioManager.Version, EditorStyles.miniLabel.MarginBottom(0));
            if (Application.isPlaying)
            {
                DrawRuntime();
            }
            else
            {
                DrawDefault();
            }
        }
Beispiel #5
0
        public static void Draw(NodeProcessDebug debug, Rect processArea)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            const int bgPadding = 6;
            const int dist      = 2;

            _LabelsTxts[0] = "<b><color=#ff0000>NodeProcess DEBUG</color></b>";
            _LabelsTxts[1] = string.Format(
                "<b>Panning Avrg <color=#4290f5>FPS</color> (Layout/Repaint/Layout+Repaint):</b> <color=#ffd845>{0:N2}</color> / <color=#ffd845>{1:N2}</color> / <color=#ffd845>{2:N2}</color>",
                debug.panningData.avrgFps_Layout,
                debug.panningData.avrgFps_Repaint,
                debug.panningData.avrgFps_LayoutAndRepaint
                );
            _LabelsTxts[2] = string.Format(
                "<b>Panning Avrg <color=#4290f5>MS</color> (Layout/Repaint/Layout+Repaint):</b> <color=#ffd845>{0:N2}</color> / <color=#ffd845>{1:N2}</color> / <color=#ffd845>{2:N2}</color>",
                debug.panningData.avrgDrawTime_Layout,
                debug.panningData.avrgDrawTime_Repaint,
                debug.panningData.avrgDrawTime_LayoutAndRepaint
                );

            Rect bgR = new Rect(processArea.x, processArea.y, 0, bgPadding * 2);

            for (int i = 0; i < _LabelsTxts.Length; ++i)
            {
                Vector2 labelSize = Styles.fpsLabel.CalcSize(new GUIContent(_LabelsTxts[i]));
                _LabelsRects[i] = new Rect(bgR.x + bgPadding, bgR.yMax - bgPadding, labelSize.x, labelSize.y);
                if (bgR.width < labelSize.x + bgPadding * 2)
                {
                    bgR.width = labelSize.x + bgPadding * 2;
                }
                if (i > 0)
                {
                    bgR.height += dist;
                }
                bgR.height += labelSize.y;
            }

            DeGUI.DrawColoredSquare(bgR, new Color(0, 0, 0, 0.8f));
            for (int i = 0; i < _LabelsTxts.Length; ++i)
            {
                GUI.Label(_LabelsRects[i], _LabelsTxts[i], Styles.fpsLabel);
            }
        }
        public override void OnInspectorGUI()
        {
            Undo.RecordObject(src, "ContinueScreen");
            DeGUI.BeginGUI();

            GUILayout.Label("Settings", DeGUI.styles.label.bold);
            DeGUILayout.Toolbar("Center Position", new DeSkinColor(0.5f, 0.1f));
            using (new DeGUILayout.ToolbarScope(new DeSkinColor(0.5f, 0.1f), DeGUI.styles.toolbar.def)) {
                if (GUILayout.Button("Save", DeGUI.styles.button.tool))
                {
                    src.CenterSnapshot = GetSnapshot();
                    EditorUtility.SetDirty(src);
                }
                if (GUILayout.Button("Apply", DeGUI.styles.button.tool))
                {
                    SetSnapshot(src.CenterSnapshot);
                }
            }
            GUILayout.Space(4);
            DeGUILayout.Toolbar("Side Position", new DeSkinColor(0.5f, 0.1f));
            using (new DeGUILayout.ToolbarScope(new DeSkinColor(0.5f, 0.1f), DeGUI.styles.toolbar.def)) {
                if (GUILayout.Button("Save", DeGUI.styles.button.tool))
                {
                    src.SideSnapshot = GetSnapshot();
                    EditorUtility.SetDirty(src);
                }
                if (GUILayout.Button("Apply", DeGUI.styles.button.tool))
                {
                    SetSnapshot(src.SideSnapshot);
                }
            }

            GUILayout.Label("References", DeGUI.styles.label.bold);
            src.Bg          = EditorGUILayout.ObjectField("Bg", src.Bg, typeof(Button), true) as Button;
            src.BtContinue  = EditorGUILayout.ObjectField("BT Continue", src.BtContinue, typeof(Button), true) as Button;
            src.BtRetry     = EditorGUILayout.ObjectField("BT Retry", src.BtRetry, typeof(Button), true) as Button;
            src.IcoContinue = EditorGUILayout.ObjectField("Ico Continue", src.IcoContinue, typeof(RectTransform), true) as RectTransform;
        }
        /// <summary>
        /// Returns TRUE if its actually previewing animations
        /// </summary>
        public static bool PreviewGUI(DOTweenAnimation src)
        {
            if (EditorApplication.isPlaying)
            {
                return(false);
            }

            Styles.Init();

            bool isPreviewing     = _AnimationToTween.Count > 0;
            bool isPreviewingThis = isPreviewing && _AnimationToTween.ContainsKey(src);

            // Preview in editor
            GUI.backgroundColor = isPreviewing
                ? new DeSkinColor(new Color(0.49f, 0.8f, 0.86f), new Color(0.15f, 0.26f, 0.35f))
                : new DeSkinColor(Color.white, new Color(0.13f, 0.13f, 0.13f));
            GUILayout.BeginVertical(Styles.previewBox);
            DeGUI.ResetGUIColors();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Preview Mode - Experimental", Styles.previewLabel);
            _previewOnlyIfSetToAutoPlay = DeGUILayout.ToggleButton(
                _previewOnlyIfSetToAutoPlay,
                new GUIContent("AutoPlay only", "If toggled only previews animations that have AutoPlay turned ON"),
                Styles.btOption
                );
            GUILayout.EndHorizontal();
            GUILayout.Space(1);
            // Preview - Play
            GUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(
                isPreviewingThis || src.animationType == DOTweenAnimation.AnimationType.None ||
                !src.isActive || _previewOnlyIfSetToAutoPlay && !src.autoPlay
                );
            if (GUILayout.Button("► Play", Styles.btPreview))
            {
                if (!isPreviewing)
                {
                    StartupGlobalPreview();
                }
                AddAnimationToGlobalPreview(src);
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(isPreviewing);
            if (GUILayout.Button("► Play All <i>on GameObject</i>", Styles.btPreview))
            {
                if (!isPreviewing)
                {
                    StartupGlobalPreview();
                }
                DOTweenAnimation[] anims = src.gameObject.GetComponents <DOTweenAnimation>();
                foreach (DOTweenAnimation anim in anims)
                {
                    AddAnimationToGlobalPreview(anim);
                }
            }
            if (GUILayout.Button("► Play All <i>in Scene</i>", Styles.btPreview))
            {
                if (!isPreviewing)
                {
                    StartupGlobalPreview();
                }
                DOTweenAnimation[] anims = Object.FindObjectsOfType <DOTweenAnimation>();
                foreach (DOTweenAnimation anim in anims)
                {
                    AddAnimationToGlobalPreview(anim);
                }
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
            // Preview - Stop
            GUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(!isPreviewingThis);
            if (GUILayout.Button("■ Stop", Styles.btPreview))
            {
                if (_AnimationToTween.ContainsKey(src))
                {
                    StopPreview(_AnimationToTween[src].tween);
                }
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(!isPreviewing);
            if (GUILayout.Button("■ Stop All <i>on GameObject</i>", Styles.btPreview))
            {
                StopPreview(src.gameObject);
            }
            if (GUILayout.Button("■ Stop All <i>in Scene</i>", Styles.btPreview))
            {
                StopAllPreviews();
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
            if (isPreviewing)
            {
                int playingTweens   = 0;
                int completedTweens = 0;
                int pausedTweens    = 0;
                foreach (KeyValuePair <DOTweenAnimation, TweenInfo> kvp in _AnimationToTween)
                {
                    Tween t = kvp.Value.tween;
                    if (t.IsPlaying())
                    {
                        playingTweens++;
                    }
                    else if (t.IsComplete())
                    {
                        completedTweens++;
                    }
                    else
                    {
                        pausedTweens++;
                    }
                }
                GUILayout.Label("Playing Tweens: " + playingTweens, Styles.previewStatusLabel);
                GUILayout.Label("Completed Tweens: " + completedTweens, Styles.previewStatusLabel);
//                GUILayout.Label("Paused Tweens: " + playingTweens);
            }
            GUILayout.EndVertical();

            return(isPreviewing);
        }
Beispiel #8
0
 public override void OnInspectorGUI()
 {
     DeGUI.BeginGUI(ABSAnimationInspector.colors, ABSAnimationInspector.styles);
 }
 // Methods
 public override void OnInspectorGUI()
 {
     DeGUI.BeginGUI(colors, styles);
 }
Beispiel #10
0
 static void LoopToggle(Rect r, DeAudioClipData value)
 {
     value.loop = DeGUI.ToggleButton(r, value.loop, "Loop");
 }
Beispiel #11
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            DeAudioClipDataModeAttribute options = drawMode == null ? _DefDrawMode : drawMode;

            EditorGUI.BeginProperty(position, label, property);
            DeGUI.BeginGUI();
            int orIndent = EditorGUI.indentLevel;

            float lineH       = EditorGUIUtility.singleLineHeight;
            float btW         = 22;
            float btLoopW     = 44;
            float groupW      = 78;
            Rect  clipRect    = new Rect(position.x, position.y, position.width - groupW - 4, lineH);
            Rect  groupIdRect = new Rect(position.x + (position.width - groupW), clipRect.y, groupW, lineH);
            Rect  volumeRect  = new Rect(position.x, position.y + lineH + 1, position.width - btW * 2 - 4, lineH);
            Rect  btPlayRect  = new Rect(position.x + (position.width - btW * 2), volumeRect.y - 1, btW, lineH);
            Rect  btStopRect  = new Rect(position.x + (position.width - btW), volumeRect.y - 1, btW, lineH);
            Rect  pitchRect   = new Rect(position.x, volumeRect.y + lineH, position.width - btLoopW - 4, lineH);
            Rect  btLoopRect  = new Rect(position.x + (position.width - btLoopW), pitchRect.y + 1, btLoopW, lineH - 2);

            switch (options.mode)
            {
            case DeAudioClipGUIMode.ClipOnly:
            case DeAudioClipGUIMode.FullNoGroup:
                clipRect.width = position.width;
                break;

            case DeAudioClipGUIMode.CompactPreviewOnly:
                clipRect.width = position.width - btW * 2 - 4;
                btPlayRect.y   = btStopRect.y = position.y;
                break;

            case DeAudioClipGUIMode.CompactWithGroupAndPreview:
                clipRect.width -= btW * 2 + 2;
                groupIdRect.x  -= btW * 2 + 2;
                btPlayRect.y    = btStopRect.y = position.y;
                break;

            case DeAudioClipGUIMode.VolumeAndLoopsWithPreview:
                volumeRect.width -= btW * 2 + 8;
                btLoopRect.x     -= btW * 2 + 7;
                btLoopRect.y      = volumeRect.y + 1;
                break;
            }

            // Clip
            SerializedProperty clip = property.FindPropertyRelative("clip");

            using (new DeGUI.ColorScope(clip.objectReferenceValue == null ? Color.yellow : Color.white)) {
                EditorGUI.PropertyField(clipRect, clip, label);
            }
            if (options.mode != DeAudioClipGUIMode.ClipOnly)
            {
                if (options.mode != DeAudioClipGUIMode.CompactPreviewOnly && options.mode != DeAudioClipGUIMode.FullNoGroup)
                {
                    // Group
                    using (new EditorGUI.DisabledScope(!options.allowGroupChange)) {
                        EditorGUI.PropertyField(groupIdRect, property.FindPropertyRelative("groupId"), new GUIContent(""));
                    }
                }
                // Volume
                bool hasVolume = options.mode == DeAudioClipGUIMode.Full ||
                                 options.mode == DeAudioClipGUIMode.VolumeWithPreview ||
                                 options.mode == DeAudioClipGUIMode.VolumeAndLoopsWithPreview;
                if (hasVolume)
                {
                    SerializedProperty volumeProp = property.FindPropertyRelative("volume");
                    float prevVolume = volumeProp.floatValue;
                    EditorGUI.Slider(volumeRect, volumeProp, 0, 1, "└ Volume");
                    if (Math.Abs(volumeProp.floatValue - prevVolume) > float.Epsilon)
                    {
                        AdjustVolume(property, volumeProp.floatValue);
                    }
                }
                if (options.mode == DeAudioClipGUIMode.Full)
                {
                    // Pitch
                    SerializedProperty pitchProp = property.FindPropertyRelative("pitch");
                    float prevPitch = pitchProp.floatValue;
                    EditorGUI.Slider(pitchRect, pitchProp, 0, 3, "└ Pitch");
                    if (Math.Abs(pitchProp.floatValue - prevPitch) > float.Epsilon)
                    {
                        AdjustPitch(property, pitchProp.floatValue);
                    }
                }
                if (options.mode != DeAudioClipGUIMode.Compact)
                {
                    // Controls
                    if (GUI.Button(btPlayRect, "►", DeGUI.styles.button.tool))
                    {
                        Play(property);
                    }
                    if (GUI.Button(btStopRect, "■", DeGUI.styles.button.tool))
                    {
                        Stop(property);
                    }
                }
                if (options.mode == DeAudioClipGUIMode.Full || options.mode == DeAudioClipGUIMode.VolumeAndLoopsWithPreview)
                {
                    // Loop
                    SerializedProperty loopProp = property.FindPropertyRelative("loop");
                    loopProp.boolValue = DeGUI.ToggleButton(btLoopRect, loopProp.boolValue, "Loop", DeGUI.styles.button.bBlankBorderCompact);
                }
            }

            EditorGUI.indentLevel = orIndent;
            EditorGUI.EndProperty();
        }