static int InitGrid(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UIWrapGrid obj = (UIWrapGrid)ToLua.CheckObject(L, 1, typeof(UIWrapGrid)); obj.InitGrid(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void Start() { var go = transform.DeepFindEx("sahres"); _wrapGrid = new UIWrapGrid(go.gameObject, 6); _wrapGrid.OnRefreshCell += RefreshCell; for (int i = 0; i < _wrapGrid.Cells.Length; ++i) { var item = _wrapGrid.Cells[i]; item.DisplayObject = new ItemTest(item.GetTransform()); } _wrapGrid.Refresh(); }
internal void Init(UIWrapGrid grid) { if (scrollRect == null || content == null) { Debug.LogError("Check UIWarpGridContent ScrollRect"); return; } _wrapGrid = grid; _SetUpdateContentSize(); scrollRect.onValueChanged.RemoveAllListeners(); scrollRect.onValueChanged.AddListener(_OnValueChanged); _SetUpdateRectItem(0); }