| | |
| | | private void OnBeforePlayerDataInitializeEventOnRelogin() |
| | | { |
| | | isSendFirst = true; |
| | | starHeroIndexDict.Clear(); |
| | | starHeroIndex = 0; |
| | | callHeroIndex = 0; |
| | | starFreeAwardDict.Clear(); |
| | | callHeroIndexDict.Clear(); |
| | | } |
| | | |
| | | private void OnPlayerLoginOk() |
| | |
| | | UIManager.Instance.CloseWindow<HeroDebutPopWin>(); |
| | | if (UIManager.Instance.IsOpened<HeroDebutWin>()) |
| | | UIManager.Instance.CloseWindow<HeroDebutWin>(); |
| | | gameRecDict.Clear(); |
| | | UpdateRedpoint(); |
| | | } |
| | | } |
| | |
| | | OnNowCallChooseHeroIDChangeEvent?.Invoke(); |
| | | } |
| | | } |
| | | public event Action<int> OnUpdateHeroAppearPlayerInfoEvent; |
| | | public int starHeroIndex = 0; |
| | | public int callHeroIndex = 0; |
| | | //<升星计划选择的武将ID索引,升星计划免费奖励记录> |
| | | Dictionary<int, uint> starFreeAwardDict = new(); |
| | | |
| | | public event Action OnUpdateHeroAppearPlayerInfoEvent; |
| | | public void UpdateHeroAppearPlayerInfo(HAA22_tagSCActHeroAppearPlayerInfo vNetData) |
| | | { |
| | | if (vNetData == null) return; |
| | | int actNum = vNetData.ActNum; |
| | | starHeroIndexDict[actNum] = vNetData.StarHeroIndex; |
| | | callHeroIndexDict[actNum] = vNetData.CallHeroIndex; |
| | | if (vNetData.ActNum != this.actNum) return; |
| | | |
| | | if (!starFreeAwardDict.TryGetValue(actNum, out var dict)) |
| | | { |
| | | dict = new Dictionary<int, uint>(); |
| | | starFreeAwardDict[actNum] = dict; |
| | | } |
| | | dict[vNetData.StarHeroIndex] = vNetData.StarFreeAward; |
| | | int actNum = vNetData.ActNum; |
| | | starHeroIndex = vNetData.StarHeroIndex; |
| | | callHeroIndex = vNetData.CallHeroIndex; |
| | | starFreeAwardDict[starHeroIndex] = vNetData.StarFreeAward; |
| | | UpdateRedpoint(); |
| | | OnUpdateHeroAppearPlayerInfoEvent?.Invoke(actNum); |
| | | OnUpdateHeroAppearPlayerInfoEvent?.Invoke(); |
| | | } |
| | | |
| | | public void SendHeroAppearStarHeroSelect(int actNum, int starHeroIndex) |
| | |
| | | |
| | | #region 升星计划 |
| | | |
| | | //<活动编号,升星计划选择的武将ID索引> |
| | | public Dictionary<int, int> starHeroIndexDict = new(); |
| | | |
| | | //<活动编号,<升星计划选择的武将ID索引,升星计划免费奖励记录>> |
| | | public Dictionary<int, Dictionary<int, uint>> starFreeAwardDict = new(); |
| | | |
| | | /// <summary> |
| | | /// 当前升星计划选中的武将ID |
| | | /// </summary> |
| | |
| | | { |
| | | var act = GetOperationHeroAppearInfo(); |
| | | if (act == null) return 0; |
| | | if (!starHeroIndexDict.TryGetValue(actNum, out int index)) return 0; |
| | | |
| | | var config = ActHeroAppearConfig.Get(act.CfgID); |
| | | if (config == null || config.ActHeroIDList?.Length <= index) return 0; |
| | | if (config == null || config.ActHeroIDList?.Length <= starHeroIndex) return 0; |
| | | |
| | | return config.ActHeroIDList[index]; |
| | | return config.ActHeroIDList[starHeroIndex]; |
| | | } |
| | | |
| | | private Dictionary<int, Dictionary<int, int[][]>> showHeroGiftItemInfoDict = new(); |
| | |
| | | // 没获得武将本体不可领取 |
| | | if (!HeroManager.Instance.HasHero(heroId))return 0; |
| | | |
| | | if (!starHeroIndexDict.TryGetValue(actNum, out int index)) return 0; |
| | | if (IsStarUpFreeHave(index, config.AwardIndex)) return 2; |
| | | if (IsStarUpFreeHave(starHeroIndex, config.AwardIndex)) return 2; |
| | | if (IsHeroStarCntOk(heroConfig.HeroID, config.NeedStar)) return 1; |
| | | return 0; |
| | | } |
| | | |
| | | private bool IsStarUpFreeHave(int starHeroIndex, int awardIndex) |
| | | { |
| | | if (!starFreeAwardDict.TryGetValue(actNum, out var dict)) return false; |
| | | if (!dict.TryGetValue(starHeroIndex, out uint freeAward)) return false; |
| | | if (!starFreeAwardDict.TryGetValue(starHeroIndex, out uint freeAward)) return false; |
| | | return ((freeAward >> awardIndex) & 1u) == 1u; |
| | | } |
| | | |
| | |
| | | public bool TryGetStarUpStateIndex(int starGiftTempID, int tarState, out int index) |
| | | { |
| | | index = 0; |
| | | var list = ActHeroAppearStarConfig.GetAwardIndexSortList(starGiftTempID); |
| | | var list = ActHeroAppearStarConfig.GetHeroDebutAwardIndexSortList(starGiftTempID); |
| | | if (list == null) return false; |
| | | |
| | | for (int i = 0; i < list.Count; i++) |
| | |
| | | } |
| | | private string GetCallSkipKey(int cfgID, OperationDate startDate, OperationDate endDate) |
| | | { |
| | | return string.Concat("HeroDebutManager_CallSkip_", cfgID, ToInt(startDate), ToInt(endDate), PlayerDatas.Instance.PlayerId); |
| | | return string.Concat("HeroDebutManager_CallSkip_", cfgID, "_", ToInt(startDate), "_", ToInt(endDate), "_", PlayerDatas.Instance.PlayerId); |
| | | } |
| | | |
| | | public bool LoadCallSkipData(int cfgID, OperationDate startDate, OperationDate endDate) |
| | |
| | | LocalSave.SetBool(GetCallSkipKey(cfgID, startDate, endDate), value); |
| | | } |
| | | |
| | | //<活动编号,招募选择的武将ID索引> |
| | | public Dictionary<int, int> callHeroIndexDict = new(); |
| | | |
| | | /// <summary> |
| | | /// 当前招募选中的武将ID |
| | | /// </summary> |
| | |
| | | { |
| | | var act = GetOperationHeroAppearInfo(); |
| | | if (act == null) return 0; |
| | | if (!callHeroIndexDict.TryGetValue(actNum, out int index)) return 0; |
| | | |
| | | var config = ActHeroAppearConfig.Get(act.CfgID); |
| | | if (config == null || config.ActHeroIDList?.Length <= index) return 0; |
| | | if (config == null || config.ActHeroIDList?.Length <= callHeroIndex) return 0; |
| | | |
| | | return config.ActHeroIDList[index]; |
| | | return config.ActHeroIDList[callHeroIndex]; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | return gameRecDict; |
| | | } |
| | | public List<HeroDebutGameRec> GetLastFourRecords() |
| | | { |
| | | if (gameRecDict == null || gameRecDict.Count == 0) return new List<HeroDebutGameRec>(); |
| | | |
| | | int count = gameRecDict.Count; |
| | | int takeCount = Math.Min(4, count); |
| | | return gameRecDict.GetRange(count - takeCount, takeCount); |
| | | } |
| | | |
| | | public event Action OnUpdateGameRecInfo; |
| | | public void UpdateGameRecInfo(HA009_tagSCGameRecInfo vNetData) |
| | | { |
| | | |
| | | var act = GetOperationHeroAppearInfo(); |
| | | if (act == null) return; |
| | | |