BattleScroll.cs 723 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using UnityEngine;
  3. public class BattleScroll : UIRuleControler
  4. {
  5. public void Awake()
  6. {
  7. }
  8. public void Start()
  9. {
  10. if (this.Image == null)
  11. {
  12. return;
  13. }
  14. this.Image.onRender = delegate(Material mat)
  15. {
  16. mat.mainTexture.wrapMode = TextureWrapMode.Repeat;
  17. mat.SetFloat("_UvScaleX", (float)this.RepetitionCount);
  18. mat.SetFloat("_TexOffsetX", this.scroll_val_ += this.Speed);
  19. mat.SetFloat("_Cutoff", this.m_fCutoff);
  20. float value = -this.m_fCutoff + (1f + this.m_fCutoff) * this.m_fStep;
  21. mat.SetFloat("_Step", value);
  22. mat.SetTexture("_RuleTex", this.m_texRule);
  23. };
  24. }
  25. public UI2DSprite Image;
  26. public float Speed;
  27. public int RepetitionCount;
  28. private float scroll_val_;
  29. }