Abstract base class for HorizontalLayoutGroup and VerticalLayoutGroup.
protected override void Awake() { directionSign = -1; GridLayoutGroup layout = content.GetComponent <GridLayoutGroup>(); if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedColumnCount) { Debug.LogError("[LoopHorizontalScrollRect] unsupported GridLayoutGroup constraint"); } if (layout != null) { m_Padding = layout.padding.top + layout.padding.bottom; } else { HorizontalOrVerticalLayoutGroup layout1 = content.GetComponent <HorizontalOrVerticalLayoutGroup>(); if (layout1 != null) { m_Padding = layout1.padding.top + layout1.padding.bottom; } } base.Awake(); }
static public int set_spacing(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.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); float v; checkType(l, 2, out v); self.spacing = v; 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 }
static public int get_childForceExpandWidth(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.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); pushValue(l, true); pushValue(l, self.childForceExpandWidth); 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 }
static public int set_childForceExpandHeight(IntPtr l) { UnityEngine.UI.HorizontalOrVerticalLayoutGroup o = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); bool v; checkType(l, 2, out v); o.childForceExpandHeight = v; return(0); }
static public int set_spacing(IntPtr l) { UnityEngine.UI.HorizontalOrVerticalLayoutGroup o = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); float v; checkType(l, 2, out v); o.spacing = v; return(0); }
static public int get_childControlWidth(IntPtr l) { try { UnityEngine.UI.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); pushValue(l, self.childControlWidth); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_childForceExpandHeight(IntPtr l) { try { UnityEngine.UI.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); pushValue(l, true); pushValue(l, self.childForceExpandHeight); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_spacing(IntPtr l) { try { UnityEngine.UI.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); pushValue(l, true); pushValue(l, self.spacing); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_spacing(IntPtr l) { try { UnityEngine.UI.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); pushValue(l, self.spacing); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int set_childForceExpandHeight(IntPtr l) { try { UnityEngine.UI.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); bool v; checkType(l, 2, out v); self.childForceExpandHeight = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static public int set_spacing(IntPtr l) { try { UnityEngine.UI.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); float v; checkType(l, 2, out v); self.spacing = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static public int set_childControlHeight(IntPtr l) { try { UnityEngine.UI.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); bool v; checkType(l, 2, out v); self.childControlHeight = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_childForceExpandWidth(IntPtr l) { try { UnityEngine.UI.HorizontalOrVerticalLayoutGroup self = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); bool v; checkType(l, 2, out v); self.childForceExpandWidth = v; return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static int get_childForceExpandHeight(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup obj = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)o; bool ret = obj.childForceExpandHeight; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index childForceExpandHeight on a nil value" : e.Message)); } }
static int set_childScaleHeight(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup obj = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.childScaleHeight = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index childScaleHeight on a nil value")); } }
static int set_childForceExpandWidth(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup obj = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.childForceExpandWidth = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index childForceExpandWidth on a nil value" : e.Message)); } }
static int get_spacing(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup obj = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)o; float ret = obj.spacing; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index spacing on a nil value" : e.Message)); } }
static int get_childControlWidth(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup obj = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)o; bool ret = obj.childControlWidth; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index childControlWidth on a nil value")); } }
static int set_spacing(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup obj = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.spacing = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index spacing on a nil value" : e.Message)); } }
static public int get_spacing(IntPtr l) { UnityEngine.UI.HorizontalOrVerticalLayoutGroup o = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); pushValue(l, o.spacing); return(1); }
static public int get_childForceExpandHeight(IntPtr l) { UnityEngine.UI.HorizontalOrVerticalLayoutGroup o = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)checkSelf(l); pushValue(l, o.childForceExpandHeight); return(1); }
protected override void Awake() { base.Awake(); _layoutGroup = GetComponent <UnityUI.HorizontalOrVerticalLayoutGroup>(); }
static int QPYX_get_childControlWidth_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup QPYX_obj_YXQP = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)QPYX_o_YXQP; bool QPYX_ret_YXQP = QPYX_obj_YXQP.childControlWidth; LuaDLL.lua_pushboolean(L_YXQP, QPYX_ret_YXQP); return(1); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index childControlWidth on a nil value")); } }
static int QPYX_get_spacing_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup QPYX_obj_YXQP = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)QPYX_o_YXQP; float QPYX_ret_YXQP = QPYX_obj_YXQP.spacing; LuaDLL.lua_pushnumber(L_YXQP, QPYX_ret_YXQP); return(1); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index spacing on a nil value")); } }
static int QPYX_set_childControlHeight_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); UnityEngine.UI.HorizontalOrVerticalLayoutGroup QPYX_obj_YXQP = (UnityEngine.UI.HorizontalOrVerticalLayoutGroup)QPYX_o_YXQP; bool QPYX_arg0_YXQP = LuaDLL.luaL_checkboolean(L_YXQP, 2); QPYX_obj_YXQP.childControlHeight = QPYX_arg0_YXQP; return(0); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index childControlHeight on a nil value")); } }
/// <summary> /// Caches and initializes the scroller /// </summary> void Awake() { GameObject go; // cache some components _scrollRect = this.GetComponent<ScrollRect>(); _scrollRectTransform = _scrollRect.GetComponent<RectTransform>(); // destroy any content objects if they exist. Likely there will be // one at design time because Unity gives errors if it can't find one. if (_scrollRect.content != null) { DestroyImmediate(_scrollRect.content.gameObject); } // Create a new active cell view container with a layout group go = new GameObject("Container", typeof(RectTransform)); go.transform.SetParent(_scrollRectTransform, false); if (scrollDirection == ScrollDirectionEnum.Vertical) go.AddComponent<VerticalLayoutGroup>(); else go.AddComponent<HorizontalLayoutGroup>(); _container = go.GetComponent<RectTransform>(); // set the containers anchor and pivot if (scrollDirection == ScrollDirectionEnum.Vertical) { _container.anchorMin = new Vector2(0, 1); _container.anchorMax = Vector2.one; _container.pivot = new Vector2(0.5f, 1f); } else { _container.anchorMin = Vector2.zero; _container.anchorMax = new Vector2(0, 1f); _container.pivot = new Vector2(0, 0.5f); } _container.offsetMax = Vector2.zero; _container.offsetMin = Vector2.zero; _container.localScale = Vector3.one; _scrollRect.content = _container; // cache the scrollbar if it exists if (scrollDirection == ScrollDirectionEnum.Vertical) { _scrollbar = _scrollRect.verticalScrollbar; } else { _scrollbar = _scrollRect.horizontalScrollbar; } // cache the layout group and set up its spacing and padding _layoutGroup = _container.GetComponent<HorizontalOrVerticalLayoutGroup>(); _layoutGroup.spacing = spacing; _layoutGroup.padding = padding; _layoutGroup.childAlignment = TextAnchor.UpperLeft; _layoutGroup.childForceExpandHeight = (scrollDirection == ScrollDirectionEnum.Vertical ? false : true); _layoutGroup.childForceExpandWidth = (scrollDirection == ScrollDirectionEnum.Vertical ? true : false); // force the scroller to scroll in the direction we want _scrollRect.horizontal = scrollDirection == ScrollDirectionEnum.Horizontal; _scrollRect.vertical = scrollDirection == ScrollDirectionEnum.Vertical; // create the padder objects go = new GameObject("First Padder", typeof(RectTransform), typeof(LayoutElement)); go.transform.SetParent(_container, false); _firstPadder = go.GetComponent<LayoutElement>(); go = new GameObject("Last Padder", typeof(RectTransform), typeof(LayoutElement)); go.transform.SetParent(_container, false); _lastPadder = go.GetComponent<LayoutElement>(); // create the recycled cell view container go = new GameObject("Recycled Cells", typeof(RectTransform)); go.transform.SetParent(_scrollRect.transform, false); _recycledCellViewContainer = go.GetComponent<RectTransform>(); _recycledCellViewContainer.gameObject.SetActive(false); // set up the last values for updates _lastScrollRectSize = ScrollRectSize; _lastLoop = loop; _lastScrollbarVisibility = scrollbarVisibility; }