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 : Base { //公会属性 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 UnionDataInPage body; public Image Image; //公会相关组件 public Button sqBtn;//申请按钮 public Button panelBtn;//打开详情 public TextMeshProUGUI nameTxt;//名称text //public TextMeshPro countTxt;//数量Text public GameObject detailPrefab; public Transform trans; // 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 gobj = GameObject.Instantiate(detailPrefab, trans); gobj.GetComponent().Body = body; } public async void SetInfo(UnionDataInPage _body,Transform tran) { body = _body; id = body.Id; name = body.Name; cover = body.Cover; Image.sprite = await GlobalObj.GetComponent().LoadImageAsync(cover); level = body.Level; slogan = body.Slogan; leaderId = body.LeaderId; leaderUserName = body.LeaderUserName; createTime = body.CreateTime; updateTime = body.UpdateTime; nameTxt.text = name; trans = tran; } }