Example #1
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        NGUIEditorTools.SetLabelWidth(120f);

        TweenRotation tw = target as TweenRotation;

        GUI.changed = false;

        Vector3 from = EditorGUILayout.Vector3Field("From", tw.from);
        Vector3 to   = EditorGUILayout.Vector3Field("To", tw.to);
        var     quat = EditorGUILayout.Toggle("Quaternion", tw.quaternionLerp);

        if (GUI.changed)
        {
            NGUIEditorTools.RegisterUndo("Tween Change", tw);
            tw.from           = from;
            tw.to             = to;
            tw.quaternionLerp = quat;
            if (preview)
            {
                tw.Sample(tw.tweenFactor, false);
            }
            NGUITools.SetDirty(tw);
        }

        DrawCommonProperties();
    }
Example #2
0
    public static TweenRotation RotateTo(GameObject go, UITweener.Method method, UITweener.Style style,
                                         float duration, float delay, Vector3 rotateFrom, Vector3 rotateTo)
    {
        if (go == null)
        {
            return(null);
        }

        //go.RemoveComponent<TweenPosition>();

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

        //comp.ResetToBeginning();
        comp.from     = rotateFrom;
        comp.to       = rotateTo;
        comp.duration = duration;
        comp.delay    = delay;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        comp = ResetTween(comp);
        comp.Play(true);
        return(comp);
    }
Example #3
0
	public static TweenRotation Begin(GameObject go, Single duration, Quaternion rot)
	{
		TweenRotation tweenRotation = UITweener.Begin<TweenRotation>(go, duration);
		tweenRotation.from = tweenRotation.value.eulerAngles;
		tweenRotation.to = rot.eulerAngles;
		if (duration <= 0f)
		{
			tweenRotation.Sample(1f, true);
			tweenRotation.enabled = false;
		}
		return tweenRotation;
	}
Example #4
0
    public static TweenRotation Begin(GameObject go, float duration, Quaternion rot)
    {
        TweenRotation rotation = UITweener.Begin <TweenRotation>(go, duration);

        rotation.from = rotation.rotation.eulerAngles;
        rotation.to   = rot.eulerAngles;
        if (duration <= 0f)
        {
            rotation.Sample(1f, true);
            rotation.enabled = false;
        }
        return(rotation);
    }
Example #5
0
    public static TweenRotation Begin(GameObject go, float duration, Quaternion rot)
    {
        TweenRotation tweenRotation = UITweener.Begin <TweenRotation>(go, duration);

        tweenRotation.from = tweenRotation.value.get_eulerAngles();
        tweenRotation.to   = rot.get_eulerAngles();
        if (duration <= 0f)
        {
            tweenRotation.Sample(1f, true);
            tweenRotation.set_enabled(false);
        }
        return(tweenRotation);
    }
Example #6
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenRotation Begin(GameObject go, float duration, Quaternion rot)
    {
        TweenRotation comp = UITweener.Begin <TweenRotation>(go, duration);

        comp.from = comp.value.eulerAngles;
        comp.to   = rot.eulerAngles;
        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Example #7
0
    /// <summary>
    /// 新增回调
    /// </summary>
    /// <param name="go"></param>
    /// <param name="duration"></param>
    /// <param name="rot"></param>
    /// <returns></returns>
    static public TweenRotation Begin(GameObject go, float duration, Quaternion rot, ButtonCallBack CallBack)
    {
        TweenRotation comp = UITweener.Begin <TweenRotation>(go, duration);

        comp.from = comp.rotation.eulerAngles;
        comp.to   = rot.eulerAngles;
        comp.CallBackWhenFinished = CallBack;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Example #8
0
    public static TweenRotation Begin(GameObject go, Vector3 from, Vector3 to, float duration = 1f, float delay = 0f)
    {
        TweenRotation comp = Begin <TweenRotation>(go, duration);

        comp.value    = from;
        comp.from     = from;
        comp.to       = to;
        comp.duration = duration;
        comp.delay    = delay;
        if (duration <= 0)
        {
            comp.Sample(1, true);
            comp.enabled = false;
        }
        return(comp);
    }
    public static TweenRotation Begin(GameObject go, float duration, Quaternion rot)
    {
        //IL_000b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0010: Unknown result type (might be due to invalid IL or missing references)
        //IL_0013: Unknown result type (might be due to invalid IL or missing references)
        //IL_0018: Unknown result type (might be due to invalid IL or missing references)
        //IL_0020: Unknown result type (might be due to invalid IL or missing references)
        //IL_0025: Unknown result type (might be due to invalid IL or missing references)
        TweenRotation tweenRotation  = UITweener.Begin <TweenRotation>(go, duration, true);
        TweenRotation tweenRotation2 = tweenRotation;
        Quaternion    value          = tweenRotation.value;

        tweenRotation2.from = value.get_eulerAngles();
        tweenRotation.to    = rot.get_eulerAngles();
        if (duration <= 0f)
        {
            tweenRotation.Sample(1f, true);
            tweenRotation.set_enabled(false);
        }
        return(tweenRotation);
    }
Example #10
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenRotation Begin(GameObject go, float duration, Quaternion rot)
    {
        TweenRotation comp = UITweener.Begin <TweenRotation>(go, duration);
        Vector3       f    = comp.value.eulerAngles;
        Vector3       t    = rot.eulerAngles;

        if (f.y - t.y < -180)
        {
            t = new Vector3(t.x, t.y - 360, t.z);
        }
        else if (f.y - t.y > 180)
        {
            f = new Vector3(f.x, f.y - 360, f.z);
        }
        comp.from = f;
        comp.to   = t;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }