Ejemplo n.º 1
0
    public void WorkshopItemInfoUpdateFinished(int result, bool acceptTermsOfService)
    {
        GD.Print("Workshop item update result: ", result, " TOS: ", acceptTermsOfService);

        if (workshopUpdateCallback == null)
        {
            GD.PrintErr($"Got {nameof(WorkshopItemInfoUpdateFinished)} even with no active callbacks");
            return;
        }

        var convertedResult = new WorkshopResult
        {
            TermsOfServiceSigningRequired = acceptTermsOfService,
        };

        if (result == Steam.ResultOk)
        {
            convertedResult.Success = true;
        }
        else
        {
            convertedResult.Success         = false;
            convertedResult.TranslatedError = GetDescriptiveSteamError(result);
        }

        workshopUpdateCallback.Invoke(convertedResult);
        workshopUpdateCallback = null;
    }
Ejemplo n.º 2
0
    public void SubmitWorkshopItemUpdate(ulong updateHandle, string?changeNotes, Action <WorkshopResult> callback)
    {
        if (workshopUpdateCallback != null)
        {
            throw new InvalidOperationException("Workshop update is already in-progress");
        }

        workshopUpdateCallback = callback ?? throw new ArgumentException("callback is required");

        // Steam docs say this constant is unused, but at least currently it seems to be the same value as the document
        // description max length
        if (changeNotes?.Length > Steam.PublishedDocumentChangeDescriptionMax)
        {
            callback.Invoke(
                WorkshopResult.CreateFailure(TranslationServer.Translate("CHANGE_DESCRIPTION_IS_TOO_LONG")));
            return;
        }

        GD.Print("Submitting workshop update with handle: ", updateHandle);

        Steam.SubmitItemUpdate(updateHandle, changeNotes);
    }
Ejemplo n.º 3
0
    public void WorkshopItemInfoUpdateFinished(int result, bool acceptTermsOfService)
    {
        GD.Print("Workshop item update result: ", result, " TOS: ", acceptTermsOfService);

        if (workshopUpdateCallback == null)
        {
            GD.PrintErr($"Got {nameof(WorkshopItemInfoUpdateFinished)} even with no active callbacks");
            return;
        }

        bool   success = true;
        string?error   = null;

        if (result != Steam.ResultOk)
        {
            success = false;
            error   = GetDescriptiveSteamError(result);
        }

        var convertedResult = new WorkshopResult(success, error, acceptTermsOfService, null);

        workshopUpdateCallback.Invoke(convertedResult);
        workshopUpdateCallback = null;
    }