Example #1
0
        private void CreateItemResult(CreateItemResult_t callback, bool bIOFailure)
        {
            switch (callback.m_eResult)
            {
            case EResult.k_EResultTimeout:
                this.currentTitleMessage = "Error: Timeout";
                this.currentBodyMessage  = "Current user is not currently logged into steam";
                break;

            case EResult.k_EResultNotLoggedOn:
                this.currentTitleMessage = "Error: Not logged on";
                this.currentBodyMessage  = "The user creating the item is currently banned in the community";
                break;

            case EResult.k_EResultInsufficientPrivilege:
                this.currentTitleMessage = "Error: Insufficient Privilege";
                this.currentBodyMessage  = "The user creating the item is currently banned in the community";
                break;

            default:
                ulong publishedFileId = callback.m_nPublishedFileId.m_PublishedFileId;
                this.showLoadingSpinner           = false;
                this.currentTitleMessage          = "Extension successfully created!";
                this.currentBodyMessage           = "Extension Publish ID: " + (object)callback.m_nPublishedFileId;
                this.ActiveInfo.WorkshopPublishID = string.Concat((object)callback.m_nPublishedFileId.m_PublishedFileId);
                if (callback.m_bUserNeedsToAcceptWorkshopLegalAgreement)
                {
                    SteamFriends.ActivateGameOverlayToWebPage("steam://url/CommunityFilePage/" + (object)callback.m_nPublishedFileId);
                }
                string str      = this.ActiveInfo.FolderPath + "/ExtensionInfo.xml";
                string contents = Utils.readEntireFile(str).Replace("<WorkshopPublishID>NONE</WorkshopPublishID>", "<WorkshopPublishID>" + (object)publishedFileId + "</WorkshopPublishID>");
                File.WriteAllText(str, contents);
                break;
            }
        }
 private static void OnCreateItemResult(CreateItemResult_t pCallback, bool bIOFailure)
 {
     WorkshopTool.WorkshopToolForm.BeginInvoke((Action) delegate
     {
         CreateItem_delegate(pCallback.m_eResult, pCallback.m_bUserNeedsToAcceptWorkshopLegalAgreement, pCallback.m_nPublishedFileId);
     });
 }
Example #3
0
        private void CreatedWorkshopItem(CreateItemResult_t res, bool ioFailure)
        {
            runMT runMTCB = () =>
            {
                if (res.m_bUserNeedsToAcceptWorkshopLegalAgreement)
                {
                    MessageBox.Show("You must accept first the workshop legal agreement");
                    return;
                }

                // UGCUpdateHandle_t ugHandle = new UGCUpdateHandle_t(res.m_nPublishedFileId.m_PublishedFileId);

                UGCUpdateHandle_t ugHandle = SteamUGC.StartItemUpdate(app, res.m_nPublishedFileId);

                SteamUGC.SetItemTitle(ugHandle, contentTitle.Text);
                SteamUGC.SetItemDescription(ugHandle, contentDesc.Text);
                SteamUGC.SetItemPreview(ugHandle, (string)imagePath.Content);

                string runtimePath = AppDomain.CurrentDomain.BaseDirectory;

                if (!Directory.Exists(runtimePath + "Workshop"))
                {
                    Directory.CreateDirectory(runtimePath + "Workshop");
                }

                if (!Directory.Exists(runtimePath + "Workshop\\" + res.m_nPublishedFileId))
                {
                    Directory.CreateDirectory(runtimePath + "Workshop\\" + res.m_nPublishedFileId);
                }

                Guid   localLowId = new Guid("A520A1A4-1780-4FF6-BD18-167343C5AF16");
                string DataPath   = GetKnownFolderPath(localLowId);
                DataPath += "\\Fustygame\\Hover\\Missions";

                if (!Directory.Exists(System.IO.Path.GetDirectoryName(runtimePath + "Workshop\\" + res.m_nPublishedFileId + "\\" + SelectedFileName + ".xml")))
                {
                    Directory.CreateDirectory(System.IO.Path.GetDirectoryName(runtimePath + "Workshop\\" + res.m_nPublishedFileId + "\\" + SelectedFileName + ".xml"));
                }

                File.Copy(DataPath + "\\" + SelectedFileName + ".xml", runtimePath + "Workshop\\" + res.m_nPublishedFileId + "\\" + SelectedFileName + ".xml");

                SteamUGC.SetItemContent(ugHandle, (runtimePath + "Workshop\\" + res.m_nPublishedFileId + "\\").Replace("\\", "/"));
                SteamUGC.SetItemTags(ugHandle, new List <string> {
                    "Races"
                });                                                           // Add language
                SteamUGC.SetItemVisibility(ugHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic);

                var steamCall = SteamUGC.SubmitItemUpdate(ugHandle, "");
                p_workshopUpd = CallResult <SubmitItemUpdateResult_t> .Create();

                p_workshopUpd.Set(steamCall, SubmitItemCallResult);

                MessageBox.Show("Submitting to Steam...");

                _Missions.Clear();
                //RefreshWorkshopList();
            };

            pending = runMTCB;
        }
