|
@@ -1,3 +1,7 @@
|
|
|
+using System;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.Reflection;
|
|
|
+
|
|
|
namespace GFGGame
|
|
|
{
|
|
|
public class ItemData
|
|
@@ -6,11 +10,40 @@ namespace GFGGame
|
|
|
public int num;
|
|
|
public bool isOnceBonus;
|
|
|
|
|
|
+ public int[] AddScoresArr;
|
|
|
+ public int[] AddPercentArr;
|
|
|
+ delegate object MemberGetDelegate(ItemCfg p);
|
|
|
+
|
|
|
public void Reset()
|
|
|
{
|
|
|
id = 0;
|
|
|
num = 0;
|
|
|
isOnceBonus = false;
|
|
|
+ AddScoresArr = null;
|
|
|
+ AddPercentArr = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int MainScore
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ var cfg = ItemCfgArray.Instance.GetCfg(id);
|
|
|
+ return GetScore(cfg.mainScore);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public int GetScore(int scoreType)
|
|
|
+ {
|
|
|
+ var cfg = ItemCfgArray.Instance.GetCfg(id);
|
|
|
+ Type type = typeof(ItemCfg);
|
|
|
+ PropertyInfo property = type.GetProperty("score" + scoreType);
|
|
|
+ MemberGetDelegate memberGet = (MemberGetDelegate)System.Delegate.CreateDelegate(typeof(MemberGetDelegate), property.GetGetMethod());
|
|
|
+ Stopwatch stopwatch = Stopwatch.StartNew();
|
|
|
+ var scoreBase = (int)memberGet(cfg);
|
|
|
+ int index = scoreType - 1;
|
|
|
+ var scoreadd = AddScoresArr[index];
|
|
|
+ var percentAdd = AddPercentArr[index];
|
|
|
+ return CalculateUtil.GetItemScore(scoreBase, percentAdd, scoreadd);
|
|
|
}
|
|
|
}
|
|
|
}
|