CollectPartDataManager.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using ET;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. namespace GFGGame
  7. {
  8. public class CollectPartDataManager : SingletonBase<CollectPartDataManager>
  9. {
  10. //部位数量
  11. public const int Count = 8;
  12. //普通最高段位
  13. public int MaxNormalRank = 5;
  14. //特殊最高段位
  15. public int MaxSpecialRank = 3;
  16. //最高等级
  17. public int MaxLevel = 9;
  18. //加成比值
  19. public int AddtitionRatio = 100;
  20. //搭配部位分类
  21. public Dictionary<int, List<float>> partScoreListDic = new Dictionary<int, List<float>>();
  22. //部位名
  23. public Dictionary<int, string> partNameDic = new Dictionary<int, string>()
  24. { [1] = "连衣裙或上下装及内搭",
  25. [2] = "发型",
  26. [3] = "外套",
  27. [4] = "袜子",
  28. [5] = "鞋子",
  29. [6] = "饰品",
  30. [7] = "手持物",
  31. [99] = "所有",
  32. };
  33. //部位图片
  34. public Dictionary<int, string> partImage = new Dictionary<int, string>
  35. {
  36. [1] = "part1",
  37. [2] = "hz_fenleitu_1",
  38. [3] = "hz_fenleitu_12",
  39. [4] = "hz_fenleitu_7",
  40. [5] = "hz_fenleitu_8",
  41. [6] = "hz_fenleitu_9",
  42. [7] = "hz_fenleitu_10",
  43. [99] = "part99",
  44. };
  45. //数据
  46. public Dictionary<int, List<int>> CollectPartDataDic = new Dictionary<int, List<int>>();
  47. //临时数据,后续通过服务器获取
  48. public void UpdateDic()
  49. {
  50. CollectPartDataDic.Clear();
  51. CollegeBoostCfg collectcfg;
  52. for (int i = 1; i <= Count; i++)
  53. {
  54. List<int> item = new List<int>() { 3, 9 };
  55. if (i == Count)
  56. {
  57. collectcfg = CollegeBoostCfgArray.Instance.GetCfgBytypePartsAndtypePhaseAndlayer(99, item[0], item[1]);
  58. if (collectcfg == null)
  59. {
  60. item.Add(0);
  61. }
  62. else
  63. {
  64. item.Add(collectcfg.value);
  65. }
  66. if (CollectPartDataDic.ContainsKey(99))
  67. {
  68. CollectPartDataDic[99] = item;
  69. }
  70. else
  71. {
  72. CollectPartDataDic.Add(99, item);
  73. }
  74. }
  75. else
  76. {
  77. collectcfg = CollegeBoostCfgArray.Instance.GetCfgBytypePartsAndtypePhaseAndlayer(i, item[0], item[1]);
  78. if (collectcfg == null)
  79. {
  80. item.Add(0);
  81. }
  82. else
  83. {
  84. item.Add(collectcfg.value);
  85. }
  86. if (CollectPartDataDic.ContainsKey(i))
  87. {
  88. CollectPartDataDic[i] = item;
  89. }
  90. else
  91. {
  92. CollectPartDataDic.Add(i, item);
  93. }
  94. }
  95. }
  96. }
  97. /// <summary>
  98. /// 穿戴部件的搭配加成
  99. /// </summary>
  100. public float GetEquipScoresWithPartId(int itemID)
  101. {
  102. CollegeSubTypesCfg[] typeCfgs = CollegeSubTypesCfgArray.Instance.dataArray;
  103. float addNum = 0;
  104. for (int j = 0; j < typeCfgs.Length; j++)
  105. {
  106. CollegeSubTypesCfg cfg = typeCfgs[j];
  107. for (int k = 0; k < cfg.subTypesArr.Length; k++)
  108. {
  109. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemID);
  110. if (itemCfg.subType == cfg.subTypesArr[k])
  111. {
  112. int partIndex = cfg.AdditionSite;
  113. int partIndexCommon = 0;
  114. if (partIndex != 99)
  115. {
  116. //0表示所有部位,1~7表示各个部位
  117. partIndexCommon = 0;
  118. }
  119. else
  120. {
  121. partIndexCommon = partIndex;
  122. }
  123. int level = CollectPartDataDic[partIndex][0];
  124. int levelNum = CollectPartDataDic[partIndex][1];
  125. if(levelNum == 0)
  126. {
  127. addNum += 0;
  128. break;
  129. }
  130. CollegeBoostCfg collegeCfg = CollegeBoostCfgArray.Instance.GetCfgBytypePartsAndtypePhaseAndlayer(partIndexCommon, level, levelNum);
  131. addNum += (float)collegeCfg.value / 10000;
  132. break;
  133. }
  134. }
  135. }
  136. return addNum + 1;
  137. }
  138. }
  139. }