using Codice.Client.Common; using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; namespace GFGGame { public class ItemData { public int id; public int num; public bool isOnceBonus; public Dictionary AttributesDic = new Dictionary(); delegate object MemberGetDelegate(ItemCfg p); public void Reset() { id = 0; num = 0; isOnceBonus = false; AttributesDic.Clear(); } public int MainScore { get { var cfg = ItemCfgArray.Instance.GetCfg(id); return GetScore(cfg.mainScore>0? cfg.mainScore:1); } } public int GetScore(int scoreType) { int valueBase = 0; var cfg = ItemCfgArray.Instance.GetCfg(id); switch(scoreType) { case (int)ConstItemAttributeType.FENG: valueBase = cfg.score1; break; case (int)ConstItemAttributeType.HUA: valueBase = cfg.score2; break; case (int)ConstItemAttributeType.XUE: valueBase = cfg.score3; break; case (int)ConstItemAttributeType.YUE: valueBase = cfg.score4; break; } AttributesDic.TryGetValue(CalculateUtil.GetItemScoreKey(scoreType, (int)ConstItemAttributeActionType.ADD_VALUE), out var valueAdd); AttributesDic.TryGetValue(CalculateUtil.GetItemScoreKey(scoreType, (int)ConstItemAttributeActionType.ADD_PERCENT), out var percentAdd); return CalculateUtil.GetItemAttribute(valueBase, percentAdd, valueAdd); } } }