Example #4
0
    private void OnCreateItemResult(CreateItemResult_t pResult, bool failed)
    {
        if (failed == false)
        {
            if (pResult.m_eResult != EResult.k_EResultOK)
            {
                Debug.LogError("Steam CreateItem error " + pResult.m_eResult.ToString());
                uploading = false;
                return;
            }
            else
            {
                steamworks_id = pResult.m_nPublishedFileId;

                if (pResult.m_bUserNeedsToAcceptWorkshopLegalAgreement)
                {
                    Debug.LogWarning("User needs to accept workshop legal agreement");
                    Application.OpenURL("https://steamcommunity.com/sharedfiles/workshoplegalagreement");
                }
            }
        }
        else
        {
            Debug.LogError("Error creating Steam Workshop item");
            uploading = false;
            return;
        }

        RequestUpload("Initial Upload");
    }
Example #5
0
        private static void OnItemCreated(CreateItemResult_t callBack, bool bIOFailure)
        {
            if (bIOFailure)
            {
                SetStatus("Error: I/O Failure!");
                return;
            }

            switch (callBack.m_eResult)
            {
            case EResult.k_EResultInsufficientPrivilege:
                SetStatus("Error: Unfortunately, you're banned from uploading to the workshop!");
                break;

            case EResult.k_EResultTimeout:
                SetStatus("Error: Timeout");
                break;

            case EResult.k_EResultNotLoggedOn:
                SetStatus("Error: You're not logged into Steam!");
                break;

            default:
                SetStatus("Unknown status: " + callBack.m_eResult.ToString());
                break;
            }

            if (callBack.m_eResult == EResult.k_EResultOK)
            {
                var callback_publishID = callBack.m_nPublishedFileId;
                publishID = ulong.Parse(callback_publishID.ToString());
                Console.WriteLine(callback_publishID);
            }
        }
Example #6
0
    static void CreateItemTask(SteamAPICall_t handle, string title, string description, string content, string[] tags, string image, bool update = false)
    {
        while (!IsCompleted(handle))
        {
        }
        UGCUpdateHandle_t  updateHandle = UGCUpdateHandle_t.Invalid;
        CreateItemResult_t callback     = AllocCallback <CreateItemResult_t>(handle, out IntPtr pCallback, CreateItemResult_t.k_iCallback);

        if (callback.m_eResult == EResult.k_EResultOK)
        {
            PublishedFileId_t _PublishedFileID = callback.m_nPublishedFileId;
            updateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), _PublishedFileID);
            SteamUGC.SetItemTitle(updateHandle, title);
            SteamUGC.SetItemDescription(updateHandle, description);
            SteamUGC.SetItemContent(updateHandle, content);
            SteamUGC.SetItemTags(updateHandle, tags);
            SteamUGC.SetItemPreview(updateHandle, image);
            SteamUGC.SetItemVisibility(updateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate);
            SteamAPICall_t submitHandle = SteamUGC.SubmitItemUpdate(updateHandle, "Initial commit");
            SubmitItemAsync(submitHandle, updateHandle);
        }
        else
        {
            Console.WriteLine("Couldn't create a new item ! Press any key to continue...");
        }
        ReleaseCallback(pCallback);
    }
