123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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;
- }
|