Ejemplo n.º 1
0
 public override void Unity_Deserialize(int depth)
 {
     this.method = (UITweener.Method)SerializedStateReader.Instance.ReadInt32();
     this.style  = (UITweener.Style)SerializedStateReader.Instance.ReadInt32();
     if (depth <= 7)
     {
         this.animationCurve = (SerializedStateReader.Instance.ReadAnimationCurve() as AnimationCurve);
     }
     this.ignoreTimeScale = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
     this.delay         = SerializedStateReader.Instance.ReadSingle();
     this.duration      = SerializedStateReader.Instance.ReadSingle();
     this.steeperCurves = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
     this.tweenGroup = SerializedStateReader.Instance.ReadInt32();
     if (depth <= 7)
     {
         int num = SerializedStateReader.Instance.ReadInt32();
         this.onFinished = new List <EventDelegate>(num);
         for (int i = 0; i < num; i++)
         {
             EventDelegate eventDelegate = new EventDelegate();
             eventDelegate.Unity_Deserialize(depth + 1);
             this.onFinished.Add(eventDelegate);
         }
     }
     if (depth <= 7)
     {
         this.eventReceiver = (SerializedStateReader.Instance.ReadUnityEngineObject() as GameObject);
     }
     this.callWhenFinished = (SerializedStateReader.Instance.ReadString() as string);
 }
Ejemplo n.º 2
0
    public static TweenAlpha FadeTo(GameObject go, UITweener.Method method, UITweener.Style style,
                                    float duration, float delay, float alphaFrom, float alphaTo)
    {
        if (go == null)
        {
            return(null);
        }

        //go.RemoveComponent<TweenAlpha>();

        TweenAlpha comp = UITweenerUtil.Begin <TweenAlpha>(go, method, style, duration, delay);

        //comp.ResetToBeginning();
        comp.from     = alphaFrom;
        comp.to       = alphaTo;
        comp.duration = duration;
        comp.delay    = delay;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        comp = ResetTween(comp);
        comp.Play(true);
        return(comp);
    }
Ejemplo n.º 3
0
    public static T Begin <T>(GameObject go, UITweener.Method method, UITweener.Style style,
                              float duration, float delay) where T : UITweener
    {
        if (go == null)
        {
            return(default(T));
        }

        T comp = go.GetComponent <T>();

#if UNITY_FLASH
        if ((object)comp == null)
        {
            comp = (T)go.AddComponent <T>();
        }
#else
        if (comp == null)
        {
            comp = go.AddComponent <T>();
        }
#endif
        comp.delay            = delay;
        comp.duration         = duration;
        comp.method           = method;
        comp.style            = style;
        comp.eventReceiver    = null;
        comp.callWhenFinished = null;
        comp.onFinished       = null;
        comp.enabled          = true;
        return(comp);
    }
 private void PlayTween()
 {
     this.GetTweens();
     this.allDisabled = false;
     foreach (UITweener uitweener in this.tween)
     {
         if (!(uitweener == null))
         {
             if (uitweener.style != UITweener.Style.Once)
             {
                 UITweener.Style style = uitweener.style;
                 uitweener.style = UITweener.Style.Once;
                 uitweener.ResetToBeginning();
                 uitweener.style = style;
             }
             else
             {
                 uitweener.ResetToBeginning();
             }
             uitweener.PlayForward();
             if (uitweener.delay > 0f)
             {
                 uitweener.ApplyTweenFromValue();
             }
         }
     }
 }
Ejemplo n.º 5
0
    static int IntToEnum(IntPtr L)
    {
        int arg0 = (int)LuaDLL.lua_tonumber(L, 1);

        UITweener.Style o = (UITweener.Style)arg0;
        ToLua.Push(L, o);
        return(1);
    }
Ejemplo n.º 6
0
 private void SetTweenPositon(TweenPosition td, Vector3 from, Vector3 to, UITweener.Style style, UITweener.Method method, float duration)
 {
     td.from            = from;
     td.to              = to;
     td.style           = style;
     td.method          = method;
     td.duration        = duration;
     td.ignoreTimeScale = false;
 }
Ejemplo n.º 7
0
    public static TweenAlpha FadeTo(GameObject go, UITweener.Method method, UITweener.Style style,
                                    float duration, float delay, float alpha)
    {
        if (go == null)
        {
            return(null);
        }

        return(FadeTo(false, go, method, style, duration, delay, alpha));
    }
