/// <summary> /// Call SetItems to refresh the item selection UI. /// Calling this method will remove all currently visible items and replace them with those passed in the p_itemList argument. /// </summary> /// <param name="p_itemList">list of items to be visualized.</param> public void SetItems(WorkshopItemList p_itemList) { if (ITEM_BROWSER != null) { m_uiNodeToSteamItem.Clear(); ITEM_BROWSER.Clear(); ITEM_BROWSER.BuildTree(ConvertItemsToNodes(p_itemList.Items.ToArray())); } else { Debug.LogError("SteamWorkshopUIBrowse: SetItems: ITEM_BROWSER is not set in inspector!"); } if (PAGE_SELCTOR != null) { PAGE_SELCTOR.OnPageSelected -= SetPage; PAGE_SELCTOR.SetPageCount((int)p_itemList.PagesItems); PAGE_SELCTOR.SelectPage((int)p_itemList.Page); PAGE_SELCTOR.OnPageSelected += SetPage; } else { Debug.LogError("SteamWorkshopUIBrowse: SetItems: PAGE_SELCTOR is not set in inspector!"); } if (m_improveNavigationFocus && ITEM_BROWSER != null && ITEM_BROWSER.transform.childCount > 0 && ITEM_BROWSER.transform.GetChild(0).GetComponent <SteamWorkshopItemNode>() != null) { // select the first list item if available ITEM_BROWSER.transform.GetChild(0).GetComponent <SteamWorkshopItemNode>().Select(); } }
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(); } }