| | |
| | | public class ItemLegendPropertyUtility |
| | | { |
| | | static PropertyColor propertyColor; |
| | | static EquipPropertyMap equipPropertyMap; |
| | | static DogzPropertyMap dogzPropertyMap; |
| | | static EquipPropertyCount equipPropertyCount; |
| | | static DogzPropertyCount dogzPropertyCount; |
| | | static EquipQualityPropertyValue equipQualityPropertyValue; |
| | | static DogzQualityPropertyValue dogzQualityPropertyValue; |
| | | static EquipLevelPropertyValue equipLevelPropertyValue; |
| | | static PropertyMap equipPropertyMap; |
| | | static PropertyMap dogzPropertyMap; |
| | | static PropertyCount equipPropertyCount; |
| | | static PropertyCount dogzPropertyCount; |
| | | static QualityPropertyValue equipQualityPropertyValue; |
| | | static QualityPropertyValue dogzQualityPropertyValue; |
| | | static LevelPropertyValue equipLevelPropertyValue; |
| | | static WingPropertyCount wingPropertyCount; |
| | | static WingPropertyValue wingPropertyValue; |
| | | |
| | | public static void Init() |
| | | { |
| | | propertyColor = new PropertyColor("LegendAttrColor"); |
| | | equipPropertyMap = new EquipPropertyMap(FuncConfigConfig.Get("LegendAttrRulePreview").Numerical1); |
| | | dogzPropertyMap = new DogzPropertyMap(FuncConfigConfig.Get("DogzLegendAttrRulePreview").Numerical1); |
| | | |
| | | equipPropertyCount = new EquipPropertyCount(FuncConfigConfig.Get(" LegendAttrCountPreview").Numerical1); |
| | | dogzPropertyCount = new DogzPropertyCount(FuncConfigConfig.Get("DogzLegendAttrCountPreview").Numerical1); |
| | | equipPropertyMap = new PropertyMap(FuncConfigConfig.Get("LegendAttrColor").Numerical1, |
| | | FuncConfigConfig.Get("LegendAttrRulePreview").Numerical1); |
| | | |
| | | equipQualityPropertyValue = new EquipQualityPropertyValue(FuncConfigConfig.Get("LegendAttrValueByColorPreview").Numerical1); |
| | | dogzQualityPropertyValue = new DogzQualityPropertyValue(FuncConfigConfig.Get("DogzLegendAttrValueByColorPreview").Numerical1); |
| | | dogzPropertyMap = new PropertyMap(FuncConfigConfig.Get("DogzLegendAttrColor").Numerical1, |
| | | FuncConfigConfig.Get("DogzLegendAttrRulePreview").Numerical1); |
| | | |
| | | equipLevelPropertyValue = new EquipLevelPropertyValue(FuncConfigConfig.Get("LegendAttrValueByClassLVPreview").Numerical1); |
| | | equipPropertyCount = new PropertyCount(FuncConfigConfig.Get("LegendAttrCountPreview").Numerical1); |
| | | dogzPropertyCount = new PropertyCount(FuncConfigConfig.Get("DogzLegendAttrCountPreview").Numerical1); |
| | | |
| | | equipQualityPropertyValue = new QualityPropertyValue(FuncConfigConfig.Get("LegendAttrValueByColorPreview").Numerical1); |
| | | dogzQualityPropertyValue = new QualityPropertyValue(FuncConfigConfig.Get("DogzLegendAttrValueByColorPreview").Numerical1); |
| | | |
| | | equipLevelPropertyValue = new LevelPropertyValue(FuncConfigConfig.Get("LegendAttrValueByClassLVPreview").Numerical1); |
| | | |
| | | wingPropertyCount = new WingPropertyCount(); |
| | | wingPropertyValue = new WingPropertyValue(); |
| | | } |
| | | |
| | | public static bool HasPropertyColor(int propertyId) |
| | | { |
| | | return propertyColor.HasPropertyType(propertyId); |
| | | } |
| | | |
| | | public static LegendAttrType GetPropertyType(int propertyId) |
| | | { |
| | | return propertyColor.GetPropertyType(propertyId); |
| | | } |
| | | |
| | | public static string GetWingPropertyColor(int propertyId, int value) |
| | |
| | | return propertyColor.GetWingPropertyColor(propertyId, value); |
| | | } |
| | | |
| | | public static bool IsEquipPlaceHasLegendProperty(int place) |
| | | public static LegendAttrType GetEquipPropertyType(int propertyId) |
| | | { |
| | | return equipPropertyMap.GetPropertyType(propertyId); |
| | | } |
| | | |
| | | public static bool HasEquipPlace(int place) |
| | | { |
| | | return equipPropertyMap.HasPlace(place); |
| | | } |
| | | |
| | | public static bool HasEquipPlaceLegendProperty(int place, int propertyId) |
| | | public static bool HasEquipProperty(int place, int propertyId) |
| | | { |
| | | return equipPropertyMap.HasProperty(place, propertyId); |
| | | if (!HasEquipPlace(place)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return equipPropertyMap.GetProperties(place).Contains(propertyId); |
| | | } |
| | | |
| | | public static List<int> GetEquipPlaceProperties(int place) |
| | |
| | | return equipPropertyMap.GetProperties(place); |
| | | } |
| | | |
| | | public static List<int> GetEquipPlaceProperties(int place, LegendAttrType type) |
| | | public static LegendAttrType GetDogzPropertyType(int propertyId) |
| | | { |
| | | return equipPropertyMap.GetProperties(place, type); |
| | | return dogzPropertyMap.GetPropertyType(propertyId); |
| | | } |
| | | |
| | | public static bool IsDogzPlaceHasLegendProperty(int place) |
| | | public static bool HasDogzPlace(int place) |
| | | { |
| | | return dogzPropertyMap.HasPlace(place); |
| | | } |
| | | |
| | | public static bool HasDogzPlaceLegendProperty(int place, int propertyId) |
| | | public static bool HasDogzProperty(int place, int propertyId) |
| | | { |
| | | return dogzPropertyMap.HasProperty(place, propertyId); |
| | | if (!HasEquipPlace(place)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return dogzPropertyMap.GetProperties(place).Contains(propertyId); |
| | | } |
| | | |
| | | public static List<int> GetDogzPlaceProperties(int place) |
| | |
| | | return dogzPropertyMap.GetProperties(place); |
| | | } |
| | | |
| | | public static List<int> GetDogzPlaceProperties(int place, LegendAttrType type) |
| | | public static int GetEquipPropertyCount(int quality, int star, LegendAttrType type) |
| | | { |
| | | return dogzPropertyMap.GetProperties(place, type); |
| | | return equipPropertyCount.GetCount(quality, star, type); |
| | | } |
| | | |
| | | public static int GetDogzPropertyCount(int quality, int star, LegendAttrType type) |
| | | { |
| | | return dogzPropertyCount.GetCount(quality, star, type); |
| | | } |
| | | |
| | | public static int GetEquipQualityPropertyValue(int property, int quality) |
| | | { |
| | | return equipQualityPropertyValue.GetValue(property, quality); |
| | | } |
| | | |
| | | public static int GetDogzQualityPropertyValue(int property, int quality) |
| | | { |
| | | return dogzQualityPropertyValue.GetValue(property, quality); |
| | | } |
| | | |
| | | public static int GetEquipLevelPropertyValue(int property, int level) |
| | | { |
| | | return equipLevelPropertyValue.GetValue(property, level); |
| | | } |
| | | |
| | | public static int GetWingPropertyCount(int level) |
| | | { |
| | | return wingPropertyCount.GetValue(level); |
| | | } |
| | | |
| | | public static int GetWingPropertyMinValue(int level, int property) |
| | | { |
| | | return wingPropertyValue.GetMin(level, property); |
| | | } |
| | | |
| | | public static int GetWingPropertyMaxValue(int level, int property) |
| | | { |
| | | return wingPropertyValue.GetMax(level, property); |
| | | } |
| | | |
| | | public class PropertyColor |
| | | { |
| | | Dictionary<int, LegendAttrType> equipLegendPropertyColors = new Dictionary<int, LegendAttrType>(); |
| | | Dictionary<int, Dictionary<int, string>> wingLegendPropertyColors = new Dictionary<int, Dictionary<int, string>>(); |
| | | |
| | | public PropertyColor(string configId) |
| | |
| | | |
| | | } |
| | | |
| | | public bool HasPropertyType(int propertyId) |
| | | { |
| | | return equipLegendPropertyColors.ContainsKey(propertyId); |
| | | } |
| | | |
| | | public LegendAttrType GetPropertyType(int propertyId) |
| | | { |
| | | if (HasPropertyType(propertyId)) |
| | | { |
| | | return equipLegendPropertyColors[propertyId]; |
| | | } |
| | | else |
| | | { |
| | | return LegendAttrType.Normal; |
| | | } |
| | | } |
| | | |
| | | public string GetWingPropertyColor(int propertyId, int value) |
| | | { |
| | | if (!wingLegendPropertyColors.ContainsKey(propertyId)) |
| | |
| | | |
| | | return color; |
| | | } |
| | | |
| | | } |
| | | |
| | | public class PropertyMap |
| | | { |
| | | Dictionary<int, LegendAttrType> propertyTypes = new Dictionary<int, LegendAttrType>(); |
| | | // key 装备位 value 属性ID,属性类型 |
| | | Dictionary<int, Dictionary<int, LegendAttrType>> placeToProperties = new Dictionary<int, Dictionary<int, LegendAttrType>>(); |
| | | Dictionary<int, List<int>> placeToProperties = new Dictionary<int, List<int>>(); |
| | | |
| | | public PropertyMap(string config) |
| | | public PropertyMap(string typeConfig, string placeConfig) |
| | | { |
| | | var json = JsonMapper.ToObject(config); |
| | | var json = JsonMapper.ToObject(typeConfig); |
| | | foreach (var item in json.Keys) |
| | | { |
| | | var type = (LegendAttrType)(int.Parse(item) - 1); |
| | | propertyTypes[(int)json[item]] = type; |
| | | } |
| | | |
| | | json = JsonMapper.ToObject(placeConfig); |
| | | foreach (var key in json.Keys) |
| | | { |
| | | var equipPlace = int.Parse(key); |
| | | var propertyDictionary = new Dictionary<int, LegendAttrType>(); |
| | | placeToProperties.Add(equipPlace, propertyDictionary); |
| | | var properties = new List<int>(); |
| | | placeToProperties.Add(equipPlace, properties); |
| | | |
| | | if (json[key].IsArray) |
| | | { |
| | | var subJson = json[key]; |
| | | foreach (var type in subJson.Keys) |
| | | { |
| | | var legendPropertyType = (LegendAttrType)int.Parse(type); |
| | | for (var i = 0; i < subJson[type].Count; i++) |
| | | { |
| | | var propertyId = (int)subJson[type][i]; |
| | | propertyDictionary[propertyId] = legendPropertyType; |
| | | properties.Add(propertyId); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public bool HasProperty(int propertyId) |
| | | { |
| | | return propertyTypes.ContainsKey(propertyId); |
| | | } |
| | | |
| | | public LegendAttrType GetPropertyType(int propertyId) |
| | | { |
| | | if (HasProperty(propertyId)) |
| | | { |
| | | return propertyTypes[propertyId]; |
| | | } |
| | | else |
| | | { |
| | | return LegendAttrType.Normal; |
| | | } |
| | | } |
| | | |
| | | public bool HasPlace(int place) |
| | | { |
| | | return placeToProperties.ContainsKey(place); |
| | | } |
| | | |
| | | public bool HasProperty(int place, int propertyId) |
| | | { |
| | | if (!placeToProperties.ContainsKey(place)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return placeToProperties[place].ContainsKey(propertyId); |
| | | } |
| | | |
| | | public List<int> GetProperties(int place) |
| | |
| | | } |
| | | } |
| | | |
| | | public List<int> GetProperties(int place, LegendAttrType type) |
| | | { |
| | | if (!HasPlace(place)) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | var properties = new List<int>(); |
| | | foreach (var item in placeToProperties[place]) |
| | | { |
| | | if (item.Value == type) |
| | | { |
| | | properties.Add(item.Key); |
| | | } |
| | | } |
| | | |
| | | return properties; |
| | | } |
| | | |
| | | } |
| | | |
| | | public class EquipPropertyMap : PropertyMap |
| | | { |
| | | public EquipPropertyMap(string configId) : base(configId) |
| | | { |
| | | } |
| | | } |
| | | |
| | | public class DogzPropertyMap : PropertyMap |
| | | { |
| | | public DogzPropertyMap(string configId) : base(configId) |
| | | { |
| | | } |
| | | } |
| | | |
| | | public class PropertyCount |
| | |
| | | } |
| | | } |
| | | |
| | | public class EquipPropertyCount : PropertyCount |
| | | { |
| | | public EquipPropertyCount(string configId) : base(configId) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | public class DogzPropertyCount : PropertyCount |
| | | { |
| | | public DogzPropertyCount(string configId) : base(configId) |
| | | { |
| | | } |
| | | } |
| | | |
| | | public class QualityPropertyValue |
| | | { |
| | | // key 属性ID value 装备品质,属性数值 |
| | |
| | | } |
| | | } |
| | | |
| | | public class EquipQualityPropertyValue : QualityPropertyValue |
| | | { |
| | | public EquipQualityPropertyValue(string config) : base(config) |
| | | { |
| | | } |
| | | } |
| | | |
| | | public class DogzQualityPropertyValue : QualityPropertyValue |
| | | { |
| | | public DogzQualityPropertyValue(string config) : base(config) |
| | | { |
| | | } |
| | | } |
| | | |
| | | public class LevelPropertyValue |
| | | { |
| | | // key 属性ID value 装备阶级,属性数值 |
| | |
| | | return levelValues.ContainsKey(property); |
| | | } |
| | | |
| | | public bool Has(int property, int quality) |
| | | public bool Has(int property, int level) |
| | | { |
| | | if (!levelValues.ContainsKey(property)) |
| | | { |
| | |
| | | return levelValues[property].ContainsKey(property); |
| | | } |
| | | |
| | | public int GetValue(int property, int quality) |
| | | public int GetValue(int property, int level) |
| | | { |
| | | if (Has(property, quality)) |
| | | if (Has(property, level)) |
| | | { |
| | | return levelValues[property][quality]; |
| | | return levelValues[property][level]; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | public class EquipLevelPropertyValue : LevelPropertyValue |
| | | { |
| | | public EquipLevelPropertyValue(string config) : base(config) |
| | | { |
| | | } |
| | | } |
| | | |
| | | public class DogzLevelPropertyValue : LevelPropertyValue |
| | | { |
| | | public DogzLevelPropertyValue(string config) : base(config) |
| | | { |
| | | } |
| | | } |
| | | |
| | | public class WingPropertyCount |