UIWFScrollBGAlphaSupport.cs 703 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using UnityEngine;
  3. public class UIWFScrollBGAlphaSupport : MonoBehaviour
  4. {
  5. private void Awake()
  6. {
  7. this.update_timing_ = UnityEngine.Random.Range(1, 30);
  8. this.widget_ = base.GetComponent<UIWidget>();
  9. }
  10. private void Start()
  11. {
  12. this.update_count_ = this.update_timing_;
  13. }
  14. private void Update()
  15. {
  16. if (this.update_count_ == this.update_timing_)
  17. {
  18. this.update_count_ = 0;
  19. if (this.TargetWidget == null || this.widget_ == null)
  20. {
  21. return;
  22. }
  23. this.widget_.alpha = this.TargetWidget.alpha;
  24. }
  25. else
  26. {
  27. this.update_count_++;
  28. }
  29. }
  30. public UIWidget TargetWidget;
  31. private UIWidget widget_;
  32. private int update_count_;
  33. private int update_timing_;
  34. }