示例#1
0
        //return a list of item sets, given the full inventory
        public static List<ItemSet> getItemSetList(List<Item> inventory)
        {

            List<ItemSet> retvalList = new List<ItemSet>();

            var usableItemList = (from data in inventory
                                  where data is UsableItem
                                  select data).ToList();

            foreach(var item in usableItemList)
            {
                int count = usableItemList.Count(x => x.ID == item.ID);
               // int count = usableItemList.Select(x=>x.ID==item.ID).Count();
                ItemSet tempItemSet = new ItemSet(){itemName=item.name,itemID=item.ID,count = count,sheetname=item.sheetname,spriteindex=item.spriteindex};
                if(!retvalList.Contains(tempItemSet))
                {
                    retvalList.Add(tempItemSet);
                }
            }

            return retvalList;
        }
    private GameObject updateAmmoGameObject(GameObject obj, ItemSet ammo)
    {
        var equipTypePanel = UIHelper.getChildObject(obj, "EquipTypePanel");
        UIHelper.UpdateTextComponent(equipTypePanel, "EquipType", "Ammo");
        UIHelper.UpdateSpriteComponent(equipTypePanel, "EquipImage", assetLibrary.getSprite(ammo.sheetname,ammo.spriteindex));

        UIHelper.UpdateTextComponent(obj, "EquipStats", ammo.ToString());
        return obj;
    }