Exemple #1
0
        public static void update(int updateLevel)
        {
            if (!isGUIEnabled)
            {
                return;
            }
            init();
            if (levelDepths[updateLevel] <= 0)
            {
                return;
            }
            color = GUI.color;
            int num  = updateLevel * RECTS_PER_LEVEL;
            int num2 = num + levelDepths[updateLevel];

            for (int i = num; i < num2; i++)
            {
                r = levels[i];
                if (r == null)
                {
                    continue;
                }
                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 vector = (!r.useSimpleScale) ? new Vector2(r.rect.width, r.rect.height) : new Vector2(0f, r.rect.height * r.relativeRect.height);
                    if (r.sizeByHeight)
                    {
                        vector.x = (float)r.texture.width / (float)r.texture.height * vector.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, vector.x, vector.y), r.texture);
                    }
                    else
                    {
                        GUI.DrawTexture(new Rect(r.rect.x + r.margin.x, r.rect.y + r.margin.y, vector.x, vector.y), r.texture);
                    }
                }
            }
            GUI.color = color;
        }
 public static void update(int updateLevel)
 {
     if (LTGUI.isGUIEnabled)
     {
         LTGUI.init();
         if (LTGUI.levelDepths[updateLevel] > 0)
         {
             LTGUI.color = GUI.get_color();
             int num  = updateLevel * LTGUI.RECTS_PER_LEVEL;
             int num2 = num + LTGUI.levelDepths[updateLevel];
             for (int i = num; i < num2; i++)
             {
                 LTGUI.r = LTGUI.levels[i];
                 if (LTGUI.r != null)
                 {
                     if (LTGUI.r.useColor)
                     {
                         GUI.set_color(LTGUI.r.color);
                     }
                     if (LTGUI.r.type == LTGUI.Element_Type.Label)
                     {
                         if (LTGUI.r.style != null)
                         {
                             GUI.get_skin().set_label(LTGUI.r.style);
                         }
                         if (LTGUI.r.useSimpleScale)
                         {
                             GUI.Label(new Rect((LTGUI.r.rect.get_x() + LTGUI.r.margin.x + LTGUI.r.relativeRect.get_x()) * LTGUI.r.relativeRect.get_width(), (LTGUI.r.rect.get_y() + LTGUI.r.margin.y + LTGUI.r.relativeRect.get_y()) * LTGUI.r.relativeRect.get_height(), LTGUI.r.rect.get_width() * LTGUI.r.relativeRect.get_width(), LTGUI.r.rect.get_height() * LTGUI.r.relativeRect.get_height()), LTGUI.r.labelStr);
                         }
                         else
                         {
                             GUI.Label(new Rect(LTGUI.r.rect.get_x() + LTGUI.r.margin.x, LTGUI.r.rect.get_y() + LTGUI.r.margin.y, LTGUI.r.rect.get_width(), LTGUI.r.rect.get_height()), LTGUI.r.labelStr);
                         }
                     }
                     else if (LTGUI.r.type == LTGUI.Element_Type.Texture && LTGUI.r.texture != null)
                     {
                         Vector2 vector = (!LTGUI.r.useSimpleScale) ? new Vector2(LTGUI.r.rect.get_width(), LTGUI.r.rect.get_height()) : new Vector2(0f, LTGUI.r.rect.get_height() * LTGUI.r.relativeRect.get_height());
                         if (LTGUI.r.sizeByHeight)
                         {
                             vector.x = (float)LTGUI.r.texture.get_width() / (float)LTGUI.r.texture.get_height() * vector.y;
                         }
                         if (LTGUI.r.useSimpleScale)
                         {
                             GUI.DrawTexture(new Rect((LTGUI.r.rect.get_x() + LTGUI.r.margin.x + LTGUI.r.relativeRect.get_x()) * LTGUI.r.relativeRect.get_width(), (LTGUI.r.rect.get_y() + LTGUI.r.margin.y + LTGUI.r.relativeRect.get_y()) * LTGUI.r.relativeRect.get_height(), vector.x, vector.y), LTGUI.r.texture);
                         }
                         else
                         {
                             GUI.DrawTexture(new Rect(LTGUI.r.rect.get_x() + LTGUI.r.margin.x, LTGUI.r.rect.get_y() + LTGUI.r.margin.y, vector.x, vector.y), LTGUI.r.texture);
                         }
                     }
                 }
             }
             GUI.set_color(LTGUI.color);
         }
     }
 }
