Unity3d 数据展示
public class Show : MonoBehaviour { private bool isDesc = true; private string strTitle = "ID\t\t\t\tName\t\t\t\tScore\t\t\t\tClass\r\n"; private string strResult = ""; private string name = "Jim"; void OnGUI() { name = GUI.TextField(new Rect(50, 20, 200, 20), name); if (GUI.Button(new Rect(260, 20, 100, 20), "Seacrh")) { strResult = ""; TB_Score result = new TB_ScoreBLL().Get(name); strResult += result.Id + "\t\t\t\t" + result.Name + "\t\t\t\t" + result.Score + "\t\t\t\t" + result.Class + "\r\n"; } if(GUI.Button(new Rect(370, 20, 100, 20), "Sort")) { strResult = ""; List<TB_Score> results = (List<TB_Score>)new TB_ScoreBLL().ListAllBySort(isDesc); foreach (TB_Score r in results) { strResult += r.Id + "\t\t\t\t" + r.Name + "\t\t\t\t" + r.Score + "\t\t\t\t" + r.Class + "\r\n"; } if (isDesc) { isDesc = false; } else { isDesc = true; } } GUI.Label(new Rect(50, 50, 500, 600), strTitle + strResult); } }