private void Start() { turnManager = GetComponent <TurnManager>(); aIcon = iconsPanel.GetComponent <AbilityIcon>(); hIcon = iconsPanel.GetComponent <HeroIcon>(); loreInfoText = LoreInfo.GetComponentInChildren <Text>(); abilityInfoText = abilityInfo.GetComponentInChildren <Text>(); }
private void InitHeroHead() { OnClickButton(0); if (HeroHeadScrollView != null) { for (int i = 0; i < heroIconList.Count; i++) { Destroy(heroIconList[i]); } Dictionary <long, Hero> heroes = DataManager.GetInstance().GetHeroes(); int index = 0; foreach (KeyValuePair <long, Hero> heroPair in heroes) { //显示所有拥有的佣兵,在战斗界面进行部署上阵,并且上阵的优先显示 if (heroPair.Value.teamPosition > -1) { GameObject gameObject = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("", "HeroIcon"); if (gameObject != null) { gameObject.transform.SetParent(HeroHeadScrollView.content, false); HeroIcon head = gameObject.GetComponent <HeroIcon>(); head.InitData(heroPair.Value); heroIconList.Add(gameObject); } if (index == 0) { HeroIndex = heroPair.Key; } index++; } } foreach (KeyValuePair <long, Hero> heroPair in heroes) { //显示所有拥有的佣兵,在战斗界面进行部署上阵,并且上阵的优先显示 if (heroPair.Value.teamPosition <= -1) { GameObject gameObject = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("", "HeroIcon"); if (gameObject != null) { gameObject.transform.SetParent(HeroHeadScrollView.content, false); HeroIcon head = gameObject.GetComponent <HeroIcon>(); head.InitData(heroPair.Value); heroIconList.Add(gameObject); } } } //if (heroes.Count > 0) { SetCuurentHero(); } } }
public void AddHeroToListView(Hero hero) { GameObject gameObject = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("", "HeroIcon"); if (gameObject != null) { gameObject.transform.SetParent(heroesView.content, false); HeroIcon heroicon = gameObject.GetComponent <HeroIcon>(); if (heroicon != null) { heroicon.InitData(hero, HeroIconType.ChangeHeroPanel); } heroes.Add(gameObject); } }
public void ChoseFirstHero(HeroIcon icon) { leftHero.texture = icon.sideAvatar; playBtn.interactable = true; playBtn.GetComponentInChildren <Text>().text = "Fight!"; }