using UnityEngine;

public class WrapVariableContentsScrollBarSize : MonoBehaviour
{
	public UIWrapVariableContentVertical wrapContent;

	private void Start()
	{
		ContentUpdate();
	}

	public void ContentUpdate()
	{
		UIWidget uIWidget = base.gameObject.GetComponent<UIWidget>();
		if (uIWidget == null)
		{
			uIWidget = base.gameObject.AddComponent<UIWidget>();
		}
		int num = 0;
		for (int i = 0; i < wrapContent.ItemParamList.Count; i++)
		{
			num += wrapContent.ItemParamList[i].Size;
		}
		uIWidget.height = num;
		uIWidget.pivot = UIWidget.Pivot.Top;
		Vector3 localPosition = Vector3.zero;
		if (wrapContent.ItemParamList.Count > 0)
		{
			float position = wrapContent.ItemParamList[0].Position;
			localPosition = new Vector3(localPosition.x, position, localPosition.z);
		}
		base.transform.localPosition = localPosition;
	}
}
