_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Trade/TradeDes.cs

86 lines
2.0 KiB
C#
Raw Normal View History

using System;
2024-11-25 23:54:53 +08:00
using System.Collections;
using System.Collections.Generic;
using TMPro;
2024-11-25 23:54:53 +08:00
using UnityEngine;
using UnityEngine.UI;
2024-11-25 23:54:53 +08:00
//public class Union
//{
// public int id;
// public string name;
// public string iconName;
// public string counts;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//}
2024-12-02 15:35:46 +08:00
public class TradeDes : Base
2024-11-25 23:54:53 +08:00
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public int id;
public string name;
public string cover;
public string counts;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public int level;
public string slogan;
public int leaderId;
public string leaderUserName;
public string createTime;
public string updateTime;
2024-12-02 15:35:46 +08:00
public UnionDataInPage body;
2024-11-25 23:54:53 +08:00
2024-12-02 15:35:46 +08:00
public Image Image;
2024-11-25 23:54:53 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public Button sqBtn;//<2F><><EFBFBD>밴ť
2024-12-02 15:35:46 +08:00
public Button panelBtn;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public TextMeshProUGUI nameTxt;//<2F><><EFBFBD><EFBFBD>text
//public TextMeshPro countTxt;//<2F><><EFBFBD><EFBFBD>Text
2024-11-25 23:54:53 +08:00
public GameObject detailPrefab;
2024-11-26 16:26:07 +08:00
public Transform trans;
2024-11-25 23:54:53 +08:00
// Start is called before the first frame update
void Awake()
2024-11-25 23:54:53 +08:00
{
if (sqBtn == null)
Debug.LogError("<22><><EFBFBD>밴ťδ<C5A5>ҵ<EFBFBD><D2B5><EFBFBD>");
if (nameTxt == null)
Debug.LogError("<22><><EFBFBD><EFBFBD> TextMeshPro <20><><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>");
sqBtn.onClick.AddListener(ShowDetail);
panelBtn.onClick.AddListener(ShowDetail);
2024-11-25 23:54:53 +08:00
}
2024-11-25 23:54:53 +08:00
// Update is called once per frame
void Update()
{
}
public void ShowDetail()
{
2024-12-02 15:35:46 +08:00
GameObject gobj = GameObject.Instantiate(detailPrefab, trans);
gobj.GetComponent<New_GonghuiInfo>().Body = body;
}
2024-12-02 15:35:46 +08:00
public async void SetInfo(UnionDataInPage _body,Transform tran)
2024-11-25 23:54:53 +08:00
{
2024-12-02 15:35:46 +08:00
body = _body;
2024-11-25 23:54:53 +08:00
id = body.Id;
name = body.Name;
cover = body.Cover;
2024-12-02 15:35:46 +08:00
Image.sprite = await GlobalObj.GetComponent<ImageLoader>().LoadImageAsync(cover);
2024-11-25 23:54:53 +08:00
level = body.Level;
slogan = body.Slogan;
leaderId = body.LeaderId;
leaderUserName = body.LeaderUserName;
createTime = body.CreateTime;
updateTime = body.UpdateTime;
nameTxt.text = name;
2024-11-26 16:26:07 +08:00
trans = tran;
2024-11-25 23:54:53 +08:00
}
}