public void setData(JsData jd) { Text_Fan.text = jd.getFunCount().ToString() + "番"; int gold = jd.getGold(); if (gold > 0) { Text_Gold.text = "+" + jd.getGold().ToString(); } else { Text_Gold.text = jd.getGold().ToString(); } string typeStr = Helper_JieSuan.getTypeToStr(jd.getJtype(), jd.getPaiXing(), jd.getZj()); Text_Name.text = typeStr; }
public void initData(PlayerData pd, int pos = 0) { //头像 Sprite sp = Resources.Load("Sprite/head/head_" + pd.getPlayerIcon().ToString(), typeof(Sprite)) as Sprite; Img_Head.sprite = sp; //昵称 Txt_Name.text = pd.getPlayerName(); //金币 int gold = pd.getWinGold(); if (gold > 0) { Txt_Gold.text = "<color=#66F0E5FF> +" + gold.ToString() + "</color>"; } else { Txt_Gold.text = "<color=#6AF066FF> " + gold.ToString() + "</color>"; } //庄家 if (pd.getZhuangjia() == 1) { Img_Zhuang.transform.gameObject.SetActive(true); } //如果是自己,输赢明细 if (pos == 1) { List <JsData> jsList = pd.getJsList(); if (jsList == null) { return; } for (int i = 0; i < jsList.Count; i++) { JsData jsData = jsList[i]; GameObject jsBox = Instantiate(Resources.Load("Prefab/GameObject_jiesuan_scrollBox")) as GameObject; jsBox.GetComponent <GameObject_jiesuan_scrollBox>().setData(jsData); jsBox.transform.SetParent(scroView.GetComponent <ScrollRect>().content, false); } } }