Exemplo n.º 1
0
        private void OnUGCDetailsComplete(SteamUGCQueryCompleted_t callback, bool ioError)
        {
            var result = callback.m_eResult;
            var handle = callback.m_handle;
            PublishedFileId_t id;

            if (!ioError && result == EResult.k_EResultOK)
            {
                var allResults = ListPool <SteamUGCDetails_t, SteamUGCServiceFixed> .Allocate();

                for (uint i = 0U; i < callback.m_unNumResultsReturned; i++)
                {
                    if (SteamUGC.GetQueryUGCResult(handle, i, out SteamUGCDetails_t details) &&
                        allMods.TryGetValue(id = details.m_nPublishedFileId,
                                            out ModInfo mod))
                    {
#if false
                        PUtil.LogDebug("Updated mod {0:D} ({1})".F(id.m_PublishedFileId,
                                                                   details.m_rgchTitle));
#endif
                        mod.Populate(details);
                        // Queue up the preview image
                        download.Queue(id);
                        preview.Queue(id);
                        allResults.Add(details);
                    }
                }
                ModUpdateDetails.OnInstalledUpdate(allResults);
                allResults.Recycle();
            }
            SteamUGC.ReleaseQueryUGCRequest(handle);
            onQueryComplete?.Dispose();
            onQueryComplete = null;
        }
Exemplo n.º 2
0
    private void OnUGCSteamUGCQueryCompleted(SteamUGCQueryCompleted_t pResult, bool failed)
    {
        Debug.Log("OnUGCSteamUGCQueryCompleted() " + pResult.m_eResult);

        if (failed == false)
        {
            for (uint i = 0; i < pResult.m_unNumResultsReturned; i++)
            {
                SteamUGCDetails_t details;
                SteamUGC.GetQueryUGCResult(pResult.m_handle, i, out details);
                // Only load items when explicitly requested by something
                if (loadItems)
                {
                    bool owner = false;
                    if (details.m_ulSteamIDOwner == SteamUser.GetSteamID().m_SteamID)
                    {
                        owner = true;
                    }
                    uint itemState = SteamUGC.GetItemState(details.m_nPublishedFileId);
                    if ((itemState & (uint)EItemState.k_EItemStateInstalled) != 0)
                    {
                        LoadModIntoGame(details.m_nPublishedFileId, owner);
                    }
                }
            }
        }
        else
        {
            Debug.LogError("OnUGCSteamUGCQueryCompleted() error " + pResult.m_eResult);
        }
        loadItems = false;

        SteamUGC.ReleaseQueryUGCRequest(pResult.m_handle);
    }
    public void CallBackSendQuery(SteamUGCQueryCompleted_t pCallback, bool bIOFailure)
    {
        try
        {
            if (pCallback.m_eResult == EResult.k_EResultOK)
            {
                uint count = pCallback.m_unNumResultsReturned;
                uint index = _StartIndex % 50;
                if (count - index > _Count)
                {
                    count = _Count;
                }
                SteamUGCDetails_t detail = new SteamUGCDetails_t();
                for (uint i = index; i < count + index; i++)
                {
                    SteamUGC.GetQueryUGCResult(_UGCQueryHandle, i, out detail);
                    _FileIDLsit.Add(detail.m_nPublishedFileId);
                    Debug.LogWarning("CallBackSendQuery PublishedFileId_t " + i.ToString() + " = " + detail.m_nPublishedFileId);
                }

                Finish(_FileIDLsit, (int)pCallback.m_unTotalMatchingResults, _StartIndex, true);
            }
            else
            {
                Finish(null, 0, _StartIndex, false);
            }
        }
        catch (Exception)
        {
            Finish(null, 0, _StartIndex, false);
        }
    }
