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

namespace Wizard;

public class MyPageMaintenanceNotification : MonoBehaviour
{
	[SerializeField]
	private NotificatonAnimation _notificationAnimationPrefab;

	private NotificatonAnimation _notificationAnimation;

	private bool _isShow;

	private const float WAIT_TIME = 0.5f;

	private void Awake()
	{
		_notificationAnimation = NGUITools.AddChild(base.gameObject, _notificationAnimationPrefab.gameObject).GetComponent<NotificatonAnimation>();
		_isShow = false;
	}

	private void Update()
	{
		if (_isShow && (UIManager.GetInstance().WebViewHelper.IsOpenWebViewDialog() || UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.MyPage))
		{
			Object.Destroy(base.gameObject);
		}
	}

	public IEnumerator Show(List<NotificatonAnimation.Param> paramList)
	{
		int waitCount = 0;
		while (UIManager.GetInstance().isFading() || UIManager.GetInstance().WebViewHelper.IsOpenWebViewDialog() || waitCount <= 0)
		{
			yield return new WaitForSeconds(0.5f);
			int num = waitCount + 1;
			waitCount = num;
		}
		_isShow = true;
		yield return StartCoroutine(_notificationAnimation.Exec(paramList));
		_isShow = false;
		Object.Destroy(base.gameObject);
	}

	private void OnDisable()
	{
		Object.Destroy(base.gameObject);
	}
}
