| | |
| | | Dictionary<int, int> m_MainReikiRoots = new Dictionary<int, int>();
|
| | | Dictionary<int, int> m_ReikiQualityMapColors;
|
| | | Dictionary<int, int> m_CacheReikiRootPoints = new Dictionary<int, int>();
|
| | | Dictionary<int, Dictionary<int, int[]>> m_PromotePropertyValues = new Dictionary<int, Dictionary<int, int[]>>();
|
| | |
|
| | | public List<int> reikiRoots = new List<int>();
|
| | |
|
| | |
| | | reikiRoots.Add((int)PropertyType.Fire);
|
| | | reikiRoots.Add((int)PropertyType.Earth);
|
| | |
|
| | | var configs = ReikiRootConfig.GetValues();
|
| | | foreach (var _config in configs)
|
| | | {
|
| | | m_PromotePropertyValues.Add(_config.id, new Dictionary<int, int[]>());
|
| | | var _json = LitJson.JsonMapper.ToObject(_config.promoteValue);
|
| | | foreach (var _jobKey in _json.Keys)
|
| | | {
|
| | | var job = int.Parse(_jobKey);
|
| | | m_PromotePropertyValues[_config.id].Add(job,
|
| | | LitJson.JsonMapper.ToObject<int[]>(_json[_jobKey].ToJson()));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetReikiRootQuality(int id, int point)
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | m_CacheReikiRootPoints.Clear();
|
| | | foreach (var id in m_ReikiRootPoints.Keys)
|
| | | {
|
| | | m_CacheReikiRootPoints[id] = m_ReikiRootPoints[id];
|
| | | }
|
| | | //m_CacheReikiRootPoints.Clear();
|
| | | //foreach (var id in m_ReikiRootPoints.Keys)
|
| | | //{
|
| | | // m_CacheReikiRootPoints[id] = m_ReikiRootPoints[id];
|
| | | //}
|
| | |
|
| | | var recommends = new List<ReikiRootRecommend>();
|
| | | var job = PlayerDatas.Instance.baseData.Job;
|
| | | var remainPoint = point;
|
| | | var currentMaxQuality = 1;
|
| | |
|
| | | foreach (var id in reikiRoots)
|
| | | if (m_RecommendProportion.ContainsKey(job))
|
| | | {
|
| | | var quality = GetReikiRootQuality(id);
|
| | | if (quality >= currentMaxQuality)
|
| | | var proportions = m_RecommendProportion[job];
|
| | | var index = 0;
|
| | | var surplusPoint = point;
|
| | | foreach (var id in proportions.Keys)
|
| | | {
|
| | | currentMaxQuality = quality;
|
| | | var recommendPoint = Mathf.Min(surplusPoint, (int)(point * proportions[id]));
|
| | | if (index == proportions.Keys.Count - 1)
|
| | | {
|
| | | recommendPoint = surplusPoint;
|
| | | }
|
| | | recommends.Add(new ReikiRootRecommend()
|
| | | {
|
| | | id = id,
|
| | | value = recommendPoint,
|
| | | });
|
| | | surplusPoint -= recommendPoint;
|
| | | index++;
|
| | | }
|
| | | }
|
| | |
|
| | | if (m_RecommendReikiRoots.ContainsKey(job))
|
| | | {
|
| | | var reikiRoots = m_RecommendReikiRoots[job];
|
| | | while (remainPoint > 0)
|
| | | {
|
| | | reikiRoots.Sort(QualityCompare);
|
| | | var id = reikiRoots[0];
|
| | | var quality = GetReikiRootQuality(id, m_CacheReikiRootPoints[id]);
|
| | | var addpoint = 0;
|
| | | if (quality >= maxQuality)
|
| | | {
|
| | | var proportions = m_RecommendProportion[job];
|
| | | foreach (var key in proportions.Keys)
|
| | | {
|
| | | addpoint = Mathf.RoundToInt(remainPoint * proportions[key]);
|
| | | recommends.Add(new ReikiRootRecommend()
|
| | | {
|
| | | id = key,
|
| | | value = addpoint,
|
| | | });
|
| | | if (!m_CacheReikiRootPoints.ContainsKey(key))
|
| | | {
|
| | | m_CacheReikiRootPoints.Add(key, 0);
|
| | | }
|
| | | m_CacheReikiRootPoints[key] += addpoint;
|
| | | }
|
| | | remainPoint = 0;
|
| | | }
|
| | | else
|
| | | {
|
| | | addpoint = Mathf.Min(remainPoint, GetCacheQualityRequrePoint(id,
|
| | | quality < currentMaxQuality ? currentMaxQuality : quality + 1));
|
| | | remainPoint -= addpoint;
|
| | | recommends.Add(new ReikiRootRecommend()
|
| | | {
|
| | | id = id,
|
| | | value = addpoint,
|
| | | });
|
| | | if (!m_CacheReikiRootPoints.ContainsKey(id))
|
| | | {
|
| | | m_CacheReikiRootPoints.Add(id, 0);
|
| | | }
|
| | | m_CacheReikiRootPoints[id] += addpoint;
|
| | | }
|
| | | }
|
| | | }
|
| | | //var remainPoint = point;
|
| | | //var currentMaxQuality = 1;
|
| | |
|
| | | //foreach (var id in reikiRoots)
|
| | | //{
|
| | | // var quality = GetReikiRootQuality(id);
|
| | | // if (quality >= currentMaxQuality)
|
| | | // {
|
| | | // currentMaxQuality = quality;
|
| | | // }
|
| | | //}
|
| | | //
|
| | | //if (m_RecommendReikiRoots.ContainsKey(job))
|
| | | //{
|
| | | // var reikiRoots = m_RecommendReikiRoots[job];
|
| | | // while (remainPoint > 0)
|
| | | // {
|
| | | // reikiRoots.Sort(QualityCompare);
|
| | | // var id = reikiRoots[0];
|
| | | // var quality = GetReikiRootQuality(id, m_CacheReikiRootPoints[id]);
|
| | | // var addpoint = 0;
|
| | | // if (quality >= maxQuality)
|
| | | // {
|
| | | // var proportions = m_RecommendProportion[job];
|
| | | // foreach (var key in proportions.Keys)
|
| | | // {
|
| | | // addpoint = Mathf.RoundToInt(remainPoint * proportions[key]);
|
| | | // recommends.Add(new ReikiRootRecommend()
|
| | | // {
|
| | | // id = key,
|
| | | // value = addpoint,
|
| | | // });
|
| | | // if (!m_CacheReikiRootPoints.ContainsKey(key))
|
| | | // {
|
| | | // m_CacheReikiRootPoints.Add(key, 0);
|
| | | // }
|
| | | // m_CacheReikiRootPoints[key] += addpoint;
|
| | | // }
|
| | | // remainPoint = 0;
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // addpoint = Mathf.Min(remainPoint, GetCacheQualityRequrePoint(id,
|
| | | // quality < currentMaxQuality ? currentMaxQuality : quality + 1));
|
| | | // remainPoint -= addpoint;
|
| | | // recommends.Add(new ReikiRootRecommend()
|
| | | // {
|
| | | // id = id,
|
| | | // value = addpoint,
|
| | | // });
|
| | | // if (!m_CacheReikiRootPoints.ContainsKey(id))
|
| | | // {
|
| | | // m_CacheReikiRootPoints.Add(id, 0);
|
| | | // }
|
| | | // m_CacheReikiRootPoints[id] += addpoint;
|
| | | // }
|
| | | // }
|
| | | //}
|
| | | return recommends;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | propertyDict[config.propertyPerPoint.x] += config.propertyPerPoint.y * point;
|
| | |
|
| | | if (!propertyDict.ContainsKey(config.promoteProperty))
|
| | | var job = PlayerDatas.Instance.baseData.Job;
|
| | | var promotePropertyId = config.GetPromotePropertyId(job);
|
| | |
|
| | | if (!propertyDict.ContainsKey(promotePropertyId))
|
| | | {
|
| | | propertyDict.Add(config.promoteProperty, 0);
|
| | | propertyDict.Add(promotePropertyId, 0);
|
| | | }
|
| | | var quality = GetReikiRootQuality(id, point);
|
| | | propertyDict[config.promoteProperty] += GetQualityProperty(id, quality);
|
| | | propertyDict[promotePropertyId] += GetQualityProperty(id, quality);
|
| | | }
|
| | |
|
| | | public int GetQualityProperty(int id, int quality)
|
| | | {
|
| | | var config = ReikiRootConfig.Get(id);
|
| | | var job = PlayerDatas.Instance.baseData.Job;
|
| | | var promoteValues = m_PromotePropertyValues[id][job];
|
| | | var value = 0;
|
| | | for (int i = 0; i < config.promoteValue.Length; i++)
|
| | | for (int i = 0; i < promoteValues.Length; i++)
|
| | | {
|
| | | if (quality > i)
|
| | | {
|
| | | value = config.promoteValue[i];
|
| | | value = promoteValues[i];
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | public int id;
|
| | | public int value;
|
| | | }
|
| | |
|
| | | public static class ReikiRootConfigUtil
|
| | | {
|
| | | public static int GetPromotePropertyId(this ReikiRootConfig config, int job)
|
| | | {
|
| | | if (config != null)
|
| | | {
|
| | | foreach (var item in config.promoteProperty)
|
| | | {
|
| | | if (item.x == job)
|
| | | {
|
| | | return item.y;
|
| | | }
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | |