MarkData.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class MarkData
  5. {
  6. public int markId;
  7. public string markIcon;
  8. public int maxLayer;
  9. public float duration;
  10. public bool isOverlay;
  11. public int effectId;
  12. public List<FValType> funList;
  13. public List<FValType> funIncList;
  14. public int ShowTypes;
  15. public enum EnShowType
  16. {
  17. En_ShowAll = 0,
  18. En_ShowInDesc = 1,
  19. En_ShowBattle = 2,
  20. en_UnShowAll = 3,
  21. }
  22. public bool IsShow(EnShowType enType)
  23. {
  24. switch((EnShowType)ShowTypes)
  25. {
  26. case EnShowType.En_ShowAll:
  27. return true;
  28. case EnShowType.en_UnShowAll:
  29. return false;
  30. case EnShowType.En_ShowBattle:
  31. case EnShowType.En_ShowInDesc:
  32. return (int)enType != ShowTypes;
  33. }
  34. return true;
  35. }
  36. private bool bValid = false;
  37. public bool Valid
  38. {
  39. get { return bValid; }
  40. }
  41. public MarkData(int id)
  42. {
  43. Dictionary<string, string> dic = ConfigMgr.Instance.getLine(id, Config.MarkCfgName);
  44. if(dic == null)
  45. {
  46. DebugHelper.LogError(string.Format("印记 {0} 没有配置", id));
  47. return;
  48. }
  49. this.markId = id;
  50. if(dic.ContainsKey("Icon"))
  51. {
  52. this.markIcon = dic["Icon"];
  53. }
  54. if(dic.ContainsKey("MaxLayer"))
  55. {
  56. int.TryParse(dic["MaxLayer"], out maxLayer);
  57. }
  58. if(dic.ContainsKey("Duration"))
  59. {
  60. float.TryParse(dic["Duration"], out duration);
  61. }
  62. if(dic.ContainsKey("Overlay"))
  63. {
  64. int temp = 0;
  65. int.TryParse(dic["Overlay"], out temp);
  66. isOverlay = temp > 0;
  67. }
  68. if(dic.ContainsKey("EffectId"))
  69. {
  70. int.TryParse(dic["EffectId"], out effectId);
  71. }
  72. if(dic.ContainsKey("FunList"))
  73. {
  74. string tempStr = dic["FunList"];
  75. if (!string.IsNullOrEmpty(tempStr))
  76. {
  77. string[] tempStrList = tempStr.Split(';');
  78. funList = new List<FValType>();
  79. for (int idx =0; idx < tempStrList.Length;idx++)
  80. {
  81. string[] tempStr2 = tempStrList[idx].Split(':');
  82. if(tempStr2.Length >= 2)
  83. {
  84. int funType = 0;
  85. float funVal = 0;
  86. int.TryParse(tempStr2[0], out funType);
  87. float.TryParse(tempStr2[1], out funVal);
  88. funList.Add(new FValType(funType, funVal));
  89. }
  90. }
  91. }
  92. }
  93. if(dic.ContainsKey("FunIncList"))
  94. {
  95. string tempStr = dic["FunIncList"];
  96. if (!string.IsNullOrEmpty(tempStr))
  97. {
  98. string[] tempStrList = tempStr.Split(';');
  99. funIncList = new List<FValType>();
  100. for (int idx = 0; idx < tempStrList.Length; idx++)
  101. {
  102. string[] tempStr2 = tempStrList[idx].Split(':');
  103. if (tempStr2.Length >= 2)
  104. {
  105. int funType = 0;
  106. float funVal = 0;
  107. int.TryParse(tempStr2[0], out funType);
  108. float.TryParse(tempStr2[1], out funVal);
  109. funIncList.Add(new FValType(funType, funVal));
  110. }
  111. }
  112. }
  113. }
  114. if (dic.ContainsKey("ShowTypes"))
  115. {
  116. int.TryParse(dic["ShowTypes"], out ShowTypes);
  117. }
  118. bValid = true;
  119. }
  120. }