using System;
using UnityEngine;

public class WfFadeBasic : WfFadeBehaviour
{
	public override void OnStartedFadeIn()
	{
		base.OnStartedFadeIn();
		if (this.onStartedFadeInAction != null)
		{
			this.onStartedFadeInAction(this);
		}
	}

	public override void OnStartedFadeOut()
	{
		base.OnStartedFadeOut();
		if (this.onStartedFadeOutAction != null)
		{
			this.onStartedFadeOutAction(this);
		}
	}

	public override void OnCompleteFadeIn()
	{
		base.OnCompleteFadeIn();
		if (this.onCompleteFadeInAction != null)
		{
			this.onCompleteFadeInAction(this);
		}
	}

	public override void OnCompleteFadeOut()
	{
		base.OnCompleteFadeOut();
		if (this.onCompleteFadeOutAction != null)
		{
			this.onCompleteFadeOutAction(this);
		}
	}

	public override void OnUpdateFadeIn(float val)
	{
		this.alpha = val;
		if (this.OnUpdateFadeAlphaAction != null)
		{
			this.OnUpdateFadeAlphaAction(this);
		}
	}

	public override void OnUpdateFadeOut(float val)
	{
		this.alpha = val;
		if (this.OnUpdateFadeAlphaAction != null)
		{
			this.OnUpdateFadeAlphaAction(this);
		}
	}

	public virtual float alpha
	{
		get
		{
			if (this.targetWidgets != null && 0 < this.targetWidgets.Length)
			{
				foreach (UIWidget uiwidget in this.targetWidgets)
				{
					if (uiwidget != null)
					{
						return uiwidget.alpha;
					}
				}
			}
			if (this.targetPanels != null && 0 < this.targetPanels.Length)
			{
				foreach (UIPanel uipanel in this.targetPanels)
				{
					if (uipanel != null)
					{
						return uipanel.alpha;
					}
				}
			}
			return 0f;
		}
		set
		{
			if (this.targetWidgets != null && 0 < this.targetWidgets.Length)
			{
				foreach (UIWidget uiwidget in this.targetWidgets)
				{
					if (uiwidget != null)
					{
						uiwidget.alpha = value;
					}
				}
			}
			if (this.targetPanels != null && 0 < this.targetPanels.Length)
			{
				foreach (UIPanel uipanel in this.targetPanels)
				{
					if (uipanel != null)
					{
						uipanel.alpha = value;
					}
				}
			}
		}
	}

	[SerializeField]
	public UIWidget[] targetWidgets;

	[SerializeField]
	public UIPanel[] targetPanels;

	public Action<WfFadeBasic> onStartedFadeInAction;

	public Action<WfFadeBasic> onStartedFadeOutAction;

	public Action<WfFadeBasic> onCompleteFadeInAction;

	public Action<WfFadeBasic> onCompleteFadeOutAction;

	public Action<WfFadeBasic> OnUpdateFadeAlphaAction;
}