Exemplo n.º 4
0
    static void GetModsInfoFromUserTask(SteamAPICall_t handle)
    {
        while (!IsCompleted(handle))
        {
        }
        List <string>            _ModsReceivedResult = new List <string>();
        SteamUGCQueryCompleted_t result = AllocCallback <SteamUGCQueryCompleted_t>(handle, out IntPtr pCallback, SteamUGCQueryCompleted_t.k_iCallback);

        Console.WriteLine("*************************************");
        _ModsReceivedResult.Add("User mods: " + result.m_unNumResultsReturned.ToString());
        for (uint i = 0; i < result.m_unNumResultsReturned; i++)
        {
            if (SteamUGC.GetQueryUGCResult(result.m_handle, i, out var details))
            {
                DateTime FromUnixTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(details.m_rtimeUpdated);
                _ModsReceivedResult.Add("- " + details.m_rgchTitle.ToString() + ", " + details.m_rgchDescription.ToString() + ", " + FromUnixTime.ToString() + ", " + details.m_nPublishedFileId.ToString());
            }
        }
        for (int i = 0; i < _ModsReceivedResult.Count; i++)
        {
            Console.WriteLine(_ModsReceivedResult[i]);
        }
        Console.WriteLine("*************************************");
        ReleaseCallback(pCallback);
    }
        private static void OnUGCQueryComplete(SteamUGCQueryCompleted_t param, bool bIOFailure)
        {
            factory_list_init._mainFormAccessor._addonList.RemoveItems();
            pszImagePreviewURLs.Clear();

            if (bIOFailure || (param.m_eResult != EResult.k_EResultOK))
            {
                utils.ShowWarningDialog("Unable to fetch workshop items!", null, true);
                SteamUGC.ReleaseQueryUGCRequest(_ugcHandle);
                return;
            }

            for (uint i = 0; i < param.m_unNumResultsReturned; i++)
            {
                SteamUGCDetails_t pDetails;
                if (SteamUGC.GetQueryUGCResult(param.m_handle, i, out pDetails))
                {
                    string url = null;
                    if (SteamUGC.GetQueryUGCPreviewURL(param.m_handle, i, out url, 1024))
                    {
                        AddImagePreviewItemToQueue(url, pDetails.m_nPublishedFileId.m_PublishedFileId.ToString());
                    }

                    string tags = pDetails.m_rgchTags + ",";
                    factory_list_init._mainFormAccessor._addonList.AddItem(pDetails.m_rgchTitle, pDetails.m_rgchDescription, tags, (int)pDetails.m_eVisibility, pDetails.m_nPublishedFileId, utils.GetDateFromTimeCreated((ulong)pDetails.m_rtimeUpdated));
                }
            }

            SteamUGC.ReleaseQueryUGCRequest(_ugcHandle);

            StartDownloadingPreviewImages();
        }
        private void OnUGCDetailsComplete(SteamUGCQueryCompleted_t callback, bool ioError)
        {
            var result = callback.m_eResult;
            var handle = callback.m_handle;
            PublishedFileId_t id;

            if (!ioError && result == EResult.k_EResultOK)
            {
                for (uint i = 0U; i < callback.m_unNumResultsReturned; i++)
                {
                    if (SteamUGC.GetQueryUGCResult(handle, i, out SteamUGCDetails_t details) &&
                        allMods.TryGetValue(id = details.m_nPublishedFileId,
                                            out ModInfo mod))
                    {
#if false
                        PUtil.LogDebug("Updated mod {0:D} ({1})".F(id.m_PublishedFileId,
                                                                   details.m_rgchTitle));
#endif
                        mod.Populate(details);
                        // Queue up a download and a preview
                        download.Queue(id);
                        preview.Queue(id);
                    }
                }
            }
            SteamUGC.ReleaseQueryUGCRequest(handle);
            onQueryComplete?.Dispose();
            onQueryComplete = null;
        }
    private void OnQueryCompleted(SteamUGCQueryCompleted_t p_callback, bool p_bIOFailure)
    {
        waitingOnQuery = false;
        items.Clear();

        if (p_bIOFailure || p_callback.m_eResult != EResult.k_EResultOK)
        {
            Util.LogError($"Failed to query featured workshop items. Result code: {p_callback.m_eResult}");
            return;
        }

        for (uint i = 0; i < p_callback.m_unNumResultsReturned; i++)
        {
            SteamUGCDetails_t itemDetails;
            if (SteamUGC.GetQueryUGCResult(p_callback.m_handle, i, out itemDetails))
            {
                if (itemDetails.m_eResult != Steamworks.EResult.k_EResultOK)
                {
                    Util.LogError($"Something is wrong with featured file ID {FeaturedPublishedFileIds[i]} - ignoring.");
                }
                else
                {
                    WorkshopItem item = SteamWorkshopMain.Instance.RegisterQueryResultItem(p_callback.m_handle, i, itemDetails);
                    items.Add(item);
                    // Util.Log($"got WorkshopItem for featured ID {item.SteamNative.m_nPublishedFileId}, name is {item.Name} {item.PreviewImageURL}. sub'd? {item.IsSubscribed}");
                }
            }
            else
            {
                Util.LogError($"Could not query details of featured file ID {FeaturedPublishedFileIds[i]} - ignoring.");
            }
        }
    }
