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

namespace Kasizuki
{
	public class KasizukiPlayInfoCtrl : NGUIWindow
	{
		public GameObject windowRoomList
		{
			get
			{
				return this.m_WindowRoomList;
			}
		}

		public GameObject windowManList
		{
			get
			{
				return this.m_WindowManList;
			}
		}

		public GameObject windowPlayList
		{
			get
			{
				return this.m_WindowPlayList;
			}
		}

		public GameObject windowDescriptionList
		{
			get
			{
				return this.m_WindowDesciption;
			}
		}

		public Action<RoomData.Data> onClickRoom { get; set; }

		public Action<ManData.Data> onClickMan { get; set; }

		public Action<PlayData.Data> onClickPlay { get; set; }

		public Action<PlayData.Data> onHoverPlay { get; set; }

		public Action<PlayData.Data> onOutPlay { get; set; }

		public ObjectCacheDic descriptionCache
		{
			get
			{
				return this.m_DescriptionCache;
			}
		}

		private void Start()
		{
			this.SetUpRoomList();
			this.SetUpManList();
			this.SetUpPlayList();
			this.SetUpDescription();
		}

		private void SetUpRoomList()
		{
			this.m_RoomListCache = new ObjectCacheDic();
		}

		private void SetUpManList()
		{
			this.m_ManListCache = new ObjectCacheDic();
		}

		private void SetUpPlayList()
		{
			this.m_PlayListCache = new ObjectCacheDic();
		}

		private void SetUpDescription()
		{
			this.m_DescriptionCache = new ObjectCacheDic();
			this.m_DescriptionCache.CacheChildObject<UILabel>(this.m_WindowDesciption, "Text Description", "説明文");
			this.m_DescriptionCache.CacheChildObject<uGUIListViewer>(this.m_WindowDesciption, "Parent Condition", "条件一覧");
		}

		public void OpenRoomList(List<RoomData.Data> roomDataList, RoomData.Data selectingData = null)
		{
			KasizukiPlayInfoCtrl.<OpenRoomList>c__AnonStorey1 <OpenRoomList>c__AnonStorey = new KasizukiPlayInfoCtrl.<OpenRoomList>c__AnonStorey1();
			<OpenRoomList>c__AnonStorey.selectingData = selectingData;
			<OpenRoomList>c__AnonStorey.$this = this;
			ListViewerWindow component = this.m_WindowRoomList.GetComponent<ListViewerWindow>();
			component.Show<RoomData.Data, UIWFTabButton>(roomDataList, delegate(int index, RoomData.Data data, UIWFTabButton item)
			{
				UILabel componentInChildren = item.GetComponentInChildren<UILabel>();
				componentInChildren.text = data.drawName;
				EventDelegate.Add(item.onClick, delegate()
				{
					<OpenRoomList>c__AnonStorey.OnClickRoom(data);
				});
				if (<OpenRoomList>c__AnonStorey.selectingData != null && <OpenRoomList>c__AnonStorey.selectingData == data)
				{
					item.SetSelect(true);
				}
			});
			UIWFTabPanel component2 = component.viewer.parentItemArea.GetComponent<UIWFTabPanel>();
			if (component2)
			{
				component2.UpdateChildren();
			}
		}

		public void OnClickRoom(RoomData.Data roomData)
		{
			if (this.onClickRoom != null)
			{
				this.onClickRoom(roomData);
			}
		}