Exemple #3
0
        public static LTRect element(LTRect rect, int depth)
        {
            isGUIEnabled = true;
            init();
            int num  = depth * RECTS_PER_LEVEL + RECTS_PER_LEVEL;
            int num2 = 0;

            if (rect != null)
            {
                destroy(rect.id);
            }
            if (rect.type == Element_Type.Label && rect.style != null)
            {
                Color textColor = rect.style.normal.textColor;
                if (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 < num; i++)
            {
                r = levels[i];
                if (r == null)
                {
                    r = rect;
                    r.rotateEnabled = true;
                    r.alphaEnabled  = true;
                    r.setId(i, global_counter);
                    levels[i] = r;
                    if (num2 >= levelDepths[depth])
                    {
                        levelDepths[depth] = num2 + 1;
                    }
                    global_counter++;
                    return(r);
                }
                num2++;
            }
            Debug.LogError("You ran out of GUI Element spaces");
            return(null);
        }
        public static LTRect element(LTRect rect, int depth)
        {
            LTGUI.isGUIEnabled = true;
            LTGUI.init();
            int num  = depth * LTGUI.RECTS_PER_LEVEL + LTGUI.RECTS_PER_LEVEL;
            int num2 = 0;

            if (rect != null)
            {
                LTGUI.destroy(rect.id);
            }
            if (rect.type == LTGUI.Element_Type.Label && rect.style != null && rect.style.get_normal().get_textColor().a <= 0f)
            {
                Debug.LogWarning("Your GUI normal color has an alpha of zero, and will not be rendered.");
            }
            if (rect.relativeRect.get_width() == float.PositiveInfinity)
            {
                rect.relativeRect = new Rect(0f, 0f, (float)Screen.get_width(), (float)Screen.get_height());
            }
            for (int i = depth * LTGUI.RECTS_PER_LEVEL; i < num; i++)
            {
                LTGUI.r = LTGUI.levels[i];
                if (LTGUI.r == null)
                {
                    LTGUI.r = rect;
                    LTGUI.r.rotateEnabled = true;
                    LTGUI.r.alphaEnabled  = true;
                    LTGUI.r.setId(i, LTGUI.global_counter);
                    LTGUI.levels[i] = LTGUI.r;
                    if (num2 >= LTGUI.levelDepths[depth])
                    {
                        LTGUI.levelDepths[depth] = num2 + 1;
                    }
                    LTGUI.global_counter++;
                    return(LTGUI.r);
                }
                num2++;
            }
            Debug.LogError("You ran out of GUI Element spaces");
            return(null);
        }
 public LTDescr setRect(Rect rect)
 {
     this.ltRect = new LTRect(rect);
     return(this);
 }
 public LTDescr setRect(LTRect rect)
 {
     this.ltRect = rect;
     return(this);
 }
 public static LTRect texture(LTRect rect, Texture texture, int depth)
 {
     rect.type    = LTGUI.Element_Type.Texture;
     rect.texture = texture;
     return(LTGUI.element(rect, depth));
 }
 public static LTRect label(LTRect rect, string label, int depth)
 {
     rect.type     = LTGUI.Element_Type.Label;
     rect.labelStr = label;
     return(LTGUI.element(rect, depth));
 }
Exemple #9
0
 public static bool LTIsTweening(this Transform self, LTRect ltRect)
 {
     return(LeanTween.isTweening(ltRect));
 }
Exemple #10
0
 public static void LTCancel(this Transform self, LTRect ltRect, int uniqueId)
 {
     LeanTween.cancel(ltRect, uniqueId);
 }