StaffRollImageCtrl.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using UnityEngine;
  3. public class StaffRollImageCtrl : MonoBehaviour
  4. {
  5. private void Awake()
  6. {
  7. this.uiTexture.mainTexture = null;
  8. this.spriteBack.enabled = false;
  9. this.animator = base.GetComponent<Animator>();
  10. this.ReadTexture();
  11. }
  12. private void ReadTexture()
  13. {
  14. this.m_listTexture = Resources.LoadAll<Texture2D>("SceneStaffRoll/Texture");
  15. this.QueTexture(0);
  16. }
  17. public void CheckChange(float progress)
  18. {
  19. int num = this.m_listTexture.Length - 1;
  20. int num2 = (int)((float)num * progress);
  21. if (num2 >= this.m_listTexture.Length)
  22. {
  23. return;
  24. }
  25. if (this.latestTexIndex != num2)
  26. {
  27. this.latestTexIndex = num2;
  28. this.QueTexture(num2);
  29. this.animator.SetTrigger("ApplyTex");
  30. }
  31. }
  32. private void QueTexture(int index)
  33. {
  34. this.queTexture = this.m_listTexture[index];
  35. }
  36. public void ApplyTex()
  37. {
  38. this.spriteBack.enabled = true;
  39. this.uiTexture.mainTexture = this.queTexture;
  40. }
  41. public void Finish()
  42. {
  43. this.animator.SetTrigger("End");
  44. }
  45. private Animator animator;
  46. [SerializeField]
  47. private UITexture uiTexture;
  48. [SerializeField]
  49. private UITexture spriteBack;
  50. private Texture2D queTexture;
  51. private Texture2D[] m_listTexture;
  52. private const string LOAD_TEXTURE_PATH = "SceneStaffRoll/Texture";
  53. private int latestTexIndex;
  54. }