		public void OpenManList(List<ManData.Data> manDataList, ManData.Data selectingData = null, Action<UIWFTabButton, ManData.Data> onCreate = null)
		{
			KasizukiPlayInfoCtrl.<OpenManList>c__AnonStorey3 <OpenManList>c__AnonStorey = new KasizukiPlayInfoCtrl.<OpenManList>c__AnonStorey3();
			<OpenManList>c__AnonStorey.selectingData = selectingData;
			<OpenManList>c__AnonStorey.onCreate = onCreate;
			<OpenManList>c__AnonStorey.$this = this;
			ListViewerWindow component = this.m_WindowManList.GetComponent<ListViewerWindow>();
			component.Show<ManData.Data, UIWFTabButton>(manDataList, delegate(int index, ManData.Data data, UIWFTabButton item)
			{
				UILabel componentInChildren = item.GetComponentInChildren<UILabel>();
				componentInChildren.text = data.drawName;
				EventDelegate.Add(item.onClick, delegate()
				{
					<OpenManList>c__AnonStorey.OnClickMan(data);
				});
				if (<OpenManList>c__AnonStorey.selectingData != null && <OpenManList>c__AnonStorey.selectingData == data)
				{
					item.SetSelect(true);
				}
				if (<OpenManList>c__AnonStorey.onCreate != null)
				{
					<OpenManList>c__AnonStorey.onCreate(item, data);
				}
			});
			UIWFTabPanel component2 = component.viewer.parentItemArea.GetComponent<UIWFTabPanel>();
			if (component2)
			{
				component2.UpdateChildren();
			}
		}

		public void OnClickMan(ManData.Data manData)
		{
			if (this.onClickMan != null)
			{
				this.onClickMan(manData);
			}
		}

		public void OpenPlayList(List<PlayData.Data> playDataList, PlayData.Data selectingData = null)
		{
			KasizukiPlayInfoCtrl.<OpenPlayList>c__AnonStorey5 <OpenPlayList>c__AnonStorey = new KasizukiPlayInfoCtrl.<OpenPlayList>c__AnonStorey5();
			<OpenPlayList>c__AnonStorey.selectingData = selectingData;
			<OpenPlayList>c__AnonStorey.$this = this;
			ListViewerWindow component = this.m_WindowPlayList.GetComponent<ListViewerWindow>();
			component.Show<PlayData.Data, UIWFTabButton>(playDataList, delegate(int index, PlayData.Data data, UIWFTabButton item)
			{
				UILabel componentInChildren = item.GetComponentInChildren<UILabel>();
				componentInChildren.text = data.drawName;
				EventDelegate.Add(item.onClick, delegate()
				{
					<OpenPlayList>c__AnonStorey.OnClickPlay(data);
				});
				EventDelegate.Add(item.GetComponent<UIEventTrigger>().onHoverOver, delegate()
				{
					<OpenPlayList>c__AnonStorey.OnHoverPlay(data);
				});
				EventDelegate.Add(item.GetComponent<UIEventTrigger>().onHoverOut, delegate()
				{
					<OpenPlayList>c__AnonStorey.OnOutPlay(data);
				});
				EventDelegate.Add(item.transform.Find("hover event").GetComponent<UIEventTrigger>().onHoverOver, delegate()
				{
					<OpenPlayList>c__AnonStorey.OnHoverPlay(data);
				});
				EventDelegate.Add(item.transform.Find("hover event").GetComponent<UIEventTrigger>().onHoverOut, delegate()
				{
					<OpenPlayList>c__AnonStorey.OnOutPlay(data);
				});
				if (<OpenPlayList>c__AnonStorey.selectingData != null && <OpenPlayList>c__AnonStorey.selectingData == data)
				{
					item.SetSelect(true);
				}
				item.isEnabled = data.IsPassed;
			});
			UIWFTabPanel component2 = component.viewer.parentItemArea.GetComponent<UIWFTabPanel>();
			if (component2)
			{
				component2.UpdateChildren();
			}
		}

		public void OnClickPlay(PlayData.Data playData)
		{
			if (this.onClickPlay != null)
			{
				this.onClickPlay(playData);
			}
		}

		private void OnHoverPlay(PlayData.Data playData)
		{
			if (this.onHoverPlay != null)
			{
				this.onHoverPlay(playData);
			}
		}

		private void OnOutPlay(PlayData.Data playData)
		{
			if (this.onOutPlay != null)
			{
				this.onOutPlay(playData);
			}
		}

		[SerializeField]
		private GameObject m_WindowRoomList;

		[SerializeField]
		private GameObject m_WindowManList;

		[SerializeField]
		private GameObject m_WindowPlayList;

		[SerializeField]
		private GameObject m_WindowDesciption;

		private ObjectCacheDic m_RoomListCache;

		private ObjectCacheDic m_ManListCache;

		private ObjectCacheDic m_PlayListCache;

		private ObjectCacheDic m_DescriptionCache;
	}
}
