コード例 #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUIUtils.SetGUIStyles(null);
            GUILayout.Space(3f);
            EditorGUIUtils.InspectorLogo();
            if (Application.isPlaying)
            {
                GUILayout.Space(8f);
                GUILayout.Label("Path Editor disabled while in play mode", EditorGUIUtils.wordWrapLabelStyle, new GUILayoutOption[0]);
                GUILayout.Space(10f);
                return;
            }
            if (this._refreshAfterEnable)
            {
                this._refreshAfterEnable = false;
                if (this._src.path == null)
                {
                    this.ResetPath(RepaintMode.None);
                }
                else
                {
                    this.RefreshPath(RepaintMode.Scene, true);
                }
                this._wpsList = new ReorderableList(this._src.wps, typeof(Vector3), true, true, true, true);
                ReorderableList arg_CD_0 = this._wpsList;
                ReorderableList.HeaderCallbackDelegate arg_CD_1;
                if ((arg_CD_1 = DOTweenPathInspector.HeaderItem.headerHander) == null)
                {
                    HeaderItem.headerHander = new ReorderableList.HeaderCallbackDelegate(HeaderItem.item.OnInspectorGUI);
                    arg_CD_1 = HeaderItem.headerHander;
                }
                arg_CD_0.drawHeaderCallback     = arg_CD_1;
                this._wpsList.onReorderCallback = delegate(ReorderableList list)
                {
                    this.RefreshPath(RepaintMode.Scene, true);
                };
                this._wpsList.drawElementCallback = delegate(Rect rect, int index, bool isActive, bool isFocused)
                {
                    Rect position  = new Rect(rect.xMin, rect.yMin, 23f, rect.height);
                    Rect position2 = new Rect(position.xMax, position.yMin, rect.width - 23f, position.height);
                    GUI.Label(position, (index + 1).ToString());
                    this._src.wps[index] = EditorGUI.Vector3Field(position2, "", this._src.wps[index]);
                };
            }
            bool flag = false;

            Undo.RecordObject(this._src, "DOTween Path");
            if (this._src.inspectorMode != DOTweenInspectorMode.Default)
            {
                GUILayout.Label("Inspector Mode: <b>" + this._src.inspectorMode + "</b>", ABSAnimationInspector.styles.custom.warningLabel, new GUILayoutOption[0]);
                GUILayout.Space(2f);
            }
            if (!(this._src.GetComponent <DOTweenVisualManager>() != null) && this._showAddManager)
            {
                if (GUILayout.Button(new GUIContent("Add Manager", "Adds a manager component which allows you to choose additional options for this gameObject"), new GUILayoutOption[0]))
                {
                    this._src.gameObject.AddComponent <DOTweenVisualManager>();
                }
                GUILayout.Space(4f);
            }
            AnimationInspectorGUI.StickyTitle("Scene View Commands");
            DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
            GUILayout.Label("➲ SHIFT + " + (EditorUtils.isOSXEditor ? "CMD" : "CTRL") + ": add a waypoint\n➲ SHIFT + ALT: remove a waypoint", new GUILayoutOption[0]);
            DeGUILayout.EndVBox();
            AnimationInspectorGUI.StickyTitle("Info");
            DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
            GUILayout.Label("Path Length: " + ((this._src.path == null) ? "-" : this._src.path.length.ToString()), new GUILayoutOption[0]);
            DeGUILayout.EndVBox();
            if (this._showTweenSettings)
            {
                AnimationInspectorGUI.StickyTitle("Tween Options");
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this._src.autoPlay = DeGUILayout.ToggleButton(this._src.autoPlay, new GUIContent("AutoPlay", "If selected, the tween will play automatically"), DeGUI.styles.button.tool, new GUILayoutOption[0]);
                this._src.autoKill = DeGUILayout.ToggleButton(this._src.autoKill, new GUIContent("AutoKill", "If selected, the tween will be killed when it completes, and won't be reusable"), DeGUI.styles.button.tool, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this._src.duration = EditorGUILayout.FloatField("Duration", this._src.duration, new GUILayoutOption[0]);
                if (this._src.duration < 0f)
                {
                    this._src.duration = 0f;
                }
                this._src.isSpeedBased = DeGUILayout.ToggleButton(this._src.isSpeedBased, new GUIContent("SpeedBased", "If selected, the duration will count as units/degree x second"), DeGUI.styles.button.tool, new GUILayoutOption[]
                {
                    GUILayout.Width(75f)
                });
                GUILayout.EndHorizontal();
                this._src.delay = EditorGUILayout.FloatField("Delay", this._src.delay, new GUILayoutOption[0]);
                if (this._src.delay < 0f)
                {
                    this._src.delay = 0f;
                }
                this._src.easeType = EditorGUIUtils.FilteredEasePopup(this._src.easeType);
                if (this._src.easeType == Ease.INTERNAL_Custom)
                {
                    this._src.easeCurve = EditorGUILayout.CurveField("   Ease Curve", this._src.easeCurve, new GUILayoutOption[0]);
                }
                this._src.loops = EditorGUILayout.IntField(new GUIContent("Loops", "Set to -1 for infinite loops"), this._src.loops, new GUILayoutOption[0]);
                if (this._src.loops < -1)
                {
                    this._src.loops = -1;
                }
                if (this._src.loops > 1 || this._src.loops == -1)
                {
                    this._src.loopType = (LoopType)EditorGUILayout.EnumPopup("   Loop Type", this._src.loopType, new GUILayoutOption[0]);
                }
                this._src.id         = EditorGUILayout.TextField("ID", this._src.id, new GUILayoutOption[0]);
                this._src.updateType = (UpdateType)EditorGUILayout.EnumPopup("Update Type", this._src.updateType, new GUILayoutOption[0]);
                if (this._src.inspectorMode == DOTweenInspectorMode.Developer)
                {
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    Rigidbody component = this._src.GetComponent <Rigidbody>();
                    this._src.tweenRigidbody = EditorGUILayout.Toggle("Tween Rigidbody", component != null && this._src.tweenRigidbody, new GUILayoutOption[0]);
                    if (component == null)
                    {
                        GUILayout.Label("No rigidbody found", ABSAnimationInspector.styles.custom.warningLabel, new GUILayoutOption[0]);
                    }
                    GUILayout.EndHorizontal();
                    if (this._src.tweenRigidbody)
                    {
                        EditorGUILayout.HelpBox("Tweening a rigidbody works correctly only when it's kinematic", MessageType.Warning);
                    }
                }
                DeGUILayout.EndVBox();
                AnimationInspectorGUI.StickyTitle("Path Tween Options");
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                PathType pathType = this._src.pathType;
                this._src.pathType = (PathType)EditorGUILayout.EnumPopup("Path Type", this._src.pathType, new GUILayoutOption[0]);
                if (pathType != this._src.pathType)
                {
                    flag = true;
                }
                if (this._src.pathType != PathType.Linear)
                {
                    this._src.pathResolution = EditorGUILayout.IntSlider("   Path resolution", this._src.pathResolution, 2, 20, new GUILayoutOption[0]);
                }
                bool isClosedPath = this._src.isClosedPath;
                this._src.isClosedPath = EditorGUILayout.Toggle("Close Path", this._src.isClosedPath, new GUILayoutOption[0]);
                if (isClosedPath != this._src.isClosedPath)
                {
                    flag = true;
                }
                this._src.isLocal      = EditorGUILayout.Toggle(new GUIContent("Local Movement", "If checked, the path will tween the localPosition (instead than the position) of its target"), this._src.isLocal, new GUILayoutOption[0]);
                this._src.pathMode     = (PathMode)EditorGUILayout.EnumPopup("Path Mode", this._src.pathMode, new GUILayoutOption[0]);
                this._src.lockRotation = (AxisConstraint)EditorGUILayout.EnumPopup("Lock Rotation", this._src.lockRotation, new GUILayoutOption[0]);
                this._src.orientType   = (OrientType)EditorGUILayout.EnumPopup("Orientation", this._src.orientType, new GUILayoutOption[0]);
                if (this._src.orientType != OrientType.None)
                {
                    switch (this._src.orientType)
                    {
                    case OrientType.ToPath:
                        this._src.lookAhead = EditorGUILayout.Slider("   LookAhead", this._src.lookAhead, 0f, 1f, new GUILayoutOption[0]);
                        break;

                    case OrientType.LookAtTransform:
                        this._src.lookAtTransform = (EditorGUILayout.ObjectField("   LookAt Target", this._src.lookAtTransform, typeof(Transform), true, new GUILayoutOption[0]) as Transform);
                        break;

                    case OrientType.LookAtPosition:
                        this._src.lookAtPosition = EditorGUILayout.Vector3Field("   LookAt Position", this._src.lookAtPosition, new GUILayoutOption[0]);
                        break;
                    }
                }
                DeGUILayout.EndVBox();
            }
            AnimationInspectorGUI.StickyTitle("Path Editor Options");
            DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
            this._src.relative     = EditorGUILayout.Toggle(new GUIContent("Relative", "If toggled, the whole path moves with the target"), this._src.relative, new GUILayoutOption[0]);
            this._src.pathColor    = EditorGUILayout.ColorField("Color", this._src.pathColor, new GUILayoutOption[0]);
            this._src.showIndexes  = EditorGUILayout.Toggle("Show Indexes", this._src.showIndexes, new GUILayoutOption[0]);
            this._src.showWpLength = EditorGUILayout.Toggle("Show WPs Lengths", this._src.showWpLength, new GUILayoutOption[0]);
            this._src.livePreview  = EditorGUILayout.Toggle("Live Preview", this._src.livePreview, new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Handles Type/Mode", new GUILayoutOption[]
            {
                GUILayout.Width(EditorGUIUtility.labelWidth - 11f)
            });
            this._src.handlesType     = (HandlesType)EditorGUILayout.EnumPopup(this._src.handlesType, new GUILayoutOption[0]);
            this._src.handlesDrawMode = (HandlesDrawMode)EditorGUILayout.EnumPopup(this._src.handlesDrawMode, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            if (this._src.handlesDrawMode == HandlesDrawMode.Perspective)
            {
                this._src.perspectiveHandleSize = EditorGUILayout.FloatField("   Handle Size", this._src.perspectiveHandleSize, new GUILayoutOption[0]);
            }
            DeGUILayout.EndVBox();
            if (this._showTweenSettings)
            {
                AnimationInspectorGUI.AnimationEvents(this, this._src);
            }
            this.DrawExtras();
            GUILayout.Space(10f);
            DeGUILayout.BeginToolbar(new GUILayoutOption[0]);
            this._src.wpsDropdown = DeGUILayout.ToolbarFoldoutButton(this._src.wpsDropdown, "Waypoints", false, false);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(new GUIContent("Copy to clipboard", "Copies the current waypoints to clipboard, as an array ready to be pasted in your code"), DeGUI.styles.button.tool, new GUILayoutOption[0]))
            {
                this.CopyWaypointsToClipboard();
            }
            DeGUILayout.EndToolbar();
            if (this._src.wpsDropdown)
            {
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                bool arg_ABE_0 = GUI.changed;
                this._wpsList.DoLayoutList();
                if (!arg_ABE_0 && GUI.changed)
                {
                    flag = true;
                }
                DeGUILayout.EndVBox();
            }
            else
            {
                GUILayout.Space(5f);
            }
            if (flag)
            {
                this.RefreshPath(RepaintMode.Scene, false);
                return;
            }
            if (GUI.changed)
            {
                EditorUtility.SetDirty(this._src);
                this.DORepaint(RepaintMode.Scene, false);
            }
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            //IL_0174: Unknown result type (might be due to invalid IL or missing references)
            //IL_0179: Unknown result type (might be due to invalid IL or missing references)
            //IL_01c4: Unknown result type (might be due to invalid IL or missing references)
            //IL_01c9: Unknown result type (might be due to invalid IL or missing references)
            //IL_0261: Unknown result type (might be due to invalid IL or missing references)
            //IL_0266: Unknown result type (might be due to invalid IL or missing references)
            //IL_02a0: Unknown result type (might be due to invalid IL or missing references)
            //IL_02a5: Unknown result type (might be due to invalid IL or missing references)
            //IL_02c4: Unknown result type (might be due to invalid IL or missing references)
            //IL_02c9: Unknown result type (might be due to invalid IL or missing references)
            //IL_034b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0350: Unknown result type (might be due to invalid IL or missing references)
            //IL_050f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0514: Unknown result type (might be due to invalid IL or missing references)
            //IL_077d: Unknown result type (might be due to invalid IL or missing references)
            //IL_0782: Unknown result type (might be due to invalid IL or missing references)
            //IL_0991: Unknown result type (might be due to invalid IL or missing references)
            //IL_0996: Unknown result type (might be due to invalid IL or missing references)
            //IL_09c5: Unknown result type (might be due to invalid IL or missing references)
            //IL_09ca: Unknown result type (might be due to invalid IL or missing references)
            base.OnInspectorGUI();
            EditorGUIUtils.SetGUIStyles(null);
            GUILayout.Space(3f);
            EditorGUIUtils.InspectorLogo();
            if (Application.isPlaying)
            {
                GUILayout.Space(8f);
                GUILayout.Label("Path Editor disabled while in play mode", EditorGUIUtils.wordWrapLabelStyle);
                GUILayout.Space(10f);
            }
            else
            {
                if (this._refreshAfterEnable)
                {
                    this._refreshAfterEnable = false;
                    if (this._src.path == null)
                    {
                        this.ResetPath(RepaintMode.None);
                    }
                    else
                    {
                        this.RefreshPath(RepaintMode.Scene, true);
                    }
                    this._wpsList = new ReorderableList(this._src.wps, typeof(Vector3), true, true, true, true);
                    this._wpsList.drawHeaderCallback = delegate(Rect rect)
                    {
                        EditorGUI.LabelField(rect, "Path Waypoints");
                    };
                    this._wpsList.onReorderCallback = delegate
                    {
                        this.RefreshPath(RepaintMode.Scene, true);
                    };
                    this._wpsList.drawElementCallback = delegate(Rect rect, int index, bool isActive, bool isFocused)
                    {
                        Rect position  = new Rect(rect.xMin, rect.yMin, 23f, rect.height);
                        Rect position2 = new Rect(position.xMax, position.yMin, rect.width - 23f, position.height);
                        GUI.Label(position, (index + 1).ToString());
                        this._src.wps[index] = EditorGUI.Vector3Field(position2, "", this._src.wps[index]);
                    };
                }
                bool flag = false;
                Undo.RecordObject(this._src, "DOTween Path");
                if (!((UnityEngine.Object)((Component)this._src).GetComponent <DOTweenVisualManager>() != (UnityEngine.Object)null) && this._src.inspectorMode != DOTweenInspectorMode.InfoAndWaypointsOnly)
                {
                    if (GUILayout.Button(new GUIContent("Add Manager", "Adds a manager component which allows you to choose additional options for this gameObject")))
                    {
                        this._src.gameObject.AddComponent <DOTweenVisualManager>();
                    }
                    GUILayout.Space(4f);
                }
                AnimationInspectorGUI.StickyTitle("Scene View Commands");
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                GUILayout.Label("➲ SHIFT + " + (EditorUtils.isOSXEditor ? "CMD" : "CTRL") + ": add a waypoint\n➲ SHIFT + ALT: remove a waypoint");
                DeGUILayout.EndVBox();
                AnimationInspectorGUI.StickyTitle("Info");
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                GUILayout.Label("Path Length: " + ((this._src.path == null) ? "-" : this._src.path.length.ToString()));
                DeGUILayout.EndVBox();
                if (this._src.inspectorMode != DOTweenInspectorMode.InfoAndWaypointsOnly)
                {
                    AnimationInspectorGUI.StickyTitle("Tween Options");
                    GUILayout.BeginHorizontal();
                    this._src.autoPlay = DeGUILayout.ToggleButton(this._src.autoPlay, new GUIContent("AutoPlay", "If selected, the tween will play automatically"), DeGUI.styles.button.tool, new GUILayoutOption[0]);
                    this._src.autoKill = DeGUILayout.ToggleButton(this._src.autoKill, new GUIContent("AutoKill", "If selected, the tween will be killed when it completes, and won't be reusable"), DeGUI.styles.button.tool, new GUILayoutOption[0]);
                    GUILayout.EndHorizontal();
                    DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                    GUILayout.BeginHorizontal();
                    this._src.duration = EditorGUILayout.FloatField("Duration", this._src.duration);
                    if (this._src.duration < 0f)
                    {
                        this._src.duration = 0f;
                    }
                    this._src.isSpeedBased = DeGUILayout.ToggleButton(this._src.isSpeedBased, new GUIContent("SpeedBased", "If selected, the duration will count as units/degree x second"), DeGUI.styles.button.tool, new GUILayoutOption[1]
                    {
                        GUILayout.Width(75f)
                    });
                    GUILayout.EndHorizontal();
                    this._src.delay = EditorGUILayout.FloatField("Delay", this._src.delay);
                    if (this._src.delay < 0f)
                    {
                        this._src.delay = 0f;
                    }
                    this._src.easeType = EditorGUIUtils.FilteredEasePopup(this._src.easeType);
                    if (this._src.easeType == Ease.INTERNAL_Custom)
                    {
                        this._src.easeCurve = EditorGUILayout.CurveField("   Ease Curve", this._src.easeCurve);
                    }
                    this._src.loops = EditorGUILayout.IntField(new GUIContent("Loops", "Set to -1 for infinite loops"), this._src.loops);
                    if (this._src.loops < -1)
                    {
                        this._src.loops = -1;
                    }
                    if (this._src.loops > 1 || this._src.loops == -1)
                    {
                        this._src.loopType = (LoopType)EditorGUILayout.EnumPopup("   Loop Type", (Enum)(object)this._src.loopType);
                    }
                    this._src.id         = EditorGUILayout.TextField("ID", this._src.id);
                    this._src.updateType = (UpdateType)EditorGUILayout.EnumPopup("Update Type", (Enum)(object)this._src.updateType);
                    DeGUILayout.EndVBox();
                    AnimationInspectorGUI.StickyTitle("Path Tween Options");
                    DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                    PathType pathType = this._src.pathType;
                    this._src.pathType = (PathType)EditorGUILayout.EnumPopup("Path Type", (Enum)(object)this._src.pathType);
                    if (pathType != this._src.pathType)
                    {
                        flag = true;
                    }
                    if (this._src.pathType != 0)
                    {
                        this._src.pathResolution = EditorGUILayout.IntSlider("   Path resolution", this._src.pathResolution, 2, 20);
                    }
                    bool isClosedPath = this._src.isClosedPath;
                    this._src.isClosedPath = EditorGUILayout.Toggle("Close Path", this._src.isClosedPath);
                    if (isClosedPath != this._src.isClosedPath)
                    {
                        flag = true;
                    }
                    this._src.isLocal      = EditorGUILayout.Toggle(new GUIContent("Local Movement", "If checked, the path will tween the localPosition (instead than the position) of its target"), this._src.isLocal);
                    this._src.pathMode     = (PathMode)EditorGUILayout.EnumPopup("Path Mode", (Enum)(object)this._src.pathMode);
                    this._src.lockRotation = (AxisConstraint)EditorGUILayout.EnumPopup("Lock Rotation", (Enum)(object)this._src.lockRotation);
                    this._src.orientType   = (OrientType)EditorGUILayout.EnumPopup("Orientation", (Enum)(object)this._src.orientType);
                    if (this._src.orientType != 0)
                    {
                        switch (this._src.orientType)
                        {
                        case OrientType.LookAtTransform:
                            this._src.lookAtTransform = (EditorGUILayout.ObjectField("   LookAt Target", this._src.lookAtTransform, typeof(Transform), true) as Transform);
                            break;

                        case OrientType.LookAtPosition:
                            this._src.lookAtPosition = EditorGUILayout.Vector3Field("   LookAt Position", this._src.lookAtPosition);
                            break;

                        case OrientType.ToPath:
                            this._src.lookAhead = EditorGUILayout.Slider("   LookAhead", this._src.lookAhead, 0f, 1f);
                            break;
                        }
                    }
                    DeGUILayout.EndVBox();
                    AnimationInspectorGUI.StickyTitle("Path Editor Options");
                    DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                    this._src.relative        = EditorGUILayout.Toggle(new GUIContent("Relative", "If toggled, the whole path moves with the target"), this._src.relative);
                    this._src.pathColor       = EditorGUILayout.ColorField("Color", this._src.pathColor);
                    this._src.showIndexes     = EditorGUILayout.Toggle("Show Indexes", this._src.showIndexes);
                    this._src.showWpLength    = EditorGUILayout.Toggle("Show WPs Lengths", this._src.showWpLength);
                    this._src.livePreview     = EditorGUILayout.Toggle("Live Preview", this._src.livePreview);
                    this._src.handlesType     = (HandlesType)EditorGUILayout.EnumPopup("Handles Type", (Enum)(object)this._src.handlesType);
                    this._src.handlesDrawMode = (HandlesDrawMode)EditorGUILayout.EnumPopup("Handles Mode", (Enum)(object)this._src.handlesDrawMode);
                    if (this._src.handlesDrawMode == HandlesDrawMode.Perspective)
                    {
                        this._src.perspectiveHandleSize = EditorGUILayout.FloatField("   Handle Size", this._src.perspectiveHandleSize);
                    }
                    DeGUILayout.EndVBox();
                    GUILayout.Space(6f);
                    if (GUILayout.Button("Reset Path"))
                    {
                        this.ResetPath(RepaintMode.SceneAndInspector);
                    }
                    AnimationInspectorGUI.AnimationEvents(this, this._src);
                }
                else
                {
                    GUILayout.Space(6f);
                    if (GUILayout.Button("Reset Path"))
                    {
                        this.ResetPath(RepaintMode.SceneAndInspector);
                    }
                }
                GUILayout.Space(10f);
                DeGUILayout.BeginToolbar(new GUILayoutOption[0]);
                this._src.wpsDropdown = DeGUILayout.ToolbarFoldoutButton(this._src.wpsDropdown, "Waypoints", false, false);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(new GUIContent("Copy to clipboard", "Copies the current waypoints to clipboard, as an array ready to be pasted in your code"), DeGUI.styles.button.tool))
                {
                    this.CopyWaypointsToClipboard();
                }
                DeGUILayout.EndToolbar();
                if (this._src.wpsDropdown)
                {
                    DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                    bool changed = GUI.changed;
                    this._wpsList.DoLayoutList();
                    if (!changed && GUI.changed)
                    {
                        flag = true;
                    }
                    DeGUILayout.EndVBox();
                }
                else
                {
                    GUILayout.Space(5f);
                }
                if (flag)
                {
                    this.RefreshPath(RepaintMode.Scene, false);
                }
                else if (GUI.changed)
                {
                    EditorUtility.SetDirty(this._src);
                    this.DORepaint(RepaintMode.Scene, false);
                }
            }
        }