Ejemplo n.º 8
0
    public static TweenPosition MoveTo(GameObject go, UITweener.Method method, UITweener.Style style,
                                       float duration, float delay, Vector3 pos)
    {
        if (go == null)
        {
            return(null);
        }

        return(MoveTo(false, go, method, style, duration, delay, pos));
    }
Ejemplo n.º 9
0
    //

    public static TweenColor ColorTo(GameObject go, UITweener.Method method, UITweener.Style style,
                                     float duration, float delay, Color colorTo)
    {
        if (go == null)
        {
            return(null);
        }

        return(ColorTo(false, go, method, style, duration, delay, colorTo));
    }
Ejemplo n.º 10
0
    public static TweenRotation RotateTo(
        GameObject go, UITweener.Method method, UITweener.Style style,
        float duration, float delay, Vector3 rotateTo)
    {
        if (go == null)
        {
            return(null);
        }

        return(RotateTo(go, method, style, duration, delay, go.transform.rotation.eulerAngles, rotateTo));
    }
Ejemplo n.º 11
0
    protected void DrawCommonProperties()
    {
        UITweener tw = target as UITweener;

        if (NGUIEditorTools.DrawHeader("Tweener"))
        {
            NGUIEditorTools.BeginContents();
            NGUIEditorTools.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();
            float del = EditorGUILayout.FloatField("Start Delay", tw.delay, GUILayout.Width(170f));
            GUILayout.Label("seconds");
            GUILayout.EndHorizontal();

            var deff = (UITweener.DelayAffects)EditorGUILayout.EnumPopup("Delay Affects", tw.delayAffects);

            int  tg = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(170f));
            bool ts = EditorGUILayout.Toggle("Ignore TimeScale", tw.ignoreTimeScale);
            bool fx = EditorGUILayout.Toggle("Use Fixed Update", tw.useFixedUpdate);

            if (GUI.changed)
            {
                NGUIEditorTools.RegisterUndo("Tween Change", tw);
                tw.animationCurve = curve;
                //tw.method = method;
                tw.style           = style;
                tw.ignoreTimeScale = ts;
                tw.tweenGroup      = tg;
                tw.duration        = dur;
                tw.delay           = del;
                tw.delayAffects    = deff;
                tw.useFixedUpdate  = fx;
                NGUITools.SetDirty(tw);
            }
            NGUIEditorTools.EndContents();
        }

        NGUIEditorTools.SetLabelWidth(80f);
        NGUIEditorTools.DrawEvents("On Finished", tw, tw.onFinished);
    }
Ejemplo n.º 12
0
    protected virtual void _TweenReset(UITweener target)
    {
        float duration = target.duration;
        float delay    = target.delay;

        UITweener.Style style = target.style;
        target.duration = 0f;
        target.delay    = 0f;
        target.style    = UITweener.Style.Once;
        target.Play(false);
        target.style    = style;
        target.duration = duration;
        target.delay    = delay;
    }
Ejemplo n.º 13
0
    static int set_style(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UITweener       obj  = (UITweener)o;
            UITweener.Style arg0 = (UITweener.Style)ToLua.CheckObject(L, 2, typeof(UITweener.Style));
            obj.style = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index style on a nil value" : e.Message));
        }
    }
Ejemplo n.º 14
0
    static int get_style(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UITweener       obj = (UITweener)o;
            UITweener.Style ret = obj.style;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index style on a nil value" : e.Message));
        }
    }
Ejemplo n.º 15
0
    protected void DrawCommonProperties()
    {
        UITweener tw = target as UITweener;

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

            GUI.changed = false;

            UITweener.Style style    = (UITweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.style);
            EaseType        easeType = (EaseType)EditorGUILayout.EnumPopup("Ease Type", tw.easeType);
            EditorGUILayout.CurveField("Animation Curve", tw.animationCurve, GUILayout.Width(170f), GUILayout.Height(62f));
            GUILayout.BeginHorizontal();
            float dur = EditorGUILayout.FloatField("Duration", tw.duration, GUILayout.Width(170f));
            GUILayout.Label("seconds");
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            float del = EditorGUILayout.FloatField("Start 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);

            if (GUI.changed)
            {
                SUGUIEditorTools.RegisterUndo("Tween Change", tw);
                tw.easeType        = easeType;
                tw.style           = style;
                tw.ignoreTimeScale = ts;
                tw.tweenGroup      = tg;
                tw.duration        = dur;
                tw.delay           = del;
                SUGUITools.SetDirty(tw);
            }
            SUGUIEditorTools.EndContents();
        }

        SUGUIEditorTools.SetLabelWidth(80f);
        SUGUIEditorTools.DrawEvents("On Finished", tw, tw.onFinished);
    }
