StaffRollImageCtrl.cs 1.6 KB

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