Exemplo n.º 8
0
        private static void OnQueryCompleted(SteamUGCQueryCompleted_t p_callback, bool p_bIOFailure, WorkShopItemHandler handleItem, ulong requestedFileId)
        {
            if (p_bIOFailure || p_callback.m_eResult != EResult.k_EResultOK)
            {
                Util.LogError($"Failed to query workshop item {requestedFileId}. Result code: {p_callback.m_eResult}");
                handleItem(Util.Maybe <WorkshopItem> .CreateEmpty());
                return;
            }

            // There should just be 1..but doesn't hurt.
            for (uint i = 0; i < p_callback.m_unNumResultsReturned; i++)
            {
                SteamUGCDetails_t itemDetails;
                if (SteamUGC.GetQueryUGCResult(p_callback.m_handle, i, out itemDetails))
                {
                    if (itemDetails.m_eResult != Steamworks.EResult.k_EResultOK)
                    {
                        Util.LogError($"Something is wrong with workshop item {requestedFileId} - returning empty. Result code: {itemDetails.m_eResult}");
                        handleItem(Util.Maybe <WorkshopItem> .CreateEmpty());
                    }
                    else
                    {
                        WorkshopItem item = SteamWorkshopMain.Instance.RegisterQueryResultItem(p_callback.m_handle, i, itemDetails);
                        handleItem(Util.Maybe <WorkshopItem> .CreateWith(item));
                    }
                }
                else
                {
                    Util.LogError($"Could not query details of workshop item {requestedFileId} - returning empty. Result code: {itemDetails.m_eResult}");
                    handleItem(Util.Maybe <WorkshopItem> .CreateEmpty());
                }
            }
        }
Exemplo n.º 9
0
        private static void OnVisibilityQueryCompleted(SteamUGCQueryCompleted_t p_callback, bool p_bIOFailure, System.Action <Util.Maybe <bool> > handleResult, ulong requestedFileId)
        {
            if (p_bIOFailure || p_callback.m_eResult != EResult.k_EResultOK)
            {
                Util.LogError($"Failed to query workshop item {requestedFileId}. Result code: {p_callback.m_eResult}");
                handleResult(Util.Maybe <bool> .CreateEmpty());
                return;
            }

            // There should just be 1..but doesn't hurt.
            for (uint i = 0; i < p_callback.m_unNumResultsReturned; i++)
            {
                SteamUGCDetails_t itemDetails;
                if (SteamUGC.GetQueryUGCResult(p_callback.m_handle, i, out itemDetails))
                {
                    if (itemDetails.m_eResult != Steamworks.EResult.k_EResultOK)
                    {
                        Util.LogError($"Something is wrong with workshop item {requestedFileId} - returning empty. Result code: {itemDetails.m_eResult}");
                        handleResult(Util.Maybe <bool> .CreateEmpty());
                    }
                    else
                    {
                        bool isPublicyVisible = itemDetails.m_eVisibility == Steamworks.ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic;
                        handleResult(Util.Maybe <bool> .CreateWith(isPublicyVisible));
                    }
                }
                else
                {
                    Util.LogError($"Could not query details of workshop item {requestedFileId} - returning empty. Result code: {itemDetails.m_eResult}");
                    handleResult(Util.Maybe <bool> .CreateEmpty());
                }
            }
        }