Ejemplo n.º 16
0
    protected void DrawCommonProperties()
    {
        UITweener tw = target as UITweener;

        if (DrawHeader("TweenBase"))
        {
            BeginContents(false);
            GUI.changed = false;
            EditorGUIUtility.labelWidth = 110f;

            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();
            float del = EditorGUILayout.FloatField("Start 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);

            if (GUI.changed)
            {
                RegisterUndo("Tween Change", tw);
                tw.animationCurve  = curve;
                tw.method          = method;
                tw.style           = style;
                tw.ignoreTimeScale = ts;
                tw.tweenGroup      = tg;
                tw.duration        = dur;
                tw.delay           = del;
                UnityEditor.EditorUtility.SetDirty(tw);
            }
            EndContents();
        }
        EditorGUIUtility.labelWidth = 80f;
    }
Ejemplo n.º 17
0
    private static int get_style(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UITweener       uITweener = (UITweener)obj;
            UITweener.Style style     = uITweener.style;
            ToLua.Push(L, style);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index style on a nil value");
        }
        return(result);
    }
Ejemplo n.º 18
0
    private static int set_style(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UITweener       uITweener = (UITweener)obj;
            UITweener.Style style     = (UITweener.Style)((int)ToLua.CheckObject(L, 2, typeof(UITweener.Style)));
            uITweener.style = style;
            result          = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index style on a nil value");
        }
        return(result);
    }
Ejemplo n.º 19
0
        protected void DrawCommonProperties()
        {
            if (InspectorToolExtends.DrawHeader("Tweener"))
            {
                InspectorToolExtends.BeginContents();
                EditorGUIUtility.labelWidth = 110f;

                EditorGUI.BeginChangeCheck();

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

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

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

                bool ts = EditorGUILayout.Toggle("Ignore TimeScale", mTarget.ignoreTimeScale);

                if (EditorGUI.EndChangeCheck())
                {
                    InspectorToolExtends.RegisterUndo("Tween Change", mTarget);
                    mTarget.animationCurve  = curve;
                    mTarget.method          = moveType;
                    mTarget.style           = style;
                    mTarget.ignoreTimeScale = ts;
                    mTarget.duration        = dur;
                    mTarget.delay           = del;
                    InspectorToolExtends.SetDirty(mTarget);
                }
                InspectorToolExtends.EndContents();
            }
        }
 private void End(UITweener[] target_tweens)
 {
     if (target_tweens != null && target_tweens.Length != 0 && !isEnd)
     {
         isEnd = true;
         int i = 0;
         for (int num = target_tweens.Length; i < num; i++)
         {
             if (!(target_tweens[i] == null))
             {
                 UITweener.Style style = target_tweens[i].style;
                 target_tweens[i].style       = UITweener.Style.Once;
                 target_tweens[i].tweenFactor = 1f;
                 target_tweens[i].Sample(target_tweens[i].tweenFactor, true);
                 target_tweens[i].PlayForward();
                 target_tweens[i].style = style;
             }
         }
     }
 }
