static int Init(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); ScrollViewLoopItem obj = (ScrollViewLoopItem)ToLua.CheckObject(L, 1, typeof(ScrollViewLoopItem)); ScrollViewLoop arg0 = (ScrollViewLoop)ToLua.CheckUnityObject(L, 2, typeof(ScrollViewLoop)); obj.Init(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void InitAllChild() { for (int i = transform.childCount - 1; i >= 0; i--) { Transform tran = transform.GetChild(i); tran.FindChild("imgSkill").gameObject.SetActive(false); tran.localPosition = Vector3.zero; ScrollViewLoopItem item = tran.GetComponent <ScrollViewLoopItem>(); if (item) { item.Init(this); item.v = 0; } } Items.Clear(); currentIndex = 0; }
public void Init(Action onFinish = null, Action onBegin = null) { kRect = GetComponent <RectTransform>(); Width = kRect.rect.width; height = kRect.rect.height; kFinishCallback = onFinish; kBeginCallback = onBegin; if (kRect.childCount < 5) { StartValue = StartValue + AddValue; } else { VMax = StartValue + (kRect.childCount - 1) * AddValue + AddValue * 0.95f; } for (int i = 0; i < kRect.childCount; i++) { Transform tran = kRect.GetChild(i); ScrollViewLoopItem item = tran.GetComponent <ScrollViewLoopItem>(); if (item == null) { item = tran.gameObject.AddComponent <ScrollViewLoopItem>(); } if (item != null) { Items.Add(item); item.Init(this); item.Drag(StartValue + i * AddValue); } } if (kRect.childCount < 5) { enabled = false; } currentIndex = 1; }