| | |
| | | {
|
| | | potentialLevelChangeEvent(key, config.SkillTypeID);
|
| | | }
|
| | | if (FuncOpen.Instance.IsFuncOpen(82))
|
| | | {
|
| | | UpdateSkillLevelUpRedpoint(treasure.id);
|
| | | }
|
| | | UpdateSkillLevelUpRedpoints();
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | private void UpdateSkillLevelUpRedpoints()
|
| | | {
|
| | | var list = GetTreasureCategory(TreasureCategory.Human);
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | var id = list[i];
|
| | | if (treasures[id].skillLevelUpRedpoint != null)
|
| | | {
|
| | | treasures[id].skillLevelUpRedpoint.state = RedPointState.None;
|
| | | }
|
| | | }
|
| | | var functionOpen = FuncOpen.Instance.IsFuncOpen(82);
|
| | | if (functionOpen)
|
| | | {
|
| | | foreach (var id in treasures.Keys)
|
| | | for (int k = 0; k < 3; k++)
|
| | | {
|
| | | UpdateSkillLevelUpRedpoint(id);
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | var treasure = treasures[list[i]];
|
| | | if (k < treasure.potentials.Count)
|
| | | {
|
| | | var potential = treasure.potentials[k];
|
| | | Item item;
|
| | | if (SatisfyLevelUpUnlock(list[i], k)
|
| | | && SatisyPotentialLevelUp(list[i], potential.id, out item))
|
| | | {
|
| | | treasure.skillLevelUpRedpoint.state = RedPointState.Simple;
|
| | | treasure.autoSelectPotential = k;
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | int minCostTreasure = 0;
|
| | | int minCostPotentialIndex = 0;
|
| | | int minCostItemColor = 0;
|
| | | int minCostItemCount = 0;
|
| | | bool step = false;
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | var treasure = treasures[list[i]];
|
| | | if (treasure.state != TreasureState.Collected || !treasure.IsHighestStage)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | for (int k = 0; k < treasure.potentials.Count; k++)
|
| | | {
|
| | | Item item;
|
| | | if (SatisyPotentialLevelUp(treasure.id, treasure.potentials[k].id, out item))
|
| | | {
|
| | | if (item.id != 0)
|
| | | {
|
| | | var itemConfig = Config.Instance.Get<ItemConfig>(item.id);
|
| | | var itemColor = itemConfig.ItemColor;
|
| | | if (minCostItemColor == 0 || itemColor < minCostItemColor ||
|
| | | (itemColor == minCostItemColor && minCostItemCount < item.count))
|
| | | {
|
| | | minCostItemColor = itemColor;
|
| | | minCostItemCount = item.count;
|
| | | minCostTreasure = treasure.id;
|
| | | minCostPotentialIndex = k;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | minCostTreasure = treasure.id;
|
| | | minCostPotentialIndex = k;
|
| | | step = true;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | if (step)
|
| | | {
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (minCostTreasure != 0)
|
| | | {
|
| | | treasures[minCostTreasure].skillLevelUpRedpoint.state = RedPointState.Simple;
|
| | | treasures[minCostTreasure].autoSelectPotential = minCostPotentialIndex;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetSkillLevelUpRedpointTreasure()
|
| | | {
|
| | | var list = GetTreasureCategory(TreasureCategory.Human);
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | var treasure = treasures[list[i]];
|
| | | if (treasure.skillLevelUpRedpoint != null &&
|
| | | treasure.skillLevelUpRedpoint.state == RedPointState.Simple)
|
| | | {
|
| | | return list[i];
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | private void UpdateAchievementRedpoints()
|
| | |
| | | WindowCenter.Instance.Open<TreasureNewGotWin>();
|
| | | }
|
| | |
|
| | | private void UpdateSkillLevelUpRedpoint(int _treasureId)
|
| | | public bool SatisfyLevelUpUnlock(int treasureId, int index)
|
| | | {
|
| | | if (treasures.ContainsKey(_treasureId))
|
| | | if (treasures.ContainsKey(treasureId))
|
| | | {
|
| | | var treasure = treasures[_treasureId];
|
| | | if (treasure.skillLevelUpRedpoint == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var anyPointialLevelupAble = false;
|
| | | var treasure = treasures[treasureId];
|
| | | if (treasure.state == TreasureState.Collected && treasure.IsHighestStage)
|
| | | {
|
| | | for (int i = 0; i < treasure.potentials.Count; i++)
|
| | | if (index >= 0 && index < treasure.potentials.Count - 1)
|
| | | {
|
| | | var potential = treasure.potentials[i];
|
| | | if (SatisyPotentialLevelUp(treasure.id, potential.id))
|
| | | var potential = treasure.potentials[index];
|
| | | var nextPotential = treasure.potentials[index + 1];
|
| | | var skillConfig = Config.Instance.Get<SkillConfig>(nextPotential.id);
|
| | | if (skillConfig.LearnSkillReq > 0)
|
| | | {
|
| | | anyPointialLevelupAble = true;
|
| | | break;
|
| | | if (potential.level < skillConfig.LearnSkillLV)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | treasure.skillLevelUpRedpoint.state = anyPointialLevelupAble ? RedPointState.Simple : RedPointState.None;
|
| | | else if (index == treasure.potentials.Count - 1)
|
| | | {
|
| | | var potential = treasure.GetPotential(index);
|
| | | var config = Config.Instance.Get<SkillConfig>(potential.id);
|
| | | int[] _getSkillArray;
|
| | | if (TryGetPotentialGetSkill(config.SkillTypeID, out _getSkillArray))
|
| | | {
|
| | | if (potential.level < _getSkillArray[0])
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool SatisyPotentialLevelUp(int treasureId, int potentialId)
|
| | | public bool SatisyPotentialLevelUp(int treasureId, int potentialId, out Item item)
|
| | | {
|
| | | item = default(Item);
|
| | | var treasure = treasures[treasureId];
|
| | | var potential = treasure.GetPotential(potentialId);
|
| | | if (potential == null)
|
| | |
| | | var own = packageModel.GetItemCountByID(PackType.rptItem, itemId);
|
| | | if (own >= treasureSkillConfig.MeterialNum2[j])
|
| | | {
|
| | | item = new Item()
|
| | | {
|
| | | id = itemId,
|
| | | count = treasureSkillConfig.MeterialNum2[j],
|
| | | };
|
| | | return true;
|
| | | }
|
| | | }
|