Exemplo n.º 10
0
 private void OnSteamUGCQueryCompleted(SteamUGCQueryCompleted_t param, bool bIOFailure)
 {
     if (param.m_eResult == EResult.k_EResultOK)
     {
         refreshResults = param.m_handle;
     }
     OnSteamUGCQueryCompletedCallResult = null;
 }
    void OnSteamUGCQueryCompleted(SteamUGCQueryCompleted_t pCallback, bool bIOFailure)
    {
        Console.WriteLine("[" + SteamUGCQueryCompleted_t.k_iCallback + " - SteamUGCQueryCompleted_t] - " + pCallback.m_handle + " -- " + pCallback.m_eResult + " -- " + pCallback.m_unNumResultsReturned + " -- " + pCallback.m_unTotalMatchingResults + " -- " + pCallback.m_bCachedData);
        SteamUGCDetails_t pDetails;

        SteamUGC.GetQueryUGCResult(pCallback.m_handle, 17, out pDetails);
        Console.WriteLine("pDetails.m_pchFileName (" + pDetails.m_nPublishedFileId + "): " + pDetails.m_rgchTitle + " -- " + pDetails.m_rgchDescription);
        //Console.WriteLine("URL: " +pDetails.m_rgchURL);
    }
Exemplo n.º 12
0
    void OnSteamUGCQueryCompleted(SteamUGCQueryCompleted_t pCallback, bool bIOFailure)
    {
        Debug.Log("[" + SteamUGCQueryCompleted_t.k_iCallback + " - SteamUGCQueryCompleted] - " + pCallback.m_handle + " -- " + pCallback.m_eResult + " -- " + pCallback.m_unNumResultsReturned + " -- " + pCallback.m_unTotalMatchingResults + " -- " + pCallback.m_bCachedData);

        for (uint i = 0; i < pCallback.m_unNumResultsReturned; i++)
        {
            bool ret = SteamUGC.GetQueryUGCResult(pCallback.m_handle, i, out SteamUGCDetails_t details);
            _modList.Add(details);
        }
    }
Exemplo n.º 13
0
        private void OnQueryResultReceived(SteamUGCQueryCompleted_t result, bool ioFail)
        {
            QueryResult = new QueryPublishedModResult()
            {
                ResultCount = result.m_unNumResultsReturned,
                TotalMatchingResultCount = result.m_unTotalMatchingResults
            };

            if (ioFail)
            {
                ExitCode = Steam.ExitCodes.SteamIOError;
                QueryResult.IsIOFailure    = true;
                QueryResult.FailureReason  = result.m_eResult;
                AllAsyncOperationsFinished = true;
                return;
            }
            if (result.m_eResult != EResult.k_EResultOK)
            {
                QueryResult.FailureReason  = result.m_eResult;
                AllAsyncOperationsFinished = true;
                return;
            }

            QueryResult.ModData = new PublishedModData[result.m_unNumResultsReturned];
            for (uint i = 0; i < result.m_unNumResultsReturned; i++)
            {
                SteamUGC.GetQueryUGCResult(result.m_handle, i, out SteamUGCDetails_t detail);
                QueryResult.ModData[i] = new PublishedModData()
                {
                    Description     = detail.m_rgchDescription,
                    FileSize        = detail.m_nFileSize,
                    PreviewFileSize = detail.m_nPreviewFileSize,
                    HFile           = detail.m_hFile,
                    HPreviewFile    = detail.m_hPreviewFile,
                    ID                  = detail.m_nPublishedFileId,
                    IsBanned            = detail.m_bBanned,
                    IsTagsTruncated     = detail.m_bTagsTruncated,
                    NumChildren         = detail.m_unNumChildren,
                    Owner               = new CSteamID(detail.m_ulSteamIDOwner),
                    Score               = detail.m_flScore,
                    Tags                = detail.m_rgchTags,
                    TimeAddedToUserList = detail.m_rtimeAddedToUserList,
                    TimeCreated         = detail.m_rtimeCreated,
                    TimeUpdated         = detail.m_rtimeUpdated,
                    Title               = detail.m_rgchTitle,
                    Visibility          = detail.m_eVisibility,
                    VotesDown           = detail.m_unVotesDown,
                    VotesUp             = detail.m_unVotesUp,
                    URL                 = detail.m_rgchURL
                };
            }

            ExitCode = Steam.ExitCodes.NoError;
            AllAsyncOperationsFinished = true;
        }
