using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; //public class Union //{ // public int id; // public string name; // public string iconName; // public string counts;//公会人数 //} public class TradeDes : MonoBehaviour { //公会属性 public int id; public string name; public string cover; public string counts;//公会人数 public int level; public string slogan; public int leaderId; public string leaderUserName; public string createTime; public string updateTime; //公会相关组件 public Button sqBtn;//申请按钮 public Button panelBtn;//申请按钮 public TextMeshProUGUI nameTxt;//名称text //public TextMeshPro countTxt;//数量Text public GameObject detailPrefab; public Transform canvasTrans; // Start is called before the first frame update void Awake() { if (sqBtn == null) Debug.LogError("申请按钮未找到!"); if (nameTxt == null) Debug.LogError("名称 TextMeshPro 组件未找到!"); sqBtn.onClick.AddListener(ShowDetail); panelBtn.onClick.AddListener(ShowDetail); } // Update is called once per frame void Update() { } public void ShowDetail() { GameObject.Instantiate(detailPrefab, canvasTrans); } public void SetInfo(UnionDataInPage body) { id = body.Id; name = body.Name; cover = body.Cover; level = body.Level; slogan = body.Slogan; leaderId = body.LeaderId; leaderUserName = body.LeaderUserName; createTime = body.CreateTime; updateTime = body.UpdateTime; nameTxt.text = name; } }