// ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ void AddElement(GameObject _el) { Vector2 size = new Vector2(480.0f, 110.0f); float margin = 10.0f; float curY = elementCount * size.y + (elementCount == 0 ? 0 : elementCount * margin); _el.transform.parent = scrollView.contentAnchor.transform; _el.transform.localPosition = new Vector3(0.0f, -curY, _el.transform.position.z); scrollView.contentSize = new Vector2(480.0f, curY + size.y + margin); layer.Add(_el); clipping.Add(_el); ++elementCount; }
/////////////////////////////////////////////////////////////////////////////// // Public Functions /////////////////////////////////////////////////////////////////////////////// // ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ public void SetLayer(exLayer _layer = null) { if (ReferenceEquals(layer_, _layer)) { return; } if (_layer != null) { _layer.Add(this); } else if (layer_ != null) { layer_.Remove(this); } }