public void SaveCurrentModPack() { if (currentPack != null && !string.IsNullOrEmpty(currentPackFilename)) { currentPack.Save(currentPackFilename); } }
public void AddModPack() { var packName = modPackName.text; // validate modpack name if (string.IsNullOrEmpty(packName) || packName.Contains(".")) { statusText.text = "Bad modpack name: " + modPackName.text; } else { string filename = basePath + packName + ".workshop.json"; var pack = new WorkshopModPack(); pack.Save(filename); pack.contentfolder = modPackName.text; Directory.CreateDirectory(basePath + modPackName.text); RefreshPackList(); SelectModPack(filename); CreateWorkshopItem(); } }
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()); 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(); } }