using System.Collections; using System.Collections.Generic; using UnityEngine; using LitJson; using System.IO; using UnityEngine.UI; using static UnityEditor.Progress; public class TenExtract : MonoBehaviour { private List talentsItemList = new List(); private List currentItemList = new List(); public List toggleList = new List(); public List labelList = new List(); public Button selectBtn; public GameObject Adjust_Panel; void Start() { string filePath = "Assets/Data/myTalent.json"; if (File.Exists(filePath)) { string dataAsJson = File.ReadAllText(filePath); TalentsData talentsData = JsonMapper.ToObject(dataAsJson); foreach (var item in talentsData.talents) { talentsItemList.Add(item); } } for (int i = 0; i < 10; i++) { int index = Random.Range(0, talentsItemList.Count); currentItemList.Add(talentsItemList[index]); talentsItemList.Remove(talentsItemList[index]); } foreach (var item in toggleList) { labelList.Add(item.transform.GetChild(1).GetComponent()); } for (int i = 0; i < labelList.Count; i++) { labelList[i].text = currentItemList[i].name + "(" + currentItemList[i].description + ")"; } selectBtn.onClick.AddListener(() => { PlayerData.intance.currentItemTalentList.Clear(); int m = 0; for (int i = 0; i < toggleList.Count; i++) { if (toggleList[i].isOn == true) m++; } if (m != 3) { Debug.Log("ÇëÑ¡ÔñÈý¸öÌ츳£¡"); return; } for (int i = 0;i