public void Init(CardInfo cardInfo)//传入要显示的数据 { resSvc = ResSvc.instance; //Debug.Log(PathDefine.CardPathCfg + PathDefine.CardBackName); cardBack = Resources.Load <Sprite>(PathDefine.CardPathCfg + PathDefine.CardBackName); isBack = true; imgBg = GetComponent <Image>(); imgCard = transform.Find("Mask").Find("imgCard").GetComponent <Image>(); txtCardName = transform.Find("imgCardName").Find("txtCardName").GetComponent <Text>(); txtCardDes = transform.Find("txtDescription").GetComponent <Text>(); imgHp = transform.Find("imgHp").GetComponent <Image>(); imgAttack = transform.Find("imgAttack").GetComponent <Image>(); txtHp = imgHp.transform.GetComponentInChildren <Text>(); txtAttack = imgAttack.transform.GetComponentInChildren <Text>(); imgQuality = transform.Find("imgQuality").GetComponent <Image>(); imgCost = transform.Find("imgCost").GetComponent <Image>(); txtCost = imgCost.transform.GetComponentInChildren <Text>(); //imgCard.sprite = cardBack; //imgCard.rectTransform.localScale = new Vector3(cardBackScale, cardBackScale, 1); //imgCard.transform.SetSiblingIndex(transform.childCount); imgBg.sprite = cardBack; imgBg.rectTransform.localEulerAngles = new Vector3(cardBackScale, cardBackScale, 1); SetCardInfoState(false); cardSprite = resSvc.LoadCard(cardInfo.fileName); txtCardName.text = cardInfo.name; txtCardDes.text = cardInfo.description; txtAttack.text = cardInfo.attack.ToString(); txtHp.text = cardInfo.hp.ToString(); txtCost.text = cardInfo.cost.ToString(); if (cardInfo.quality != Quality.BASE) { imgQuality.sprite = qualitySprites[cardInfo.qualityId - 2]; } else { imgQuality.color = new Color(0, 0, 0, 0); } }