PhotoTutorialButton.cs 904 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using UnityEngine;
  3. public class PhotoTutorialButton : MonoBehaviour
  4. {
  5. public void Awake()
  6. {
  7. EventDelegate.Add(base.GetComponent<UIButton>().onClick, new EventDelegate.Callback(this.OnClickEvent));
  8. }
  9. public void SetTarget(GameObject target_object)
  10. {
  11. this.target_text_ = target_object;
  12. this.scroll_view_ = NGUITools.FindInParents<UIScrollView>(this.target_text_.transform);
  13. }
  14. public void OnClickEvent()
  15. {
  16. this.scroll_view_.verticalScrollBar.value = 0f;
  17. this.scroll_view_.ResetPosition();
  18. Transform parent = this.target_text_.transform.parent;
  19. for (int i = 0; i < parent.childCount; i++)
  20. {
  21. parent.GetChild(i).localScale = Vector3.zero;
  22. }
  23. this.target_text_.transform.localScale = Vector3.one;
  24. this.scroll_view_.verticalScrollBar.value = 0f;
  25. this.scroll_view_.ResetPosition();
  26. }
  27. private UIScrollView scroll_view_;
  28. private GameObject target_text_;
  29. }