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

public class ScheduleRoomInfo : MonoBehaviour
{
	public int RoomIndex
	{
		get
		{
			return this.roomIndex;
		}
	}

	private void Awake()
	{
		this.panel_RoomInfo = base.gameObject.GetComponent<UIPanel>();
		this.sprite_CheckMark = UTY.GetChildObject(base.gameObject, "BG/Sprite_CheckMark", false).GetComponent<UISprite>();
		this.uitex_Thumbnail = UTY.GetChildObject(base.gameObject, "BG/Sprite_Thumbnail", false).GetComponent<UITexture>();
		this.label_RoomName = UTY.GetChildObject(base.gameObject, "BG/BG/Label_Name", false).GetComponent<UILabel>();
		this.label_RoomNumber = UTY.GetChildObject(base.gameObject, "BG/BG/Label_Number", false).GetComponent<UILabel>();
		this.uiButton = UTY.GetChildObject(base.gameObject, "BG", false).GetComponent<UIButton>();
		this.grid_Rank = UTY.GetChildObject(base.gameObject, "BG/Grid_Value/Parent_Rank/Grid_Star", false).GetComponent<UIGrid>();
		this.grid_StaffNum = UTY.GetChildObject(base.gameObject, "BG/Grid_Value/Parent_StafNum/Grid_Star", false).GetComponent<UIGrid>();
		this.uiButton.onClick.Add(new EventDelegate(new EventDelegate.Callback(this.ButtonOnClick)));
	}

	private void Start()
	{
		this.SetActiveCheckMark(false);
	}

	public void SetData(ScheduleRoomCtrl scheduleRoomCtrl, int index, ScheduleRoomCtrl.BGInfo bg_info)
	{
		this.m_ScheduleRoomCtrl = scheduleRoomCtrl;
		this.roomIndex = index;
		this.bg_info = bg_info;
		this.uitex_Thumbnail.mainTexture = bg_info.texIcon;
		this.label_RoomName.text = bg_info.stageName;
		this.label_RoomNumber.text = (this.roomIndex + 1).ToString();
		this.SetStarNum(this.grid_Rank, 2);
		this.SetStarNum(this.grid_StaffNum, 3);
	}

	private void SetStarNum(UIGrid grid, int num)
	{
		List<Transform> childList = grid.GetChildList();
		int num2 = 0;
		foreach (Transform transform in childList)
		{
			transform.gameObject.SetActive(num2 < num);
			num2++;
		}
	}

	public void SetActiveCheckMark(bool active)
	{
		this.sprite_CheckMark.gameObject.SetActive(active);
	}

	private void ButtonOnClick()
	{
		this.m_ScheduleRoomCtrl.SetSecelctRoomIndex(this.roomIndex);
	}

	private void Update()
	{
		if (this.sprite_CheckMark.gameObject.activeSelf)
		{
			if (this.panel_RoomInfo.alpha != 1f)
			{
				this.panel_RoomInfo.alpha = 1f;
			}
		}
		else if (this.panel_RoomInfo.alpha != 0.75f)
		{
			this.panel_RoomInfo.alpha = 0.75f;
		}
	}

	private ScheduleRoomCtrl m_ScheduleRoomCtrl;

	private UITexture uitex_Thumbnail;

	private UILabel label_RoomName;

	private UILabel label_RoomNumber;

	private UISprite sprite_CheckMark;

	private UIPanel panel_RoomInfo;

	private UIButton uiButton;

	private UIGrid grid_Rank;

	private UIGrid grid_StaffNum;

	private ScheduleRoomCtrl.BGInfo bg_info;

	private int roomIndex;
}
