UserChooseScene.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. GameManager.Instance.isShowDownTip = true;
  32. UIManager.Instance.ShowUI(UINameConfig.LoadingPanel, typeof(LoadingPanel), (int)ELoadState.download);
  33. cs.SetActive(false);
  34. for (int i = 0; i < list.Count; i++)
  35. {
  36. if(list[i].tg.isOn)
  37. {
  38. GameScene.Instance.gotoScenes(list[i].id);
  39. break;
  40. }
  41. }
  42. DownloadResManager.Instance.StartDownLoad();
  43. }
  44. public void CloseCS()
  45. {
  46. cs.SetActive(false);
  47. }
  48. }