| | |
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow; |
| | | HeroManager.Instance.onHeroDeleteEvent += HeroDeleteEvent; |
| | | HeroUIManager.Instance.SortHeroList(); |
| | | UIManager.Instance.OnOpenWindow += OnOpenWindow; |
| | | CreateScroller(); |
| | | Refresh(); |
| | | } |
| | |
| | | PackManager.Instance.gridRefreshEvent -= GridRefreshEvent; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | HeroManager.Instance.onHeroDeleteEvent -= HeroDeleteEvent; |
| | | UIManager.Instance.OnOpenWindow -= OnOpenWindow; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void OnOpenWindow(UIBase openUI) |
| | | { |
| | | if (openUI is NewBieWin) |
| | | { |
| | | if (HeroUIManager.Instance.heroStarGuideDic.ContainsKey(NewBieCenter.Instance.guideStep)) |
| | | { |
| | | int jumpHeroID = HeroUIManager.Instance.heroStarGuideDic[NewBieCenter.Instance.guideStep]; |
| | | heroListScroller.JumpIndex(FindJumpIndexByHeroID(jumpHeroID)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | int FindJumpIndexByHeroID(int heroID) |
| | | { |
| | | int index = -1; |
| | | foreach (var guid in HeroUIManager.Instance.heroSortList) |
| | | { |
| | | index++; |
| | | var hero = HeroManager.Instance.GetHero(guid); |
| | | if (hero == null) |
| | | continue; |
| | | if (hero.heroId == heroID) |
| | | { |
| | | return index/4 - 1; |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | |
| | | public override void Refresh() |
| | | { |