UserChooseScene.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class UserChooseScene : MonoBehaviour
  6. {
  7. public GameObject cs;
  8. public GameObject st;
  9. public UserChooseSceneItem item;
  10. List<UserChooseSceneItem> list = new List<UserChooseSceneItem>();
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. initList();
  15. }
  16. public void initList()
  17. {
  18. Debug.Log("µ±Ç°³¡¾°===¡·" + UserSceneManager.Instance.SceneList.Count) ;
  19. foreach(var i in UserSceneManager.Instance.SceneList.Values)
  20. {
  21. UserChooseSceneItem go = GameObject.Instantiate(item, item.transform.parent);
  22. go.gameObject.SetActive(true);
  23. go.itemName.text = i.name;
  24. go.id = i.id;
  25. list.Add(go);
  26. }
  27. list[0].tg.isOn = true;
  28. }
  29. public void gotoScene()
  30. {
  31. cs.SetActive(false);
  32. st.SetActive(true);
  33. for (int i = 0; i < list.Count; i++)
  34. {
  35. if(list[i].tg.isOn)
  36. {
  37. GameScene.Instance.gotoScenes(list[i].id);
  38. break;
  39. }
  40. }
  41. }
  42. }