Example #7
0
    void OnCreateItemResult(CreateItemResult_t p, bool ioFailure)
    {
        bool ok = true;

        this.lastResult = p.m_eResult;

        if (ioFailure)
        {
            SetError("Create Item failed, IO Failure!");
            ok = false;
        }
        else if (p.m_eResult != EResult.k_EResultOK)
        {
            SetError("Create Item failed, error: " + p.m_eResult.ToString());
            ok = false;
        }
        else
        {
            this.needsToAcceptWorkshopLegalAgreement = p.m_bUserNeedsToAcceptWorkshopLegalAgreement;

            this.currentItem       = new WorkshopItem(p.m_nPublishedFileId);
            this.currentItem.title = "My new item";
        }

        if (OnCreateItemDone != null)
        {
            OnCreateItemDone(ok, p.m_nPublishedFileId);
        }

        SignalStateChanged();
    }
Example #8
0
        private static void OnItemCreated(CreateItemResult_t result, bool IOFailure)
        {
            if (IOFailure || result.m_eResult != EResult.k_EResultOK)
            {
                uploadingHook = null;
                Dialog_WorkshopOperationInProgress.CloseAll();
                Log.Error("Workshop: OnItemCreated failure. Result: " + result.m_eResult.GetLabel());
                Find.WindowStack.Add(new Dialog_MessageBox("WorkshopSubmissionFailed".Translate(GenText.SplitCamelCase(result.m_eResult.GetLabel()))));
            }
            else
            {
                uploadingHook.PublishedFileId = result.m_nPublishedFileId;
                if (Prefs.LogVerbose)
                {
                    Log.Message("Workshop: Item created. PublishedFileId: " + uploadingHook.PublishedFileId);
                }
                curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), uploadingHook.PublishedFileId);
                SetWorkshopItemDataFrom(curUpdateHandle, uploadingHook, creating: true);
                curStage = WorkshopInteractStage.SubmittingItem;
                if (Prefs.LogVerbose)
                {
                    Log.Message("Workshop: Submitting item.");
                }
                SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(curUpdateHandle, "[Auto-generated text]: Initial upload.");
                submitResult = CallResult <SubmitItemUpdateResult_t> .Create(OnItemSubmitted);

                submitResult.Set(hAPICall);
                createResult = null;
            }
        }
        void CreatedItemCallback(CreateItemResult_t args, bool failure)
        {
            Logger.Trace("[WORKSHOP] Got callback for creating item");
            switch (args.m_eResult)
            {
            case EResult.k_EResultOK:
                break;

            case EResult.k_EResultInsufficientPrivilege:
                MessageBox.Show("You are not permitted to create workshop items.", "Item Creation Failed");
                ResetUIState();
                return;

            case EResult.k_EResultTimeout:
                MessageBox.Show("This took longer than expected, Steam Servers may be acting up - please try again.", "Item Creation Failed");
                ResetUIState();
                return;

            case EResult.k_EResultNotLoggedOn:
                MessageBox.Show("Please login to Steam before trying to submit an item.", "Item Creation Failed");
                ResetUIState();
                return;
            }

            _selectedAddon.FileId = args.m_nPublishedFileId.m_PublishedFileId;

            File.WriteAllText(_selectedAddon.Path + "\\workshop.json", JsonConvert.SerializeObject(_selectedAddon, Formatting.Indented));

            Logger.Info("[WORKSHOP] Created Item with File ID " + _selectedAddon.FileId);

            UpdateItem();
        }
Example #10
0
        private static void OnItemCreated(CreateItemResult_t callBack, bool bIOFailure)
        {
            if (bIOFailure)
            {
                Console.WriteLine("Error: I/O Failure! :(");
                return;
            }

            switch (callBack.m_eResult)
            {
            case EResult.k_EResultInsufficientPrivilege:
                // you're banned!
                Console.WriteLine("Error: Unfortunately, you're banned by the community from uploading to the workshop! Bummer. :(");
                break;

            case EResult.k_EResultTimeout:
                Console.WriteLine("Error: Timeout :S");
                break;

            case EResult.k_EResultNotLoggedOn:
                Console.WriteLine("Error: You're not logged into Steam!");
                break;
            }

            if (callBack.m_eResult == EResult.k_EResultOK)
            {
                var callback_publishID = callBack.m_nPublishedFileId;
                publishID = ulong.Parse(callback_publishID.ToString());
                Console.WriteLine(callback_publishID);
            }
        }
