using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using DataModel.Model; using System.Linq; public class CreateRoomSubjectItem : MonoBehaviour { SubejctsInfo subejctsInfo1; public List seatItems; public Text Name; public Text subejctMode; public Text seatinfo; public Text stepinfo; public void Init(SubejctsInfo subejctsInfo,int index) { subejctsInfo1 = subejctsInfo; Name.text = subejctsInfo1.subjectName; subejctMode.text = subejctsInfo1.mode; seatinfo.text = subejctsInfo.seatInfo; stepinfo.text = subejctsInfo1.stepInfo; //强制刷新 ////获取所有seat //StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.instance.CallIP + "/Handler/Subject.ashx?action=querysubjectseat&SubjectId="+ subjectId, result => //{ // var json = JObject.Parse(result); // if (json["state"].ToObject()) // { // string str = json["data"].ToString(); // var seats = JsonConvert.DeserializeObject>(str); // seats.ForEach(a => // { // GameObject obj = Instantiate(CreateRoomPanel.instance.seatItemPrefb,CreateRoomPanel.instance.group3seat.transform); // CreateRoomSeatItem script = obj.GetComponent(); // seatItems.Add(script); // script.Init(a,this); // if (index == 0) // { // obj.gameObject.SetActive(true); // } // else // { // obj.gameObject.SetActive(false); // } // }); // self.onClick.AddListener(()=> { ShowSeats(); }); // self.interactable = true; // } // else // { // string msg = json["message"].ToString(); // Debug.LogError(msg); // } //})); } private void ShowSeats() { CreateRoomPanel.instance.group3seat.transform.GetComponentsInChildren(true).ToList().ForEach(a=> { if(seatItems.Contains(a)) { a.gameObject.SetActive(true); } else { a.gameObject.SetActive(false); } }); } }