public QuikChargeItemUI(GameObject go, ExchangeTemplate exchangeT) { trans = go.transform; mExchangeT = exchangeT; nameTxt = trans.FindChild("NameImg/Text").GetComponent <Text>(); iconBg = trans.FindChild("iconBg").GetComponent <Image>(); iconImg = trans.FindChild("iconImg").GetComponent <Image>(); iconBtn = trans.FindChild("iconImg").GetComponent <Button>(); detailTxt = trans.FindChild("DetailTxt").GetComponent <Text>(); costTypeTxt = trans.FindChild("MoneyCost/TypeTxt").GetComponent <Text>(); costNumTxt = trans.FindChild("MoneyCost/Text").GetComponent <Text>(); nameTxt.text = GameUtils.getString(exchangeT.getName()); iconBg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + exchangeT.getBaseicon()); iconBg.SetNativeSize(); iconImg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + exchangeT.getIcon()); iconImg.SetNativeSize(); detailTxt.text = GameUtils.getString(exchangeT.getDetail()); costTypeTxt.text = ExchangeModule.Money_Str; costNumTxt.text = exchangeT.getPrice().ToString(); buyBtn = trans.FindChild("BuyBtn").GetComponent <Button>(); //iconBtn.onClick.AddListener(OnItemClick); buyBtn.onClick.AddListener(OnItemClick); }
public void SetShowData(MonthcardTemplate monthT) { nameTxt.text = GameUtils.getString(monthT.getName()); iconBg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + monthT.getBaseicon()); iconBg.SetNativeSize(); iconImg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + monthT.getIcon()); iconImg.preserveAspect = true; ExchangeTemplate ex = DataTemplate.GetInstance().GetExchangeTemplateByMonthCardId(monthT.getId()); costTxt.text = ex.getPrice().ToString(); //iconImg.SetNativeSize(); string[] detailTxt = monthT.getDes().Split(new string[] { "#" }, StringSplitOptions.None); if (detailTxt == null || detailTxt.Length == 0) { LogManager.LogError("ExchangeTemplate表格预览内容描述解析数据为空!id=" + monthT.getId()); return; } for (int i = 0, j = detailTxt.Length; i < j; i++) { CreateDetail(GameUtils.getString(detailTxt[i])); } }
public void InitInfo(MonthcardTemplate monthcardT) { mt = monthcardT; titleTxt.text = GameUtils.getString(mt.getName()); welfareTxt.text = GameUtils.getString("monthcard_content1"); iconBg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + mt.getBaseicon()); iconBg.SetNativeSize(); iconImg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + mt.getIcon()); ExchangeTemplate ex = DataTemplate.GetInstance().GetExchangeTemplateByMonthCardId(monthcardT.getId()); if (ex != null) { costTxt.text = ex.getPrice().ToString(); } itemIconImg1.sprite = GameUtils.GetSpriteByResourceType(EM_RESOURCE_TYPE.Gold); itemIconImg1.gameObject.SetActive(mt.getDailydiamond() > 0); itemCountTxt1.text = mt.getDailydiamond() <= 0 ? "" : mt.getDailydiamond().ToString(); itemIconImg2.sprite = GameUtils.GetSpriteByResourceType(EM_RESOURCE_TYPE.Money); itemIconImg2.gameObject.SetActive(mt.getDailygold() > 0); itemCountTxt2.text = mt.getDailygold() <= 0 ? "" : mt.getDailygold().ToString(); SetMonthcardType(mt.getDuration() > 0 ? Monthcard_Type.Limited : Monthcard_Type.Forever); }