void GuiGalaxyTweenControllers()
        {
            if (_src.m_animationMap.Count > 0)
            {
                foreach (EAnimTrigger trigger in _src.m_animationMap.Keys)
                {
                    List <GalaxyDOTweenAnimation> animations = _src.m_animationMap[trigger];


                    DeGUILayout.BeginVBox(GetColorByEAnimTrigger(trigger));
                    switch (trigger)
                    {
                    case EAnimTrigger.Appear:
                        GuiGalaxyTweensAppear(animations); break;

                    case EAnimTrigger.Disappear:
                        GuiGalaxyTweensDisappear(animations); break;

                    case EAnimTrigger.Click:
                        GuiGalaxyTweensClick(animations); break;

                    case EAnimTrigger.Trigger:
                        GuiGalaxyTweensTrigger(animations); break;
                    }

                    DeGUILayout.EndVBox();
                }
            }
        }
 private void DrawExtras()
 {
     AnimationInspectorGUI.StickyTitle("Extras");
     DeGUILayout.BeginVBox(DeGUI.styles.box.sticky);
     if (GUILayout.Button("Reset Path", new GUILayoutOption[0]))
     {
         this.ResetPath(RepaintMode.SceneAndInspector);
     }
     DeGUILayout.EndVBox();
     GUILayout.Space(2f);
     GUILayout.BeginHorizontal(DeGUI.styles.box.stickyTop, new GUILayoutOption[0]);
     if (GUILayout.Button("Drop To Floor", new GUILayoutOption[0]))
     {
         this.DropToFloor(this._src.dropToFloorOffset);
     }
     GUILayout.Space(7f);
     GUILayout.Label("Offset Y", new GUILayoutOption[]
     {
         GUILayout.Width(49f)
     });
     this._src.dropToFloorOffset = EditorGUILayout.FloatField(this._src.dropToFloorOffset, new GUILayoutOption[]
     {
         GUILayout.Width(40f)
     });
     GUILayout.EndHorizontal();
 }
