CustomHorizintalScrollView.cs 925 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using UnityEngine.EventSystems;
  4. using UnityEngine.UI;
  5. public class CustomHorizintalScrollView : MonoBehaviour
  6. {
  7. public RectTransform content;
  8. public GameObject itemgo;
  9. public List<GameObject> itemgolist;
  10. public int startIndex = 0;
  11. public int endIndex = 0;
  12. public void Init(List<SceneValue> m_SceneData, SceneChoose SceneChoose)
  13. {
  14. Debug.Log("UpdateSceneItem411");
  15. if(itemgolist!=null)
  16. {
  17. for (int i = 0; i < itemgolist.Count; i++)
  18. {
  19. Destroy(itemgolist[i]);
  20. }
  21. }
  22. for (int i = 0; i < m_SceneData.Count; i++)
  23. {
  24. itemgolist.Add(Instantiate(itemgo, content));
  25. itemgolist[itemgolist.Count - 1].SetActive(true) ;
  26. itemgolist[itemgolist.Count - 1].GetComponent<SChooseItem>().init( m_SceneData[i]);
  27. }
  28. }
  29. }