From 2a0cfb41b98f077fa49bf4a61762cafd76aaa258 Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期三, 26 九月 2018 16:34:53 +0800
Subject: [PATCH] 1885 增加神兽评分计算
---
System/Dogz/DogzPackWin.cs | 4
System/KnapSack/Logic/ItemTipsModel.cs | 171 ++++++++++++++++++++++++----------
System/Dogz/DogzCell.cs | 2
System/Dogz/DogzModel.cs | 76 ++++++++++++++
4 files changed, 197 insertions(+), 56 deletions(-)
diff --git a/System/Dogz/DogzCell.cs b/System/Dogz/DogzCell.cs
index ec1bf90..b408f12 100644
--- a/System/Dogz/DogzCell.cs
+++ b/System/Dogz/DogzCell.cs
@@ -34,7 +34,7 @@
var _dogzEquips = model.GetDogzEquips(_dogzCfg.ID);
bool isActive = (_dogzEquips == null || _dogzEquips.Count < 5) ? false : true;
m_DogzName.text = _dogzCfg.Name;
- m_DogzGrade.text = StringUtility.Contact("璇勫垎锛�", 100);
+ m_DogzGrade.text = Language.Get("DogzFunc106", model.GetDogzScoreById(cell.index));
redpointBehav.redpointId = model.GetSingleDogzRedpointById(_dogzCfg.ID).id;
if (isActive)
{
diff --git a/System/Dogz/DogzModel.cs b/System/Dogz/DogzModel.cs
index d33c8ad..0977455 100644
--- a/System/Dogz/DogzModel.cs
+++ b/System/Dogz/DogzModel.cs
@@ -26,6 +26,7 @@
selectEquipPlacelist = new List<ItemModel>();
dogzAssistStateDict = new Dictionary<int, int>();
m_DogzEquipAttrDict = new Dictionary<int, int>();
+ m_DogzAttrDict = new Dictionary<int, int>();
}
public void OnAfterPlayerDataInitialize()
@@ -56,7 +57,7 @@
public int DogzPackGridCnt { get; private set; } //绁炲吔鐗╁搧鑳屽寘鏍煎瓙鏁�
public int[] AddAssistItemCnt { get; private set; } //澧炲姞鍔╂垬绁炲吔鎬绘暟鐨勭墿鍝佹暟閲�
public Dictionary<int, int> m_DogzEquipStrenLimit { get; private set;} //绁炲吔瑁呭寮哄寲涓婇檺 鍝佽川 寮哄寲绛夌骇
-
+ public string dogzScoreFormula { get; private set; } //绁炲吔璇勫垎鍏紡
void ParseConfig()
{
var _dogzCfgs = Config.Instance.GetAllValues<DogzConfig>();
@@ -78,6 +79,8 @@
m_DogzEquipStrenLimit = ConfigParse.GetDic<int, int>(_funcCfg.Numerical4);
_funcCfg = Config.Instance.Get<FuncConfigConfig>("DogzPack");
DogzPackGridCnt = int.Parse(_funcCfg.Numerical1);
+ _funcCfg = Config.Instance.Get<FuncConfigConfig>("DogzGrade");
+ dogzScoreFormula = _funcCfg.Numerical1;
}
/// <summary>
/// 鑾峰緱鏍煎瓙鍙互绌挎埓鐨勮澶囬檺鍒� 绁炲吔Id 鏍煎瓙绱㈠紩
@@ -103,7 +106,7 @@
/// </summary>
/// <param name="_index"></param>
/// <returns></returns>
- public static string GetDogzPartNameByIndex(int _index)
+ public string GetDogzPartNameByIndex(int _index)
{
switch (_index)
{
@@ -122,7 +125,7 @@
}
}
- public static string GetItemColorName(int _itemColor)
+ public string GetItemColorName(int _itemColor)
{
switch (_itemColor)
{
@@ -143,6 +146,73 @@
return string.Empty;
}
}
+
+ public int GetDogzScoreById(int dogzId)
+ {
+ DogzConfig dogzConfig = Config.Instance.Get<DogzConfig>(dogzId);
+ if (dogzConfig == null) return 0;
+ Equation.Instance.Clear();
+ Equation.Instance.AddKeyValue("FightPowerEx",dogzConfig.FightPowerEx);
+ Equation.Instance.AddKeyValue("EquipGSFormula", GetDogzEquipScore(dogzId));
+ GetDogzAttrDictById(dogzId);
+ foreach(var key in m_DogzAttrDict.Keys)
+ {
+ PlayerPropertyConfig propertyConfig = Config.Instance.Get<PlayerPropertyConfig>(key);
+ if (propertyConfig != null)
+ {
+ Equation.Instance.AddKeyValue(propertyConfig.Parameter, m_DogzAttrDict[key]);
+ }
+ }
+ return Equation.Instance.Eval<int>(dogzScoreFormula);
+ }
+ public Dictionary<int, int> m_DogzAttrDict { get; private set; }
+ public Dictionary<int, int> GetDogzAttrDictById(int dogzId)
+ {
+ m_DogzAttrDict.Clear();
+ DogzConfig dogzConfig = Config.Instance.Get<DogzConfig>(dogzId);
+ int[] baseAttrIds = dogzConfig.BaseAttrTypes;
+ int[] baseAttrValues = dogzConfig.BaseAttrValues;
+ for (int i = 0; i < baseAttrIds.Length; i++)
+ {
+ if (!m_DogzAttrDict.ContainsKey(baseAttrIds[i]))
+ {
+ m_DogzAttrDict.Add(baseAttrIds[i], baseAttrValues[i]);
+ }
+ else
+ {
+ m_DogzAttrDict[baseAttrIds[i]] += baseAttrValues[i];
+ }
+ }
+
+ Dictionary<int, int> dogzStrenDict = beastModel.AllEnhancedProperties(dogzId);
+ foreach (var key in dogzStrenDict.Keys)
+ {
+ if (!m_DogzAttrDict.ContainsKey(key))
+ {
+ m_DogzAttrDict.Add(key, dogzStrenDict[key]);
+ }
+ else
+ {
+ m_DogzAttrDict[key] += dogzStrenDict[key];
+ }
+ }
+ return m_DogzAttrDict;
+ }
+
+ public int GetDogzEquipScore(int dogzId)
+ {
+ int score = 0;
+ List<ItemModel> itemModels = GetDogzEquips(dogzId);
+ if(itemModels != null)
+ {
+ for(int i = 0; i < itemModels.Count; i++)
+ {
+ score += itemModels[i].equipScore;
+ }
+ }
+ return score;
+ }
+
#endregion
public int GetAssistItemCnt()
diff --git a/System/Dogz/DogzPackWin.cs b/System/Dogz/DogzPackWin.cs
index 61ffb22..df575f7 100644
--- a/System/Dogz/DogzPackWin.cs
+++ b/System/Dogz/DogzPackWin.cs
@@ -125,8 +125,8 @@
else
{
var _itemColor = dogzModel.GetDogzEquipLimitByIndex(dogzModel.presentSelectDogz, i);
- m_DogzUnEquipContents[i].text = StringUtility.Contact(DogzModel.GetItemColorName(_itemColor),
- DogzModel.GetDogzPartNameByIndex(i));
+ m_DogzUnEquipContents[i].text = StringUtility.Contact(dogzModel.GetItemColorName(_itemColor),
+ dogzModel.GetDogzPartNameByIndex(i));
m_DogzUnEquipContents[i].color = UIHelper.GetUIColor(_itemColor);
m_DogzUnEquipBtns[i].DogzUnEquipBtn.RemoveAllListeners();
m_DogzUnEquipBtns[i].DogzUnEquipBtn.AddListener(() => { ClickEquipIndex(index); });
diff --git a/System/KnapSack/Logic/ItemTipsModel.cs b/System/KnapSack/Logic/ItemTipsModel.cs
index ea499fc..79fa337 100644
--- a/System/KnapSack/Logic/ItemTipsModel.cs
+++ b/System/KnapSack/Logic/ItemTipsModel.cs
@@ -1732,58 +1732,34 @@
{
if (isPreview)
{
- List<int> legendIdlist = new List<int>();
- List<int> legendValuelist = new List<int>();
- if (itemConfig.EquipPlace != (int)RoleEquipType.retWing)
+ List<int> legendIdlist = null;
+ List<int> legendValuelist = null;
+ switch(itemConfig.EquipPlace)
{
- if (itemTipsModel.legendAttrIDPreviewDict.ContainsKey(itemConfig.EquipPlace))
- {
- foreach (var attrType in itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace].Keys)
- {
- switch (attrType)
- {
- case LegendAttrType.Pursuit:
- legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
- break;
- case LegendAttrType.Fixed:
- legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
- break;
- }
- }
- }
- int i = 0;
- for (i = 0; i < legendIdlist.Count; i++)
- {
- if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
- {
- if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
- {
- legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
- }
- }
- else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(legendIdlist[i]))
- {
- if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.LV))
- {
- legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][itemConfig.LV]);
- }
- }
- }
+ case 11:
+ SetWingsLegendAttrPreview(out legendIdlist,out legendValuelist);
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 12:
+ SetEquipLegendAttrPreview(out legendIdlist,out legendValuelist);
+ break;
+ case 101:
+ case 102:
+ case 103:
+ case 104:
+ case 105:
+ SetDogzEquipLegendAttrPreview(out legendIdlist, out legendValuelist);
+ break;
}
- else
- {
- if (itemTipsModel.wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
- {
- Dictionary<int, List<int>> attrIdDict = itemTipsModel.wingsLegendAttrValuePreviewDict[itemConfig.LV];
- foreach (var attrId in attrIdDict.Keys)
- {
- legendIdlist.Add(attrId);
- legendValuelist.Add(attrIdDict[attrId][0]);
- }
-
- }
- }
-
if (legendIdlist.Count == legendValuelist.Count)
{
SetLegendData(legendIdlist, legendValuelist);
@@ -1864,6 +1840,101 @@
this.extraInfos = extraInfos;
}
+ private void SetWingsLegendAttrPreview(out List<int> legendIdlist, out List<int> legendValuelist)
+ {
+ legendIdlist = new List<int>();
+ legendValuelist = new List<int>();
+ if (itemTipsModel.wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
+ {
+ Dictionary<int, List<int>> attrIdDict = itemTipsModel.wingsLegendAttrValuePreviewDict[itemConfig.LV];
+ foreach (var attrId in attrIdDict.Keys)
+ {
+ legendIdlist.Add(attrId);
+ legendValuelist.Add(attrIdDict[attrId][0]);
+ }
+
+ }
+ }
+
+ private void SetEquipLegendAttrPreview(out List<int> legendIdlist, out List<int> legendValuelist)
+ {
+ legendIdlist = new List<int>();
+ legendValuelist = new List<int>();
+ if (itemTipsModel.legendAttrIDPreviewDict.ContainsKey(itemConfig.EquipPlace))
+ {
+ foreach (var attrType in itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace].Keys)
+ {
+ switch (attrType)
+ {
+ case LegendAttrType.Pursuit:
+ legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
+ break;
+ case LegendAttrType.Fixed:
+ legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
+ break;
+ }
+ }
+ }
+ int i = 0;
+ for (i = 0; i < legendIdlist.Count; i++)
+ {
+ if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
+ {
+ if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
+ {
+ legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
+ }
+ }
+ else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(legendIdlist[i]))
+ {
+ if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.LV))
+ {
+ legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][itemConfig.LV]);
+ }
+ }
+ }
+ }
+
+ private void SetDogzEquipLegendAttrPreview(out List<int> legendIdlist, out List<int> legendValuelist)
+ {
+ legendIdlist = new List<int>();
+ legendValuelist = new List<int>();
+ if (itemTipsModel.legendAttrIDPreviewDict.ContainsKey(itemConfig.EquipPlace))
+ {
+ foreach (var attrType in itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace].Keys)
+ {
+ switch (attrType)
+ {
+ case LegendAttrType.Pursuit:
+ legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
+ break;
+ case LegendAttrType.Fixed:
+ legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
+ break;
+ }
+ }
+ }
+ int i = 0;
+ for (i = 0; i < legendIdlist.Count; i++)
+ {
+ if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
+ {
+ if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
+ {
+ legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
+ }
+ }
+ else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(legendIdlist[i]))
+ {
+ if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.LV))
+ {
+ legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][itemConfig.LV]);
+ }
+ }
+ }
+ }
+
+
private StringBuilder _extraInfoBuider = new StringBuilder();
private StringBuilder _allInfoDesBuider = new StringBuilder();
public string GetExtraInfos()
--
Gitblit v1.8.0