| | |
| | | public event Action vipKillNPCTreasureEvent;
|
| | | public event Action<int> treasureLevelProgressUpdateEvent;
|
| | | public event Action<int> treasureStageUpEvent;
|
| | | public event Action<int> treasurePrivilegeUpdateEvent;
|
| | | public event Action<int> humanTreasureStateChangeEvent;
|
| | | public event Action<int> treasureSelectSoulChangeEvent;
|
| | |
|
| | | bool m_WaitOpenDetailsWin = false;
|
| | | public bool waitOpenDetailsWin {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | int m_SelectSoul = 0;
|
| | | public int selectSoul
|
| | | {
|
| | | get { return m_SelectSoul; }
|
| | | set
|
| | | {
|
| | | m_SelectSoul = value;
|
| | | if (treasureSelectSoulChangeEvent != null)
|
| | | {
|
| | | treasureSelectSoulChangeEvent(value);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public int gotoSoul { get; set; }
|
| | |
|
| | | int m_SelectedStage = 0;
|
| | | public int selectedStage {
|
| | |
| | | Dictionary<int, Treasure> treasures = new Dictionary<int, Treasure>();
|
| | | Dictionary<TreasureCategory, List<int>> treasureCategory = new Dictionary<TreasureCategory, List<int>>();
|
| | | Dictionary<int, int> treasureMapDict = new Dictionary<int, int>();
|
| | | Dictionary<int, TreasureSpecialData> treasurePrivilegeDict = new Dictionary<int, TreasureSpecialData>();
|
| | | Dictionary<int, int> treasureAchievementDict = new Dictionary<int, int>();
|
| | | List<int> eightFurnacesAchievements = new List<int>();
|
| | | List<int> m_CacheGotAchievements = new List<int>();
|
| | |
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFunctionStateChange;
|
| | | packageModel.RefreshItemCountAct += OnPackageItemChange;
|
| | | WindowCenter.Instance.windowAfterOpenEvent += OnWindowOpen;
|
| | | PlayerStrengthengDatas.RefreshEquipUpgradLvAct += RefreshEquipSTRLv;
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFunctionStateChange;
|
| | | packageModel.RefreshItemCountAct -= OnPackageItemChange;
|
| | | WindowCenter.Instance.windowAfterOpenEvent -= OnWindowOpen;
|
| | | PlayerStrengthengDatas.RefreshEquipUpgradLvAct -= RefreshEquipSTRLv;
|
| | | }
|
| | |
|
| | | public void OnAfterPlayerDataInitialize()
|
| | |
| | | if ((treasure is HumanTreasure))
|
| | | {
|
| | | var humanTreasure = treasure as HumanTreasure;
|
| | | humanTreasure.humanState = HumanTreasureState.Locked;
|
| | | treasure.specialData.presentFinishCount = 0;
|
| | | treasure.specialData.presentGetCount = 0;
|
| | | treasure.specialData.itemGet = false;
|
| | | humanTreasure.UpdateTreasureState();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | UpdateAchievementRedpoints();
|
| | | UpdateCastSoulRedpoints();
|
| | | UpdateSkillLevelUpRedpoints();
|
| | | UpdatePrivileges();
|
| | | }
|
| | |
|
| | | private bool needDisplayReguluLevelUp = false;
|
| | |
| | | {
|
| | | var _playerId = PlayerDatas.Instance.baseData.PlayerID;
|
| | | LocalSave.SetBool(StringUtility.Contact(_playerId, "_PotentialUnlockShow_", _treasureId), _value);
|
| | | }
|
| | |
|
| | | public bool GetSpAnim(int _treasureId)
|
| | | {
|
| | | var list = GetTreasureCategory(TreasureCategory.Human);
|
| | | var index = list.IndexOf(_treasureId);
|
| | | if (index == -1)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | uint value = 0;
|
| | | uint.TryParse(QuickSetting.Instance.GetQuickSetting(QuickSetting.QuickSettingType.SpAnim, 0), out value);
|
| | | return MathUtility.GetBitValue(value, (ushort)index);
|
| | | }
|
| | |
|
| | | public void SetSpAnim(int _treasureId, bool anim = true)
|
| | | {
|
| | | var list = GetTreasureCategory(TreasureCategory.Human);
|
| | | var index = list.IndexOf(_treasureId);
|
| | | if (index == -1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | uint value = 0;
|
| | | uint.TryParse(QuickSetting.Instance.GetQuickSetting(QuickSetting.QuickSettingType.SpAnim, 0), out value);
|
| | | int bitValue = MathUtility.SetBitValue((int)value, (ushort)index, anim);
|
| | | QuickSetting.Instance.SetQuickSetting(QuickSetting.QuickSettingType.SpAnim, bitValue);
|
| | | QuickSetting.Instance.SendPackage();
|
| | | }
|
| | |
|
| | | public bool TryGetUnlockShowTreasure(out int _id)
|
| | |
| | | if (treasure is HumanTreasure)
|
| | | {
|
| | | var humanTreasure = treasure as HumanTreasure;
|
| | | humanTreasure.humanState = HumanTreasureState.CastSoul;
|
| | | humanTreasure.UpdateTreasureState();
|
| | | UpdateCastSoulRedpoint(treasure.id);
|
| | | if (GetTreasureUnlockShow(TreasureCategory.Human) == treasure.id)
|
| | | {
|
| | |
| | | }
|
| | | if (serverInited)
|
| | | {
|
| | | newGotTreasureId = id == 301 ? 0 : id;
|
| | | newGotTreasureId = id;
|
| | | treasureEntranceShowId = id;
|
| | |
|
| | | var mapConfig = ConfigManager.Instance.GetTemplate<MapConfig>(PlayerDatas.Instance.baseData.MapID);
|
| | |
| | | treasure.state = TreasureState.Collecting;
|
| | | if ((TreasureCategory)config.Category == TreasureCategory.Human)
|
| | | {
|
| | | (treasure as HumanTreasure).humanState = HumanTreasureState.Challenge;
|
| | | (treasure as HumanTreasure).UpdateTreasureState();
|
| | | }
|
| | | if ((TreasureCategory)config.Category == TreasureCategory.Demon)
|
| | | {
|
| | |
| | | UpdateSkillLevelUpRedpoints();
|
| | | }
|
| | | }
|
| | |
|
| | | if (_type == PackType.rptEquip)
|
| | | {
|
| | | UpdateTreasurePrivilegeStrenthen();
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnFunctionStateChange(int _functionId)
|
| | |
| | | if (_functionId == 82)
|
| | | {
|
| | | UpdateSkillLevelUpRedpoints();
|
| | | if (!FuncOpen.Instance.IsFuncOpen(82) || !serverInited)
|
| | | if (!FuncOpen.Instance.IsFuncOpen(82))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | {
|
| | | Treasure treasure;
|
| | | TryGetTreasure(list[i], out treasure);
|
| | | if (WindowCenter.Instance.CheckOpen<TreasureLevelUpWin>()
|
| | | && selectedTreasure == list[i] && treasure.IsMaxStage())
|
| | | var humanTreasure = treasure as HumanTreasure;
|
| | | humanTreasure.UpdateTreasureState();
|
| | | if (!serverInited || !treasure.IsHighestStage)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | | var anyPointialLevelupAble = false;
|
| | | if (treasure.state == TreasureState.Collected && treasure.IsMaxStage())
|
| | | if (treasure.state == TreasureState.Collected && treasure.IsHighestStage)
|
| | | {
|
| | | for (int i = 0; i < treasure.potentials.Count; i++)
|
| | | {
|
| | |
| | | if (_pretreasure == null || _pretreasure.state == TreasureState.Collected)
|
| | | {
|
| | | treasure.state = TreasureState.Collecting;
|
| | | (treasure as HumanTreasure).humanState = HumanTreasureState.Challenge;
|
| | | (treasure as HumanTreasure).UpdateTreasureState();
|
| | | collectingHuman = treasure.id;
|
| | | if (serverInited)
|
| | | {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if((TreasureCategory)config.Category == TreasureCategory.Human && treasure.IsMaxStage())
|
| | | if((TreasureCategory)config.Category == TreasureCategory.Human && treasure.IsHighestStage)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | }
|
| | | UpdateCastSoulRedpoint(treasure.id);
|
| | | UpdateAchievementRedpoint(treasure.id);
|
| | | if (treasure.IsMaxStage())
|
| | | {
|
| | | UpdatePrivilege(treasure.id);
|
| | | }
|
| | | if (serverInited && _up && treasureStageUpEvent != null)
|
| | | {
|
| | | treasureStageUpEvent(treasure.id);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateTreasurePrivilege(HA353_tagMCMWPrivilegeDataInfo package)
|
| | | {
|
| | | for (int i = 0; i < package.Count; i++)
|
| | | {
|
| | | var _data = package.InfoList[i];
|
| | | if ((TreasurePrivilege)_data.PriID == TreasurePrivilege.StrengthenAdd)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (treasurePrivilegeDict.ContainsKey((int)_data.PriID))
|
| | | {
|
| | | var _specialData = treasurePrivilegeDict[(int)_data.PriID];
|
| | | _specialData.presentFinishCount = (int)_data.GotValue;
|
| | | _specialData.presentGetCount = (int)_data.CurValue;
|
| | | _specialData.itemGet = _data.ItemAwardState == 1;
|
| | | var _list = treasureCategory[TreasureCategory.Human];
|
| | | var _index = _list.FindIndex((x) =>
|
| | | {
|
| | | var treasure = treasures[x];
|
| | | return (int)treasure.specialData.type == _data.PriID;
|
| | | });
|
| | | if (_index != -1)
|
| | | {
|
| | | UpdatePrivilege(_list[_index]);
|
| | | }
|
| | | }
|
| | | if (treasurePrivilegeUpdateEvent != null)
|
| | | {
|
| | | treasurePrivilegeUpdateEvent((int)_data.PriID);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateTreasurePrivilege(HA317_tagMCAllEquipAttrActiveInfo package)
|
| | | {
|
| | | for (int i = 0; i < package.ActiveInfo.Length; i++)
|
| | | {
|
| | | var _data = package.ActiveInfo[i];
|
| | | if (_data.Type == 0)
|
| | | {
|
| | | if (treasurePrivilegeDict.ContainsKey((int)TreasurePrivilege.StrengthenAdd))
|
| | | {
|
| | | var _specialData = treasurePrivilegeDict[(int)TreasurePrivilege.StrengthenAdd];
|
| | | _specialData.presentFinishCount = (int)_data.Cnt;
|
| | | var _list = treasureCategory[TreasureCategory.Human];
|
| | | var _index = _list.FindIndex((x) =>
|
| | | {
|
| | | var treasure = treasures[x];
|
| | | return treasure.specialData.type == TreasurePrivilege.StrengthenAdd;
|
| | | });
|
| | | if (_index != -1)
|
| | | {
|
| | | UpdatePrivilege(_list[_index]);
|
| | | }
|
| | | }
|
| | | if (treasurePrivilegeUpdateEvent != null)
|
| | | {
|
| | | treasurePrivilegeUpdateEvent((int)TreasurePrivilege.StrengthenAdd);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshEquipSTRLv(int _index)
|
| | | {
|
| | | UpdateTreasurePrivilegeStrenthen();
|
| | | }
|
| | |
|
| | | public void UpdateTreasurePrivilegeStrenthen()
|
| | | {
|
| | | var _list = treasureCategory[TreasureCategory.Human];
|
| | | var _index = _list.FindIndex((x) =>
|
| | | {
|
| | | var treasure = treasures[x];
|
| | | return treasure.specialData.type == TreasurePrivilege.StrengthenAdd;
|
| | | });
|
| | | if (_index != -1)
|
| | | {
|
| | | UpdatePrivilege(_list[_index]);
|
| | | if (treasurePrivilegeUpdateEvent != null)
|
| | | {
|
| | | treasurePrivilegeUpdateEvent((int)TreasurePrivilege.StrengthenAdd);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdatePrivileges()
|
| | | {
|
| | | var list = treasureCategory[TreasureCategory.Human];
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | UpdatePrivilege(list[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsGetTreasurePrivilege(TreasurePrivilege type)
|
| | | {
|
| | | var list = treasureCategory[TreasureCategory.Human];
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | Treasure treasure;
|
| | | if (TryGetTreasure(list[i], out treasure)
|
| | | && treasure.specialData.type == type && treasure.IsMaxStage())
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | private void UpdatePrivilege(int _id)
|
| | | {
|
| | | if (treasures.ContainsKey(_id))
|
| | | {
|
| | | var treasure = treasures[_id];
|
| | | if (treasure.state != TreasureState.Collected || !treasure.IsMaxStage())
|
| | | {
|
| | | if (treasure.specialData.privilegeRedpoint != null)
|
| | | {
|
| | | treasure.specialData.privilegeRedpoint.state = RedPointState.None;
|
| | | }
|
| | | return;
|
| | | }
|
| | | treasure.specialData.UpdateState();
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetPrivilegeValue(int _privilegeId)
|
| | | {
|
| | | if (treasurePrivilegeDict.ContainsKey(_privilegeId))
|
| | | {
|
| | | var _list = GetTreasureCategory(TreasureCategory.Human);
|
| | | Treasure _treasure = null;
|
| | | var _index = _list.FindIndex((x) =>
|
| | | {
|
| | | if (TryGetTreasure(x, out _treasure))
|
| | | {
|
| | | return _treasure.unLockPrivilege == _privilegeId;
|
| | | }
|
| | | return false;
|
| | | });
|
| | | if (_index != -1 && _treasure.IsMaxStage())
|
| | | {
|
| | | var _specialData = treasurePrivilegeDict[_privilegeId];
|
| | | return _specialData.GetPrivilegeValue();
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public void HumanTreasureStateChange(int _id)
|
| | |
| | | if (TryGetTreasure(config.MWID, out treasure))
|
| | | {
|
| | | treasure.UpdateTreasureStage(config);
|
| | | if (treasure.specialData != null)
|
| | | {
|
| | | treasurePrivilegeDict.Add((int)treasure.specialData.type, treasure.specialData);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|