예제 #1
0
 static public int checkWithinRect_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
         UnityEngine.Vector2 a1;
         checkType(l, 1, out a1);
         UnityEngine.Rect a2;
         checkValueType(l, 2, out a2);
         var ret = LTGUI.checkWithinRect(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     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
 }
예제 #2
0
 static public int initRectCheck_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.initRectCheck();
         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
 }
예제 #3
0
    public static bool hasNoOverlap(Rect rect, int depth)
    {
        LTGUI.initRectCheck();
        bool result = true;
        bool flag   = false;

        for (int i = 0; i < LTGUI.buttonLevels.Length; i++)
        {
            if (LTGUI.buttonLevels[i] >= 0)
            {
                if (LTGUI.buttonLastFrame[i] + 1 < Time.frameCount)
                {
                    LTGUI.buttonLevels[i] = -1;
                }
                else if (LTGUI.buttonLevels[i] > depth && LTGUI.pressedWithinRect(LTGUI.buttons[i]))
                {
                    result = false;
                }
            }
            if (!flag && LTGUI.buttonLevels[i] < 0)
            {
                flag = true;
                LTGUI.buttonLevels[i]    = depth;
                LTGUI.buttons[i]         = rect;
                LTGUI.buttonLastFrame[i] = Time.frameCount;
            }
        }
        return(result);
    }
예제 #4
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;
         }
     }
 }
예제 #5
0
 static public int texture_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
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 1, typeof(UnityEngine.Rect), typeof(UnityEngine.Texture), typeof(int)))
         {
             UnityEngine.Rect a1;
             checkValueType(l, 1, out a1);
             UnityEngine.Texture a2;
             checkType(l, 2, out a2);
             System.Int32 a3;
             checkType(l, 3, out a3);
             var ret = LTGUI.texture(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 1, typeof(LTRect), typeof(UnityEngine.Texture), typeof(int)))
         {
             LTRect a1;
             checkType(l, 1, out a1);
             UnityEngine.Texture a2;
             checkType(l, 2, out a2);
             System.Int32 a3;
             checkType(l, 3, out a3);
             var ret = LTGUI.texture(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function texture to call");
         return(2);
     }
     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
 }
예제 #6
0
 static public int reset_s(IntPtr l)
 {
     try {
         LTGUI.reset();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #7
0
 static public int initRectCheck_s(IntPtr l)
 {
     try {
         LTGUI.initRectCheck();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #8
0
    public static bool pressedWithinRect(Rect rect)
    {
        Vector2 vector = LTGUI.firstTouch();

        if (vector.x < 0f)
        {
            return(false);
        }
        float num = (float)Screen.height - vector.y;

        return(vector.x > rect.x && vector.x < rect.x + rect.width && num > rect.y && num < rect.y + rect.height);
    }
예제 #9
0
 static public int firstTouch_s(IntPtr l)
 {
     try {
         var ret = LTGUI.firstTouch();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #10
0
 static public int destroy_s(IntPtr l)
 {
     try {
         System.Int32 a1;
         checkType(l, 1, out a1);
         LTGUI.destroy(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #11
0
 static public int constructor(IntPtr l)
 {
     try {
         LTGUI o;
         o = new LTGUI();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #12
0
 static public int checkOnScreen_s(IntPtr l)
 {
     try {
         UnityEngine.Rect a1;
         checkValueType(l, 1, out a1);
         var ret = LTGUI.checkOnScreen(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #13
0
 static public int hasNoOverlap_s(IntPtr l)
 {
     try {
         UnityEngine.Rect a1;
         checkValueType(l, 1, out a1);
         System.Int32 a2;
         checkType(l, 2, out a2);
         var ret = LTGUI.hasNoOverlap(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #14
0
 static public int checkWithinRect_s(IntPtr l)
 {
     try {
         UnityEngine.Vector2 a1;
         checkType(l, 1, out a1);
         UnityEngine.Rect a2;
         checkValueType(l, 2, out a2);
         var ret = LTGUI.checkWithinRect(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #15
0
 static public int element_s(IntPtr l)
 {
     try {
         LTRect a1;
         checkType(l, 1, out a1);
         System.Int32 a2;
         checkType(l, 2, out a2);
         var ret = LTGUI.element(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #16
0
    public static bool pressedWithinRect(Rect rect)
    {
        Vector2 vector2 = LTGUI.firstTouch();

        if (vector2.x < 0f)
        {
            return(false);
        }
        float single = (float)Screen.height - vector2.y;

        if (vector2.x <= rect.x || vector2.x >= rect.x + rect.width || single <= rect.y)
        {
            return(false);
        }
        return(single < rect.y + rect.height);
    }
예제 #17
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);
    }
예제 #18
0
 static public int texture_s(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 1, typeof(LTRect), typeof(UnityEngine.Texture), typeof(int)))
         {
             LTRect a1;
             checkType(l, 1, out a1);
             UnityEngine.Texture a2;
             checkType(l, 2, out a2);
             System.Int32 a3;
             checkType(l, 3, out a3);
             var ret = LTGUI.texture(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 1, typeof(UnityEngine.Rect), typeof(UnityEngine.Texture), typeof(int)))
         {
             UnityEngine.Rect a1;
             checkValueType(l, 1, out a1);
             UnityEngine.Texture a2;
             checkType(l, 2, out a2);
             System.Int32 a3;
             checkType(l, 3, out a3);
             var ret = LTGUI.texture(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #19
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;
            }
        }
    }
예제 #20
0
 public static LTRect label(Rect rect, string label, int depth)
 {
     return(LTGUI.label(new LTRect(rect), label, depth));
 }
예제 #21
0
 public static LTRect texture(Rect rect, Texture texture, int depth)
 {
     return(LTGUI.texture(new LTRect(rect), texture, depth));
 }
예제 #22
0
 public static LTRect label(LTRect rect, string label, int depth)
 {
     rect.type     = LTGUI.Element_Type.Label;
     rect.labelStr = label;
     return(LTGUI.element(rect, depth));
 }
예제 #23
0
 public static LTRect texture(LTRect rect, Texture texture, int depth)
 {
     rect.type    = LTGUI.Element_Type.Texture;
     rect.texture = texture;
     return(LTGUI.element(rect, depth));
 }