Esempio n. 1
0
public static int alpha(LTRect ltRect, float to, float time, object[] optional){
	return alpha( ltRect, to, time, h(optional) );
}
Esempio n. 2
0
public static int scale(LTRect ltRect, Vector2 to, float time, object[] optional){
	return scale( ltRect, to, time, h(optional) );
}
Esempio n. 3
0
public static int alpha(LTRect ltRect, float to, float time, Hashtable optional){
	init();
	if( optional==null || optional.Count == 0 )
		optional = new Hashtable();

	ltRect.alphaEnabled = true;
	optional["rect"] = ltRect;
	return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ALPHA, optional );
}
Esempio n. 4
0
public static int move(LTRect ltRect, Vector3 to, float time, object[] optional){
	return move( ltRect, to, time, LeanTween.h( optional ) );
}
Esempio n. 5
0
public static int scale(LTRect ltRect,Vector2 to, float time, Hashtable optional)
{ 
	init();
	if( optional==null || optional.Count == 0 )
		optional = new Hashtable();

	optional["rect"] = ltRect;
	return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_SCALE, optional );
}
Esempio n. 6
0
 public static LTRect texture(LTRect rect, Texture texture, int depth)
 {
     rect.type = Element_Type.Texture;
     rect.texture = texture;
     return element(rect, depth);
 }
Esempio n. 7
0
 public LTDescr setRect(Rect rect)
 {
     this.ltRect = new LTRect(rect);
     return this;
 }
Esempio n. 8
0
        /**
    * Rotate a GUI element (using an LTRect object), to a value that is in degrees
    * 
    * @method LeanTween.rotate
    * @param {LTRect} ltRect:LTRect LTRect that you wish to rotate
    * @param {float} to:float The final rotation with which to rotate to
    * @param {float} time:float The time to complete the tween in
    * @param {Array} optional:Array Object Array where you can pass <a href="#optional">optional items</a>.
    * @return {LTDescr} LTDescr an object that distinguishes the tween
    * @example 
    * if(GUI.Button(buttonRect.rect, "Rotate"))<br>
    *	LeanTween.rotate( buttonRect4, 150.0f, 1.0f).setEase(LeanTweenType.easeOutElastic);<br>
    * GUI.matrix = Matrix4x4.identity;<br>
    */

        public static LTDescr rotate(LTRect ltRect, float to, float time)
        {
            return pushNewTween(tweenEmpty, new Vector3(to, 0f, 0f), time, TweenAction.GUI_ROTATE,
                options().setRect(ltRect));
        }
Esempio n. 9
0
        /**
    * Scale a GUI Element to a certain width and height
    * 
    * @method LeanTween.scale (GUI)
    * @param {LTRect} LTRect ltRect LTRect object that you wish to move
    * @param {Vector2} Vector2 to The final width and height to scale to (pixel based)
    * @param {float} float time The time to complete the tween in
    * @return {LTDescr} LTDescr an object that distinguishes the tween
    * @example
    * <i>Example Javascript: </i><br>
    * var bRect:LTRect = new LTRect( 0, 0, 100, 50 );<br>
    * LeanTween.scale( bRect, Vector2(bRect.rect.width, bRect.rect.height) * 1.3, 0.25 ).setEase(LeanTweenType.easeOutBounce);<br>
    * function OnGUI(){<br>
    * &nbsp; if(GUI.Button(bRect.rect, "Scale")){ }<br>
    * }<br>
    * <br>
    * <i>Example C#: </i> <br>
    * LTRect bRect = new LTRect( 0f, 0f, 100f, 50f );<br>
    * LeanTween.scale( bRect, new Vector2(150f,75f), 0.25f ).setEase(LeanTweenType.easeOutBounce);<br>
    * void OnGUI(){<br>
    * &nbsp; if(GUI.Button(bRect.rect, "Scale")){ }<br>
    * }<br>
    */

        public static LTDescr scale(LTRect ltRect, Vector2 to, float time)
        {
            return pushNewTween(tweenEmpty, to, time, TweenAction.GUI_SCALE, options().setRect(ltRect));
        }
Esempio n. 10
0
 public static LTDescr destroyAfter(LTRect rect, float delayTime)
 {
     return pushNewTween(tweenEmpty, Vector3.zero, delayTime, TweenAction.CALLBACK,
         options().setRect(rect).setDestroyOnComplete(true));
 }
Esempio n. 11
0
 public static LTDescr moveMargin(LTRect ltRect, Vector2 to, float time)
 {
     return pushNewTween(tweenEmpty, to, time, TweenAction.GUI_MOVE_MARGIN, options().setRect(ltRect));
 }
Esempio n. 12
0
        /**
    * Fade a GUI Object
    * 
    * @method LeanTween.alpha
    * @param {LTRect} ltRect:LTRect LTRect that you wish to fade
    * @param {float} to:float the final alpha value (0-1)
    * @param {float} time:float The time with which to fade the object
    * @return {LTDescr} LTDescr an object that distinguishes the tween
    * @example
    * LeanTween.alpha(ltRect, 1f, 1f) .setEase(LeanTweenType.easeInCirc);
    */

        public static LTDescr alpha(LTRect ltRect, float to, float time)
        {
            ltRect.alphaEnabled = true;
            return pushNewTween(tweenEmpty, new Vector3(to, 0f, 0f), time, TweenAction.GUI_ALPHA,
                options().setRect(ltRect));
        }
Esempio n. 13
0
        /**
    * Test whether or not a tween is active on a LTRect
    * 
    * @method LeanTween.isTweening
    * @param {LTRect} ltRect:LTRect LTRect that you want to test if it is tweening
    */

        public static bool isTweening(LTRect ltRect)
        {
            for (int i = 0; i <= tweenMaxSearch; i++)
            {
                if (tweens[i].toggle && tweens[i].ltRect == ltRect)
                    return true;
            }
            return false;
        }
