protected ScrollItem CreateItem() { if (Recycler.Count > 0) { var it = Recycler[0]; it.target.activeSelf = true; it.index = -1; Recycler.RemoveAt(0); return(it); } ModelElement me = new ModelElement(); me.Load(modData); me.data.sizeDelta = ItemSize; me.SetParent(Model); ScrollItem a = new ScrollItem(); a.target = me; if (creator != null) { if (creator.hotfix) { if (creator.reflect != null) { a.obj = creator.reflect(me); } else { a.obj = me; } } else if (creator.create) { a.obj = creator.Create(); ModelManagerUI.ComponentReflection(me, a.obj); } else { a.obj = me; } } else { a.obj = me; } me.IsChanged = true; return(a); }
protected ScrollItem CreateItem(List <ScrollItem> buffer, Constructor con, ModelElement mod, ModelElement parent) { if (buffer.Count > 0) { var it = buffer[0]; it.target.activeSelf = true; it.index = -1; buffer.RemoveAt(0); return(it); } ModelElement me = new ModelElement(); me.Load(mod.ModData); me.SetParent(parent); ScrollItem a = new ScrollItem(); a.target = me; if (con == null) { a.obj = me; } else { if (con.hotfix) { if (con.reflect != null) { a.obj = con.reflect(me); } else { a.obj = me; } } else { a.obj = con.Create(); ModelManagerUI.ComponentReflection(me, a.obj); } } return(a); }