public void LoadHeroSlots() { LBLHeroCount.text = string.Format("{0}/{1} " + GameManager.localization.GetText("Hero_Heroes"), GameManager.GameUser.UserRoles.Count, _maxHero); int i = 0; foreach (UserRole item in GameManager.GameUser.UserRoles) { if (!_heroUISet.ContainsKey(item.Id)) { GameObject go = NGUITools.AddChild(HeroSlotRoot, HeroSlotPrefab); go.transform.localPosition = new Vector3(0, -70 * i, 0); UIHeroSlotManager slot = go.GetComponent <UIHeroSlotManager>(); slot.uiHeroManager = this; //Debug.Log("item " + item); slot.SetGameRole(item); if (i == 0) { slot.OnClick(); } _heroUISet[item.Id] = slot; } i++; } }
public void OnClickSlot(UIHeroSlotManager uiHeroSlotManager) { if (MessageBox.isShow) { return; } if (heroSlotSelected != null) { heroSlotSelected.OnDeselect(); } heroSlotSelected = uiHeroSlotManager; SetHeroSelectedUI(); inventory.RefreshGUI(); if (_curItemTypeSelect != ItemKind.None) { information.gameObject.SetActive(false); ClearItems(); OnSlot_Click(_curItemTypeSelect); } }