| using UnityEngine; | 
| using System.Collections; | 
| using System.Collections.Generic; | 
|   | 
| public class CommonFunc | 
| { | 
|     public static Dictionary<int, long> AddDict(Dictionary<int, long> dic1, Dictionary<int, long> dic2) | 
|     { | 
|         var resultDic = new Dictionary<int, long>(dic1); | 
|         foreach (var data in dic2) | 
|         { | 
|             if (resultDic.ContainsKey(data.Key)) | 
|             { | 
|                 resultDic[data.Key] = resultDic[data.Key] + data.Value; | 
|                 continue; | 
|             } | 
|             resultDic[data.Key] = data.Value; | 
|         } | 
|         return resultDic; | 
|     } | 
|   | 
|   | 
|   | 
|     public static List<Item> ChangeToItemList(Dictionary<int, long> dict) | 
|     { | 
|         List<Item> itemlist = new List<Item>(); | 
|         if (dict == null) | 
|             return itemlist; | 
|         foreach (var data in dict) | 
|         { | 
|             itemlist.Add(new Item(data.Key, data.Value)); | 
|         } | 
|         return itemlist; | 
|     } | 
| } |