Beispiel #1
0
    //返回背包信息
    public Dictionary <int, GridInfo> GetInventoryData(JsonData _data)
    {
        Dictionary <int, GridInfo> tempInventory = new Dictionary <int, GridInfo>();

        for (int i = 1; i <= 8; i++)
        {
            string tempData = (string)_data["bagItem" + i];
            if (tempData != "-1")
            {
                string[] arrays = tempData.Split('|');
                tempInventory.Add(i, new GridInfo(i, GamingData.GetItemByID(int.Parse(arrays[0])), int.Parse(arrays[1])));
            }

            else
            {
                tempInventory.Add(i, new GridInfo(i, new Item(), 0));
            }
        }
        return(tempInventory);
    }
Beispiel #2
0
 //使用物品
 public void UseItem(int _itemGridID)
 {
     //判断物品是否存在
     if (inventoryInfo[_itemGridID].GetItemID() != -1)
     {
         inventoryInfo[_itemGridID].itemCount--;
         Item item = GamingData.GetItemByID(inventoryInfo[_itemGridID].GetItemID());
         heroSystem.hill(item.UseType, item.Value);
         //如果物品耗尽
         if (inventoryInfo[_itemGridID].itemCount == 0)
         {
             ClearGridInfo(_itemGridID);
             //TODO给UI发送消息
         }
         else
         {
             //TODO提示使用物品并实现效果
         }
     }
     else
     {
         return;
     }
 }
Beispiel #3
0
 Item GetItemFromAll(int _itemID)
 {
     return(GamingData.GetItemByID(_itemID));
 }
Beispiel #4
0
    //装备卸下是的回调
    void OnUnEquiped(int _gridID, int _equipID)
    {
        Item item = GamingData.GetItemByID(_equipID);

        heroSystem.SetATK_DEF(item.UseType, -item.Value);
    }