init() public static method

public static init ( ) : void
return void
Exemplo n.º 1
0
 static public int init_s(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         LTGUI.init();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Exemplo n.º 2
0
 public static void update(int updateLevel)
 {
     if (LTGUI.isGUIEnabled)
     {
         LTGUI.init();
         if (LTGUI.levelDepths[updateLevel] > 0)
         {
             LTGUI.color = GUI.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.color = LTGUI.r.color;
                     }
                     if (LTGUI.r.type == LTGUI.Element_Type.Label)
                     {
                         if (LTGUI.r.style != null)
                         {
                             GUI.skin.label = LTGUI.r.style;
                         }
                         if (LTGUI.r.useSimpleScale)
                         {
                             GUI.Label(new Rect((LTGUI.r.rect.x + LTGUI.r.margin.x + LTGUI.r.relativeRect.x) * LTGUI.r.relativeRect.width, (LTGUI.r.rect.y + LTGUI.r.margin.y + LTGUI.r.relativeRect.y) * LTGUI.r.relativeRect.height, LTGUI.r.rect.width * LTGUI.r.relativeRect.width, LTGUI.r.rect.height * LTGUI.r.relativeRect.height), LTGUI.r.labelStr);
                         }
                         else
                         {
                             GUI.Label(new Rect(LTGUI.r.rect.x + LTGUI.r.margin.x, LTGUI.r.rect.y + LTGUI.r.margin.y, LTGUI.r.rect.width, LTGUI.r.rect.height), LTGUI.r.labelStr);
                         }
                     }
                     else if (LTGUI.r.type == LTGUI.Element_Type.Texture && LTGUI.r.texture != null)
                     {
                         Vector2 vector = LTGUI.r.useSimpleScale ? new Vector2(0f, LTGUI.r.rect.height * LTGUI.r.relativeRect.height) : new Vector2(LTGUI.r.rect.width, LTGUI.r.rect.height);
                         if (LTGUI.r.sizeByHeight)
                         {
                             vector.x = (float)LTGUI.r.texture.width / (float)LTGUI.r.texture.height * vector.y;
                         }
                         if (LTGUI.r.useSimpleScale)
                         {
                             GUI.DrawTexture(new Rect((LTGUI.r.rect.x + LTGUI.r.margin.x + LTGUI.r.relativeRect.x) * LTGUI.r.relativeRect.width, (LTGUI.r.rect.y + LTGUI.r.margin.y + LTGUI.r.relativeRect.y) * LTGUI.r.relativeRect.height, vector.x, vector.y), LTGUI.r.texture);
                         }
                         else
                         {
                             GUI.DrawTexture(new Rect(LTGUI.r.rect.x + LTGUI.r.margin.x, LTGUI.r.rect.y + LTGUI.r.margin.y, vector.x, vector.y), LTGUI.r.texture);
                         }
                     }
                 }
             }
             GUI.color = LTGUI.color;
         }
     }
 }
Exemplo n.º 3
0
 static public int init_s(IntPtr l)
 {
     try {
         LTGUI.init();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 4
0
    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 != null && rect.type == LTGUI.Element_Type.Label && rect.style != null && rect.style.normal.textColor.a <= 0f)
        {
            Debug.LogWarning("Your GUI normal color has an alpha of zero, and will not be rendered.");
        }
        if (rect != null && rect.relativeRect.width == float.PositiveInfinity)
        {
            rect.relativeRect = new Rect(0f, 0f, (float)Screen.width, (float)Screen.height);
        }
        for (int i = depth * LTGUI.RECTS_PER_LEVEL; i < num; i++)
        {
            LTGUI.r = LTGUI.levels[i];
            if (LTGUI.r == null)
            {
                LTGUI.r = rect;
                if (LTGUI.r != null)
                {
                    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);
    }
Exemplo n.º 5
0
    public static void update(int updateLevel)
    {
        Rect    rect;
        Vector2 vector2;

        if (LTGUI.isGUIEnabled)
        {
            LTGUI.init();
            if (LTGUI.levelDepths[updateLevel] > 0)
            {
                LTGUI.color = GUI.color;
                int num  = updateLevel * LTGUI.RECTS_PER_LEVEL;
                int num1 = num + LTGUI.levelDepths[updateLevel];
                for (int i = num; i < num1; i++)
                {
                    LTGUI.r = LTGUI.levels[i];
                    if (LTGUI.r != null)
                    {
                        if (LTGUI.r.useColor)
                        {
                            GUI.color = LTGUI.r.color;
                        }
                        if (LTGUI.r.type == LTGUI.Element_Type.Label)
                        {
                            if (LTGUI.r.style != null)
                            {
                                GUI.skin.label = LTGUI.r.style;
                            }
                            if (!LTGUI.r.useSimpleScale)
                            {
                                rect = LTGUI.r.rect;
                                float single = rect.x + LTGUI.r.margin.x;
                                rect = LTGUI.r.rect;
                                float single1 = rect.y + LTGUI.r.margin.y;
                                float single2 = LTGUI.r.rect.width;
                                rect = LTGUI.r.rect;
                                GUI.Label(new Rect(single, single1, single2, rect.height), LTGUI.r.labelStr);
                            }
                            else
                            {
                                rect = LTGUI.r.rect;
                                float single3 = (rect.x + LTGUI.r.margin.x + LTGUI.r.relativeRect.x) * LTGUI.r.relativeRect.width;
                                rect = LTGUI.r.rect;
                                float single4 = (rect.y + LTGUI.r.margin.y + LTGUI.r.relativeRect.y) * LTGUI.r.relativeRect.height;
                                rect = LTGUI.r.rect;
                                float single5 = rect.width * LTGUI.r.relativeRect.width;
                                rect = LTGUI.r.rect;
                                GUI.Label(new Rect(single3, single4, single5, rect.height * LTGUI.r.relativeRect.height), LTGUI.r.labelStr);
                            }
                        }
                        else if (LTGUI.r.type == LTGUI.Element_Type.Texture && LTGUI.r.texture != null)
                        {
                            if (LTGUI.r.useSimpleScale)
                            {
                                rect    = LTGUI.r.rect;
                                vector2 = new Vector2(0f, rect.height * LTGUI.r.relativeRect.height);
                            }
                            else
                            {
                                float single6 = LTGUI.r.rect.width;
                                rect    = LTGUI.r.rect;
                                vector2 = new Vector2(single6, rect.height);
                            }
                            Vector2 vector21 = vector2;
                            if (LTGUI.r.sizeByHeight)
                            {
                                vector21.x = (float)LTGUI.r.texture.width / (float)LTGUI.r.texture.height * vector21.y;
                            }
                            if (!LTGUI.r.useSimpleScale)
                            {
                                rect = LTGUI.r.rect;
                                float single7 = rect.x + LTGUI.r.margin.x;
                                rect = LTGUI.r.rect;
                                GUI.DrawTexture(new Rect(single7, rect.y + LTGUI.r.margin.y, vector21.x, vector21.y), LTGUI.r.texture);
                            }
                            else
                            {
                                rect = LTGUI.r.rect;
                                float single8 = (rect.x + LTGUI.r.margin.x + LTGUI.r.relativeRect.x) * LTGUI.r.relativeRect.width;
                                rect = LTGUI.r.rect;
                                GUI.DrawTexture(new Rect(single8, (rect.y + LTGUI.r.margin.y + LTGUI.r.relativeRect.y) * LTGUI.r.relativeRect.height, vector21.x, vector21.y), LTGUI.r.texture);
                            }
                        }
                    }
                }
                GUI.color = LTGUI.color;
            }
        }
    }