Exemplo n.º 14
0
        private void QueryCompleted(SteamUGCQueryCompleted_t pCallback, bool bIOFailure)
        {
            Success = pCallback.m_eResult == EResult.k_EResultOK;

            if (!Success)
            {
                Log.Warn("SendQueryUGCRequest result was " + pCallback.m_eResult);
            }

            Finished = true;
        }
Exemplo n.º 15
0
 //Called when the Steam query returns asynchronously
 private static void OnSendQueryUGCRequest(SteamUGCQueryCompleted_t param, bool bIOFailure)
 {
     if (param.m_eResult == EResult.k_EResultOK)
     {
         UGCQueryHandle_t UGCHandle = param.m_handle;
         SteamUGC.GetQueryUGCResult(UGCHandle, 0, out SteamUGCDetails_t itemDetails);
         if (Settings.CurrentProfile.EnabledMods.Contains(itemDetails.m_rgchTitle))
         {
             modPackList.Add(itemDetails.m_pchFileName.Remove(0, 5));
         }
     }
 }
Exemplo n.º 16
0
 private static void OnQueryCompleted(SteamUGCQueryCompleted_t param, bool bIOFailure)
 {
     if (bIOFailure)
     {
         Console.WriteLine("Querying Workshop Failed.");
         return;
     }
     else
     {
         IndexPage(param);
     }
 }
Exemplo n.º 17
0
 private static void OnUGCQueryCompleted(SteamUGCQueryCompleted_t pCallback, bool bIOFailure)
 {
     publishedWorkshopItems = new SteamUGCDetails_t[pCallback.m_unNumResultsReturned];
     for (uint index = 0u; index < pCallback.m_unNumResultsReturned; index++)
     {
         SteamUGC.GetQueryUGCResult(pCallback.m_handle, index, out publishedWorkshopItems[index]);
     }
     SteamUGC.ReleaseQueryUGCRequest(pCallback.m_handle);
     WorkshopTool.WorkshopToolForm.BeginInvoke((Action) delegate
     {
         PublishedItems_delegate(pCallback.m_eResult);
     });
 }
        // SteamAPICall_t
        public CallbackHandle SendQueryUGCRequest(UGCQueryHandle_t handle /*UGCQueryHandle_t*/, Action <SteamUGCQueryCompleted_t, bool> CallbackFunction = null /*Action<SteamUGCQueryCompleted_t, bool>*/)
        {
            SteamAPICall_t callback = 0;

            callback = platform.ISteamUGC_SendQueryUGCRequest(handle.Value);

            if (CallbackFunction == null)
            {
                return(null);
            }

            return(SteamUGCQueryCompleted_t.CallResult(steamworks, callback, CallbackFunction));
        }