Esempio n. 3
0
 public static void AnimationEvents(ABSAnimationInspector inspector, ABSAnimationComponent src)
 {
     //IL_003a: Unknown result type (might be due to invalid IL or missing references)
     //IL_006f: Unknown result type (might be due to invalid IL or missing references)
     //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
     //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
     //IL_011e: Unknown result type (might be due to invalid IL or missing references)
     //IL_0153: Unknown result type (might be due to invalid IL or missing references)
     //IL_01b3: Unknown result type (might be due to invalid IL or missing references)
     //IL_01b8: Unknown result type (might be due to invalid IL or missing references)
     GUILayout.Space(6f);
     AnimationInspectorGUI.StickyTitle("Events");
     GUILayout.BeginHorizontal();
     src.hasOnStart  = DeGUILayout.ToggleButton(src.hasOnStart, new GUIContent("OnStart", "Event called the first time the tween starts, after any eventual delay"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnPlay   = DeGUILayout.ToggleButton(src.hasOnPlay, new GUIContent("OnPlay", "Event called each time the tween status changes from a pause to a play state (including the first time the tween starts playing), after any eventual delay"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnUpdate = DeGUILayout.ToggleButton(src.hasOnUpdate, new GUIContent("OnUpdate", "Event called every frame while the tween is playing"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     src.hasOnStepComplete = DeGUILayout.ToggleButton(src.hasOnStepComplete, new GUIContent("OnStep", "Event called at the end of each loop cycle"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnComplete     = DeGUILayout.ToggleButton(src.hasOnComplete, new GUIContent("OnComplete", "Event called at the end of the tween, all loops included"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnTweenCreated = DeGUILayout.ToggleButton(src.hasOnTweenCreated, new GUIContent("OnCreated", "Event called as soon as the tween is instantiated"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     GUILayout.EndHorizontal();
     if (src.hasOnStart || src.hasOnPlay || src.hasOnUpdate || src.hasOnStepComplete || src.hasOnComplete || src.hasOnTweenCreated)
     {
         inspector.serializedObject.Update();
         DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
         if (src.hasOnStart)
         {
             EditorGUILayout.PropertyField(inspector.onStartProperty);
         }
         if (src.hasOnPlay)
         {
             EditorGUILayout.PropertyField(inspector.onPlayProperty);
         }
         if (src.hasOnUpdate)
         {
             EditorGUILayout.PropertyField(inspector.onUpdateProperty);
         }
         if (src.hasOnStepComplete)
         {
             EditorGUILayout.PropertyField(inspector.onStepCompleteProperty);
         }
         if (src.hasOnComplete)
         {
             EditorGUILayout.PropertyField(inspector.onCompleteProperty);
         }
         if (src.hasOnTweenCreated)
         {
             EditorGUILayout.PropertyField(inspector.onTweenCreatedProperty);
         }
         inspector.serializedObject.ApplyModifiedProperties();
         DeGUILayout.EndVBox();
     }
     else
     {
         GUILayout.Space(4f);
     }
 }
Esempio n. 4
0
 public static void AnimationEvents(ABSAnimationInspector inspector, ABSAnimationComponent src)
 {
     GUILayout.Space(6f);
     AnimationInspectorGUI.StickyTitle("Events");
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     src.hasOnStart  = DeGUILayout.ToggleButton(src.hasOnStart, new GUIContent("OnStart", "Event called the first time the tween starts, after any eventual delay"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnPlay   = DeGUILayout.ToggleButton(src.hasOnPlay, new GUIContent("OnPlay", "Event called each time the tween status changes from a pause to a play state (including the first time the tween starts playing), after any eventual delay"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnUpdate = DeGUILayout.ToggleButton(src.hasOnUpdate, new GUIContent("OnUpdate", "Event called every frame while the tween is playing"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     src.hasOnStepComplete = DeGUILayout.ToggleButton(src.hasOnStepComplete, new GUIContent("OnStep", "Event called at the end of each loop cycle"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnComplete     = DeGUILayout.ToggleButton(src.hasOnComplete, new GUIContent("OnComplete", "Event called at the end of the tween, all loops included"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnRewind       = DeGUILayout.ToggleButton(src.hasOnRewind, new GUIContent("OnRewind", "Event called when the tween is rewinded, either by playing it backwards until the end, or by rewinding it manually"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     src.hasOnTweenCreated = DeGUILayout.ToggleButton(src.hasOnTweenCreated, new GUIContent("OnCreated", "Event called as soon as the tween is instantiated"), ABSAnimationInspector.styles.button.tool, new GUILayoutOption[0]);
     GUILayout.EndHorizontal();
     if (src.hasOnStart || src.hasOnPlay || src.hasOnUpdate || src.hasOnStepComplete || src.hasOnComplete || src.hasOnRewind || src.hasOnTweenCreated)
     {
         inspector.serializedObject.Update();
         DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
         if (src.hasOnStart)
         {
             EditorGUILayout.PropertyField(inspector.onStartProperty, new GUILayoutOption[0]);
         }
         if (src.hasOnPlay)
         {
             EditorGUILayout.PropertyField(inspector.onPlayProperty, new GUILayoutOption[0]);
         }
         if (src.hasOnUpdate)
         {
             EditorGUILayout.PropertyField(inspector.onUpdateProperty, new GUILayoutOption[0]);
         }
         if (src.hasOnStepComplete)
         {
             EditorGUILayout.PropertyField(inspector.onStepCompleteProperty, new GUILayoutOption[0]);
         }
         if (src.hasOnComplete)
         {
             EditorGUILayout.PropertyField(inspector.onCompleteProperty, new GUILayoutOption[0]);
         }
         if (src.hasOnRewind)
         {
             EditorGUILayout.PropertyField(inspector.onRewindProperty, new GUILayoutOption[0]);
         }
         if (src.hasOnTweenCreated)
         {
             EditorGUILayout.PropertyField(inspector.onTweenCreatedProperty, new GUILayoutOption[0]);
         }
         inspector.serializedObject.ApplyModifiedProperties();
         DeGUILayout.EndVBox();
         return;
     }
     GUILayout.Space(4f);
 }
Esempio n. 5
0
        void DrawRuntime()
        {
            EditorGUILayout.HelpBox("Runtime Mode", MessageType.Info);

            // Global volume
            EditorGUIUtility.labelWidth = 96;
            GUILayout.BeginVertical(DeGUI.styles.box.def);
            float prevGlobalVolume = _src.fooGlobalVolume;

            _src.fooGlobalVolume = EditorGUILayout.Slider("Global Volume", _src.fooGlobalVolume, 0, 1);
            if (Math.Abs(_src.fooGlobalVolume - prevGlobalVolume) > float.Epsilon)
            {
                DeAudioManager.SetVolume(_src.fooGlobalVolume);
            }
            GUILayout.EndVertical();
            // Group volumes
            GUILayout.Space(4);
            EditorGUIUtility.labelWidth = 101;
            GUILayout.Label("DeAudioGroups", DeGUI.styles.label.bold);
            // Groups with ids
            if (DeAudioManager.audioGroups != null)
            {
                int len = DeAudioManager.audioGroups.Length;
                for (int i = 0; i < len; ++i)
                {
                    // Group volumes
                    DeAudioGroup g = DeAudioManager.audioGroups[i];
                    if (g.id == DeAudioGroupId.INTERNAL_Global && !HasPlayingSources(DeAudioManager.globalGroup))
                    {
                        continue;
                    }
                    DeGUILayout.BeginVBox(DeGUI.styles.box.flatAlpha25);
                    float prevVolume = g.fooVolume;
                    g.fooVolume = EditorGUILayout.Slider(g.id == DeAudioGroupId.INTERNAL_Global ? "[GLOBAL]" : g.id.ToString(), g.fooVolume, 0, 1);
                    if (Math.Abs(g.fooVolume - prevVolume) > float.Epsilon)
                    {
                        g.SetVolume(g.fooVolume);
                    }
                    DrawRuntimeSourcesFor(g);
                    DeGUILayout.EndVBox();
                }
            }
        }
        override public void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GUILayout.Space(3);
            EditorGUIUtils.SetGUIStyles();

            bool playMode = Application.isPlaying;

            _runtimeEditMode = _runtimeEditMode && playMode;

            GUILayout.BeginHorizontal();
            // EditorGUIUtils.InspectorLogo();
            GUILayout.Label(_src.animationType.ToString() + (string.IsNullOrEmpty(_src.id) ? "" : " [" + _src.id + "]"), EditorGUIUtils.sideLogoIconBoldLabelStyle);
            // Up-down buttons
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("▲", DeGUI.styles.button.toolIco))
            {
                UnityEditorInternal.ComponentUtility.MoveComponentUp(_src);
            }
            if (GUILayout.Button("▼", DeGUI.styles.button.toolIco))
            {
                UnityEditorInternal.ComponentUtility.MoveComponentDown(_src);
            }
            GUILayout.EndHorizontal();

            if (playMode)
            {
                if (_runtimeEditMode)
                {
                }
                else
                {
                    GUILayout.Space(8);
                    GUILayout.Label("Animation Editor disabled while in play mode", EditorGUIUtils.wordWrapLabelStyle);
                    if (!_src.isActive)
                    {
                        GUILayout.Label("This animation has been toggled as inactive and won't be generated", EditorGUIUtils.wordWrapLabelStyle);
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button(new GUIContent("Activate Edit Mode", "Switches to Runtime Edit Mode, where you can change animations values and restart them")))
                    {
                        _runtimeEditMode = true;
                    }
                    GUILayout.Label("NOTE: when using DOPlayNext, the sequence is determined by the DOTweenAnimation Components order in the target GameObject's Inspector", EditorGUIUtils.wordWrapLabelStyle);
                    GUILayout.Space(10);
                    if (!_runtimeEditMode)
                    {
                        return;
                    }
                }
            }

            Undo.RecordObject(_src, "DOTween Animation");

//            _src.isValid = Validate(); // Moved down

            EditorGUIUtility.labelWidth = 110;

            if (playMode)
            {
                GUILayout.Space(4);
                DeGUILayout.Toolbar("Edit Mode Commands");
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("TogglePause"))
                {
                    _src.tween.TogglePause();
                }
                if (GUILayout.Button("Rewind"))
                {
                    _src.tween.Rewind();
                }
                if (GUILayout.Button("Restart"))
                {
                    _src.tween.Restart();
                }
                GUILayout.EndHorizontal();
                if (GUILayout.Button("Commit changes and restart"))
                {
                    _src.tween.Rewind();
                    _src.tween.Kill();
                    if (_src.isValid)
                    {
                        _src.CreateTween();
                        _src.tween.Play();
                    }
                }
                GUILayout.Label("To apply your changes when exiting Play mode, use the Component's upper right menu and choose \"Copy Component\", then \"Paste Component Values\" after exiting Play mode", DeGUI.styles.label.wordwrap);
                DeGUILayout.EndVBox();
            }
            else
            {
                /*
                 * bool hasManager = _src.GetComponent<DOTweenVisualManager>() != null;
                 * if (!hasManager)
                 * {
                 *  if (GUILayout.Button(new GUIContent("Add Manager", "Adds a manager component which allows you to choose additional options for this gameObject")))
                 *  {
                 *      _src.gameObject.AddComponent<DOTweenVisualManager>();
                 *  }
                 * }
                 */
            }

            //This is quite hacky. Every event is a DOTweenAnimation, but things like ActivationEvents simple don't show that.

            GUILayout.BeginHorizontal();
            DOTweenAnimationType prevAnimType = _src.animationType;

//                _src.animationType = (DOTweenAnimationType)EditorGUILayout.EnumPopup(_src.animationType, EditorGUIUtils.popupButton);
            _src.isActive      = EditorGUILayout.Toggle(new GUIContent("", "If unchecked, this animation will not be created"), _src.isActive, GUILayout.Width(16));
            GUI.enabled        = _src.isActive;
            _src.animationType = AnimationToDOTweenAnimationType(_AnimationType[EditorGUILayout.Popup(DOTweenAnimationTypeToPopupId(_src.animationType), _AnimationType)]);
            _src.autoPlay      = DeGUILayout.ToggleButton(_src.autoPlay, new GUIContent("AutoPlay", "If selected, the tween will play automatically"));
            _src.autoKill      = DeGUILayout.ToggleButton(_src.autoKill, new GUIContent("AutoKill", "If selected, the tween will be killed when it completes, and won't be reusable"));
            GUILayout.EndHorizontal();
            if (prevAnimType != _src.animationType)
            {
                // Set default optional values based on animation type
                _src.endValueTransform = null;
                _src.useTargetAsV3     = false;
                switch (_src.animationType)
                {
                case DOTweenAnimationType.Move:
                case DOTweenAnimationType.LocalMove:
                case DOTweenAnimationType.Rotate:
                case DOTweenAnimationType.LocalRotate:
                case DOTweenAnimationType.Scale:
                    _src.endValueV3    = Vector3.zero;
                    _src.endValueFloat = 0;
                    _src.optionalBool0 = _src.animationType == DOTweenAnimationType.Scale;
                    break;

                case DOTweenAnimationType.UIWidthHeight:
                    _src.endValueV3    = Vector3.zero;
                    _src.endValueFloat = 0;
                    _src.optionalBool0 = _src.animationType == DOTweenAnimationType.UIWidthHeight;
                    break;

                case DOTweenAnimationType.Color:
                case DOTweenAnimationType.Fade:
                    _isLightSrc        = _src.GetComponent <Light>() != null;
                    _src.endValueFloat = 0;
                    break;

                case DOTweenAnimationType.Text:
                    _src.optionalBool0 = true;
                    break;

                case DOTweenAnimationType.PunchPosition:
                case DOTweenAnimationType.PunchRotation:
                case DOTweenAnimationType.PunchScale:
                    _src.endValueV3     = _src.animationType == DOTweenAnimationType.PunchRotation ? new Vector3(0, 180, 0) : Vector3.one;
                    _src.optionalFloat0 = 1;
                    _src.optionalInt0   = 10;
                    _src.optionalBool0  = false;
                    break;

                case DOTweenAnimationType.ShakePosition:
                case DOTweenAnimationType.ShakeRotation:
                case DOTweenAnimationType.ShakeScale:
                    _src.endValueV3     = _src.animationType == DOTweenAnimationType.ShakeRotation ? new Vector3(90, 90, 90) : Vector3.one;
                    _src.optionalInt0   = 10;
                    _src.optionalFloat0 = 90;
                    _src.optionalBool0  = false;
                    break;

                case DOTweenAnimationType.CameraAspect:
                case DOTweenAnimationType.CameraFieldOfView:
                case DOTweenAnimationType.CameraOrthoSize:
                    _src.endValueFloat = 0;
                    break;

                case DOTweenAnimationType.CameraPixelRect:
                case DOTweenAnimationType.CameraRect:
                    _src.endValueRect = new Rect(0, 0, 0, 0);
                    break;
                }
            }
            if (_src.animationType == DOTweenAnimationType.None)
            {
                _src.isValid = false;
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(_src);
                }
                return;
            }

            if (prevAnimType != _src.animationType || ComponentsChanged())
            {
                _src.isValid = Validate();
                // See if we need to choose between multiple targets
                if (_src.animationType == DOTweenAnimationType.Fade && _src.GetComponent <CanvasGroup>() != null && _src.GetComponent <Image>() != null)
                {
                    _chooseTargetMode = ChooseTargetMode.BetweenCanvasGroupAndImage;
                    // Reassign target and forcedTargetType if lost
                    if (_src.forcedTargetType == TargetType.Unset)
                    {
                        _src.forcedTargetType = _src.targetType;
                    }
                    switch (_src.forcedTargetType)
                    {
                    case TargetType.CanvasGroup:
                        _src.target = _src.GetComponent <CanvasGroup>();
                        break;

                    case TargetType.Image:
                        _src.target = _src.GetComponent <Image>();
                        break;
                    }
                }
                else
                {
                    _chooseTargetMode     = ChooseTargetMode.None;
                    _src.forcedTargetType = TargetType.Unset;
                }
            }

            if (!_src.isValid)
            {
                GUI.color = Color.red;
                GUILayout.BeginVertical(GUI.skin.box);
                GUILayout.Label("No valid Component was found for the selected animation", EditorGUIUtils.wordWrapLabelStyle);
                GUILayout.EndVertical();
                GUI.color = Color.white;
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(_src);
                }
                return;
            }

            // Special cases in which multiple target types could be used (set after validation)
            if (_chooseTargetMode == ChooseTargetMode.BetweenCanvasGroupAndImage && _src.forcedTargetType != TargetType.Unset)
            {
                FadeTargetType fadeTargetType = (FadeTargetType)Enum.Parse(typeof(FadeTargetType), _src.forcedTargetType.ToString());
                TargetType     prevTargetType = _src.forcedTargetType;
                _src.forcedTargetType = (TargetType)Enum.Parse(typeof(TargetType), EditorGUILayout.EnumPopup(_src.animationType + " Target", fadeTargetType).ToString());
                if (_src.forcedTargetType != prevTargetType)
                {
                    // Target type change > assign correct target
                    switch (_src.forcedTargetType)
                    {
                    case TargetType.CanvasGroup:
                        _src.target = _src.GetComponent <CanvasGroup>();
                        break;

                    case TargetType.Image:
                        _src.target = _src.GetComponent <Image>();
                        break;
                    }
                }
            }

            GUILayout.BeginHorizontal();
            _src.duration = EditorGUILayout.FloatField("Duration", _src.duration);
            if (_src.duration < 0)
            {
                _src.duration = 0;
            }
            _src.isSpeedBased = DeGUILayout.ToggleButton(_src.isSpeedBased, new GUIContent("SpeedBased", "If selected, the duration will count as units/degree x second"), DeGUI.styles.button.tool, GUILayout.Width(75));
            GUILayout.EndHorizontal();
            _src.delay = EditorGUILayout.FloatField("Delay", _src.delay);
            if (_src.delay < 0)
            {
                _src.delay = 0;
            }
            _src.isIndependentUpdate = EditorGUILayout.Toggle("Ignore TimeScale", _src.isIndependentUpdate);
            _src.easeType            = EditorGUIUtils.FilteredEasePopup(_src.easeType);
            if (_src.easeType == Ease.INTERNAL_Custom)
            {
                _src.easeCurve = EditorGUILayout.CurveField("   Ease Curve", _src.easeCurve);
            }
            _src.loops = EditorGUILayout.IntField(new GUIContent("Loops", "Set to -1 for infinite loops"), _src.loops);
            if (_src.loops < -1)
            {
                _src.loops = -1;
            }
            if (_src.loops > 1 || _src.loops == -1)
            {
                _src.loopType = (LoopType)EditorGUILayout.EnumPopup("   Loop Type", _src.loopType);
            }
            _src.id = EditorGUILayout.TextField("ID", _src.id);

            bool canBeRelative = true;

            // End value and eventual specific options
            switch (_src.animationType)
            {
            case DOTweenAnimationType.Move:
            case DOTweenAnimationType.LocalMove:
                GUIEndValueV3(_src.animationType == DOTweenAnimationType.Move);
                _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                canBeRelative      = !_src.useTargetAsV3;
                break;

            case DOTweenAnimationType.Rotate:
            case DOTweenAnimationType.LocalRotate:
                if (_src.GetComponent <Rigidbody2D>())
                {
                    GUIEndValueFloat();
                }
                else
                {
                    GUIEndValueV3();
                    _src.optionalRotationMode = (RotateMode)EditorGUILayout.EnumPopup("    Rotation Mode", _src.optionalRotationMode);
                }
                break;

            case DOTweenAnimationType.Scale:
                if (_src.optionalBool0)
                {
                    GUIEndValueFloat();
                }
                else
                {
                    GUIEndValueV3();
                }
                _src.optionalBool0 = EditorGUILayout.Toggle("Uniform Scale", _src.optionalBool0);
                break;

            case DOTweenAnimationType.UIWidthHeight:
                if (_src.optionalBool0)
                {
                    GUIEndValueFloat();
                }
                else
                {
                    GUIEndValueV2();
                }
                _src.optionalBool0 = EditorGUILayout.Toggle("Uniform Scale", _src.optionalBool0);
                break;

            case DOTweenAnimationType.Color:
                GUIEndValueColor();
                canBeRelative = false;
                break;

            case DOTweenAnimationType.Fade:
                GUIEndValueFloat();
                if (_src.endValueFloat < 0)
                {
                    _src.endValueFloat = 0;
                }
                if (!_isLightSrc && _src.endValueFloat > 1)
                {
                    _src.endValueFloat = 1;
                }
                canBeRelative = false;
                break;

            case DOTweenAnimationType.Text:
                GUIEndValueString();
                _src.optionalBool0        = EditorGUILayout.Toggle("Rich Text Enabled", _src.optionalBool0);
                _src.optionalScrambleMode = (ScrambleMode)EditorGUILayout.EnumPopup("Scramble Mode", _src.optionalScrambleMode);
                _src.optionalString       = EditorGUILayout.TextField(new GUIContent("Custom Scramble", "Custom characters to use in case of ScrambleMode.Custom"), _src.optionalString);
                break;

            case DOTweenAnimationType.PunchPosition:
            case DOTweenAnimationType.PunchRotation:
            case DOTweenAnimationType.PunchScale:
                GUIEndValueV3();
                canBeRelative       = false;
                _src.optionalInt0   = EditorGUILayout.IntSlider(new GUIContent("    Vibrato", "How much will the punch vibrate"), _src.optionalInt0, 1, 50);
                _src.optionalFloat0 = EditorGUILayout.Slider(new GUIContent("    Elasticity", "How much the vector will go beyond the starting position when bouncing backwards"), _src.optionalFloat0, 0, 1);
                if (_src.animationType == DOTweenAnimationType.PunchPosition)
                {
                    _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                }
                break;

            case DOTweenAnimationType.ShakePosition:
            case DOTweenAnimationType.ShakeRotation:
            case DOTweenAnimationType.ShakeScale:
                GUIEndValueV3();
                canBeRelative       = false;
                _src.optionalInt0   = EditorGUILayout.IntSlider(new GUIContent("    Vibrato", "How much will the shake vibrate"), _src.optionalInt0, 1, 50);
                _src.optionalFloat0 = EditorGUILayout.Slider(new GUIContent("    Randomness", "The shake randomness"), _src.optionalFloat0, 0, 90);
                if (_src.animationType == DOTweenAnimationType.ShakePosition)
                {
                    _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                }
                break;

            case DOTweenAnimationType.CameraAspect:
            case DOTweenAnimationType.CameraFieldOfView:
            case DOTweenAnimationType.CameraOrthoSize:
                GUIEndValueFloat();
                canBeRelative = false;
                break;

            case DOTweenAnimationType.CameraBackgroundColor:
                GUIEndValueColor();
                canBeRelative = false;
                break;

            case DOTweenAnimationType.CameraPixelRect:
            case DOTweenAnimationType.CameraRect:
                GUIEndValueRect();
                canBeRelative = false;
                break;
            }

            // Final settings
            if (canBeRelative)
            {
                _src.isRelative = EditorGUILayout.Toggle("    Relative", _src.isRelative);
            }

            // Events
            AnimationInspectorGUI.AnimationEvents(this, _src);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_src);
            }
        }
        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);
            }
        }
Esempio n. 8
0
        override public void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GUILayout.Space(3);
            EditorGUIUtils.SetGUIStyles();

            bool playMode = Application.isPlaying;

            _runtimeEditMode = _runtimeEditMode && playMode;

            GUILayout.BeginHorizontal();
            EditorGUIUtils.InspectorLogo();
            GUILayout.Label(_src.animationType.ToString() + (string.IsNullOrEmpty(_src.id) ? "" : " [" + _src.id + "]"), EditorGUIUtils.sideLogoIconBoldLabelStyle);
            // Up-down buttons
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("▲", DeGUI.styles.button.toolIco))
            {
                UnityEditorInternal.ComponentUtility.MoveComponentUp(_src);
            }
            if (GUILayout.Button("▼", DeGUI.styles.button.toolIco))
            {
                UnityEditorInternal.ComponentUtility.MoveComponentDown(_src);
            }
            GUILayout.EndHorizontal();

            if (playMode)
            {
                if (_runtimeEditMode)
                {
                }
                else
                {
                    GUILayout.Space(8);
                    GUILayout.Label("Animation Editor disabled while in play mode", EditorGUIUtils.wordWrapLabelStyle);
                    if (!_src.isActive)
                    {
                        GUILayout.Label("This animation has been toggled as inactive and won't be generated", EditorGUIUtils.wordWrapLabelStyle);
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button(new GUIContent("Activate Edit Mode", "Switches to Runtime Edit Mode, where you can change animations values and restart them")))
                    {
                        _runtimeEditMode = true;
                    }
                    GUILayout.Label("NOTE: when using DOPlayNext, the sequence is determined by the DOTweenAnimation Components order in the target GameObject's Inspector", EditorGUIUtils.wordWrapLabelStyle);
                    GUILayout.Space(10);
                    if (!_runtimeEditMode)
                    {
                        return;
                    }
                }
            }

            Undo.RecordObject(_src, "DOTween Animation");
            Undo.RecordObject(_settings, "DOTween Animation");

//            _src.isValid = Validate(); // Moved down

            EditorGUIUtility.labelWidth = 110;

            if (playMode)
            {
                GUILayout.Space(4);
                DeGUILayout.Toolbar("Edit Mode Commands");
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("TogglePause"))
                {
                    _src.tween.TogglePause();
                }
                if (GUILayout.Button("Rewind"))
                {
                    _src.tween.Rewind();
                }
                if (GUILayout.Button("Restart"))
                {
                    _src.tween.Restart();
                }
                GUILayout.EndHorizontal();
                if (GUILayout.Button("Commit changes and restart"))
                {
                    _src.tween.Rewind();
                    _src.tween.Kill();
                    if (_src.isValid)
                    {
                        _src.CreateTween();
                        _src.tween.Play();
                    }
                }
                GUILayout.Label("To apply your changes when exiting Play mode, use the Component's upper right menu and choose \"Copy Component\", then \"Paste Component Values\" after exiting Play mode", DeGUI.styles.label.wordwrap);
                DeGUILayout.EndVBox();
            }
            else
            {
                GUILayout.BeginHorizontal();
                bool hasManager = _src.GetComponent <DOTweenVisualManager>() != null;
                EditorGUI.BeginChangeCheck();
                _settings.showPreviewPanel = hasManager
                    ? DeGUILayout.ToggleButton(_settings.showPreviewPanel, "Preview Controls", styles.custom.inlineToggle)
                    : DeGUILayout.ToggleButton(_settings.showPreviewPanel, "Preview Controls", styles.custom.inlineToggle, GUILayout.Width(120));
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(_settings);
                    DOTweenPreviewManager.StopAllPreviews();
                }
                if (!hasManager)
                {
                    if (GUILayout.Button(new GUIContent("Add Manager", "Adds a manager component which allows you to choose additional options for this gameObject")))
                    {
                        _src.gameObject.AddComponent <DOTweenVisualManager>();
                    }
                }
                GUILayout.EndHorizontal();
            }

            // Preview in editor
            bool isPreviewing = _settings.showPreviewPanel ? DOTweenPreviewManager.PreviewGUI(_src) : false;

            EditorGUI.BeginDisabledGroup(isPreviewing);
            // Choose target
            GUILayout.BeginHorizontal();
            _src.isActive = EditorGUILayout.Toggle(new GUIContent("", "If unchecked, this animation will not be created"), _src.isActive, GUILayout.Width(14));
            EditorGUI.BeginChangeCheck();
            EditorGUI.BeginChangeCheck();
            _src.targetIsSelf = DeGUILayout.ToggleButton(
                _src.targetIsSelf, _src.targetIsSelf ? _GuiC_selfTarget_true : _GuiC_selfTarget_false,
                new Color(1f, 0.78f, 0f), DeGUI.colors.bg.toggleOn, new Color(0.33f, 0.14f, 0.02f), DeGUI.colors.content.toggleOn,
                null, GUILayout.Width(47)
                );
            bool innerChanged = EditorGUI.EndChangeCheck();

            if (innerChanged)
            {
                _src.targetGO = null;
                GUI.changed   = true;
            }
            if (_src.targetIsSelf)
            {
                GUILayout.Label(_GuiC_selfTarget_true.tooltip);
            }
            else
            {
                using (new DeGUI.ColorScope(null, null, _src.targetGO == null ? Color.red : Color.white)) {
                    _src.targetGO = (GameObject)EditorGUILayout.ObjectField(_src.targetGO, typeof(GameObject), true);
                }
                _src.tweenTargetIsTargetGO = DeGUILayout.ToggleButton(
                    _src.tweenTargetIsTargetGO, _src.tweenTargetIsTargetGO ? _GuiC_tweenTargetIsTargetGO_true : _GuiC_tweenTargetIsTargetGO_false,
                    GUILayout.Width(131)
                    );
            }
            bool check = EditorGUI.EndChangeCheck();

            if (check)
            {
                _refreshRequired = true;
            }
            GUILayout.EndHorizontal();

            GameObject targetGO = _src.targetIsSelf ? _src.gameObject : _src.targetGO;

            if (targetGO == null)
            {
                // Uses external target gameObject but it's not set
                if (_src.targetGO != null || _src.target != null)
                {
                    _src.targetGO = null;
                    _src.target   = null;
                    GUI.changed   = true;
                }
            }
            else
            {
                GUILayout.BeginHorizontal();
                DOTweenAnimation.AnimationType prevAnimType = _src.animationType;
//                _src.animationType = (DOTweenAnimation.AnimationType)EditorGUILayout.EnumPopup(_src.animationType, EditorGUIUtils.popupButton);
                GUI.enabled        = GUI.enabled && _src.isActive;
                _src.animationType = AnimationToDOTweenAnimationType(_AnimationType[EditorGUILayout.Popup(DOTweenAnimationTypeToPopupId(_src.animationType), _AnimationType)]);
                _src.autoGenerate  = DeGUILayout.ToggleButton(_src.autoGenerate, new GUIContent("AutoGenerate", "If selected, the tween will be generated at startup (during Start for RectTransform position tween, Awake for all the others)"));
                if (_src.autoGenerate)
                {
                    _src.autoPlay = DeGUILayout.ToggleButton(_src.autoPlay, new GUIContent("AutoPlay", "If selected, the tween will play automatically"));
                }
                _src.autoKill = DeGUILayout.ToggleButton(_src.autoKill, new GUIContent("AutoKill", "If selected, the tween will be killed when it completes, and won't be reusable"));
                GUILayout.EndHorizontal();
                if (prevAnimType != _src.animationType)
                {
                    // Set default optional values based on animation type
                    _src.endValueTransform = null;
                    _src.useTargetAsV3     = false;
                    switch (_src.animationType)
                    {
                    case DOTweenAnimation.AnimationType.Move:
                    case DOTweenAnimation.AnimationType.LocalMove:
                    case DOTweenAnimation.AnimationType.Rotate:
                    case DOTweenAnimation.AnimationType.LocalRotate:
                    case DOTweenAnimation.AnimationType.Scale:
                        _src.endValueV3    = Vector3.zero;
                        _src.endValueFloat = 0;
                        _src.optionalBool0 = _src.animationType == DOTweenAnimation.AnimationType.Scale;
                        break;

                    case DOTweenAnimation.AnimationType.UIWidthHeight:
                        _src.endValueV3    = Vector3.zero;
                        _src.endValueFloat = 0;
                        _src.optionalBool0 = _src.animationType == DOTweenAnimation.AnimationType.UIWidthHeight;
                        break;

                    case DOTweenAnimation.AnimationType.Color:
                    case DOTweenAnimation.AnimationType.Fade:
                        _isLightSrc        = targetGO.GetComponent <Light>() != null;
                        _src.endValueFloat = 0;
                        break;

                    case DOTweenAnimation.AnimationType.Text:
                        _src.optionalBool0 = true;
                        break;

                    case DOTweenAnimation.AnimationType.PunchPosition:
                    case DOTweenAnimation.AnimationType.PunchRotation:
                    case DOTweenAnimation.AnimationType.PunchScale:
                        _src.endValueV3     = _src.animationType == DOTweenAnimation.AnimationType.PunchRotation ? new Vector3(0, 180, 0) : Vector3.one;
                        _src.optionalFloat0 = 1;
                        _src.optionalInt0   = 10;
                        _src.optionalBool0  = false;
                        break;

                    case DOTweenAnimation.AnimationType.ShakePosition:
                    case DOTweenAnimation.AnimationType.ShakeRotation:
                    case DOTweenAnimation.AnimationType.ShakeScale:
                        _src.endValueV3     = _src.animationType == DOTweenAnimation.AnimationType.ShakeRotation ? new Vector3(90, 90, 90) : Vector3.one;
                        _src.optionalInt0   = 10;
                        _src.optionalFloat0 = 90;
                        _src.optionalBool0  = false;
                        _src.optionalBool1  = true;
                        break;

                    case DOTweenAnimation.AnimationType.CameraAspect:
                    case DOTweenAnimation.AnimationType.CameraFieldOfView:
                    case DOTweenAnimation.AnimationType.CameraOrthoSize:
                        _src.endValueFloat = 0;
                        break;

                    case DOTweenAnimation.AnimationType.CameraPixelRect:
                    case DOTweenAnimation.AnimationType.CameraRect:
                        _src.endValueRect = new Rect(0, 0, 0, 0);
                        break;
                    }
                }
                if (_src.animationType == DOTweenAnimation.AnimationType.None)
                {
                    _src.isValid = false;
                    if (GUI.changed)
                    {
                        EditorUtility.SetDirty(_src);
                    }
                    return;
                }

                if (_refreshRequired || prevAnimType != _src.animationType || ComponentsChanged())
                {
                    _refreshRequired = false;
                    _src.isValid     = Validate(targetGO);
                    // See if we need to choose between multiple targets
#if true // UI_MARKER
                    if (_src.animationType == DOTweenAnimation.AnimationType.Fade && targetGO.GetComponent <CanvasGroup>() != null && targetGO.GetComponent <Image>() != null)
                    {
                        _chooseTargetMode = ChooseTargetMode.BetweenCanvasGroupAndImage;
                        // Reassign target and forcedTargetType if lost
                        if (_src.forcedTargetType == DOTweenAnimation.TargetType.Unset)
                        {
                            _src.forcedTargetType = _src.targetType;
                        }
                        switch (_src.forcedTargetType)
                        {
                        case DOTweenAnimation.TargetType.CanvasGroup:
                            _src.target = targetGO.GetComponent <CanvasGroup>();
                            break;

                        case DOTweenAnimation.TargetType.Image:
                            _src.target = targetGO.GetComponent <Image>();
                            break;
                        }
                    }
                    else
                    {
#endif
                    _chooseTargetMode     = ChooseTargetMode.None;
                    _src.forcedTargetType = DOTweenAnimation.TargetType.Unset;
#if true // UI_MARKER
                }
#endif
                }

                if (!_src.isValid)
                {
                    GUI.color = Color.red;
                    GUILayout.BeginVertical(GUI.skin.box);
                    GUILayout.Label("No valid Component was found for the selected animation", EditorGUIUtils.wordWrapLabelStyle);
                    GUILayout.EndVertical();
                    GUI.color = Color.white;
                    if (GUI.changed)
                    {
                        EditorUtility.SetDirty(_src);
                    }
                    return;
                }

#if true // UI_MARKER
                // Special cases in which multiple target types could be used (set after validation)
                if (_chooseTargetMode == ChooseTargetMode.BetweenCanvasGroupAndImage && _src.forcedTargetType != DOTweenAnimation.TargetType.Unset)
                {
                    FadeTargetType fadeTargetType = (FadeTargetType)Enum.Parse(typeof(FadeTargetType), _src.forcedTargetType.ToString());
                    DOTweenAnimation.TargetType prevTargetType = _src.forcedTargetType;
                    _src.forcedTargetType = (DOTweenAnimation.TargetType)Enum.Parse(typeof(DOTweenAnimation.TargetType), EditorGUILayout.EnumPopup(_src.animationType + " Target", fadeTargetType).ToString());
                    if (_src.forcedTargetType != prevTargetType)
                    {
                        // Target type change > assign correct target
                        switch (_src.forcedTargetType)
                        {
                        case DOTweenAnimation.TargetType.CanvasGroup:
                            _src.target = targetGO.GetComponent <CanvasGroup>();
                            break;

                        case DOTweenAnimation.TargetType.Image:
                            _src.target = targetGO.GetComponent <Image>();
                            break;
                        }
                    }
                }
#endif

                GUILayout.BeginHorizontal();
                _src.duration = EditorGUILayout.FloatField("Duration", _src.duration);
                if (_src.duration < 0)
                {
                    _src.duration = 0;
                }
                _src.isSpeedBased = DeGUILayout.ToggleButton(_src.isSpeedBased, new GUIContent("SpeedBased", "If selected, the duration will count as units/degree x second"), DeGUI.styles.button.tool, GUILayout.Width(75));
                GUILayout.EndHorizontal();
                _src.delay = EditorGUILayout.FloatField("Delay", _src.delay);
                if (_src.delay < 0)
                {
                    _src.delay = 0;
                }
                _src.isIndependentUpdate = EditorGUILayout.Toggle("Ignore TimeScale", _src.isIndependentUpdate);
                _src.easeType            = EditorGUIUtils.FilteredEasePopup("Ease", _src.easeType);
                if (_src.easeType == Ease.INTERNAL_Custom)
                {
                    _src.easeCurve = EditorGUILayout.CurveField("   Ease Curve", _src.easeCurve);
                }
                _src.loops = EditorGUILayout.IntField(new GUIContent("Loops", "Set to -1 for infinite loops"), _src.loops);
                if (_src.loops < -1)
                {
                    _src.loops = -1;
                }
                if (_src.loops > 1 || _src.loops == -1)
                {
                    _src.loopType = (LoopType)EditorGUILayout.EnumPopup("   Loop Type", _src.loopType);
                }
                _src.id = EditorGUILayout.TextField("ID", _src.id);

                bool canBeRelative = true;
                // End value and eventual specific options
                switch (_src.animationType)
                {
                case DOTweenAnimation.AnimationType.Move:
                case DOTweenAnimation.AnimationType.LocalMove:
                    GUIEndValueV3(targetGO, _src.animationType == DOTweenAnimation.AnimationType.Move);
                    _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                    canBeRelative      = !_src.useTargetAsV3;
                    break;

                case DOTweenAnimation.AnimationType.Rotate:
                case DOTweenAnimation.AnimationType.LocalRotate:
                    bool isRigidbody2D = DOTweenModuleUtils.Physics.HasRigidbody2D(_src);
                    if (isRigidbody2D)
                    {
                        GUIEndValueFloat();
                    }
                    else
                    {
                        GUIEndValueV3(targetGO);
                        _src.optionalRotationMode = (RotateMode)EditorGUILayout.EnumPopup("    Rotation Mode", _src.optionalRotationMode);
                    }
                    break;

                case DOTweenAnimation.AnimationType.Scale:
                    if (_src.optionalBool0)
                    {
                        GUIEndValueFloat();
                    }
                    else
                    {
                        GUIEndValueV3(targetGO);
                    }
                    _src.optionalBool0 = EditorGUILayout.Toggle("Uniform Scale", _src.optionalBool0);
                    break;

                case DOTweenAnimation.AnimationType.UIWidthHeight:
                    if (_src.optionalBool0)
                    {
                        GUIEndValueFloat();
                    }
                    else
                    {
                        GUIEndValueV2();
                    }
                    _src.optionalBool0 = EditorGUILayout.Toggle("Uniform Scale", _src.optionalBool0);
                    break;

                case DOTweenAnimation.AnimationType.Color:
                    GUIEndValueColor();
                    canBeRelative = false;
                    break;

                case DOTweenAnimation.AnimationType.Fade:
                    GUIEndValueFloat();
                    if (_src.endValueFloat < 0)
                    {
                        _src.endValueFloat = 0;
                    }
                    if (!_isLightSrc && _src.endValueFloat > 1)
                    {
                        _src.endValueFloat = 1;
                    }
                    canBeRelative = false;
                    break;

                case DOTweenAnimation.AnimationType.Text:
                    GUIEndValueString();
                    _src.optionalBool0        = EditorGUILayout.Toggle("Rich Text Enabled", _src.optionalBool0);
                    _src.optionalScrambleMode = (ScrambleMode)EditorGUILayout.EnumPopup("Scramble Mode", _src.optionalScrambleMode);
                    _src.optionalString       = EditorGUILayout.TextField(new GUIContent("Custom Scramble", "Custom characters to use in case of ScrambleMode.Custom"), _src.optionalString);
                    break;

                case DOTweenAnimation.AnimationType.PunchPosition:
                case DOTweenAnimation.AnimationType.PunchRotation:
                case DOTweenAnimation.AnimationType.PunchScale:
                    GUIEndValueV3(targetGO);
                    canBeRelative       = false;
                    _src.optionalInt0   = EditorGUILayout.IntSlider(new GUIContent("    Vibrato", "How much will the punch vibrate"), _src.optionalInt0, 1, 50);
                    _src.optionalFloat0 = EditorGUILayout.Slider(new GUIContent("    Elasticity", "How much the vector will go beyond the starting position when bouncing backwards"), _src.optionalFloat0, 0, 1);
                    if (_src.animationType == DOTweenAnimation.AnimationType.PunchPosition)
                    {
                        _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                    }
                    break;

                case DOTweenAnimation.AnimationType.ShakePosition:
                case DOTweenAnimation.AnimationType.ShakeRotation:
                case DOTweenAnimation.AnimationType.ShakeScale:
                    GUIEndValueV3(targetGO);
                    canBeRelative       = false;
                    _src.optionalInt0   = EditorGUILayout.IntSlider(new GUIContent("    Vibrato", "How much will the shake vibrate"), _src.optionalInt0, 1, 50);
                    _src.optionalFloat0 = EditorGUILayout.Slider(new GUIContent("    Randomness", "The shake randomness"), _src.optionalFloat0, 0, 90);
                    _src.optionalBool1  = EditorGUILayout.Toggle(new GUIContent("    FadeOut", "If selected the shake will fade out, otherwise it will constantly play with full force"), _src.optionalBool1);
                    if (_src.animationType == DOTweenAnimation.AnimationType.ShakePosition)
                    {
                        _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                    }
                    break;

                case DOTweenAnimation.AnimationType.CameraAspect:
                case DOTweenAnimation.AnimationType.CameraFieldOfView:
                case DOTweenAnimation.AnimationType.CameraOrthoSize:
                    GUIEndValueFloat();
                    canBeRelative = false;
                    break;

                case DOTweenAnimation.AnimationType.CameraBackgroundColor:
                    GUIEndValueColor();
                    canBeRelative = false;
                    break;

                case DOTweenAnimation.AnimationType.CameraPixelRect:
                case DOTweenAnimation.AnimationType.CameraRect:
                    GUIEndValueRect();
                    canBeRelative = false;
                    break;
                }

                // Final settings
                if (canBeRelative)
                {
                    _src.isRelative = EditorGUILayout.Toggle("    Relative", _src.isRelative);
                }

                // Events
                AnimationInspectorGUI.AnimationEvents(this, _src);
            }
            EditorGUI.EndDisabledGroup();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_src);
            }
        }
Esempio n. 9
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);
                }
            }
        }
Esempio n. 10
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            #region 私有
            GUILayout.Space(3);
            EditorGUIUtils.SetGUIStyles();

            bool playMode = Application.isPlaying;
            _runtimeEditMode = _runtimeEditMode && playMode;

            GUILayout.BeginHorizontal();
            EditorGUIUtils.InspectorLogo();
            DrawLablelOnClick();

            // Up-down buttons
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("▲", DeGUI.styles.button.toolIco))
            {
                UnityEditorInternal.ComponentUtility.MoveComponentUp(_src);
            }
            if (GUILayout.Button("▼", DeGUI.styles.button.toolIco))
            {
                UnityEditorInternal.ComponentUtility.MoveComponentDown(_src);
            }
            GUILayout.EndHorizontal();

            if (playMode)
            {
                if (!_runtimeEditMode)
                {
                    GUILayout.Space(8);
                    Label("在播放模式下禁用动画编辑器", "Animation Editor disabled while in play mode", EditorGUIUtils.wordWrapLabelStyle);
                    if (!_src.isActive)
                    {
                        Label("此动画已切换为非活动状态,不会生成", "This animation has been toggled as inactive and won't be generated", EditorGUIUtils.wordWrapLabelStyle);
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button(NewGUIContent("激活编辑模式", "切换到运行时编辑模式,您可以在其中更改动画值并重新启动它们", "Activate Edit Mode", "Switches to Runtime Edit Mode, where you can change animations values and restart them")))
                    {
                        _runtimeEditMode = true;
                    }
                    Label("注意:使用DOPlayNext时,序列由目标 GameObject 的 Inspector 中的 DOTweenAnimation Components 顺序决定", "NOTE: when using DOPlayNext, the sequence is determined by the DOTweenAnimation Components order in the target GameObject's Inspector", EditorGUIUtils.wordWrapLabelStyle);



                    GUILayout.Space(10);

                    if (null != _src.btns && _src.btns.Length > 0)
                    {
                        GUILayout.Label("关闭的按钮:");
                        foreach (var btn in _src.btns)
                        {
                            GUILayout.Label(btn.name);
                        }
                    }

                    GUILayout.Space(10);

                    if (!_runtimeEditMode)
                    {
                        return;
                    }
                }
            }

            Undo.RecordObject(_src, "DOTween Animation");


            EditorGUIUtility.labelWidth = 120;

            if (playMode)
            {
                GUILayout.Space(4);
                DeGUILayout.Toolbar("Edit Mode Commands");
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("TogglePause"))
                {
                    _src.tween.TogglePause();
                }
                if (GUILayout.Button("Rewind"))
                {
                    _src.tween.Rewind();
                }
                if (GUILayout.Button("Restart"))
                {
                    _src.tween.Restart();
                }
                GUILayout.EndHorizontal();
                if (GUILayout.Button("Commit changes and restart"))
                {
                    _src.tween.Rewind();
                    _src.tween.Kill();
                    if (_src.isValid)
                    {
                        _src.CreateTween();
                        _src.tween.Play();
                    }
                }
                Label("要在退出播放模式时应用更改,请使用组件的右上方菜单并选择“复制组件”,然后在退出播放模式后选择“粘贴组件值”", "To apply your changes when exiting Play mode, use the Component's upper right menu and choose \"Copy Component\", then \"Paste Component Values\" after exiting Play mode", DeGUI.styles.label.wordwrap);
                DeGUILayout.EndVBox();
            }

            GUILayout.BeginHorizontal();
            DOTweenAnimationType prevAnimType = _src.animationType;
            _src.isActive      = EditorGUILayout.Toggle(new GUIContent("", "If unchecked, this animation will not be created"), _src.isActive, GUILayout.Width(16));
            GUI.enabled        = _src.isActive;
            _src.animationType = AnimationToDOTweenAnimationType(_AnimationType[EditorGUILayout.Popup(DOTweenAnimationTypeToPopupId(_src.animationType), _AnimationType)]);
            _src.autoPlay      = DeGUILayout.ToggleButton(_src.autoPlay, NewGUIContent("AutoPlay", "如果选中,则 tween 会自动播放", "AutoPlay", "If selected, the tween will play automatically"));
            _src.autoKill      = DeGUILayout.ToggleButton(_src.autoKill, NewGUIContent("AutoKill", "如果选中,则 tween 将在完成时被终止,并且不可重用", "AutoKill", "If selected, the tween will be killed when it completes, and won't be reusable"));
            GUILayout.EndHorizontal();
            if (prevAnimType != _src.animationType)
            {
                // Set default optional values based on animation type
                switch (_src.animationType)
                {
                case DOTweenAnimationType.Move:
                case DOTweenAnimationType.LocalMove:
                case DOTweenAnimationType.Rotate:
                case DOTweenAnimationType.LocalRotate:
                case DOTweenAnimationType.Scale:
                    _src.endValueV3    = Vector3.zero;
                    _src.endValueFloat = 0;
                    _src.optionalBool0 = _src.animationType == DOTweenAnimationType.Scale;
                    break;

                case DOTweenAnimationType.Color:
                case DOTweenAnimationType.Fade:
                    _src.endValueFloat = 0;
                    break;

                case DOTweenAnimationType.Text:
                    _src.optionalBool0 = true;
                    break;

                case DOTweenAnimationType.PunchPosition:
                case DOTweenAnimationType.PunchRotation:
                case DOTweenAnimationType.PunchScale:
                    _src.endValueV3     = _src.animationType == DOTweenAnimationType.PunchRotation ? new Vector3(0, 180, 0) : Vector3.one;
                    _src.optionalFloat0 = 1;
                    _src.optionalInt0   = 10;
                    _src.optionalBool0  = false;
                    break;

                case DOTweenAnimationType.ShakePosition:
                case DOTweenAnimationType.ShakeRotation:
                case DOTweenAnimationType.ShakeScale:
                    _src.endValueV3     = _src.animationType == DOTweenAnimationType.ShakeRotation ? new Vector3(90, 90, 90) : Vector3.one;
                    _src.optionalInt0   = 10;
                    _src.optionalFloat0 = 90;
                    _src.optionalBool0  = false;
                    break;

                case DOTweenAnimationType.CameraAspect:
                case DOTweenAnimationType.CameraFieldOfView:
                case DOTweenAnimationType.CameraOrthoSize:
                    _src.endValueFloat = 0;
                    break;

                case DOTweenAnimationType.CameraPixelRect:
                case DOTweenAnimationType.CameraRect:
                    _src.endValueRect = new Rect(0, 0, 0, 0);
                    break;
                }
            }
            if (_src.animationType == DOTweenAnimationType.None)
            {
                _src.isValid = false;
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(_src);
                }
                return;
            }

            if (prevAnimType != _src.animationType || ComponentsChanged())
            {
                _src.isValid = Validate();
            }

            if (!_src.isValid)
            {
                GUI.color = Color.red;
                GUILayout.BeginVertical(GUI.skin.box);
                Label("找不到所选动画的有效组件", "No valid Component was found for the selected animation", EditorGUIUtils.wordWrapLabelStyle);
                GUILayout.EndVertical();
                GUI.color = Color.white;
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(_src);
                }
                return;
            }

            #endregion

            _src.duration = FloatField("持续时间", "Duration", _src.duration);
            if (_src.duration < 0)
            {
                _src.duration = 0;
            }
            _src.delay = FloatField("延迟", "Delay", _src.delay);
            if (_src.delay < 0)
            {
                _src.delay = 0;
            }
            _src.isIndependentUpdate = Toggle("是否忽略 TimeScale", "Ignore TimeScale", _src.isIndependentUpdate);
            _src.easeType            = EditorGUIUtils.FilteredEasePopup(_src.easeType);
            if (_src.easeType == Ease.INTERNAL_Custom)
            {
                _src.easeCurve = CurveField("   缓和曲线", "   Ease Curve", _src.easeCurve);
            }
            _src.loops = EditorGUILayout.IntField(NewGUIContent("循环", "无限循环设置为 -1", "Loops", "Set to -1 for infinite loops"), _src.loops);
            if (_src.loops < -1)
            {
                _src.loops = -1;
            }
            if (_src.loops > 1 || _src.loops == -1)
            {
                _src.loopType = (LoopType)EnumPopup("   循环模式", "   Loop Type", LoopTypeStrs, _src.loopType);
            }
            _src.id = EditorGUILayout.TextField("ID", _src.id);

            bool canBeRelative = true;
            // End value and eventual specific options
            switch (_src.animationType)
            {
            case DOTweenAnimationType.Move:
            case DOTweenAnimationType.LocalMove:
                GUIEndValueV3();
                DrawSnapping();
                break;

            case DOTweenAnimationType.Rotate:
            case DOTweenAnimationType.LocalRotate:
                if (_src.GetComponent <Rigidbody2D>())
                {
                    GUIEndValueFloat();
                }
                else
                {
                    GUIEndValueV3();
                    _src.optionalRotationMode = (RotateMode)EnumPopup("    旋转模式", "    Rotation Mode", RotationModeStrs, _src.optionalRotationMode);
                }
                break;

            case DOTweenAnimationType.Scale:
                if (_src.optionalBool0)
                {
                    GUIEndValueFloat();
                }
                else
                {
                    GUIEndValueV3();
                }
                _src.optionalBool0 = ToggleLeft("    ture:统一规模缩放,即只用 float 而非 Vector3", "Uniform Scale", _src.optionalBool0);
                break;

            case DOTweenAnimationType.Color:
                GUIEndValueColor();
                canBeRelative = false;
                break;

            case DOTweenAnimationType.Fade:
                GUIEndValueFloat();
                if (_src.endValueFloat < 0)
                {
                    _src.endValueFloat = 0;
                }
                if (_src.endValueFloat > 1)
                {
                    _src.endValueFloat = 1;
                }
                canBeRelative = false;
                break;

            case DOTweenAnimationType.Text:
                GUIEndValueString();
                _src.optionalBool0        = ToggleLeft("    是否启用富文本", "Rich Text Enabled", _src.optionalBool0);
                _src.optionalScrambleMode = (ScrambleMode)EnumPopup("争夺模式", "Scramble Mode", ScrambleStrs, _src.optionalScrambleMode);
                _src.optionalString       = EditorGUILayout.TextField(NewGUIContent("自定义争夺", "争夺模式中使用的自定义字符", "Custom Scramble", "Custom characters to use in case of ScrambleMode.Custom"), _src.optionalString);
                break;

            case DOTweenAnimationType.PunchPosition:
            case DOTweenAnimationType.PunchRotation:
            case DOTweenAnimationType.PunchScale:
                GUIEndValueV3();
                canBeRelative       = false;
                _src.optionalInt0   = EditorGUILayout.IntSlider(NewGUIContent("    振动", "冲头会振动多少", "    Vibrato", "How much will the punch vibrate"), _src.optionalInt0, 1, 50);
                _src.optionalFloat0 = EditorGUILayout.Slider(NewGUIContent("    弹性", "当向后弹跳时,向量将超出起始位置", "    Elasticity", "How much the vector will go beyond the starting position when bouncing backwards"), _src.optionalFloat0, 0, 1);
                if (_src.animationType == DOTweenAnimationType.PunchPosition)
                {
                    DrawSnapping();
                }
                break;

            case DOTweenAnimationType.ShakePosition:
            case DOTweenAnimationType.ShakeRotation:
            case DOTweenAnimationType.ShakeScale:
                GUIEndValueV3();
                canBeRelative       = false;
                _src.optionalInt0   = EditorGUILayout.IntSlider(NewGUIContent("    振动", "冲头会振动多少", "    Vibrato", "How much will the shake vibrate"), _src.optionalInt0, 1, 50);
                _src.optionalFloat0 = EditorGUILayout.Slider(NewGUIContent("    随机性", "摇晃随机性", "    Randomness", "The shake randomness"), _src.optionalFloat0, 0, 90);
                if (_src.animationType == DOTweenAnimationType.ShakePosition)
                {
                    DrawSnapping();
                }
                break;

            case DOTweenAnimationType.CameraAspect:
            case DOTweenAnimationType.CameraFieldOfView:
            case DOTweenAnimationType.CameraOrthoSize:
                GUIEndValueFloat();
                canBeRelative = false;
                break;

            case DOTweenAnimationType.CameraBackgroundColor:
                GUIEndValueColor();
                canBeRelative = false;
                break;

            case DOTweenAnimationType.CameraPixelRect:
            case DOTweenAnimationType.CameraRect:
                GUIEndValueRect();
                canBeRelative = false;
                break;
            }

            // Final settings
            if (canBeRelative)
            {
                DrawRelative();
            }


            _src.isUseDTContrl = ToggleLeft("    true:使用 DTExpansion_Contrl 统一控制", "    isUseDTContrl", _src.isUseDTContrl);

            DrawToggleIsCloseBtn();

            DrawTip();
            DrawDesTip();


            // Events
            AnimationInspectorGUI.AnimationEvents(this, _src);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_src);
            }
        }