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

namespace Wizard;

public class ShopDrumrollScrollItem : MonoBehaviour
{
	[SerializeField]
	private GameObject _objNewMark;

	[SerializeField]
	private GameObject _objPrerelease;

	[SerializeField]
	private GameObject _objBadge;

	private GameObject _objNewEffect;

	private List<string> _assetPathList = new List<string>();

	private void Awake()
	{
		_ = _objNewMark != null;
	}

	private void OnDestroy()
	{
		if (_assetPathList != null)
		{
			Toolbox.ResourcesManager.RemoveAssetGroup(_assetPathList);
			_assetPathList.Clear();
		}
	}

	public void SetActiveNewMark(bool isActive)
	{
		if (_objNewMark == null)
		{
			return;
		}
		if (_objNewMark.activeSelf != isActive)
		{
			_objNewMark.SetActive(isActive);
		}
		if (isActive)
		{
			GameObject _objNewEffect = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_shop_icon_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject);
			_objNewEffect.transform.SetParent(_objNewMark.transform);
			_objNewEffect.transform.localPosition = Vector3.zero;
			_assetPathList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_objNewEffect, delegate
			{
				GameMgr.GetIns().GetEffectMgr().ChangeMaskShader(_objNewEffect);
			}));
			_objNewEffect.SetActive(value: true);
		}
	}

	public void SetActiveBadge(bool isActive)
	{
		if (!(_objBadge == null) && _objBadge.activeSelf != isActive)
		{
			_objBadge.SetActive(isActive);
		}
	}

	public void SetActivePrereleaseMark(bool isActive)
	{
		if (_objPrerelease == null)
		{
			return;
		}
		if (_objPrerelease.activeSelf != isActive)
		{
			_objPrerelease.SetActive(isActive);
		}
		if (isActive)
		{
			GameObject effectObj = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_shop_icon_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject);
			effectObj.transform.SetParent(_objPrerelease.transform);
			effectObj.transform.localPosition = Vector3.zero;
			_assetPathList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effectObj, delegate
			{
				GameMgr.GetIns().GetEffectMgr().ChangeMaskShader(effectObj);
			}));
			effectObj.SetActive(value: true);
		}
	}
}