Exemplo n.º 19
0
 private static void OnSteamUGCQueryCompleted(SteamUGCQueryCompleted_t param, bool bIOFailure)
 {
     if (param.m_eResult == EResult.k_EResultOK && SteamUGC.GetQueryUGCResult(param.m_handle, 0u, out SteamUGCDetails_t pDetails) && pDetails.m_eResult == EResult.k_EResultFileNotFound)
     {
         meta.workshopId = 0uL;
         meta.Save(folder);
         Upload();
     }
     else
     {
         PerformUpload();
     }
 }
Exemplo n.º 20
0
 private static void OnModDetailsReceived(SteamUGCQueryCompleted_t result, bool failure)
 {
     Debug.Log($"Received mod details: failure: {failure}, result: {result.m_eResult}, count: {result.m_unNumResultsReturned}");
     for (uint i = 0; i < result.m_unNumResultsReturned; i++)
     {
         if (SteamUGC.GetQueryUGCResult(result.m_handle, i, out var details))
         {
             Debug.Log($" - {details.m_rgchTitle} ({details.m_ulSteamIDOwner}");
             var author = new CSteamID(details.m_ulSteamIDOwner).GetAccountID();
             _authorForMod.Add(details.m_nPublishedFileId, author);
             _currentlyFetchingFiles.Remove(details.m_nPublishedFileId);
         }
     }
     SteamUGC.ReleaseQueryUGCRequest(result.m_handle);
 }
Exemplo n.º 21
0
    /// <summary>
    /// 查询与自己关联的创意工坊物品
    /// </summary>
    /// <param name="itemResult"></param>
    /// <param name="bIOFailure"></param>
    private void QueryUserUGCCallBack(SteamUGCQueryCompleted_t itemResult, bool bIOFailure)
    {
        if (bIOFailure || itemResult.m_eResult != EResult.k_EResultOK)
        {
            if (mQueryInstallInfoCallBack != null)
            {
                mQueryInstallInfoCallBack.GetInstallInfoFail(SteamWorkshopQueryFailEnum.REQUEST_FAIL);
            }
            return;
        }

        List <SteamWorkshopQueryInstallInfoBean> listInstallInfo = new List <SteamWorkshopQueryInstallInfoBean>();

        for (uint i = 0; i < itemResult.m_unNumResultsReturned; i++)
        {
            SteamUGCDetails_t detailsInfo;
            SteamUGC.GetQueryUGCResult(itemResult.m_handle, i, out detailsInfo);
            ulong  punSizeOnDisk;
            string pchFolder;
            uint   punTimeStamp;
            SteamUGC.GetItemInstallInfo(detailsInfo.m_nPublishedFileId, out punSizeOnDisk, out pchFolder, (uint)detailsInfo.m_nFileSize, out punTimeStamp);
            string metaData;
            SteamUGC.GetQueryUGCMetadata(itemResult.m_handle, i, out metaData, 1000);
            //if (punSizeOnDisk == 0 || punTimeStamp == 0 || CheckUtil.StringIsNull(pchFolder))
            //{
            //    continue;
            //}
            //添加缩略图地址
            string previewUrl;
            SteamUGC.GetQueryUGCPreviewURL(itemResult.m_handle, i, out previewUrl, (uint)detailsInfo.m_nPreviewFileSize);

            SteamWorkshopQueryInstallInfoBean installInfoBean = new SteamWorkshopQueryInstallInfoBean
            {
                punSizeOnDisk = punSizeOnDisk,
                pchFolder     = pchFolder,
                punTimeStamp  = punTimeStamp,
                detailsInfo   = detailsInfo,
                previewUrl    = previewUrl,
                metaData      = metaData
            };

            listInstallInfo.Add(installInfoBean);
        }
        if (mQueryInstallInfoCallBack != null)
        {
            mQueryInstallInfoCallBack.GetInstallInfoSuccess(listInstallInfo);
        }
    }
