public void OnSelectedHeroSlot(UIHeroNewHeroSlot slot) { if (_heroSlotSelected != null) { _heroSlotSelected.DeSelected(); } _heroSlotSelected = slot; OnHeroSelected(); ShowHeroInfo(); if (heroDetail.gameObject.activeInHierarchy) { heroDetail.SetHero(_heroSlotSelected.userRole); } if (strategy.gameObject.activeInHierarchy) { strategy.SetRole(_heroSlotSelected.userRole, this); } consumeInfo.Close(); infoItemSelected.Close(); infoItemEuqiped.Close(); }
private void InitHeroList() { _heroSlots = new List <UIHeroNewHeroSlot>(); for (int i = 0; i < GameManager.GameUser.UserRoles.Count; i++) { GameObject go = NGUITools.AddChild(uiHeroList.root.gameObject, uiHeroList.prefab); go.SetActive(true); UIHeroNewHeroSlot heroSlot = go.GetComponent <UIHeroNewHeroSlot>(); heroSlot.SetHero(GameManager.GameUser.UserRoles[i], this); _heroSlots.Add(heroSlot); } uiHeroList.root.Reposition(); }
public void OnResponseHeroListFormServer() { InitHeroList(); if (_heroSlots.Count > 0) { _heroSlotSelected = _heroSlots[0]; } ShowHeroInfo(); inventory.Init(); _controller.SendRequestGetHireHero(); }