12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using UnityEngine;
- using UnityEngine.UI;
- public class UserChooseScene : MonoBehaviour
- {
- public GameObject cs;
- public GameObject st;
- public UserChooseSceneItem item;
- List<UserChooseSceneItem> list = new List<UserChooseSceneItem>();
- // Start is called before the first frame update
- void Start()
- {
- initList();
- }
- public RectTransform scrollview;
- public void initList()
- {
- Debug.Log("当前场景===》" + UserSceneManager.Instance.SceneList.Count) ;
- foreach(var i in UserSceneManager.Instance.SceneList.Values)
- {
- UserChooseSceneItem go = GameObject.Instantiate(item, item.transform.parent);
- go.gameObject.SetActive(true);
- go.itemName.text = i.name;
- go.id = i.id;
- list.Add(go);
- }
- switch (UserSceneManager.Instance.SceneList.Count)
- {
- case 1:
- scrollview.sizeDelta = new Vector2(200, 291);
- break;
- case 2:
- scrollview.sizeDelta = new Vector2(500, 291);
- break;
- }
- list[0].tg.isOn = true;
- }
- public void gotoScene()
- {
- GameManager.Instance.isShowDownTip = true;
- UIManager.Instance.ShowUI(UINameConfig.LoadingPanel, typeof(LoadingPanel), (int)ELoadState.download);
- cs.SetActive(false);
-
- for (int i = 0; i < list.Count; i++)
- {
- if(list[i].tg.isOn)
- {
- GameScene.Instance.gotoScenes(list[i].id);
- break;
- }
- }
- DownloadResManager.Instance.StartDownLoad();
- }
- public void CloseCS()
- {
- cs.SetActive(false);
- }
- }
|