Example #11
0
        private void OnCreateItemResult(CreateItemResult_t callback, bool ioFailure)
        {
            if (ioFailure)
            {
                Failed = true;
                Status = "Publishing failed.";
                return;
            }

            switch (callback.m_eResult)
            {
            case EResult.k_EResultOK:
                steamSection.PublishedFileId = callback.m_nPublishedFileId.m_PublishedFileId;
                UpdateUGCItem();
                break;

            case EResult.k_EResultFileNotFound:
                Failed = true;
                Status = "UGC not found.";
                break;

            case EResult.k_EResultNotLoggedOn:
                Failed = true;
                Status = "Not logged on.";
                break;

            default:
                Failed = true;
                Status = "Publishing failed.";
                break;
            }
        }
Example #12
0
 private unsafe static void OnCreateItem(CreateItemResult_t result, bool ioFailure)
 {
     if (!_initialized)
     {
         return;
     }
     _pendingItem?.ApplyResult((SteamResult)result.m_eResult, result.m_bUserNeedsToAcceptWorkshopLegalAgreement, result.m_nPublishedFileId.m_PublishedFileId);
 }
    private void OnItemCreated(CreateItemResult_t callback, bool ioFailure)
    {
        if (ioFailure)
        {
            statusText.text = "Error: I/O Failure! :(";
            return;
        }

        switch (callback.m_eResult)
        {
        case EResult.k_EResultInsufficientPrivilege:
            // you're banned!
            statusText.text = "Error: Unfortunately, you're banned by the community from uploading to the workshop! Bummer. :(";
            break;

        case EResult.k_EResultTimeout:
            statusText.text = "Error: Timeout :S";
            break;

        case EResult.k_EResultNotLoggedOn:
            statusText.text = "Error: You're not logged into Steam!";
            break;
        }

        if (callback.m_bUserNeedsToAcceptWorkshopLegalAgreement)
        {
            /*
             * Include text next to the button that submits an item to the workshop, something to the effect of: “By submitting this item, you agree to the workshop terms of service” (including the link)
             * After a user submits an item, open a browser window to the Steam Workshop page for that item by calling:
             * SteamFriends()->ActivateGameOverlayToWebPage( const char *pchURL );
             * pchURL should be set to steam://url/CommunityFilePage/PublishedFileId_t replacing PublishedFileId_t with the workshop item Id.
             * This has the benefit of directing the author to the workshop page so that they can see the item and configure it further if necessary and will make it easy for the user to read and accept the Steam Workshop Legal Agreement.
             * */
        }

        if (callback.m_eResult == EResult.k_EResultOK)
        {
            statusText.text = "Item creation successful! Published Item ID: " + callback.m_nPublishedFileId.ToString();
            Debug.Log("Item created: Id: " + callback.m_nPublishedFileId.ToString());

            currentPack.publishedfileid = callback.m_nPublishedFileId.ToString();

            /*
             * string filename = basePath + modPackName.text + ".workshop.json";
             *
             * var pack = new WorkshopModPack();
             * pack.publishedfileid = callback.m_nPublishedFileId.ToString();
             * pack.Save(filename);
             *
             * Directory.CreateDirectory(basePath + modPackName.text);
             *
             * RefreshPackList();
             */
        }
    }
Example #14
0
    void OnCreateItemResult(CreateItemResult_t pCallback, bool bIOFailure)
    {
        Debug.Log("[" + CreateItemResult_t.k_iCallback + " - CreateItemResult] - " + pCallback.m_eResult + " -- " + pCallback.m_nPublishedFileId + " -- " + pCallback.m_bUserNeedsToAcceptWorkshopLegalAgreement);

        SteamUGCDetails_t details = new SteamUGCDetails_t
        {
            m_nPublishedFileId = pCallback.m_nPublishedFileId
        };

        _modList.Add(details);
        _modIndex = _modList.Count - 1;
    }
