| | |
| | | {
|
| | | Dictionary<int, TreasureSpecialData> treasureSoulDict = new Dictionary<int, TreasureSpecialData>();
|
| | | List<int> treasureSouls = new List<int>();
|
| | | Dictionary<int, List<int>> soulAchievements = new Dictionary<int, List<int>>();
|
| | | public Dictionary<int, int> signAddProperty = new Dictionary<int, int>();
|
| | | public int signAddTreasure { get; private set; }
|
| | |
|
| | |
| | | {
|
| | | packModel.RefreshItemCountAct += RefreshItemCountAct;
|
| | | PlayerStrengthengDatas.RefreshEquipUpgradLvAct += RefreshEquipSTRLv;
|
| | | achievementModel.achievementProgressUpdateEvent += AchievementUpdate;
|
| | | achievementModel.achievementCompletedEvent += AchievementUpdate;
|
| | | ParseConfig();
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | packModel.RefreshItemCountAct -= RefreshItemCountAct;
|
| | | PlayerStrengthengDatas.RefreshEquipUpgradLvAct -= RefreshEquipSTRLv;
|
| | | achievementModel.achievementProgressUpdateEvent -= AchievementUpdate;
|
| | | achievementModel.achievementCompletedEvent -= AchievementUpdate;
|
| | | }
|
| | |
|
| | | void ParseConfig()
|
| | |
| | | }
|
| | | treasureSouls.Add(configs[i].PrivilegeID);
|
| | | treasureSoulDict.Add(configs[i].PrivilegeID, new TreasureSpecialData((TreasurePrivilege)configs[i].PrivilegeID));
|
| | | soulAchievements.Add(configs[i].PrivilegeID, new List<int>(configs[i].successList));
|
| | | }
|
| | | var funcConfig = Config.Instance.Get<FuncConfigConfig>("MWSignDayAttr");
|
| | | var jsonData = LitJson.JsonMapper.ToObject(funcConfig.Numerical1);
|
| | |
| | | return treasureSouls;
|
| | | }
|
| | |
|
| | | public bool TryGetLockAchievement(int _id,out int achievementId)
|
| | | {
|
| | | achievementId = 0;
|
| | | List<int> list;
|
| | | if (soulAchievements.TryGetValue(_id, out list))
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | var config = Config.Instance.Get<SuccessConfig>(list[i]);
|
| | | if (config != null && config.Type == 1)
|
| | | {
|
| | | achievementId = list[i];
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool TryGetAchievements(int _id,out List<int> list)
|
| | | {
|
| | | return soulAchievements.TryGetValue(_id, out list);
|
| | | }
|
| | |
|
| | | public bool IsCompleteLockAchievement(int _id)
|
| | | {
|
| | | TreasureSpecialData special;
|
| | | if (TryGetTreasureSoul(_id, out special))
|
| | | {
|
| | | if (special.active)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | int achievementId;
|
| | | if (TryGetLockAchievement(_id, out achievementId))
|
| | | {
|
| | | Achievement achievement;
|
| | | return achievementModel.TryGetAchievement(achievementId, out achievement) && achievement.completed;
|
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | public bool IsCompleteAllAchievement(int _id)
|
| | | {
|
| | | if (soulAchievements.ContainsKey(_id))
|
| | | {
|
| | | var list = soulAchievements[_id];
|
| | | bool allCompleted = true;
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | Achievement achievement;
|
| | | achievementModel.TryGetAchievement(list[i], out achievement);
|
| | | if (achievement == null || (!achievement.completed && !Achievement.IsReach(achievement.id, achievement.progress)))
|
| | | {
|
| | | allCompleted = false;
|
| | | }
|
| | | }
|
| | | return allCompleted;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool TryGetTreasureSoul(int _id, out TreasureSpecialData special)
|
| | | {
|
| | | return treasureSoulDict.TryGetValue(_id, out special);
|
| | | }
|
| | |
|
| | | public void ActiveTreasureSoul(int _id)
|
| | | {
|
| | | if (IsCompleteAllAchievement(_id))
|
| | | {
|
| | | CA512_tagCMActiveMWSoul pak = new CA512_tagCMActiveMWSoul();
|
| | | pak.ID = (byte)_id;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetTreasureSoulValue(int _soulId)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void AchievementUpdate(int _id)
|
| | | {
|
| | | foreach (var soulId in soulAchievements.Keys)
|
| | | {
|
| | | if (soulAchievements[soulId].Contains(_id))
|
| | | {
|
| | | UpdateAchievementRedpoint(soulId);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateTreasureSoulStrenthen()
|
| | | {
|
| | | UpdateRedpoint((int)TreasurePrivilege.StrengthenAdd);
|
| | |
| | | }
|
| | | bool beforeActived = special.active;
|
| | | special.active = _data.State == 1;
|
| | | if (!beforeActived && special.active && serverInited && WindowCenter.Instance.CheckOpen<TreasureSoulWin>()
|
| | | && !WindowCenter.Instance.CheckOpen<TreasureSoulActiveWin>() && !NewBieCenter.Instance.inGuiding)
|
| | | {
|
| | | TreasureSoulActiveWin.treasureSoulId = (int)_data.PriID;
|
| | | WindowCenter.Instance.Open<TreasureSoulActiveWin>();
|
| | | }
|
| | | //if (!beforeActived && special.active && serverInited && WindowCenter.Instance.CheckOpen<TreasureSoulWin>()
|
| | | // && !WindowCenter.Instance.CheckOpen<TreasureSoulActiveWin>() && !NewBieCenter.Instance.inGuiding)
|
| | | //{
|
| | | // TreasureSoulActiveWin.treasureSoulId = (int)_data.PriID;
|
| | | // WindowCenter.Instance.Open<TreasureSoulActiveWin>();
|
| | | //}
|
| | | if ((TreasurePrivilege)_data.PriID == TreasurePrivilege.StrengthenAdd)
|
| | | {
|
| | | if (treasureSoulEvent != null)
|
| | | {
|
| | | treasureSoulEvent((int)_data.PriID);
|
| | | }
|
| | | UpdateAchievementRedpoint((int)_data.PriID);
|
| | | UpdateRedpoint((int)_data.PriID);
|
| | | continue;
|
| | | }
|
| | |
| | | special.presentGetCount = (int)_data.CurValue;
|
| | | special.itemGet = _data.ItemAwardState == 1;
|
| | | UpdateRedpoint((int)_data.PriID);
|
| | | UpdateAchievementRedpoint((int)_data.PriID);
|
| | | if (treasureSoulEvent != null)
|
| | | {
|
| | | treasureSoulEvent((int)_data.PriID);
|
| | | }
|
| | |
|
| | | if (beforeFinishCount < special.presentFinishCount && serverInited && special.active
|
| | | && !WindowCenter.Instance.CheckOpen<TreasureSoulActiveWin>()
|
| | | && WindowCenter.Instance.CheckOpen<TreasureSoulWin>()
|
| | | && !WindowCenter.Instance.CheckOpen<RealmPropertyUpWin>()
|
| | | && !NewBieCenter.Instance.inGuiding)
|
| | |
| | | _specialData.presentFinishCount = (int)_data.Cnt;
|
| | | UpdateRedpoint((int)TreasurePrivilege.StrengthenAdd);
|
| | | if (beforeFinishCount < _specialData.presentFinishCount && serverInited && _specialData.active
|
| | | && !WindowCenter.Instance.CheckOpen<TreasureSoulActiveWin>()
|
| | | && WindowCenter.Instance.CheckOpen<TreasureSoulWin>()
|
| | | && !WindowCenter.Instance.CheckOpen<RealmPropertyUpWin>())
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateAchievementRedpoint(int _id)
|
| | | {
|
| | | if (treasureSoulDict.ContainsKey(_id) && soulAchievements.ContainsKey(_id))
|
| | | {
|
| | | var special = treasureSoulDict[_id];
|
| | | special.activeRedpoint.state = RedPointState.None;
|
| | | if (!FuncOpen.Instance.IsFuncOpen(126) || !IsOpenTreasureSoul(_id) || special.active)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var list = soulAchievements[_id];
|
| | | bool allCompleted = true;
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | Achievement achievement;
|
| | | achievementModel.TryGetAchievement(list[i], out achievement);
|
| | | if (achievement == null || (!achievement.completed && !Achievement.IsReach(achievement.id, achievement.progress)))
|
| | | {
|
| | | allCompleted = false;
|
| | | }
|
| | | }
|
| | | special.activeRedpoint.state = allCompleted ? RedPointState.Simple : RedPointState.None;
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateRedpoints()
|
| | | {
|
| | | foreach (var special in treasureSoulDict.Keys)
|
| | | {
|
| | | UpdateRedpoint(special);
|
| | | UpdateAchievementRedpoint(special);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | public Dictionary<int, int> propertyDict { get; private set; }
|
| | | public Redpoint redpoint { get; private set; }
|
| | | public Redpoint privilegeRedpoint { get; private set; }
|
| | | public Redpoint activeRedpoint { get; private set; }
|
| | |
|
| | | public int treasureId { get; set; }
|
| | | public bool active { get; set; }
|
| | |
| | | }
|
| | |
|
| | | redpoint = new Redpoint(TreasureModel.TREASURE_SOUL_ID, TreasureModel.TREASURE_SOUL_ID * 100 + (int)type);
|
| | | activeRedpoint = new Redpoint(redpoint.id, redpoint.id * 100 + 1);
|
| | | switch (_type)
|
| | | {
|
| | | case TreasurePrivilege.DemonJarAtk:
|