Esempio n. 14
0
        /**
    * Cancel a specific tween with the provided id
    * 
    * @method LeanTween.cancel
    * @param {LTRect} ltRect:LTRect LTRect object whose tweens you want to cancel
    * @param {float} id:int unique id that represents that tween
    */

        public static void cancel(LTRect ltRect, int uniqueId)
        {
            if (uniqueId >= 0)
            {
                init();
                int backId = uniqueId & 0xFFFF;
                int backCounter = uniqueId >> 16;
                // Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" action:"+(TweenAction)backType + " tweens[id].type:"+tweens[backId].type);
                if (tweens[backId].ltRect == ltRect && tweens[backId].counter == backCounter)
                    removeTween((int)backId);
            }
        }
Esempio n. 15
0
        public static void update(int updateLevel)
        {
            if (isGUIEnabled)
            {
                init();
                if (levelDepths[updateLevel] > 0)
                {
                    color = GUI.color;
                    int baseI = updateLevel * RECTS_PER_LEVEL;
                    int maxLoop = baseI + levelDepths[updateLevel]; // RECTS_PER_LEVEL;//;

                    for (int i = baseI; i < maxLoop; i++)
                    {
                        r = levels[i];
                        // Debug.Log("r:"+r+" i:"+i);
                        if (r != null /*&& checkOnScreen(r.rect)*/)
                        {
                            //Debug.Log("label:"+r.labelStr+" textColor:"+r.style.normal.textColor);
                            if (r.useColor)
                                GUI.color = r.color;
                            if (r.type == Element_Type.Label)
                            {
                                if (r.style != null)
                                    GUI.skin.label = r.style;
                                if (r.useSimpleScale)
                                {
                                    GUI.Label(
                                        new Rect((r.rect.x + r.margin.x + r.relativeRect.x) * r.relativeRect.width,
                                            (r.rect.y + r.margin.y + r.relativeRect.y) * r.relativeRect.height,
                                            r.rect.width * r.relativeRect.width, r.rect.height * r.relativeRect.height),
                                        r.labelStr);
                                }
                                else
                                {
                                    GUI.Label(
                                        new Rect(r.rect.x + r.margin.x, r.rect.y + r.margin.y, r.rect.width,
                                            r.rect.height), r.labelStr);
                                }
                            }
                            else if (r.type == Element_Type.Texture && r.texture != null)
                            {
                                Vector2 size = r.useSimpleScale
                                    ? new Vector2(0f, r.rect.height * r.relativeRect.height)
                                    : new Vector2(r.rect.width, r.rect.height);
                                if (r.sizeByHeight)
                                {
                                    size.x = (float)r.texture.width / (float)r.texture.height * size.y;
                                }
                                if (r.useSimpleScale)
                                {
                                    GUI.DrawTexture(
                                        new Rect((r.rect.x + r.margin.x + r.relativeRect.x) * r.relativeRect.width,
                                            (r.rect.y + r.margin.y + r.relativeRect.y) * r.relativeRect.height, size.x,
                                            size.y), r.texture);
                                }
                                else
                                {
                                    GUI.DrawTexture(
                                        new Rect(r.rect.x + r.margin.x, r.rect.y + r.margin.y, size.x, size.y),
                                        r.texture);
                                }
                            }
                        }
                    }
                    GUI.color = color;
                }
            }
        }
Esempio n. 16
0
public static int rotate(LTRect ltRect, float to, float time, Hashtable optional){
	init();
	if( optional==null || optional.Count == 0 )
		optional = new Hashtable();

	optional["rect"] = ltRect;
	return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ROTATE, optional );
}
Esempio n. 17
0
 public static LTRect label(LTRect rect, string label, int depth)
 {
     rect.type = Element_Type.Label;
     rect.labelStr = label;
     return element(rect, depth);
 }
Esempio n. 18
0
public static int rotate(LTRect ltRect, float to, float time, object[] optional){
	return rotate( ltRect, to, time, h(optional) );
}
Esempio n. 19
0
        public static LTRect element(LTRect rect, int depth)
        {
            isGUIEnabled = true;
            init();
            int maxLoop = depth * RECTS_PER_LEVEL + RECTS_PER_LEVEL;
            int k = 0;
            if (rect != null)
            {
                destroy(rect.id);
            }
            if (rect.type == LTGUI.Element_Type.Label && rect.style != null)
            {
                if (rect.style.normal.textColor.a <= 0f)
                {
                    Debug.LogWarning("Your GUI normal color has an alpha of zero, and will not be rendered.");
                }
            }
            if (rect.relativeRect.width == float.PositiveInfinity)
            {
                rect.relativeRect = new Rect(0f, 0f, Screen.width, Screen.height);
            }
            for (int i = depth * RECTS_PER_LEVEL; i < maxLoop; i++)
            {
                r = levels[i];
                if (r == null)
                {
                    r = rect;
                    r.rotateEnabled = true;
                    r.alphaEnabled = true;
                    r.setId(i, global_counter);
                    levels[i] = r;
                    // Debug.Log("k:"+k+ " maxDepth:"+levelDepths[depth]);
                    if (k >= levelDepths[depth])
                    {
                        levelDepths[depth] = k + 1;
                    }
                    global_counter++;
                    return r;
                }
                k++;
            }

            Debug.LogError("You ran out of GUI Element spaces");

            return null;
        }
Esempio n. 20
0
 public LTDescr setRect(LTRect rect)
 {
     this.ltRect = rect;
     return this;
 }