using System; using System.Collections; using System.Collections.Generic; using System.Security.Cryptography.X509Certificates; using Pomelo.DotNetClient; using SimpleJson; using StarterAssets; using UnityEngine; using UnityEngine.UI; using TMPro; public class LoginGUI : MonoBehaviour { public static PomeloClient pc = null; public TMP_InputField username; public TMP_InputField password; public TMP_InputField guildname; public TMP_Text guildinfo; public TMP_InputField param1; public TMP_InputField param2; public TMP_InputField param3; public TMP_InputField param4; public TMP_InputField param5; public TMP_InputField teamId; public TMP_InputField sendToWorld; public TMP_InputField sendToTeam; public TMP_Text chatContent; public GameObject[] panels; private BindingList listItems = new BindingList(); public Transform contentPanel; private GameObject selectedItem; public Color normalBackgroundColor; public Color selectedBackgroundColor; private int state = 0; // Start is called before the first frame update void Start() { panels[0].SetActive(true); panels[1].SetActive(false); panels[2].SetActive(false); panels[3].SetActive(false); listItems.OnListChanged += UpdateUI; } // Update is called once per frame void Update() { switch (state) { case 0: break; case 1: panels[0].SetActive(false); panels[1].SetActive(true); state = 2; break; case 2: break; case 3: panels[0].SetActive(true); panels[1].SetActive(false); state = 0; break; case 4: panels[1].SetActive(false); panels[2].SetActive(true); state = 0; break; case 5: panels[1].SetActive(false); panels[3].SetActive(true); state = 0; break; } } private void UpdateUI() { foreach (Transform child in contentPanel) { Destroy(child.gameObject); } foreach (JsonObject text in listItems) { GameObject newItem = new GameObject("Guild"); newItem.AddComponent(); GuildData d = newItem.AddComponent(); d.guildId = Convert.ToInt32(text["idx"]); Image bgImage = newItem.AddComponent(); bgImage.color = normalBackgroundColor; GameObject textObject = new GameObject("Text"); textObject.transform.SetParent(newItem.transform, false); TMP_Text textComponent = textObject.AddComponent(); textComponent.text = (string)text["gname"]; textComponent.fontSize = 24; textComponent.color = Color.black; textComponent.alignment = TextAlignmentOptions.Center; textComponent.rectTransform.anchorMin = Vector2.zero; textComponent.rectTransform.anchorMax = Vector2.one; textComponent.rectTransform.offsetMin = Vector2.zero; textComponent.rectTransform.offsetMax = Vector2.zero; Button itemButton = newItem.AddComponent