internal IEnumerator DoImport(Item item, Skin skin) { ImportVersion2 importVersion2 = null; if (importVersion2.Bundle != null) { importVersion2.Bundle.Unload(true); importVersion2.Bundle = null; } WorkshopItemEditor.Loading(true, "Downloading..", "", 0f); if (!item.IsInstalled) { item.Download(true); while (item.IsDownloading) { yield return(null); } while (!item.IsInstalled) { yield return(null); } } string str = string.Concat(item.Directory, "/bundle"); if (!File.Exists(str)) { UnityEngine.Debug.LogWarning("No Bundle Found!"); Os.OpenFolder(item.Directory); yield return(new WaitForSeconds(5f)); } else { yield return(importVersion2.StartCoroutine(importVersion2.LoadItem(item.Directory, str, skin))); } }
private async Task ExportTexture(Dictionary <string, string> data, string folder, int group, string paramname, Material mat, Material defaultMat, bool isNormalMap = false) { WorkshopItemEditor.Loading(true, string.Concat("Exporting Texture ", paramname), "", 0f); UnityEngine.Texture texture = mat.GetTexture(paramname); if (texture != defaultMat.GetTexture(paramname)) { if (texture != null) { texture = Facepunch.Utility.Texture.LimitSize(texture as Texture2D, this.Skinnable.Groups[group].MaxTextureSize, this.Skinnable.Groups[group].MaxTextureSize); if (isNormalMap) { texture = Facepunch.Utility.Texture.CreateReadableCopy(texture as Texture2D, 0, 0); (texture as Texture2D).DecompressNormals(); } string str = string.Format("{0}{1}{2}", paramname, group, ".png"); data.Add(paramname, str); texture.SaveAsPng(string.Concat(folder, "/", str)); await Task.Delay(1); } else { data.Add(paramname, "none"); } } }
private async Task PublishToSteam(string folder) { Steamworks.Ugc.Editor editor = new Steamworks.Ugc.Editor(); editor = (this.ItemId != 0 ? new Steamworks.Ugc.Editor(this.ItemId) : Steamworks.Ugc.Editor.NewMicrotransactionFile); Steamworks.Ugc.Editor editor1 = editor.WithContent(folder); editor1 = editor1.WithPreviewFile(string.Concat(folder, "/icon_background.png")); editor1 = editor1.WithTitle(this.Title); editor1 = editor1.WithTag("Version3"); editor1 = editor1.WithTag(this.Skinnable.Name); editor1 = editor1.WithTag("Skin"); editor = editor1.WithPublicVisibility(); if (!string.IsNullOrEmpty(this.ChangeLog.text)) { editor = editor.WithChangeLog(this.ChangeLog.text); } WorkshopItemEditor.Loading(true, "Publishing To Steam", "", 0f); PublishResult publishResult = await editor.SubmitAsync(null); if (publishResult.Success) { UnityEngine.Debug.Log(string.Concat("Published File: ", publishResult.FileId)); } else { UnityEngine.Debug.Log(string.Concat("Error: ", publishResult.Result)); } Item?nullable = await SteamUGC.QueryFileAsync(publishResult.FileId); if (nullable.HasValue) { WorkshopItemEditor id = this.Editor; Item value = nullable.Value; id.ItemId = value.Id; WorkshopItemEditor title = this.Editor; value = nullable.Value; title.ItemTitle = value.Title; this.ChangeLog.text = ""; value = nullable.Value; UnityEngine.Application.OpenURL(value.Url); WorkshopItemList.RefreshAll(); } else { UnityEngine.Debug.Log("Error Retrieving item information!"); WorkshopItemList.RefreshAll(); } }
internal IEnumerator DoImport(Item item, Skin skin) { WorkshopItemEditor.Loading(true, "Downloading..", "", 0f); if (!item.IsInstalled) { item.Download(true); while (item.IsDownloading) { yield return(null); } WorkshopItemEditor.Loading(true, "Installing..", "", 0f); while (!item.IsInstalled) { yield return(null); } } Os.OpenFolder(item.Directory); WorkshopItemEditor.Loading(true, "Unable To Import", "", 0f); yield return(new WaitForSeconds(5f)); }
internal IEnumerator DoImport(Item item, Skin skin) { ImportVersion3 importVersion3 = null; WorkshopItemEditor.Loading(true, "Downloading..", "", 0f); yield return(importVersion3.StartCoroutine(importVersion3.DownloadFromWorkshop(item))); if (!item.IsInstalled || item.Directory == null) { UnityEngine.Debug.Log("Error opening item, not downloaded properly."); UnityEngine.Debug.Log(string.Concat("item.Directory: ", item.Directory)); bool isInstalled = item.IsInstalled; UnityEngine.Debug.Log(string.Concat("item.Installed: ", isInstalled.ToString())); yield break; } WorkshopItemEditor.Loading(true, "Loading..", "Reloading Textures", 0f); yield return(importVersion3.StartCoroutine(skin.LoadIcon(item.Id, item.Directory, null))); yield return(importVersion3.StartCoroutine(skin.LoadAssets(item.Id, item.Directory, null))); }