Ejemplo n.º 21
0
    public unsafe override void Unity_NamedDeserialize(int depth)
    {
        ISerializedNamedStateReader arg_1A_0 = SerializedNamedStateReader.Instance;

        byte[] var_0_cp_0 = $FieldNamesStorage.$RuntimeNames;
        int    var_0_cp_1 = 0;

        this.method = (UITweener.Method)arg_1A_0.ReadInt32(&var_0_cp_0[var_0_cp_1] + 2686);
        this.style  = (UITweener.Style)SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 2693);
        if (depth <= 7)
        {
            this.animationCurve = (SerializedNamedStateReader.Instance.ReadAnimationCurve(&var_0_cp_0[var_0_cp_1] + 2699) as AnimationCurve);
        }
        this.ignoreTimeScale = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 2653);
        SerializedNamedStateReader.Instance.Align();
        this.delay         = SerializedNamedStateReader.Instance.ReadSingle(&var_0_cp_0[var_0_cp_1] + 2714);
        this.duration      = SerializedNamedStateReader.Instance.ReadSingle(&var_0_cp_0[var_0_cp_1] + 136);
        this.steeperCurves = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 2720);
        SerializedNamedStateReader.Instance.Align();
        this.tweenGroup = SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 1219);
        if (depth <= 7)
        {
            int num = SerializedNamedStateReader.Instance.BeginSequenceGroup(&var_0_cp_0[var_0_cp_1] + 85);
            this.onFinished = new List <EventDelegate>(num);
            for (int i = 0; i < num; i++)
            {
                EventDelegate eventDelegate = new EventDelegate();
                EventDelegate arg_125_0     = eventDelegate;
                SerializedNamedStateReader.Instance.BeginMetaGroup((IntPtr)0);
                arg_125_0.Unity_NamedDeserialize(depth + 1);
                SerializedNamedStateReader.Instance.EndMetaGroup();
                this.onFinished.Add(eventDelegate);
            }
            SerializedNamedStateReader.Instance.EndMetaGroup();
        }
        if (depth <= 7)
        {
            this.eventReceiver = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1165) as GameObject);
        }
        this.callWhenFinished = (SerializedNamedStateReader.Instance.ReadString(&var_0_cp_0[var_0_cp_1] + 1179) as string);
    }
    protected void EventDrawCommonProperties(Object pTarget, STweenInfoBase sTweenInfoBase)
    {
        NGUIEditorTools.BeginContents();
        NGUIEditorTools.SetLabelWidth(110f);

        GUI.changed = false;

        UITweener.Style eStyle          = (UITweener.Style)EditorGUILayout.EnumPopup("Play Style", sTweenInfoBase.eStyle);
        AnimationCurve  pAnimationCurve = EditorGUILayout.CurveField("Animation Curve", sTweenInfoBase.pAnimationCurve, GUILayout.Width(170f), GUILayout.Height(62f));

        //UITweener.Method method = (UITweener.Method)EditorGUILayout.EnumPopup("Play Method", tw.method);

        GUILayout.BeginHorizontal();
        float fDuration = EditorGUILayout.FloatField("Duration", sTweenInfoBase.fDuration, GUILayout.Width(170f));

        GUILayout.Label("seconds");
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        float fStartDelay_Min = EditorGUILayout.FloatField("Start Delay_Min", sTweenInfoBase.fStartDelay_Min, GUILayout.Width(170f));
        float fStartDelay_Max = EditorGUILayout.FloatField("Start Delay_Max", sTweenInfoBase.fStartDelay_Max, GUILayout.Width(170f));

        GUILayout.Label("seconds");
        GUILayout.EndHorizontal();

        if (GUI.changed)
        {
            NGUIEditorTools.RegisterUndo("Tween Change", pTarget);
            sTweenInfoBase.pAnimationCurve = pAnimationCurve;
            sTweenInfoBase.eStyle          = eStyle;
            sTweenInfoBase.fDuration       = fDuration;
            sTweenInfoBase.fStartDelay_Min = fStartDelay_Min;
            sTweenInfoBase.fStartDelay_Max = fStartDelay_Max;
            NGUITools.SetDirty(pTarget);
            GUI.changed = false;
        }
        NGUIEditorTools.EndContents();

        NGUIEditorTools.DrawEvents("On Finished", pTarget, sTweenInfoBase.listOnFinished);
    }
