public void LoadItems() { var assets = Assets.find(EAssetType.ITEM).Cast <ItemAsset>().ToList(); foreach (ItemAsset asset in assets) { var ready = new ItemIconReady((icon) => { AddUnturnedIcon(asset.id, icon.EncodeToPNG()); }); ItemTool.getIcon(asset.id, 0, asset.quality, asset.getState(), asset, null, string.Empty, string.Empty, asset.size_x * 250, asset.size_y * 250, false, true, ready); } }
public void LoadItems() { UnturnedMarketplaceModule.Instance.Config.Reload(UnturnedMarketplaceModule.Instance); List <ushort> noIconItems = GetItemsWithNoIcons(); Debug.Log($"{noIconItems.Count} items do not have icons"); int num1 = 0; foreach (ushort itemId in noIconItems) { ItemAsset asset = Assets.find(EAssetType.ITEM, itemId) as ItemAsset; var ready = new ItemIconReady((icon) => { UploadUnturnedItemIcon(asset.id, icon.EncodeToPNG()); }); ItemTool.getIcon(asset.id, 0, asset.quality, asset.getState(), asset, null, string.Empty, string.Empty, asset.size_x * UnturnedMarketplaceModule.Instance.Config.IconSize, asset.size_y * UnturnedMarketplaceModule.Instance.Config.IconSize, false, true, ready); num1++; } }
private void dumpImages() { Directory.CreateDirectory("Images"); Asset[] assets = Assets.find(EAssetType.ITEM); foreach (ItemAsset asset in assets) { try { ushort id = ((Asset)asset).Id; ItemTool.getIcon(id, 100, new byte[0], (Texture2D t) => { byte[] bytes = t.EncodeToPNG(); string filename = "Images/" + id + ".png"; System.IO.File.WriteAllBytes(filename, bytes); }); } catch (Exception ex) { System.Console.WriteLine(ex.ToString()); } } }