예제 #1
0
 public void ChangeCount(int kid, int count)
 {
     ItemInfo info = null;
     if(itemInfoDic.ContainsKey(kid))
     {
         info = itemInfoDic[kid];
         info.Count += count;
         info.Count = Mathf.Max(info.Count, 0);
         if(info.Count <= 0)
         {
             itemInfoDic.Remove(kid);
         }
     }
     else if(count > 0)
     {
         ItemData data = ItemDataManager.Instance.GetData(kid) as ItemData;
         info = new ItemInfo(data, count);
         itemInfoDic[kid] = info;
     }
     else
     {
         BaseLogger.LogFormat("Illegal item count manuplation: kid={0}, count={1}", kid, count);
     }
     DispatchNotification(NotificationEnum.PACK_REFRESH, ItemType.None);
 }
예제 #2
0
 public static ItemInfo GenerateItemInfoByDrop(DropData dropData)
 {
     int index = RandomUtils.Weight(dropData.WeightList);
     int itemKid = dropData.ItemKidList[index];
     int count = RandomUtils.Range(dropData.MinCountList[index], dropData.MaxCountList[index]);
     ItemData data = ItemDataManager.Instance.GetData(itemKid) as ItemData;
     ItemInfo info = new ItemInfo(data, count);
     return info;
 }
예제 #3
0
        public void Init()
        {
            //Mock data
            ItemData data;
            ItemInfo info;

            data = ItemDataManager.Instance.GetData(140001) as ItemData;
            info = new ItemInfo(data, 1234);
            itemInfoDic.Add(140001, info);

            data = ItemDataManager.Instance.GetData(140002) as ItemData;
            info = new ItemInfo(data, 56);
            itemInfoDic.Add(140002, info);

            data = ItemDataManager.Instance.GetData(140003) as ItemData;
            info = new ItemInfo(data, 234);
            itemInfoDic.Add(140003, info);
        }
예제 #4
0
 private void OnDiscard(ItemInfo itemInfo)
 {
 }
예제 #5
0
 private void OnUse(ItemInfo itemInfo)
 {
 }