Ejemplo n.º 23
0
        protected void DrawCommonProperties()
        {
            UITweener tw = target as UITweener;

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

                GUI.changed = false;

                UITweener.Style style = (UITweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.style);

                int loopCount = EditorGUILayout.IntField("Loop Count", tw.loopCount);

                AnimationCurve curve = EditorGUILayout.CurveField("Animation Curve", tw.animationCurve, GUILayout.Width(170f), GUILayout.Height(62f));

                int additionalCurveCount = tw.GetAdditionalCurveCount();
                for (int i = 0; i < additionalCurveCount; i++)
                {
                    AnimationCurve oldCurve = null;
                    if (tw.additionalAnimationCurveList.Count <= i)
                    {
                        oldCurve = new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f));
                        tw.additionalAnimationCurveList.Add(oldCurve);
                    }
                    else
                    {
                        oldCurve = tw.additionalAnimationCurveList[i];
                    }
                    AnimationCurve newCurve = EditorGUILayout.CurveField("Animation Curve", oldCurve, GUILayout.Width(170f), GUILayout.Height(62f));
                    tw.additionalAnimationCurveList[i] = newCurve;
                }

                UITweener.Method method = (UITweener.Method)EditorGUILayout.EnumPopup("Play Method", tw.method);

                float startFactor        = EditorGUILayout.Slider("Start Factor", tw.startFactor, 0, 1);
                float startFactorReverse = EditorGUILayout.Slider("End Factor", tw.startFactorReverse, 0, 1);

                float factor = EditorGUILayout.Slider("current Factor", tw.tweenFactor, 0, 1);

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

                GUILayout.BeginHorizontal();
                float del = EditorGUILayout.FloatField("Start 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);

                if (GUI.changed)
                {
                    tw.animationCurve     = curve;
                    tw.method             = method;
                    tw.tweenFactor        = factor;
                    tw.startFactor        = startFactor;
                    tw.startFactorReverse = startFactorReverse;
                    tw.style           = style;
                    tw.loopCount       = loopCount;
                    tw.ignoreTimeScale = ts;
                    tw.tweenGroup      = tg;
                    tw.duration        = dur;
                    tw.delay           = del;

                    EditorTools.SetDirty(tw);
                }
                EditorTools.EndContents();
            }

            EditorTools.SetLabelWidth(80f);
            //EditorTools.DrawEvents("On Finished", tw, tw.onFinished);
        }
        public static void TweenAlphaBegin(GameObject obj, float duration, float alpha, UITweener.Style state)
        {
            UITweener uit = TweenAlpha.Begin(obj, duration, alpha);

            uit.style = state;
        }
        public static void TweenScaleBegin(GameObject go, float duration, Vector3 v3, UITweener.Style state)
        {
            UITweener uit = TweenScale.Begin(go, duration, v3);

            uit.style = state;
        }
        public static void TweenRotationBegin(GameObject go, float duration, Vector3 v3, UITweener.Style state)
        {
            UITweener uit = TweenRotation.Begin(go, duration, Quaternion.Euler(v3));

            uit.style = state;
        }
 public static void SafeGetTweenRotation(this GameObject obj, Vector3 from, Vector3 to, float duration, float delay, UITweener.Method method = UITweener.Method.Linear, UITweener.Style style = UITweener.Style.Once, GameObject eventReceiver = null, string callWhenFinished = "")
 {
     if ((bool)obj.GetComponent <TweenRotation>())
     {
         TweenRotation component = obj.GetComponent <TweenRotation>();
         component.ResetToBeginning();
         component.from          = from;
         component.to            = to;
         component.duration      = duration;
         component.delay         = delay;
         component.method        = method;
         component.style         = style;
         component.eventReceiver = eventReceiver;
         if (component.eventReceiver != null)
         {
             component.callWhenFinished = callWhenFinished;
         }
         component.PlayForward();
     }
     else
     {
         TweenRotation component = obj.AddComponent <TweenRotation>();
         component.from          = from;
         component.to            = to;
         component.duration      = duration;
         component.delay         = delay;
         component.method        = method;
         component.style         = style;
         component.eventReceiver = eventReceiver;
         if (component.eventReceiver != null)
         {
             component.callWhenFinished = callWhenFinished;
         }
         component.Play(forward: true);
     }
 }
 void MoveMethod(EventDelegate.Callback callback, float xMove, float durning, UITweener.Method method = UITweener.Method.EaseIn, UITweener.Style style = UITweener.Style.Once)
 {
     tweenMoveIn        = TweenPosition.Begin(posParent.gameObject, durning, new Vector3(xMove, 0f, 0f));
     tweenMoveIn.style  = style;
     tweenMoveIn.method = method;
     if (callback != null)
     {
         EventDelegate.Add(tweenMoveIn.onFinished, callback, true);
     }
 }
