|
- using System;
- using CIG.Translation;
- using CIGEnums;
- using SUISS.Core;
- using Tweening;
- using UnityEngine;
-
- public class Pling : MonoBehaviour
- {
- public void ShowWithParticles(ILocalizedString value, ParticleType particleType)
- {
- SpawnedParticles asset = SingletonMonobehaviour<ParticlesAssetCollection>.Instance.GetAsset(particleType);
- SpawnedParticles spawnedParticles = UnityEngine.Object.Instantiate<SpawnedParticles>(asset, base.transform.position, Quaternion.identity);
- spawnedParticles.Play();
- this.Show(value);
- }
-
- public void Show(ILocalizedString value)
- {
- this._valueLabel.LocalizedString = value;
- this.StartAnimation();
- }
-
- private void StartAnimation()
- {
- if (this._introTweener.IsPlaying)
- {
- this._introTweener.FinishedPlaying -= this.OnOutroFinished;
- this._introTweener.Stop();
- }
- this._introTweener.Play();
- if (this._moveTweener.IsPlaying)
- {
- this._moveTweener.FinishedPlaying -= this.OnMoveFinished;
- this._moveTweener.Stop();
- }
- this._moveTweener.FinishedPlaying += this.OnMoveFinished;
- this._moveTweener.Play();
- }
-
- private void OnMoveFinished(Tweener tweener)
- {
- tweener.FinishedPlaying -= this.OnMoveFinished;
- if (this._introTweener.IsPlaying)
- {
- this._introTweener.FinishedPlaying -= this.OnOutroFinished;
- this._introTweener.Stop();
- }
- this._introTweener.FinishedPlaying += this.OnOutroFinished;
- this._introTweener.PlayReverse();
- }
-
- private void OnOutroFinished(Tweener tweener)
- {
- tweener.FinishedPlaying -= this.OnOutroFinished;
- UnityEngine.Object.Destroy(base.gameObject);
- }
-
- [SerializeField]
- private LocalizedText _valueLabel;
-
- [SerializeField]
- private Tweener _introTweener;
-
- [SerializeField]
- private Tweener _moveTweener;
- }
|