Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(6f);
            NTweenEditorTools.SetLabelWidth(120f);

            TweenAlpha tw = target as TweenAlpha;

            GUI.changed = false;

            float from             = EditorGUILayout.Slider("From", tw.from, 0f, 1f);
            float to               = EditorGUILayout.Slider("To", tw.to, 0f, 1f);
            bool  include_children = EditorGUILayout.Toggle("Include Children", tw.include_children);
            bool  use_canvas_group = EditorGUILayout.Toggle("Use Canvas Group", tw.use_canvas_group);

            if (GUI.changed)
            {
                NTweenEditorTools.RegisterUndo("Tween Change", tw);
                tw.from             = from;
                tw.to               = to;
                tw.include_children = include_children;
                tw.use_canvas_group = use_canvas_group;
                NTweenTools.SetDirty(tw);
            }

            DrawCommonProperties();
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(6f);
            NTweenEditorTools.SetLabelWidth(120f);

            TweenScale tw = target as TweenScale;

            GUI.changed = false;
            Object  targetObj = EditorGUILayout.ObjectField("Target", tw.target, typeof(Transform), true);
            Vector3 from      = EditorGUILayout.Vector3Field("From", tw.from);
            Vector3 to        = EditorGUILayout.Vector3Field("To", tw.to);
            bool    table     = EditorGUILayout.Toggle("Update Table", tw.updateTable);

            if (GUI.changed)
            {
                NTweenEditorTools.RegisterUndo("Tween Change", tw);
                tw.target      = (Transform)targetObj;
                tw.from        = from;
                tw.to          = to;
                tw.updateTable = table;
                NTweenTools.SetDirty(tw);
            }

            DrawCommonProperties();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Convenience method that works without warnings in both Unity 3 and 4.
        /// </summary>

        static public void RegisterUndo(UnityEngine.Object obj, string name)
        {
#if UNITY_EDITOR
#if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2
            UnityEditor.Undo.RegisterUndo(obj, name);
#else
            UnityEditor.Undo.RecordObject(obj, name);
#endif
            NTweenTools.SetDirty(obj);
#endif
        }
Exemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(6f);
            NTweenEditorTools.SetLabelWidth(120f);

            TweenColor tw = target as TweenColor;

            GUI.changed = false;

            Color from             = EditorGUILayout.ColorField("From", tw.from);
            Color to               = EditorGUILayout.ColorField("To", tw.to);
            bool  include_children = EditorGUILayout.Toggle("Include Children", tw.include_children);

            if (GUI.changed)
            {
                NTweenEditorTools.RegisterUndo("Tween Change", tw);
                tw.from             = from;
                tw.to               = to;
                tw.include_children = include_children;
                NTweenTools.SetDirty(tw);
            }

            DrawCommonProperties();
        }
Exemplo n.º 5
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(6f);
            NTweenEditorTools.SetLabelWidth(120f);

            TweenPosition tw = target as TweenPosition;

            GUI.changed = false;

            Object  targetObj = EditorGUILayout.ObjectField("Target", tw.target, typeof(Transform), true);
            Vector3 from      = EditorGUILayout.Vector3Field("From", tw.from);
            Vector3 to        = EditorGUILayout.Vector3Field("To", tw.to);

            if (GUI.changed)
            {
                NTweenEditorTools.RegisterUndo("Tween Change", tw);
                tw.from   = from;
                tw.to     = to;
                tw.target = (targetObj as Transform);
                NTweenTools.SetDirty(tw);
            }
            tw.anchoredPosition = EditorGUILayout.Toggle("To", tw.anchoredPosition);
            DrawCommonProperties();
        }
Exemplo n.º 6
0
        protected void DrawCommonProperties()
        {
            UITweener tw = target as UITweener;

            if (NTweenEditorTools.DrawHeader("Tweener"))
            {
                NTweenEditorTools.BeginContents();
                NTweenEditorTools.SetLabelWidth(110f);

                GUI.changed = false;

                UITweener.Style style = (UITweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.style);
                AnimationCurve  curve = EditorGUILayout.CurveField("Animation Curve", tw.animationCurve, GUILayout.Width(170f), GUILayout.Height(62f));
                //UITweener.Method method = (UITweener.Method)EditorGUILayout.EnumPopup("Play Method", tw.method);

                GUILayout.BeginHorizontal();
                float dur = EditorGUILayout.FloatField("Duration", tw.duration, GUILayout.Width(170f));
                GUILayout.Label("seconds");
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                int lt = EditorGUILayout.IntField("Loop Times", tw.loopTimes, GUILayout.Width(170f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                int fd = EditorGUILayout.IntField(new GUIContent("Frame Delay", "由于Tween自身的时间计算机制,预制键实例化引起的卡顿会造成绑定在上面的tween动画在开始播放时出现跳帧的情况,基于帧数延迟启动可以改善该问题(帧延迟结束后才开始时间延迟计时)"), tw.delayFrame, GUILayout.Width(170f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                float del = EditorGUILayout.FloatField("Time Delay", tw.delay, GUILayout.Width(170f));
                GUILayout.Label("seconds");
                GUILayout.EndHorizontal();

                int  tg           = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(170f));
                bool ts           = EditorGUILayout.Toggle("Ignore TimeScale", tw.ignoreTimeScale);
                bool resetAtStart = EditorGUILayout.Toggle(new GUIContent("Reset At Start"), tw.resetAtStart, GUILayout.Width(170f));

                Object receiver         = EditorGUILayout.ObjectField("Receiver", tw.eventReceiver, typeof(GameObject));
                string callWhenFinished = EditorGUILayout.TextField("Finished Callback", tw.callWhenFinished);

                if (GUI.changed)
                {
                    NTweenEditorTools.RegisterUndo("Tween Change", tw);
                    tw.animationCurve = curve;
                    //tw.method = method;
                    tw.style            = style;
                    tw.ignoreTimeScale  = ts;
                    tw.tweenGroup       = tg;
                    tw.resetAtStart     = resetAtStart;
                    tw.duration         = dur;
                    tw.loopTimes        = lt;
                    tw.delayFrame       = fd;
                    tw.delay            = del;
                    tw.eventReceiver    = receiver as GameObject;
                    tw.callWhenFinished = callWhenFinished;
                    NTweenTools.SetDirty(tw);
                }
                NTweenEditorTools.EndContents();
            }

            NTweenEditorTools.SetLabelWidth(80f);
            //NTweenEditorTools.DrawEvents("On Finished", tw, tw.onFinished);
        }