SetLayoutHorizontal() public method

Called by the layout system.

public SetLayoutHorizontal ( ) : void
return void
 static public int SetLayoutHorizontal(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.UI.GridLayoutGroup self = (UnityEngine.UI.GridLayoutGroup)checkSelf(l);
         self.SetLayoutHorizontal();
         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
 }
Beispiel #2
0
        private void Start()
        {
            gridRect = GetComponentInParent<RectTransform>();
            gridCanvas = GetComponentInParent<Canvas>();
            gridLayout = GetComponentInParent<GridLayoutGroup>();

            gridRect.pivot = new Vector2(0, 0);
            gridRect.position = new Vector3(terrainMesh.transform.position.x, 6.0f, terrainMesh.transform.position.z);
            gridRect.anchorMin = new Vector2(terrainMesh.transform.position.x, terrainMesh.transform.position.z);
            gridRect.anchorMax = new Vector2(terrainMesh.terrainData.size.x, terrainMesh.terrainData.size.z);

            gridLayout.CalculateLayoutInputHorizontal();

            Debug.Log(string.Format("Origin: {0}, Size: {1}, Cell size: {2}\n", gridRect.position.ToString(), gridRect.rect.size.ToString(), gridLayout.cellSize));

            buttonTemplate = GetComponentInChildren<Button>();
            for (int y = 0; y < gridRect.rect.y; y++)
            {
                for (int x = 0; x < gridRect.rect.x; x++)
                {
                    Vector3 pos = new Vector3(x, 0, y); // * spacing;
                    Button b = (Button)Instantiate(buttonTemplate, pos, Quaternion.identity);
                    //b.gameObject.AddComponent<LayoutElement>();

                    //b.name = "Button " + x.ToString() + "," + y.ToString();
                    //b.GetComponentInChildren<Text>().text = b.name;
                    gridLayout.SetLayoutHorizontal();
                }
            }
        }
Beispiel #3
0
 void UpdataLayout(UnityEngine.UI.GridLayoutGroup _gridLayoutGroup)
 {
     _gridLayoutGroup.CalculateLayoutInputHorizontal();
     _gridLayoutGroup.CalculateLayoutInputVertical();
     _gridLayoutGroup.SetLayoutHorizontal();
     _gridLayoutGroup.SetLayoutVertical();
     _gridLayoutGroup.enabled = false;
 }
Beispiel #4
0
 static public int SetLayoutHorizontal(IntPtr l)
 {
     try {
         UnityEngine.UI.GridLayoutGroup self = (UnityEngine.UI.GridLayoutGroup)checkSelf(l);
         self.SetLayoutHorizontal();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int QPYX_SetLayoutHorizontal_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.UI.GridLayoutGroup QPYX_obj_YXQP = (UnityEngine.UI.GridLayoutGroup)ToLua.CheckObject <UnityEngine.UI.GridLayoutGroup>(L_YXQP, 1);
         QPYX_obj_YXQP.SetLayoutHorizontal();
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int SetLayoutHorizontal(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.UI.GridLayoutGroup obj = (UnityEngine.UI.GridLayoutGroup)ToLua.CheckObject(L, 1, typeof(UnityEngine.UI.GridLayoutGroup));
         obj.SetLayoutHorizontal();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }