/// <summary> /// 初始化所有的可出售卡片信息 /// </summary> void InitHeroListCards() { List <int> mHeroList = MarketHeroListModel.Instance.GetHeroList(HeroType.AllHero); if (HeroCardList.Count != 0) { HeroCardList.Clear(); } foreach (int hero in mHeroList) { ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.LoadGameMarketHeroTag, ResourceType.PREFAB); GameObject obj = GameObject.Instantiate(objUnit.Asset) as GameObject; obj.transform.parent = mGrid.transform; obj.transform.localScale = Vector3.one; obj.name = (HeroCardList.Count + 1).ToString(); HeroCard card = new HeroCard(); card.mRoot = obj; card.mGoodsId = hero; card.mSpriteIcon = obj.transform.FindChild("Portrait").GetComponent <UISprite>(); Transform cost = obj.transform.FindChild("Cost"); card.mDiamond_Common = cost.FindChild("Crystal1").gameObject; card.mDiamond_DisCount = cost.FindChild("Crystal2").gameObject; card.mGold_Common = cost.FindChild("Gold1").gameObject; card.mGold_DisCount = cost.FindChild("Gold2").gameObject; card.mGoldLine = cost.FindChild("Gold/Line"); card.mCrystalLine = cost.FindChild("Crystal/Line"); card.IsOwn = obj.transform.FindChild("IsOwn"); card.mName = obj.transform.FindChild("NamePlate/Name").GetComponent <UILabel>(); card.TagList.Add(obj.transform.FindChild("Discount").gameObject); card.TagList.Add(obj.transform.FindChild("Hot").gameObject); card.TagList.Add(obj.transform.FindChild("New").gameObject); HeroCardList.Add(card); } if (HeroCardList.Count != 0) { UIGuideCtrl.Instance.AddUiGuideEventBtn(HeroCardList[0].mRoot); } }