0312 优化武将遣散,图鉴跳转,引导升星武将定位
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | |
| | | |
| | | void CreateScroller() |
| | | { |
| | | int jumpIndex = -1; |
| | | int index = -1; |
| | | heroListScroller.Refresh(); |
| | | var _List = HeroUIManager.Instance.heroCollectDict.Keys.ToList(); |
| | | _List.Reverse(); |
| | |
| | | for (int j = 0; j < ids.Count; j++) |
| | | { |
| | | if (j % 4 == 0) |
| | | { |
| | | { |
| | | index++; |
| | | CellInfo cellInfo = new CellInfo(); |
| | | cellInfo.infoInt1 = _List[i]; |
| | | heroListScroller.AddCell(ScrollerDataType.Normal, j, cellInfo); |
| | | } |
| | | |
| | | if (jumpIndex == -1) |
| | | { |
| | | //检查每个武将 |
| | | if (HeroUIManager.Instance.IsBookShowRedPoint(ids[j])) |
| | | { |
| | | jumpIndex = index; |
| | | } |
| | | } |
| | | } |
| | | index++; |
| | | } |
| | | heroListScroller.Restart(); |
| | | heroListScroller.JumpIndex(jumpIndex); |
| | | } |
| | | |
| | | |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | if (type == ScrollerDataType.Header) |
| | |
| | | |
| | | void Click(HeroInfo hero, int index) |
| | | { |
| | | //上阵 锁定 觉醒 的情况 |
| | | if (hero.awakeLevel > 0) |
| | | if (!HeroUIManager.Instance.SelectDeleteHero(hero)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroReborn1"); |
| | | return; |
| | | } |
| | | |
| | | if (hero.IsInAnyTeamJustOne()) |
| | | { |
| | | //阵容至少要有一个武将上阵 |
| | | SysNotifyMgr.Instance.ShowTip("HeroFunc3"); |
| | | return; |
| | | } |
| | | |
| | | if (hero.isLock) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("herocard66"), (bool isOK) => |
| | | { |
| | | if (isOK) |
| | | { |
| | | hero.ChangeLockState(); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (hero.IsInAnyTeam()) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("herocard65"), (bool isOK) => |
| | | { |
| | | if (isOK) |
| | | { |
| | | hero.LeaveAllTeam(); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (HeroUIManager.Instance.selectDeleteHeroList.Contains(hero.itemHero.guid)) |
| | | { |
| | | HeroUIManager.Instance.selectDeleteHeroList.Remove(hero.itemHero.guid); |
| | | } |
| | | else |
| | | { |
| | | HeroUIManager.Instance.selectDeleteHeroList.Add(hero.itemHero.guid); |
| | | } |
| | | |
| | | Display(index); |
| | |
| | | HeroUIManager.Instance.SortHeroDeleteList(); |
| | | heroSelectBehaviour.Display(0, HeroUIManager.Instance.selectHeroDeleteListJob, HeroUIManager.Instance.selectHeroDeleteListCountry, SelectJobCountry); |
| | | RefreshEmptyTip(); |
| | | |
| | | //外部选中 |
| | | HeroUIManager.Instance.SelectDeleteHero(HeroManager.Instance.GetHero(HeroUIManager.Instance.jumpDeleteHeroGuid)); |
| | | |
| | | CreateScroller(); |
| | | } |
| | | |
| | |
| | | PackManager.Instance.RefreshItemLockEvent -= RefreshItemLockEvent; |
| | | ItemLogicUtility.Instance.OnGetItemShowEvent -= OnGetItemShowEvent; |
| | | HeroUIManager.Instance.selectDeleteHeroList.Clear(); |
| | | HeroUIManager.Instance.jumpDeleteHeroGuid = ""; |
| | | } |
| | | |
| | | void CreateScroller() |
| | |
| | | } |
| | | } |
| | | scroller.Restart(); |
| | | scroller.JumpIndex(FindJumpIndexByHero(HeroUIManager.Instance.jumpDeleteHeroGuid)); |
| | | } |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | |
| | | } |
| | | |
| | | void OnGetItemShowEvent() |
| | | { |
| | | { |
| | | HeroUIManager.Instance.SortHeroDeleteList(); |
| | | CreateScroller(); |
| | | } |
| | | |
| | | |
| | | int FindJumpIndexByHero(string guid) |
| | | { |
| | | var hero = HeroManager.Instance.GetHero(guid); |
| | | if (hero == null) |
| | | return -1; |
| | | if (hero.Quality > HeroUIManager.Instance.jumpDeleteHeroQuality && !HeroUIManager.Instance.isJumpDeleteHero) |
| | | { |
| | | return -1; |
| | | } |
| | | return HeroUIManager.Instance.heroDeleteSortList.IndexOf(guid) / 5 - 1; |
| | | } |
| | | } |
| | |
| | | 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() |
| | | { |
| | |
| | | // SysNotifyMgr.Instance.ShowTip("UnlockHero"); |
| | | // return; |
| | | // } |
| | | |
| | | HeroUIManager.Instance.jumpDeleteHeroGuid = guid; |
| | | UIManager.Instance.OpenWindow<HeroDeleteWin>(); |
| | | } |
| | | |
| | |
| | | { |
| | | if (team.serverHeroes[i] != null) |
| | | { |
| | | if (team.serverHeroes[i].level < minLV) |
| | | var hero = HeroManager.Instance.GetHero(team.serverHeroes[i].guid); |
| | | if (hero != null && hero.heroLevel < minLV) |
| | | { |
| | | minLV = team.serverHeroes[i].level; |
| | | minID = team.serverHeroes[i].heroId; |
| | | minLV = hero.heroLevel; |
| | | minID = hero.heroId; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public List<string> selectDeleteHeroList { get; private set; } = new List<string>(); |
| | | |
| | | public string jumpDeleteHeroGuid; |
| | | public int jumpDeleteHeroQuality; |
| | | public bool isJumpDeleteHero = false; //不可选中的时候是否跳转 |
| | | |
| | | |
| | | public Dictionary<int, long> GetHeroLVPayBack(int quality, int lv) |
| | | { |
| | |
| | | lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculateFightPower(false)); |
| | | |
| | | } |
| | | |
| | | // 点选删除列表的武将,添加或者从列表中移除 |
| | | // 返回是否操作成功 |
| | | public bool SelectDeleteHero(HeroInfo hero) |
| | | { |
| | | if (hero == null) |
| | | { |
| | | return false; |
| | | } |
| | | //上阵 锁定 觉醒 的情况 |
| | | if (hero.awakeLevel > 0) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroReborn1"); |
| | | return false; |
| | | } |
| | | |
| | | if (hero.IsInAnyTeamJustOne()) |
| | | { |
| | | //阵容至少要有一个武将上阵 |
| | | SysNotifyMgr.Instance.ShowTip("HeroFunc3"); |
| | | return false; |
| | | } |
| | | |
| | | if (hero.isLock) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("herocard66"), (bool isOK) => |
| | | { |
| | | if (isOK) |
| | | { |
| | | hero.ChangeLockState(); |
| | | } |
| | | }); |
| | | return false; |
| | | } |
| | | |
| | | if (hero.IsInAnyTeam()) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("herocard65"), (bool isOK) => |
| | | { |
| | | if (isOK) |
| | | { |
| | | hero.LeaveAllTeam(); |
| | | } |
| | | }); |
| | | return false; |
| | | } |
| | | |
| | | if (selectDeleteHeroList.Contains(hero.itemHero.guid)) |
| | | { |
| | | selectDeleteHeroList.Remove(hero.itemHero.guid); |
| | | } |
| | | else |
| | | { |
| | | selectDeleteHeroList.Add(hero.itemHero.guid); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | public bool isCustonHeroFormation = false; |
| | | public List<TeamHero> custonTeamHeroes = new List<TeamHero>(); |
| | | |
| | | |
| | | public Dictionary<int, int> heroStarGuideDic = new Dictionary<int, int>(); |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; |
| | |
| | | teamSortByJob = JsonMapper.ToObject<int[]>(config.Numerical2); |
| | | onekeyGuideID = int.Parse(config.Numerical3); |
| | | onekeyGuidePosList = JsonMapper.ToObject<int[]>(config.Numerical4); |
| | | |
| | | |
| | | config = FuncConfigConfig.Get("Guide"); |
| | | heroStarGuideDic = ConfigParse.ParseIntDict(config.Numerical1); |
| | | |
| | | config = FuncConfigConfig.Get("HeroDelete"); |
| | | jumpDeleteHeroQuality = int.Parse(config.Numerical1); |
| | | isJumpDeleteHero = int.Parse(config.Numerical2) == 1; |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | |
| | | } |
| | | } |
| | | |
| | | //某个武将图鉴中是否显示红点 |
| | | public bool IsBookShowRedPoint(int heroID) |
| | | { |
| | | var state = GetHeroBookState(heroID, HeroConfig.Get(heroID).Quality); |
| | | if (state == 1 || state == 3 || state == 4) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | void UpdateHeroBookRedpoint() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Hero)) |
| | |
| | | lastDataCnt = _data.Count;
|
| | | }
|
| | |
|
| | | //index 是按addcell的顺序,包含所有层级
|
| | | public void JumpIndex(int index)
|
| | | {
|
| | | if (!inited)
|