Exemplo n.º 22
0
    private void OnSteamUGCQueryCompleted(SteamUGCQueryCompleted_t param, bool bIOFailure)
    {
        if (param.m_eResult != EResult.k_EResultOK)
        {
            onRead(null);
            onRead = null;
            return;
        }
        bool queryUGCResult = SteamUGC.GetQueryUGCResult(param.m_handle, 0u, out UGCDetails);

        OnUGCDownloadCallResult = CallResult <RemoteStorageDownloadUGCResult_t> .Create(OnDownloadThumbnail);

        SteamAPICall_t hAPICall = SteamRemoteStorage.UGCDownload(UGCDetails.m_hPreviewFile, 0u);

        OnUGCDownloadCallResult.Set(hAPICall);
    }
Exemplo n.º 23
0
        private void OnSteamUGCQueryCompletedUserMods(SteamUGCQueryCompleted_t pCallback, bool bIOFailure)
        {
            SteamUGCDetails_t steamUGCDetailsT;

            if (!bIOFailure && pCallback.m_eResult == EResult.k_EResultOK && pCallback.m_unNumResultsReturned > 0)
            {
                for (uint i = 0; i < pCallback.m_unNumResultsReturned; i++)
                {
                    if (SteamUGC.GetQueryUGCResult(pCallback.m_handle, i, out steamUGCDetailsT))
                    {
                        this.publishedContent.Add(steamUGCDetailsT.m_nPublishedFileId);
                    }
                }
            }
            SteamManager.logger.Info("Published user mods IDs: {0}", string.Join <PublishedFileId_t>(", ", this.publishedContent));
            SteamUGC.ReleaseQueryUGCRequest(pCallback.m_handle);
        }
Exemplo n.º 24
0
    public void OnSteamUGCQueryCompletedCallFunc(SteamUGCQueryCompleted_t result, bool ioFailure)
    {
        Debug.LogFormat("SteamUnity.OnSteamUGCQueryCompletedCallFunc: result: {0} (total: {1})", result.m_unNumResultsReturned, result.m_unTotalMatchingResults);

        publishedItems.Clear();

        for (int i = 0; i < result.m_unNumResultsReturned; ++i)
        {
            var details = new SteamUGCDetails_t();

            SteamUGC.GetQueryUGCResult(query, (uint)i, out details);

            publishedItems.Add(details);
        }

        busy = false;
    }
Exemplo n.º 25
0
 protected void onSteamUGCQueryCompleted(SteamUGCQueryCompleted_t callback, bool io)
 {
     if (callback.m_handle != this.itemHandle)
     {
         return;
     }
     Debug.Log("Queried: " + callback.m_eResult);
     if (SteamUGC.GetQueryUGCResult(this.itemHandle, 0u, ref this.workshopItemDetails))
     {
         this.hasPersonaInfo = false;
         if (!SteamFriends.RequestUserInformation((CSteamID)this.workshopItemDetails.m_ulSteamIDOwner, true))
         {
             this.downloadWorkshopItem();
         }
     }
     SteamUGC.ReleaseQueryUGCRequest(this.itemHandle);
     this.itemHandle = UGCQueryHandle_t.Invalid;
 }
Exemplo n.º 26
0
 private void onQueryCompleted(SteamUGCQueryCompleted_t callback, bool io)
 {
     if (callback.m_eResult != 1 || io)
     {
         return;
     }
     for (uint num = 0u; num < callback.m_unNumResultsReturned; num += 1u)
     {
         SteamUGCDetails_t steamUGCDetails_t;
         SteamUGC.GetQueryUGCResult(this.ugcRequest, num, ref steamUGCDetails_t);
         SteamPublished item = new SteamPublished(steamUGCDetails_t.m_rgchTitle, steamUGCDetails_t.m_nPublishedFileId);
         this.published.Add(item);
     }
     if (this.onPublishedAdded != null)
     {
         this.onPublishedAdded();
     }
 }