Example #15
0
        private void OnCreateItemResult(CreateItemResult_t pCallback, bool bIOFailure)
        {
            if (!this.Uploading || this.uploadingMod == null || this.uploadCallback == null)
            {
                return;
            }
            bool   flag  = true;
            string empty = string.Empty;

            if (bIOFailure)
            {
                flag  = false;
                empty = "Error creating workshop item. Error: I/O failure";
            }
            else if (pCallback.m_eResult == EResult.k_EResultInsufficientPrivilege)
            {
                flag  = false;
                empty = "Error creating workshop item. Error: The user creating the item is currently banned in the community.";
            }
            else if (pCallback.m_eResult == EResult.k_EResultTimeout)
            {
                flag  = false;
                empty = "Error creating workshop item. Error: Timeout.";
            }
            else if (pCallback.m_eResult == EResult.k_EResultNotLoggedOn)
            {
                flag  = false;
                empty = "Error creating workshop item. Error: The user is not currently logged into Steam.";
            }
            else if (pCallback.m_eResult != EResult.k_EResultOK)
            {
                flag  = false;
                empty = string.Format("Error creating workshop item. Error value: {0}", pCallback.m_eResult.ToString());
            }
            if (!flag)
            {
                SteamManager.logger.Error <string, string>("Error creating mod '{0}'. Info: {1}", this.uploadingMod.mod, empty);
                this.Uploading    = false;
                this.uploadingMod = null;
                this.uploadState  = SteamManager.UploadState.None;
                this.uploadCallback(false, empty);
                this.uploadCallback = null;
                return;
            }
            PublishedFileId_t mNPublishedFileId = pCallback.m_nPublishedFileId;

            this.publishedContent.Add(mNPublishedFileId);
            this.uploadingMod.id = mNPublishedFileId.m_PublishedFileId;
            this.uploadingMod.Save();
            SteamManager.logger.Info <string, ulong>("Created mod '{0}' successfully. ID: {1}", this.uploadingMod.mod, this.uploadingMod.id);
            this.UpdateMod();
        }
Example #16
0
 private void OnCreateItemResult(CreateItemResult_t param, bool bIOFailure)
 {
     if (!bIOFailure && param.m_eResult != 0)
     {
         createItemCallBack(param.m_nPublishedFileId);
     }
     else
     {
         Debug.LogError("Failed to create workshop item!");
         PublishedFileId_t fileId = PublishedFileId_t.Invalid;
         createItemCallBack(fileId);
     }
 }
Example #17
0
    public void OnCreateItemResultFunc(CreateItemResult_t result, bool ioFailure)
    {
        Debug.LogFormat("SteamUnity.CreateItem: result: {0}, {1}", result.m_eResult, result.m_nPublishedFileId);

        if (result.m_bUserNeedsToAcceptWorkshopLegalAgreement)
        {
            CheckLegal(result.m_nPublishedFileId);
        }

        working = result.m_nPublishedFileId;

        busy = false;
    }
        // SteamAPICall_t
        public CallbackHandle CreateItem(AppId_t nConsumerAppId /*AppId_t*/, WorkshopFileType eFileType /*EWorkshopFileType*/, Action <CreateItemResult_t, bool> CallbackFunction = null /*Action<CreateItemResult_t, bool>*/)
        {
            SteamAPICall_t callback = 0;

            callback = platform.ISteamUGC_CreateItem(nConsumerAppId.Value, eFileType);

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

            return(CreateItemResult_t.CallResult(steamworks, callback, CallbackFunction));
        }
    /// <summary>
    /// Invoked when a new workshop item is created.
    /// </summary>
    void OnCreateItemResult(CreateItemResult_t pCallback, bool bIOFailure)
    {
        //3. When the CallResult handler is executed, read the PublishedFileId_t value and store for future updates to the workshop item (e.g. in a project file associated with the creation tool).
        //4. The m_bUserNeedsToAcceptWorkshopLegalAgreement variable should also be checked and if true, the user should be redirected to accept the legal agreement. See the Workshop Legal Agreement section for more details.
        //ADD TO FORM:::: By submitting this item, you agree to the workshop terms of service (include link https://partner.steamgames.com/documentation/ugc#Legal)

        //CreateItemResult_t.m_eResult may return any of the defined EResult's, however the following should be handled:
        //k_EResultInsufficientPrivilege - The user creating the item is currently banned in the community.
        //k_EResultTimeout - The operation took longer than expected, have the user retry the create process.
        // k_EResultNotLoggedOn - The user is not currently logged into Steam.

        Console.WriteLine("[" + CreateItemResult_t.k_iCallback + " - CreateItemResult_t] - " + pCallback.m_eResult + " -- " + pCallback.m_nPublishedFileId + " -- " + pCallback.m_bUserNeedsToAcceptWorkshopLegalAgreement);

        m_PublishedFileId = pCallback.m_nPublishedFileId;   //TODO: This is not being called<<<<<<<<<<<<<<<<<<<<<<<<<<<
    }
