using System;
using System.Collections.Generic;
using UnityEngine;
using wf;

namespace SceneEditWindow
{
	public abstract class BaseIconWindow : BasePhotoWindow
	{
		public override void Awake()
		{
			base.Awake();
			this.tabPanel = this.itemGrit.GetComponent<UIWFTabPanel>();
			NDebug.AssertNull(this.tabPanel);
			List<int> list = this.CreateItemIdList();
			for (int i = 0; i < list.Count; i++)
			{
				UIWFTabButton uiwftabButton = this.CreateItemObject(this.itemGrit.gameObject, list[i]);
				uiwftabButton.name = list[i].ToString();
				this.tabButtonDic.Add(list[i], uiwftabButton);
				EventDelegate.Add(uiwftabButton.onSelect, delegate()
				{
					if (!UIWFSelectButton.selected)
					{
						return;
					}
					this.OnSelectItem(int.Parse(UIWFSelectButton.current.name));
				});
			}
			Utility.ResetNGUI(this.itemGrit);
			UIScrollBar componentInChildren = base.GetComponentInChildren<UIScrollBar>();
			Utility.ResetNGUI(componentInChildren);
			this.UpdateChildren();
		}

		protected abstract void OnSelectItem(int selectItemId);

		protected abstract UIWFTabButton CreateItemObject(GameObject parent, int createItemId);

		protected abstract List<int> CreateItemIdList();

		[SerializeField]
		public SceneEdit sceneEdit;

		[SerializeField]
		private UIGrid itemGrit;

		protected UIWFTabPanel tabPanel;

		protected Dictionary<int, UIWFTabButton> tabButtonDic = new Dictionary<int, UIWFTabButton>();
	}
}
