LoadingSpinnerBehaviour.cs 756 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using SRF;
  3. using UnityEngine;
  4. namespace SRDebugger.UI.Other
  5. {
  6. public class LoadingSpinnerBehaviour : SRMonoBehaviour
  7. {
  8. private void Update()
  9. {
  10. this._dt += Time.unscaledDeltaTime;
  11. Vector3 eulerAngles = base.CachedTransform.localRotation.eulerAngles;
  12. float num = eulerAngles.z;
  13. float num2 = this.SpinDuration / (float)this.FrameCount;
  14. bool flag = false;
  15. while (this._dt > num2)
  16. {
  17. num -= 360f / (float)this.FrameCount;
  18. this._dt -= num2;
  19. flag = true;
  20. }
  21. if (flag)
  22. {
  23. base.CachedTransform.localRotation = Quaternion.Euler(eulerAngles.x, eulerAngles.y, num);
  24. }
  25. }
  26. private float _dt;
  27. public int FrameCount = 12;
  28. public float SpinDuration = 0.8f;
  29. }
  30. }