Example #20
0
 private static void OnCreateItemResult(CreateItemResult_t res, bool bIOFailure)
 {
     m_CreateItemResult = null;
     if (res.m_bUserNeedsToAcceptWorkshopLegalAgreement || res.m_eResult == EResult.k_EResultInsufficientPrivilege || res.m_eResult == EResult.k_EResultTimeout || res.m_eResult == EResult.k_EResultNotLoggedOn)
     {
         uploadCallback(meta, res.m_bUserNeedsToAcceptWorkshopLegalAgreement, res.m_eResult);
         uploadCallback = null;
     }
     else
     {
         meta.workshopId = (ulong)res.m_nPublishedFileId;
         meta.Save(folder);
         PerformUpload();
     }
 }
        private static void OnCreateItem(CreateItemResult_t param, bool bIOFailure)
        {
            if (param.m_bUserNeedsToAcceptWorkshopLegalAgreement || bIOFailure || (param.m_eResult != EResult.k_EResultOK))
            {
                utils.ShowWarningDialog("Unable to create item!", null, true);
                return;
            }

            if (OnCreateWorkshopItem == null)
            {
                return;
            }

            UGCCreationEventArg args = new UGCCreationEventArg(param.m_nPublishedFileId);

            OnCreateWorkshopItem(null, args);
        }
Example #22
0
    /// <summary>
    /// CreateItem回调
    /// </summary>
    /// <param name="itemResult"></param>
    /// <param name="bIOFailure"></param>
    private void OnCreateItemCallBack(CreateItemResult_t itemResult, bool bIOFailure)
    {
        if (bIOFailure || itemResult.m_eResult != EResult.k_EResultOK)
        {
            SteamUGC.DeleteItem(itemResult.m_nPublishedFileId);
            if (this.mUpdateCallBack != null)
            {
                this.mUpdateCallBack.UpdateFail(SteamWorkshopUpdateFailEnum.REQUEST_FAIL);
            }
            return;
        }

        if (itemResult.m_eResult == EResult.k_EResultOK)
        {
            SetCreateItemInfo(itemResult.m_nPublishedFileId);
        }
    }
Example #23
0
        private void HandleItemCreate(CreateItemResult_t param, bool bIOFailure)
        {
            if (bIOFailure)
            {
                CreateFailed.Invoke(param);
            }
            else
            {
                Author = SteamSettings.current.client.GetUserData(SteamUser.GetSteamID());
                FileId = param.m_nPublishedFileId;
                Created.Invoke(param);
            }

            if (processingCreateAndUpdate)
            {
                processingCreateAndUpdate = false;
                Update(processingChangeNote);
                processingChangeNote = string.Empty;
            }
        }
Example #24
0
    protected void OnCreateItem(CreateItemResult_t result, bool failed)
    {
        if (result.m_eResult == EResult.k_EResultOK)
        {
            Debug.LogFormat("OnCreateItem complete: {0}", result.m_eResult);
        }
        else
        {
            Debug.LogErrorFormat("OnCreateItem complete: {0}", result.m_eResult);
        }

        if (result.m_bUserNeedsToAcceptWorkshopLegalAgreement)
        {
            Debug.LogError("You must accept the Workshop Legal Agreement before continuing.");
        }

        if (result.m_eResult == EResult.k_EResultOK)
        {
            currentWorkshopItem.WorkshopPublishedFileID = result.m_nPublishedFileId.m_PublishedFileId;
            PublishWorkshopChanges();
        }
    }
Example #25
0
 private void onCreateItemResult(CreateItemResult_t callback, bool io)
 {
     if (callback.m_bUserNeedsToAcceptWorkshopLegalAgreement || callback.m_eResult != 1 || io)
     {
         if (callback.m_bUserNeedsToAcceptWorkshopLegalAgreement)
         {
             Assets.errors.Add("Failed to create item because you need to accept the workshop legal agreement.");
         }
         if (callback.m_eResult != 1)
         {
             Assets.errors.Add("Failed to create item because: " + callback.m_eResult);
         }
         if (io)
         {
             Assets.errors.Add("Failed to create item because of an IO issue.");
         }
         MenuUI.alert(Provider.localization.format("UGC_Fail"));
         return;
     }
     this.publishedFileID = callback.m_nPublishedFileId;
     this.updateUGC();
 }