Exemplo n.º 27
0
 private static void IndexPage(SteamUGCQueryCompleted_t param)
 {
     Console.WriteLine("Indexing page " + index);
     if (param.m_unNumResultsReturned == 0)
     {
         done = true;
     }
     else
     {
         for (uint i = 0; i < param.m_unNumResultsReturned; i++)
         {
             SteamUGCDetails_t details;
             SteamUGC.GetQueryUGCResult(param.m_handle, i, out details);
             if (details.m_pchFileName.Length > 0)
             {
                 levels.Add(new WorkshopLevel(details));
             }
         }
         RequestNextPage();
     }
 }
Exemplo n.º 28
0
        private void OnUGCQueryResult(SteamUGCQueryCompleted_t result, bool ioFailure)
        {
            _UGCDetails.Clear();
            _Missions.Clear();

            for (int i = 0; i < result.m_unNumResultsReturned; i++)
            {
                SteamUGCDetails_t infos;
                SteamUGC.GetQueryUGCResult(result.m_handle, (uint)i, out infos);

                _Missions.Add(infos.m_rgchTitle + " - " + infos.m_nPublishedFileId);
                _UGCDetails.Add(infos);

                // Clear broken files
                if (infos.m_rgchTitle == null || infos.m_rgchTitle == "")
                {
                    SteamUGC.DeleteItem(infos.m_nPublishedFileId);
                }
            }

            listBox.ItemsSource = _Missions.ToArray();
        }
Exemplo n.º 29
0
        private static void OnUserModsReceived(SteamUGCQueryCompleted_t result, bool failure)
        {
            Debug.Log($"Received user mods: failure: {failure}, result: {result.m_eResult}, count: {result.m_unNumResultsReturned}");
            CSteamID author = CSteamID.Nil;
            List <CrossPromotion> promotions = new List <CrossPromotion>();

            for (uint i = 0; i < result.m_unNumResultsReturned; i++)
            {
                if (SteamUGC.GetQueryUGCResult(result.m_handle, i, out var details))
                {
                    Debug.Log($" - {details.m_rgchTitle} ({details.m_ulSteamIDOwner}");
                    author = new CSteamID(details.m_ulSteamIDOwner);
                    promotions.Add(new CrossPromotion(details));
                }
            }
            if (author != CSteamID.Nil)
            {
                _modsForAuthor.Add(author.GetAccountID(), promotions);
                _currentlyFetchingAuthors.Remove(author.GetAccountID());
            }
            SteamUGC.ReleaseQueryUGCRequest(result.m_handle);
        }
Exemplo n.º 30
0
        private void HandleQueryCompleted(SteamUGCQueryCompleted_t param, bool bIOFailure)
        {
            if (!bIOFailure)
            {
                if (param.m_eResult == EResult.k_EResultOK)
                {
                    matchedRecordCount = param.m_unTotalMatchingResults;

                    PageCount = (uint)Mathf.Clamp((int)matchedRecordCount / 50, 1, int.MaxValue);
                    if (PageCount * 50 < matchedRecordCount)
                    {
                        PageCount++;
                    }

                    for (int i = 0; i < param.m_unNumResultsReturned; i++)
                    {
                        SteamUGCDetails_t details;
                        SteamUGC.GetQueryUGCResult(param.m_handle, (uint)i, out details);
                        var nRecord = new HeathenWorkshopReadCommunityItem(details);
                        ResultsList.Add(nRecord);
                    }
                    ReleaseHandle();
                    if (Callback != null)
                    {
                        Callback.Invoke(this);
                    }
                }
                else
                {
                    Debug.LogError("HeathenWorkitemQuery|HandleQueryCompleted Unexpected results, state = " + param.m_eResult.ToString());
                }
            }
            else
            {
                Debug.LogError("HeathenWorkitemQuery|HandleQueryCompleted failed.");
            }
        }