Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

68 rindas
1.7 KiB

  1. using System;
  2. using CIG.Translation;
  3. using CIGEnums;
  4. using SUISS.Core;
  5. using Tweening;
  6. using UnityEngine;
  7. public class Pling : MonoBehaviour
  8. {
  9. public void ShowWithParticles(ILocalizedString value, ParticleType particleType)
  10. {
  11. SpawnedParticles asset = SingletonMonobehaviour<ParticlesAssetCollection>.Instance.GetAsset(particleType);
  12. SpawnedParticles spawnedParticles = UnityEngine.Object.Instantiate<SpawnedParticles>(asset, base.transform.position, Quaternion.identity);
  13. spawnedParticles.Play();
  14. this.Show(value);
  15. }
  16. public void Show(ILocalizedString value)
  17. {
  18. this._valueLabel.LocalizedString = value;
  19. this.StartAnimation();
  20. }
  21. private void StartAnimation()
  22. {
  23. if (this._introTweener.IsPlaying)
  24. {
  25. this._introTweener.FinishedPlaying -= this.OnOutroFinished;
  26. this._introTweener.Stop();
  27. }
  28. this._introTweener.Play();
  29. if (this._moveTweener.IsPlaying)
  30. {
  31. this._moveTweener.FinishedPlaying -= this.OnMoveFinished;
  32. this._moveTweener.Stop();
  33. }
  34. this._moveTweener.FinishedPlaying += this.OnMoveFinished;
  35. this._moveTweener.Play();
  36. }
  37. private void OnMoveFinished(Tweener tweener)
  38. {
  39. tweener.FinishedPlaying -= this.OnMoveFinished;
  40. if (this._introTweener.IsPlaying)
  41. {
  42. this._introTweener.FinishedPlaying -= this.OnOutroFinished;
  43. this._introTweener.Stop();
  44. }
  45. this._introTweener.FinishedPlaying += this.OnOutroFinished;
  46. this._introTweener.PlayReverse();
  47. }
  48. private void OnOutroFinished(Tweener tweener)
  49. {
  50. tweener.FinishedPlaying -= this.OnOutroFinished;
  51. UnityEngine.Object.Destroy(base.gameObject);
  52. }
  53. [SerializeField]
  54. private LocalizedText _valueLabel;
  55. [SerializeField]
  56. private Tweener _introTweener;
  57. [SerializeField]
  58. private Tweener _moveTweener;
  59. }