Example #26
0
        private void OnCreateItem(CreateItemResult_t pCallback, bool bIOFailure)
        {
            if (bIOFailure || pCallback.m_eResult != EResult.k_EResultOK)
            {
                this.bIsUploading = false;
                callbacksListener.Stop();
                Debug.WriteLine("CreateItem failed, " + pCallback.m_eResult.ToString().Substring(9));
                MessageBox.Show(AddSpacesToSentence(pCallback.m_eResult.ToString().Substring(9)), "Creating Workshop Item failed");
                this.btnSendContentButton.Text = "Upload Content";
                return;
            }
            if (pCallback.m_bUserNeedsToAcceptWorkshopLegalAgreement)
            {
                Debug.WriteLine("You did not accept legal agreements required to upload this workshop item.");
                Process.Start("steam://url/CommunityFilePage/" + pCallback.m_nPublishedFileId);
            }

            Debug.WriteLine("Created an workshop item: " + pCallback.m_nPublishedFileId);
            this.WorkshopItemInfo.ItemID = (ulong)pCallback.m_nPublishedFileId;
            this.workshopId.Text         = pCallback.m_nPublishedFileId.ToString();

            using (StreamWriter streamWriter = new StreamWriter(this.txtContentFolder.Text + "\\WorkshopItemInfo.JSON"))
            {
                this.WorkshopItemInfo.ItemID      = ulong.Parse(this.workshopId.Text);
                this.WorkshopItemInfo.ItemType    = this.tabControl.SelectedIndex;
                this.WorkshopItemInfo.Title       = this.txtTitle.Text;
                this.WorkshopItemInfo.Description = this.txtDescription.Text;
                this.WorkshopItemInfo.Tags        = (from checkbox in this.cboCategory.CheckBoxItems where checkbox.Checked select checkbox.Text).ToList();
                this.WorkshopItemInfo.Preview     = this.txtPreviewImage.Text;
                this.WorkshopItemInfo.Visibility  = this.cboVisibility.SelectedIndex;

                string text = JsonConvert.SerializeObject(this.WorkshopItemInfo);
                streamWriter.Write(text);
            }

            UpdateItem(pCallback.m_nPublishedFileId);
        }
Example #27
0
        private static void OnItemCreated(CreateItemResult_t result, bool IOFailure)
        {
            if (IOFailure || result.m_eResult != EResult.k_EResultOK)
            {
                Workshop.uploadingHook = null;
                Dialog_WorkshopOperationInProgress.CloseAll();
                Log.Error("Workshop: OnItemCreated failure. Result: " + result.m_eResult.GetLabel(), false);
                Find.WindowStack.Add(new Dialog_MessageBox("WorkshopSubmissionFailed".Translate(new object[]
                {
                    GenText.SplitCamelCase(result.m_eResult.GetLabel())
                }), null, null, null, null, null, false, null, null));
            }
            else
            {
                Workshop.uploadingHook.PublishedFileId = result.m_nPublishedFileId;
                if (Prefs.LogVerbose)
                {
                    Log.Message("Workshop: Item created. PublishedFileId: " + Workshop.uploadingHook.PublishedFileId, false);
                }
                Workshop.curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), Workshop.uploadingHook.PublishedFileId);
                Workshop.SetWorkshopItemDataFrom(Workshop.curUpdateHandle, Workshop.uploadingHook, true);
                Workshop.curStage = WorkshopInteractStage.SubmittingItem;
                if (Prefs.LogVerbose)
                {
                    Log.Message("Workshop: Submitting item.", false);
                }
                SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(Workshop.curUpdateHandle, "[Auto-generated text]: Initial upload.");
                if (Workshop.< > f__mg$cache6 == null)
                {
                    Workshop.< > f__mg$cache6 = new CallResult <SubmitItemUpdateResult_t> .APIDispatchDelegate(Workshop.OnItemSubmitted);
                }
                Workshop.submitResult = CallResult <SubmitItemUpdateResult_t> .Create(Workshop.< > f__mg$cache6);

                Workshop.submitResult.Set(hAPICall, null);
                Workshop.createResult = null;
            }
        }
