// Update is called once per frame


    public void Update()
    {
        if (GameInput.GetKeyDown(KeyCode.B))
        {
            bagManager.OpenBag();
        }
        RaycastHit2D hit = Physics2D.Raycast(Input.mousePosition, Vector2.zero, 100f, LayerMask.GetMask("UI"));

        if (hit.collider != null)
        {
            GameObject obj = hit.collider.gameObject;
            Debug.Log(obj.name);
        }
    }
Exemple #2
0
 public static void GetInventoryItems()
 {
     InventoryItems.Clear();
     bm.UpdateItemsSorted();
     for (int j = 0; j < bm.Bags.Length; j++)
     {
         //PPather.Debug("Charcater: Bags.Length = {0}",bm.Bags.Length);
         BagManager.Bag b = bm.Bags[j];
         if (b.count < 1)
         {
             continue;
         }
         //PPather.Debug("Characater: Bags[{0}] contains {1} items",j,b.I.Length);
         bm.OpenBag(b.bag);
         GItem[] Items = null;
         if (b.I != null)
         {
             Items = b.I;
         }
         if (Items == null || Items.Length < 1)
         {
             continue;
         }
         foreach (GItem Item in Items)
         {
             if (Item == null || Item.GUID == 0)
             {
                 continue;
             }
             PPather.Debug("\n\n == ITEM LOOKUP FOR {0} START ==", Item.Name);
             List <string> tooltip = GetTooltipOnOpenBags(Item);
             if (tooltip == null || tooltip.Count < 1)
             {
                 PPather.Debug("Character.GetInventoryItems: tooltip for {0} is emtpy", Item.Name);
             }
             else
             {
                 string tooltipName = tooltip[tooltip.Count - 1];
                 PPather.Debug("Character.GetInventoryItems: tooltip[0] for {0} is {1}", Item.Name, tooltipName);
                 Item i = ItemManager.get(tooltipName);
                 if (i == null)
                 {
                     PPather.Debug("Character: ItemManager return null, {0} most likely not equippable", tooltipName);
                     continue;
                 }
                 try
                 {
                     EasyItem E = new EasyItem(Item, i, Item.GUID, tooltipName);
                     InventoryItems.Add(Item.GUID, E);
                     PPather.WriteLine(Pather.LOG_CATEGORY.INFORMATION, "Character: {0} added to InventoryItems", tooltipName);
                     //PPather.WriteLine(String.Format("DEBUG: Item.Type = {0} , Item.Quality = {1}",E.GItem.Type.ToString(), E.GItem.Definition.Quality.ToString()));
                     //PPather.WriteLine(String.Format("Charcter: Item [{0}] found in bags", i.Name));
                     //PPather.WriteLine(String.Format("ToolTip[{0}]: {1}", i.Name, CleanToolTip(tooltip)));
                 }
                 catch (ArgumentException)
                 {
                     PPather.Debug("Character.GetInventoryItems: {0}({1}) is already added to InventoryItems (skipping)", tooltipName, Item.GUID);
                 }
             }
             PPather.Debug("\n=== ITEM LOOKUP FOR {0} END ===\n", Item.Name);
         }
     }
     bm.CloseAllBags();
 }