Ejemplo n.º 29
0
    /// <summary>
    /// 渐隐渐现效果
    /// </summary>
    public void TweenAlphaEffect(GameObject go, float duration, float from_rate, float to_rate, bool isfrom = false, float delaytime = 0.0f, UITweener.Style style = UITweener.Style.Once)
    {
        if (go == null)
        {
            return;
        }

        TweenAlpha Tw = TweenAlpha.Begin(go, duration, to_rate);

        if (isfrom)
        {
            Tw.from = from_rate;
        }
        Tw.delay = delaytime;
        Tw.style = style;
        BegainTween(Tw);
    }
Ejemplo n.º 30
0
    protected void DrawCommonProperties()
    {
        UITweener tw = target as UITweener;

        NGUIEditorTools.SetLabelWidth(110F);
        if (DrawPreviewHeader())
        {
            NGUIEditorTools.BeginContents();
            GUI.changed = false;
            float tweenFactor = EditorGUILayout.Slider("Tween Factor", tw.tweenFactor, 0f, 1f);
            if (GUI.changed || !preview)
            {
                NGUIEditorTools.RegisterUndo("Tween Change", tw);
                tw.tweenFactor = tweenFactor;
                tw.Sample(tweenFactor, false);
                NGUITools.SetDirty(tw);
            }
            NGUIEditorTools.EndContents();

            preview = true;
        }

        if (NGUIEditorTools.DrawHeader("Tweener"))
        {
            NGUIEditorTools.BeginContents();

            bool changed = GUI.changed = false;

            UITweener.Style style = (UITweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.style);
            AnimationCurve  curve = EditorGUILayout.CurveField("Animation Curve", tw.animationCurve, GUILayout.Width(EditorGUIUtility.currentViewWidth - 50f), GUILayout.Height(62f));
            //UITweener.Method method = (UITweener.Method)EditorGUILayout.EnumPopup("Play Method", tw.method);
            changed |= GUI.changed;

            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            EditorGUILayout.BeginVertical();
            if (NGUIEditorTools.DrawHeader("Curve Data"))
            {
                GUI.changed = false;

                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(1f);
                EditorGUILayout.BeginVertical("As TextArea", GUILayout.MinHeight(18));
                GUILayout.Space(2f);
                curve = DrawCurveData(curve);
                GUILayout.Space(2f);
                EditorGUILayout.EndVertical();
                GUILayout.Space(3f);
                EditorGUILayout.EndHorizontal();

                changed |= GUI.changed;
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);

            GUI.changed = false;

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

            GUILayout.BeginHorizontal();
            float de = EditorGUILayout.FloatField("Delay Enter Curve", tw.curveDelayEnter, GUILayout.Width(170f));
            GUILayout.Label("seconds");
            GUILayout.EndHorizontal();

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

            GUILayout.BeginHorizontal();
            float ee = EditorGUILayout.FloatField("Early Exit Curve", tw.curveEarlyExit, GUILayout.Width(170f));
            GUILayout.Label("seconds");
            GUILayout.EndHorizontal();

            int tg = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(170f));

            NGUIEditorTools.SetLabelWidth(156f);
            bool ts = EditorGUILayout.Toggle("Ignore TimeScale", tw.ignoreTimeScale);
            bool fx = EditorGUILayout.Toggle("Use Fixed Update", tw.useFixedUpdate);
            bool ia = EditorGUILayout.Toggle("Init On Awake", tw.setBeginningOnAwake);
            bool ie = EditorGUILayout.Toggle("Init On Enable", tw.SetBeginningOnEnable);
            bool ap = EditorGUILayout.Toggle("Auto Play On Enable", tw.AutoPlayOnEnable);

            changed |= GUI.changed;
            if (changed)
            {
                NGUIEditorTools.RegisterUndo("Tween Change", tw);
                tw.animationCurve = curve;
                //tw.method = method;
                tw.style                = style;
                tw.ignoreTimeScale      = ts;
                tw.tweenGroup           = tg;
                tw.delay                = del;
                tw.curveDelayEnter      = de;
                tw.duration             = dur;
                tw.curveEarlyExit       = ee;
                tw.useFixedUpdate       = fx;
                tw.setBeginningOnAwake  = ia;
                tw.SetBeginningOnEnable = ie;
                tw.AutoPlayOnEnable     = ap;
                if (preview)
                {
                    tw.Sample(tw.tweenFactor, false);
                }
                NGUITools.SetDirty(tw);
            }
            NGUIEditorTools.EndContents();
        }

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