static public int set_childAlignment(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.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         UnityEngine.TextAnchor     v;
         v = (UnityEngine.TextAnchor)LuaDLL.luaL_checkinteger(l, 2);
         self.childAlignment = 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 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.LayoutGroup self = (UnityEngine.UI.LayoutGroup)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
 }
示例#3
0
        protected override void OnInit()
        {
            _uiTile         = GetComponent <UnityEngine.UI.LayoutGroup>();
            cachedTransform = _uiTile.transform;
            if (Widget.parent != null && Widget.parent.parent != null)
            {
                scrollView = Widget.parent.parent.gameObject.GetComponentInChildren <UnityEngine.UI.ScrollRect>(); //GetComponent<ScrollRect>();
            }
            if (scrollView == null)
            {
                scrollView = Widget.parent.parent.gameObject.GetComponent <UnityEngine.UI.ScrollRect>();
            }
            if (scrollView != null)
            {
                UnityAction <Vector2> valueChange = new UnityAction <Vector2>(OnValueChanged);
                scrollView.onValueChanged.AddListener(valueChange);
            }
            GridLayoutGroup tempGroup = _uiTile as GridLayoutGroup;

            if (isHorizontal)
            {
                nLineWidth = tempGroup.cellSize.x + tempGroup.spacing.x;
            }
            else
            {
                nLineWidth = tempGroup.cellSize.y + tempGroup.spacing.y;
            }

            base.OnInit();
        }
示例#4
0
 static public int set_padding(IntPtr l)
 {
     UnityEngine.UI.LayoutGroup o = (UnityEngine.UI.LayoutGroup)checkSelf(l);
     UnityEngine.RectOffset     v;
     checkType(l, 2, out v);
     o.padding = v;
     return(0);
 }
示例#5
0
 static public int set_childAlignment(IntPtr l)
 {
     UnityEngine.UI.LayoutGroup o = (UnityEngine.UI.LayoutGroup)checkSelf(l);
     UnityEngine.TextAnchor     v;
     checkEnum(l, 2, out v);
     o.childAlignment = v;
     return(0);
 }
示例#6
0
 static public int get_childAlignment(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         pushEnum(l, (int)self.childAlignment);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#7
0
 static public int CalculateLayoutInputHorizontal(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         self.CalculateLayoutInputHorizontal();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#8
0
 static public int get_padding(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         pushValue(l, self.padding);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#9
0
 static public int SetLayoutVertical(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         self.SetLayoutVertical();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#10
0
 static public int CalculateLayoutInputVertical(IntPtr l)
 {
     try{
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         self.CalculateLayoutInputVertical();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
示例#11
0
 static public int get_layoutPriority(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         pushValue(l, self.layoutPriority);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
示例#12
0
 static public int SetLayoutHorizontal(IntPtr l)
 {
     try{
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         self.SetLayoutHorizontal();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int get_flexibleHeight(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.flexibleHeight);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int SetLayoutHorizontal(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         self.SetLayoutHorizontal();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_layoutPriority(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.layoutPriority);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int CalculateLayoutInputVertical(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         self.CalculateLayoutInputVertical();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#17
0
 static public int set_childAlignment(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         UnityEngine.TextAnchor     v;
         checkEnum(l, 2, out v);
         self.childAlignment = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#18
0
 static public int set_padding(IntPtr l)
 {
     try {
         UnityEngine.UI.LayoutGroup self = (UnityEngine.UI.LayoutGroup)checkSelf(l);
         UnityEngine.RectOffset     v;
         checkType(l, 2, out v);
         self.padding = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#19
0
 static int QPYX_SetLayoutVertical_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.UI.LayoutGroup QPYX_obj_YXQP = (UnityEngine.UI.LayoutGroup)ToLua.CheckObject <UnityEngine.UI.LayoutGroup>(L_YXQP, 1);
         QPYX_obj_YXQP.SetLayoutVertical();
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int SetLayoutVertical(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)ToLua.CheckObject <UnityEngine.UI.LayoutGroup>(L, 1);
         obj.SetLayoutVertical();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int CalculateLayoutInputHorizontal(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)ToLua.CheckObject <UnityEngine.UI.LayoutGroup>(L, 1);
         obj.CalculateLayoutInputHorizontal();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int set_childAlignment(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj  = (UnityEngine.UI.LayoutGroup)o;
            UnityEngine.TextAnchor     arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextAnchor));
            obj.childAlignment = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index childAlignment on a nil value"));
        }
    }
    static int set_padding(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj  = (UnityEngine.UI.LayoutGroup)o;
            UnityEngine.RectOffset     arg0 = (UnityEngine.RectOffset)ToLua.CheckObject(L, 2, typeof(UnityEngine.RectOffset));
            obj.padding = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index padding on a nil value"));
        }
    }
    static int get_layoutPriority(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)o;
            int ret = obj.layoutPriority;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index layoutPriority on a nil value"));
        }
    }
    static int get_flexibleHeight(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)o;
            float ret = obj.flexibleHeight;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index flexibleHeight on a nil value"));
        }
    }
    static int get_childAlignment(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)o;
            UnityEngine.TextAnchor     ret = obj.childAlignment;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index childAlignment on a nil value"));
        }
    }
    static int get_padding(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)o;
            UnityEngine.RectOffset     ret = obj.padding;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index padding on a nil value"));
        }
    }
    static int get_preferredHeight(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)o;
            float ret = obj.preferredHeight;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index preferredHeight on a nil value" : e.Message));
        }
    }
