瀏覽代碼

Merge remote-tracking branch 'remotes/origin/guodong' into zhaoyang

zhaoyang 3 年之前
父節點
當前提交
c5b0cceb93
共有 2 個文件被更改,包括 34 次插入1 次删除
  1. 1 1
      GameClient/Assets/Game/CSShare
  2. 33 0
      GameClient/Assets/Game/HotUpdate/Data/VO/ItemData.cs

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit 41ed2ba5b80216f1172897a0df20ae11b30590f0
+Subproject commit 745893dc0cb8b50867e3e2eb2591cf9e318a036d

+ 33 - 0
GameClient/Assets/Game/HotUpdate/Data/VO/ItemData.cs

@@ -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); 
         }
     }
 }