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); } } }
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); }