| | |
| | | /// </summary> |
| | | protected override void InitComponent() |
| | | { |
| | | |
| | | heroPackBtn.onClick.AddListener(() => |
| | | { |
| | | HeroUIManager.Instance.QueryUnLockHeroPack(); |
| | | }); |
| | | } |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | heroListScroller.OnRefreshCell += OnRefreshCell; |
| | | PackManager.Instance.RefreshItemEvent += RefreshPakCount; |
| | | HeroManager.Instance.SortHeroList(); |
| | | CreateScroller(); |
| | | Refresh(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | heroListScroller.OnRefreshCell -= OnRefreshCell; |
| | | PackManager.Instance.RefreshItemEvent -= RefreshPakCount; |
| | | } |
| | | |
| | | |
| | | public override void Refresh() |
| | | { |
| | | SinglePack singlePack = PackManager.Instance.GetSinglePack(PackType.Item); |
| | | if (singlePack == null || singlePack.GetAllItems().Count <= 0) |
| | | { |
| | | heroListEmpty.SetActive(true); |
| | | heroListScroller.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | heroListEmpty.SetActive(false); |
| | | heroListScroller.SetActive(true); |
| | | } |
| | | |
| | | //上阵属性 |
| | | for (int i = 0; i < attrOnList.Count; i++) |
| | | { |
| | | attrOnList[i].text = PlayerPropertyConfig.GetFullDescription(new Int2 (PlayerPropertyConfig.baseAttrs[i], 1 )); |
| | | } |
| | | } |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | |
| | | for (int i = 0; i < HeroManager.Instance.heroSortList.Count; i++) |
| | | { |
| | | if (i % 4 == 0) |
| | | { |
| | | { |
| | | heroListScroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | } |
| | | heroListScroller.Restart(); |
| | | } |
| | | |
| | | void RefreshPakCount(PackType type, int index, int itemID) |
| | | { |
| | | SinglePack singlePack = PackManager.Instance.GetSinglePack(PackType.Item); |
| | | if (singlePack == null) |
| | | return; |
| | | |
| | | int count = singlePack.GetAllItems().Count; |
| | | |
| | | heroPackText.text = UIHelper.AppendColor(count > singlePack.unlockedGridCount ? TextColType.Red : TextColType.NavyBrown, |
| | | string.Format("{0}/{1}", count, singlePack.unlockedGridCount)); |
| | | |
| | | } |
| | | |
| | | } |