示例#29
0
        public override void Rebuild(CanvasUpdate executing)
        {
            if (executing != CanvasUpdate.PostLayout)
            {
                return;
            }
            base.Rebuild(executing);

            if (content.childCount > 1)
            {
                m_Gap = (content.GetChild(1) as RectTransform).anchoredPosition - (content.GetChild(0) as RectTransform).anchoredPosition;
            }

            Vector2 v = -((RectTransform)transform).sizeDelta / 2;

            v.y = -v.y;
            SetContentAnchoredPosition(v);
            movementType = MovementType.Unrestricted;

            if (Application.isPlaying)
            {
                LayoutGroup group = transform.GetComponentInChildren <LayoutGroup>();
                if (group)
                {
//					Vector2 itemPos = Vector2.one;
//					Vector2 itemSize = Vector2.one;
//					Vector2 itemAnchorMin = Vector2.one;
//					Vector2 itemAnchorMax = Vector2.one;
//					Vector2 itemPivot = Vector2.one;
//					Vector2 itemOffsetMin = Vector2.one;
//					Vector2 itemOffsetMax = Vector2.one;
//					List<Vector2> pos = new List<Vector2>();
//					if (content.childCount > 0) {
//						RectTransform child = content.GetChild (0).transform as RectTransform;
//						itemSize = child.sizeDelta;
//						itemPos = child.anchoredPosition;
//						itemAnchorMin = child.anchorMin;
//						itemAnchorMax = child.anchorMax;
//						itemPivot = child.pivot;
//						itemOffsetMin = child.offsetMin;
//						itemOffsetMax = child.offsetMax;
//						foreach (RectTransform ch in content)
//						{
//							pos.Add(ch.anchoredPosition);
//						}
//					}

                    group.enabled = false;

//					int i = 0;
//					foreach (RectTransform child in content)
//					{
//						itemPivot = child.pivot;
//						child.offsetMin = itemOffsetMin;
//						child.offsetMax = itemOffsetMax;
//						child.anchorMin = itemAnchorMin;
//						child.anchorMax = itemAnchorMax;
//						child.sizeDelta = itemSize;
//						child.anchoredPosition = pos[i];
//						++i;
//
//						LayoutGroup childGroup = child.GetComponent<LayoutGroup>();
//						if(childGroup && childGroup.enabled){
//							childGroup.enabled = false;
//							childGroup.enabled = true;
//						}
//					}
                }
            }

            onValueChanged.RemoveListener(CheckLoop);
            onValueChanged.AddListener(CheckLoop);
        }
示例#30
0
        /// <summary>
        /// 初始化此控件.
        /// </summary>
        public PageView Init(int page = 0)
        {
            if (horizontal)
            {
                content.pivot = new Vector2(0, 0.5f); //内容的原点在最左边.
            }
            else if (vertical)
            {
                content.pivot = new Vector2(0.5f, 1f); //内容的原点在最上边.
            }
            m_totalPage = content.childCount - 1;


//			Vector2 itemPos = Vector2.one;
//			Vector2 itemSize = Vector2.one;
//			Vector2 itemAnchorMin = Vector2.one;
//			Vector2 itemAnchorMax = Vector2.one;
//			Vector2 itemPivot = Vector2.one;
//			Vector2 itemOffsetMin = Vector2.one;
//			Vector2 itemOffsetMax = Vector2.one;
//			List<Vector2> pos = new List<Vector2>();
//
//			if (content.childCount > 0) {
//				RectTransform child = content.GetChild (0).transform as RectTransform;
//				itemSize = child.sizeDelta;
//				itemPos = child.anchoredPosition;
//				itemAnchorMin = child.anchorMin;
//				itemAnchorMax = child.anchorMax;
//				itemPivot = child.pivot;
//				itemOffsetMin = child.offsetMin;
//				itemOffsetMax = child.offsetMax;
//				foreach (RectTransform ch in content)
//				{
//					pos.Add(ch.anchoredPosition);
//				}
//			}

            LayoutGroup group = transform.GetComponentInChildren <LayoutGroup>();

            if (group && Application.isPlaying)
            {
                group.enabled = false;
            }

            int i = 0;

            foreach (RectTransform child in content)
            {
//				itemPivot = child.pivot;
//				child.offsetMin = itemOffsetMin;
//				child.offsetMax = itemOffsetMax;
//				child.anchorMin = itemAnchorMin;
//				child.anchorMax = itemAnchorMax;
//				child.sizeDelta = itemSize;
//				child.anchoredPosition = pos[i];

                PageItem item = child.GetComponent <PageItem>();
                if (item == null)
                {
                    item = child.gameObject.AddComponent <PageItem>();
                }
                item.index = i;

//				LayoutGroup childGroup = item.GetComponent<LayoutGroup>();
//				if(childGroup && childGroup.enabled){
//					childGroup.enabled = false;
//					childGroup.enabled = true;
//				}
                ++i;
            }


            m_end = -((RectTransform)content.GetChild(0).transform).anchoredPosition;
            SetContentAnchoredPosition(m_end);

            if (pageIndicator)
            {
                pageIndicator.iPage = this;
                pageIndicator.Build(totalPage + 1);
            }
            return(this);
        }