ActArtifactPushCtrl.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System.Collections.Generic;
  2. using XGame.Database;
  3. using XGame.Framework.Network;
  4. using static FL.Network.ActArtifactFumo;
  5. namespace FL.Network
  6. {
  7. public class ActArtifactPushCtrl : MsgController<ActArtifactPush>
  8. {
  9. protected override void OnProcess(ActArtifactPush message, object context)
  10. {
  11. ArtifactData.Instance.ArtifactInfoId = message.id;
  12. ArtifactData.Instance.ArtifactExp = message.exp;
  13. ArtifactData.Instance.AppearanceId = message.use;
  14. ArtifactData.Instance.UsingAdvanceArtifactId = message.useSkill;
  15. if (message.artifactList != null)
  16. {
  17. // 已解锁的高级神器map数据
  18. var artifactMap = ArtifactData.Instance.AdvancedArtifactMap;
  19. foreach (var item in message.artifactList)
  20. {
  21. if (artifactMap.ContainsKey(item.artifactId))
  22. {
  23. artifactMap[item.artifactId] = item.star;
  24. }
  25. else
  26. {
  27. artifactMap.Add(item.artifactId, item.star);
  28. }
  29. }
  30. }
  31. if (message.fumo != null)
  32. {
  33. //神器上5种元素类型的附魔数据
  34. var enchantMap = ArtifactData.Instance.EnchantDataMap;
  35. foreach (var item in message.fumo)
  36. {
  37. if (enchantMap.ContainsKey((EElementType)item.type))
  38. {
  39. enchantMap[(EElementType)item.type] = GetEnchantDataList(item.type,item.buwei);
  40. }
  41. else
  42. {
  43. enchantMap.Add((EElementType)item.type, GetEnchantDataList(item.type, item.buwei));
  44. }
  45. }
  46. }
  47. if (message.elementList != null)
  48. {
  49. // 已解锁的元素数据
  50. var elementInfoMap = ArtifactData.Instance.UnlockElementMap;
  51. foreach (var item in message.elementList)
  52. {
  53. var elementInfo = new ElementInfoParam()
  54. {
  55. elementId = item.elementId,
  56. level = item.level,
  57. state = item.status
  58. };
  59. if (elementInfoMap.ContainsKey(item.elementId))
  60. {
  61. elementInfoMap[item.elementId] = elementInfo;
  62. }
  63. else
  64. {
  65. elementInfoMap.Add(item.elementId, elementInfo);
  66. }
  67. }
  68. }
  69. }
  70. private List<ArtifactEnchantParam> GetEnchantDataList(int elementType, List<ActArtifactBuWei> dataList)
  71. {
  72. var artifactEnchantList = new List<ArtifactEnchantParam>();
  73. foreach (var item in dataList)
  74. {
  75. var ArtifactEnchantParam = new ArtifactEnchantParam()
  76. {
  77. elementType = elementType,
  78. holePosition = item.bwId,
  79. elementId = item.elementId
  80. };
  81. artifactEnchantList.Add(ArtifactEnchantParam);
  82. }
  83. return artifactEnchantList;
  84. }
  85. }
  86. }