Example #28
0
 private static void OnItemCreated(CreateItemResult_t result, bool failure)
 {
     // store result and let the main thread continue
     createResult = result;
     ready.Set();
 }
Example #29
0
    void OnCreateItemResult(CreateItemResult_t pCallback, bool bIOFailure)
    {
        Debug.Log("[" + CreateItemResult_t.k_iCallback + " - CreateItemResult] - " + pCallback.m_eResult + " -- " + pCallback.m_nPublishedFileId + " -- " + pCallback.m_bUserNeedsToAcceptWorkshopLegalAgreement);

        m_PublishedFileId = pCallback.m_nPublishedFileId;
    }
    private void OnItemCreated(CreateItemResult_t callback, bool ioFailure)
    {
        if (ioFailure)
        {
            statusText.text = "Error: I/O Failure! :(";
            return;
        }

        switch (callback.m_eResult)
        {
        case EResult.k_EResultInsufficientPrivilege:
            // you're banned!
            statusText.text = "Error: Unfortunately, you're banned by the community from uploading to the workshop! Bummer. :(";
            break;

        case EResult.k_EResultTimeout:
            statusText.text = "Error: Timeout :S";
            break;

        case EResult.k_EResultNotLoggedOn:
            statusText.text = "Error: You're not logged into Steam!";
            break;

        case EResult.k_EResultBanned:
            statusText.text = "You don't have permission to upload content to this hub because they have an active VAC or Game ban.";
            break;

        case EResult.k_EResultServiceUnavailable:
            statusText.text = "The workshop server hosting the content is having issues - please retry.";
            break;

        case EResult.k_EResultInvalidParam:
            statusText.text = "One of the submission fields contains something not being accepted by that field.";
            break;

        case EResult.k_EResultAccessDenied:
            statusText.text = "There was a problem trying to save the title and description. Access was denied.";
            break;

        case EResult.k_EResultLimitExceeded:
            statusText.text = "You have exceeded your Steam Cloud quota. Remove some items and try again.";
            break;

        case EResult.k_EResultFileNotFound:
            statusText.text = "The uploaded file could not be found.";
            break;

        case EResult.k_EResultDuplicateRequest:
            statusText.text = "The file was already successfully uploaded. Please refresh.";
            break;

        case EResult.k_EResultDuplicateName:
            statusText.text = "You already have a Steam Workshop item with that name.";
            break;

        case EResult.k_EResultServiceReadOnly:
            statusText.text = "Due to a recent password or email change, you are not allowed to upload new content. Usually this restriction will expire in 5 days, but can last up to 30 days if the account has been inactive recently. ";
            break;
        }

        if (callback.m_bUserNeedsToAcceptWorkshopLegalAgreement)
        {
            /*
             * Include text next to the button that submits an item to the workshop, something to the effect of: “By submitting this item, you agree to the workshop terms of service” (including the link)
             * After a user submits an item, open a browser window to the Steam Workshop page for that item by calling:
             * SteamFriends()->ActivateGameOverlayToWebPage( const char *pchURL );
             * pchURL should be set to steam://url/CommunityFilePage/PublishedFileId_t replacing PublishedFileId_t with the workshop item Id.
             * This has the benefit of directing the author to the workshop page so that they can see the item and configure it further if necessary and will make it easy for the user to read and accept the Steam Workshop Legal Agreement.
             * */
        }

        if (callback.m_eResult == EResult.k_EResultOK)
        {
            statusText.text = "Item creation successful! Published Item ID: " + callback.m_nPublishedFileId.ToString();
            Debug.Log("Item created: Id: " + callback.m_nPublishedFileId.ToString());

            currentPack.publishedfileid = callback.m_nPublishedFileId.ToString();

            /*
             * string filename = basePath + modPackName.text + ".workshop.json";
             *
             * var pack = new WorkshopModPack();
             * pack.publishedfileid = callback.m_nPublishedFileId.ToString();
             * pack.Save(filename);
             *
             * Directory.CreateDirectory(basePath + modPackName.text);
             *
             * RefreshPackList();
             */
        }
    }