Steam
Public Member Functions | Properties | Events | List of all members
LapinerTools.Steam.SteamWorkshopMain Class Reference

SteamWorkshopMain is the easy to use lightweight Steam Workshop API of the Easy Steamworks Integration Unity plugin. Use this class to list, search, sort, download, subscribe, vote, favorite, upload and update Steam workshop items. More...

Inherits MonoBehaviour.

Public Member Functions

bool GetItemList (uint p_page, System.Action< WorkshopItemListEventArgs > p_onItemListLoaded)
 Loads the item list for the given page. The p_onItemListLoaded callback is invoked when done. First all favorite items of the user are fetched, then all user votes are loaded. Once this is done the given page is loaded and the prior loaded user favorites and vote states are applied. See also SteamWorkshopMain.OnItemListLoaded, SteamWorkshopMain.Sorting and SteamWorkshopMain.SearchText. More...
 
bool Subscribe (WorkshopItem p_item, System.Action< WorkshopItemEventArgs > p_onSubscribed)
 Subscribe an item. If the subscription is succesfull, then the download is started. See also SteamWorkshopMain.OnSubscribed and SteamWorkshopMain.GetDownloadProgress. More...
 
bool Subscribe (PublishedFileId_t p_fileId, System.Action< WorkshopItemEventArgs > p_onSubscribed)
 Subscribe an item. If the subscription is succesfull, then the download is started. See also SteamWorkshopMain.OnSubscribed and SteamWorkshopMain.GetDownloadProgress. More...
 
bool Unsubscribe (WorkshopItem p_item, System.Action< WorkshopItemEventArgs > p_onUnsubscribed)
 Unsubscribe an item. Will not remove the item from disk. If the item is not used for a certain time, then the Steam client will remove it. See also SteamWorkshopMain.OnUnsubscribed. More...
 
bool Unsubscribe (PublishedFileId_t p_fileId, System.Action< WorkshopItemEventArgs > p_onUnsubscribed)
 Unsubscribe an item. Will not remove the item from disk. If the item is not used for a certain time, then the Steam client will remove it. See also SteamWorkshopMain.OnUnsubscribed. More...
 
bool AddFavorite (WorkshopItem p_item, System.Action< WorkshopItemEventArgs > p_onAddedFavorite)
 Add an item to user's favorites list. See also SteamWorkshopMain.OnAddedFavorite. More...
 
bool AddFavorite (PublishedFileId_t p_fileId, System.Action< WorkshopItemEventArgs > p_onAddedFavorite)
 Add an item to user's favorites list. See also SteamWorkshopMain.OnAddedFavorite. More...
 
bool RemoveFavorite (WorkshopItem p_item, System.Action< WorkshopItemEventArgs > p_onRemovedFavorite)
 Remove an item from user's favorites list. See also SteamWorkshopMain.OnRemovedFavorite. More...
 
bool RemoveFavorite (PublishedFileId_t p_fileId, System.Action< WorkshopItemEventArgs > p_onRemovedFavorite)
 Remove an item from user's favorites list. See also SteamWorkshopMain.OnRemovedFavorite. More...
 
bool Vote (WorkshopItem p_item, bool p_isUpVote, System.Action< WorkshopItemEventArgs > p_onVoted)
 Vote an item up or down. See also SteamWorkshopMain.OnVoted. More...
 
bool Vote (PublishedFileId_t p_fileId, bool p_isUpVote, System.Action< WorkshopItemEventArgs > p_onVoted)
 Vote an item up or down. See also SteamWorkshopMain.OnVoted. More...
 
float GetDownloadProgress (WorkshopItem p_item)
 Gets the download progress of an item. Use SteamWorkshopMain.Subscribe to start download. See also SteamWorkshopMain.OnInstalled. More...
 
float GetDownloadProgress (PublishedFileId_t p_fileId)
 Gets the download progress of an item. Use SteamWorkshopMain.Subscribe to start download. See also SteamWorkshopMain.OnInstalled. More...
 
float GetUploadProgress (WorkshopItemUpdate p_itemUpdate)
 Gets the upload progress of an item. Use SteamWorkshopMain.Upload to start upload. See also SteamWorkshopMain.OnUploaded. More...
 
bool Upload (WorkshopItemUpdate p_itemData, System.Action< WorkshopItemUpdateEventArgs > p_onUploaded)
 Upload or update the given item. A new item is created if p_itemData's WorkshopItemUpdate.SteamNative.m_nPublishedFileId is not set, otherwise the existing item is updated (new Steam PublishedFileId is stored in p_itemData). If p_itemData's WorkshopItemUpdate.ContentPath is given, then all contents at this path are uploaded or updated. Creates a WorkshopItemInfo.xml file to allow later item updates, see SteamWorkshopMain.GetItemUpdateFromFolder. See also SteamWorkshopMain.GetUploadProgress. More...
 
void Execute< T > (SteamAPICall_t p_steamCall, CallResult< T >.APIDispatchDelegate p_onCompleted)
 The Execute method will handle Steam CallResult creation and storage. Simply pass the configured SteamAPICall and the callback that you want to be invoked when the work is done. Pending results can be viewed in the console with SteamWorkshopMain.IsDebugLogEnabled set to true. More...
 
void RenderIcon (Camera p_camera, int p_width, int p_height, string p_saveToFilePath, System.Action< Texture2D > p_onRenderIconCompleted)
 Will make a screenshot with the given resolution without rendering the uGUI overlay. More...
 
void RenderIcon (Camera p_camera, int p_width, int p_height, string p_saveToFilePath, bool p_keepTextureReference, System.Action< Texture2D > p_onRenderIconCompleted)
 Will make a screenshot with the given resolution without rendering the uGUI overlay. More...
 
WorkshopItemUpdate GetItemUpdateFromFolder (string p_itemContentFolderPath)
 Tries to load the Data.WorkshopItemUpdate data from an item folder. This data can be used in SteamWorkshopMain.Upload to update existing items. The item update data is stored in the WorkshopItemInfo.xml file. More...
 

Properties

static SteamWorkshopMain Instance [get]
 You can use the static Instance property to access the Steam Workshop API from wherever you need it in your code. See also SteamWorkshopMain.IsInstanceSet. More...
 
static bool IsInstanceSet [get]
 The static IsInstanceSet property can be used before accessing the Instance property to prevent a new SteamWorkshopMain instance from being created in the teardown phase. For example, if you want to unregister from an event, then first check that IsInstanceSet is true. If it is false, then your event registration is not valid anymore. More...
 
WorkshopSortMode Sorting [get, set]
 Controls the item list sorting. See also SteamWorkshopMain.OnItemListLoaded and SteamWorkshopMain.GetItemList. More...
 
string SearchText [get, set]
 This search filter is applied to the item list. See also SteamWorkshopMain.OnItemListLoaded and SteamWorkshopMain.GetItemList. More...
 
bool IsSteamCacheEnabled [get, set]
 Set this property to true if you want your UI to respond faster, but sacrifice up-to-dateness. Disabled by default. More...
 
bool IsDebugLogEnabled [get, set]
 Set this property to true if you want to see a detailed log in the console. Disabled by default. More...
 

Events

System.Action< WorkshopItemListEventArgsOnItemListLoaded
 Invoked when the item list is fully loaded. See also SteamWorkshopMain.GetItemList. More...
 
System.Action< WorkshopItemEventArgsOnSubscribed
 Invoked when an item was successfully subscribed. See also SteamWorkshopMain.Subscribe. More...
 
System.Action< WorkshopItemEventArgsOnUnsubscribed
 Invoked when an item was successfully unsubscribed. See also SteamWorkshopMain.Unsubscribe. More...
 
System.Action< WorkshopItemEventArgsOnAddedFavorite
 Invoked when an item was successfully added to the user's favorites list. See also SteamWorkshopMain.AddFavorite. More...
 
System.Action< WorkshopItemEventArgsOnRemovedFavorite
 Invoked when an item was successfully removed from the user's favorites list. See also SteamWorkshopMain.RemoveFavorite. More...
 
System.Action< WorkshopItemEventArgsOnVoted
 Invoked when an item was successfully voted up or down. See also SteamWorkshopMain.Vote. More...
 
System.Action< WorkshopItemEventArgsOnInstalled
 Invoked when an item was successfully downloaded and installed. See also SteamWorkshopMain.Subscribe and SteamWorkshopMain.GetDownloadProgress. More...
 
System.Action< WorkshopItemUpdateEventArgsOnUploaded
 Invoked when an item was successfully uploaded or updated. See also SteamWorkshopMain.Upload and SteamWorkshopMain.GetUploadProgress. More...
 
System.Action< ErrorEventArgsOnError
 Invoked when a Steam error has occured. More...
 

Detailed Description

SteamWorkshopMain is the easy to use lightweight Steam Workshop API of the Easy Steamworks Integration Unity plugin. Use this class to list, search, sort, download, subscribe, vote, favorite, upload and update Steam workshop items.

Member Function Documentation

◆ AddFavorite() [1/2]

bool LapinerTools.Steam.SteamWorkshopMain.AddFavorite ( WorkshopItem  p_item,
System.Action< WorkshopItemEventArgs p_onAddedFavorite 
)

Add an item to user's favorites list. See also SteamWorkshopMain.OnAddedFavorite.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_itemitem added to favorites.
p_onAddedFavoriteinvoked when the item is added to favorites successfully or an error has occured.

◆ AddFavorite() [2/2]

bool LapinerTools.Steam.SteamWorkshopMain.AddFavorite ( PublishedFileId_t  p_fileId,
System.Action< WorkshopItemEventArgs p_onAddedFavorite 
)

Add an item to user's favorites list. See also SteamWorkshopMain.OnAddedFavorite.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_fileIdSteam PublishedFileId of the item added to favorites.
p_onAddedFavoriteinvoked when the item is added to favorites successfully or an error has occured.

◆ Execute< T >()

void LapinerTools.Steam.SteamWorkshopMain.Execute< T > ( SteamAPICall_t  p_steamCall,
CallResult< T >.APIDispatchDelegate  p_onCompleted 
)

The Execute method will handle Steam CallResult creation and storage. Simply pass the configured SteamAPICall and the callback that you want to be invoked when the work is done. Pending results can be viewed in the console with SteamWorkshopMain.IsDebugLogEnabled set to true.

Parameters
p_steamCallthe configured SteamAPICall.
p_onCompletedinvoked when the work is done.
Template Parameters
TThe CallResult type.

◆ GetDownloadProgress() [1/2]

float LapinerTools.Steam.SteamWorkshopMain.GetDownloadProgress ( WorkshopItem  p_item)

Gets the download progress of an item. Use SteamWorkshopMain.Subscribe to start download. See also SteamWorkshopMain.OnInstalled.

Returns
the download progress between 0 and 1.
Parameters
p_itemitem being downloaded.

◆ GetDownloadProgress() [2/2]

float LapinerTools.Steam.SteamWorkshopMain.GetDownloadProgress ( PublishedFileId_t  p_fileId)

Gets the download progress of an item. Use SteamWorkshopMain.Subscribe to start download. See also SteamWorkshopMain.OnInstalled.

Returns
the download progress between 0 and 1.
Parameters
p_fileIdSteam PublishedFileId of the item being downloaded.

◆ GetItemList()

bool LapinerTools.Steam.SteamWorkshopMain.GetItemList ( uint  p_page,
System.Action< WorkshopItemListEventArgs p_onItemListLoaded 
)

Loads the item list for the given page. The p_onItemListLoaded callback is invoked when done. First all favorite items of the user are fetched, then all user votes are loaded. Once this is done the given page is loaded and the prior loaded user favorites and vote states are applied. See also SteamWorkshopMain.OnItemListLoaded, SteamWorkshopMain.Sorting and SteamWorkshopMain.SearchText.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_pageitem list page to load, starts with 1.
p_onItemListLoadedinvoked when the item list is either fully loaded or an error has occured.

◆ GetItemUpdateFromFolder()

WorkshopItemUpdate LapinerTools.Steam.SteamWorkshopMain.GetItemUpdateFromFolder ( string  p_itemContentFolderPath)

Tries to load the Data.WorkshopItemUpdate data from an item folder. This data can be used in SteamWorkshopMain.Upload to update existing items. The item update data is stored in the WorkshopItemInfo.xml file.

Returns
a Data.WorkshopItemUpdate instance if the item update data was loaded successfuly, otherwise null.
Parameters
p_itemContentFolderPathPath of the item folder containing a WorkshopItemInfo.xml file.

◆ GetUploadProgress()

float LapinerTools.Steam.SteamWorkshopMain.GetUploadProgress ( WorkshopItemUpdate  p_itemUpdate)

Gets the upload progress of an item. Use SteamWorkshopMain.Upload to start upload. See also SteamWorkshopMain.OnUploaded.

Returns
the upload progress between 0 and 1.
Parameters
p_itemUpdateupdate data of the item being uploaded.

◆ RemoveFavorite() [1/2]

bool LapinerTools.Steam.SteamWorkshopMain.RemoveFavorite ( WorkshopItem  p_item,
System.Action< WorkshopItemEventArgs p_onRemovedFavorite 
)

Remove an item from user's favorites list. See also SteamWorkshopMain.OnRemovedFavorite.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_itemitem removed from favorites.
p_onRemovedFavoriteinvoked when the item is removed from favorites successfully or an error has occured.

◆ RemoveFavorite() [2/2]

bool LapinerTools.Steam.SteamWorkshopMain.RemoveFavorite ( PublishedFileId_t  p_fileId,
System.Action< WorkshopItemEventArgs p_onRemovedFavorite 
)

Remove an item from user's favorites list. See also SteamWorkshopMain.OnRemovedFavorite.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_fileIdSteam PublishedFileId of the item removed from favorites.
p_onRemovedFavoriteinvoked when the item is removed from favorites successfully or an error has occured.

◆ RenderIcon() [1/2]

void LapinerTools.Steam.SteamWorkshopMain.RenderIcon ( Camera  p_camera,
int  p_width,
int  p_height,
string  p_saveToFilePath,
System.Action< Texture2D >  p_onRenderIconCompleted 
)

Will make a screenshot with the given resolution without rendering the uGUI overlay.

Parameters
p_cameracamera to render.
p_widthscreenshot width, must be less or equal screen width.
p_heightscreenshot height, must be less or equal screen height.
p_saveToFilePathscreenshot is saved as a PNG file at this path. Can be null or empty.
p_onRenderIconCompletedinvoked when the screenshot is rendered. A Texture2D instance containing the screenshot is passed as argument.

◆ RenderIcon() [2/2]

void LapinerTools.Steam.SteamWorkshopMain.RenderIcon ( Camera  p_camera,
int  p_width,
int  p_height,
string  p_saveToFilePath,
bool  p_keepTextureReference,
System.Action< Texture2D >  p_onRenderIconCompleted 
)

Will make a screenshot with the given resolution without rendering the uGUI overlay.

Parameters
p_cameracamera to render.
p_widthscreenshot width, must be less or equal screen width.
p_heightscreenshot height, must be less or equal screen height.
p_saveToFilePathscreenshot is saved as a PNG file at this path. Can be null or empty.
p_keepTextureReferenceif set to true then the Texture2D will destroyed with the SteamWorkshopMain instance or when the next screenshot is taken, otherwise you must destroy the Texture2D in your code.
p_onRenderIconCompletedinvoked when the screenshot is rendered. A Texture2D instance containing the screenshot is passed as argument.

◆ Subscribe() [1/2]

bool LapinerTools.Steam.SteamWorkshopMain.Subscribe ( WorkshopItem  p_item,
System.Action< WorkshopItemEventArgs p_onSubscribed 
)

Subscribe an item. If the subscription is succesfull, then the download is started. See also SteamWorkshopMain.OnSubscribed and SteamWorkshopMain.GetDownloadProgress.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_itemitem to subscribe.
p_onSubscribedinvoked when the item is subscribed successfully or an error has occured.

◆ Subscribe() [2/2]

bool LapinerTools.Steam.SteamWorkshopMain.Subscribe ( PublishedFileId_t  p_fileId,
System.Action< WorkshopItemEventArgs p_onSubscribed 
)

Subscribe an item. If the subscription is succesfull, then the download is started. See also SteamWorkshopMain.OnSubscribed and SteamWorkshopMain.GetDownloadProgress.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_fileIdSteam PublishedFileId of the item to subscribe.
p_onSubscribedinvoked when the item is subscribed successfully or an error has occured.

◆ Unsubscribe() [1/2]

bool LapinerTools.Steam.SteamWorkshopMain.Unsubscribe ( WorkshopItem  p_item,
System.Action< WorkshopItemEventArgs p_onUnsubscribed 
)

Unsubscribe an item. Will not remove the item from disk. If the item is not used for a certain time, then the Steam client will remove it. See also SteamWorkshopMain.OnUnsubscribed.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_itemitem to unsubscribe.
p_onUnsubscribedinvoked when the item is unsubscribed successfully or an error has occured.

◆ Unsubscribe() [2/2]

bool LapinerTools.Steam.SteamWorkshopMain.Unsubscribe ( PublishedFileId_t  p_fileId,
System.Action< WorkshopItemEventArgs p_onUnsubscribed 
)

Unsubscribe an item. Will not remove the item from disk. If the item is not used for a certain time, then the Steam client will remove it. See also SteamWorkshopMain.OnUnsubscribed.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_fileIdSteam PublishedFileId of the item to unsubscribe.
p_onUnsubscribedinvoked when the item is unsubscribed successfully or an error has occured.

◆ Upload()

bool LapinerTools.Steam.SteamWorkshopMain.Upload ( WorkshopItemUpdate  p_itemData,
System.Action< WorkshopItemUpdateEventArgs p_onUploaded 
)

Upload or update the given item. A new item is created if p_itemData's WorkshopItemUpdate.SteamNative.m_nPublishedFileId is not set, otherwise the existing item is updated (new Steam PublishedFileId is stored in p_itemData). If p_itemData's WorkshopItemUpdate.ContentPath is given, then all contents at this path are uploaded or updated. Creates a WorkshopItemInfo.xml file to allow later item updates, see SteamWorkshopMain.GetItemUpdateFromFolder. See also SteamWorkshopMain.GetUploadProgress.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_itemDataupdate data of the item to upload.
p_onUploadedinvoked when the item upload is successfull or an error has occured.

◆ Vote() [1/2]

bool LapinerTools.Steam.SteamWorkshopMain.Vote ( WorkshopItem  p_item,
bool  p_isUpVote,
System.Action< WorkshopItemEventArgs p_onVoted 
)

Vote an item up or down. See also SteamWorkshopMain.OnVoted.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_itemvoted item.
p_isUpVoteif set to true then the item will be voted up, otherwise the item is voted down.
p_onVotedinvoked when the item vote is successfull or an error has occured.

◆ Vote() [2/2]

bool LapinerTools.Steam.SteamWorkshopMain.Vote ( PublishedFileId_t  p_fileId,
bool  p_isUpVote,
System.Action< WorkshopItemEventArgs p_onVoted 
)

Vote an item up or down. See also SteamWorkshopMain.OnVoted.

Returns
true, if a request was started, false when the request could not have been started due to an error.
Parameters
p_fileIdSteam PublishedFileId of the voted item.
p_isUpVoteif set to true then the item will be voted up, otherwise the item is voted down.
p_onVotedinvoked when the item vote is successfull or an error has occured.

Property Documentation

◆ Instance

SteamWorkshopMain LapinerTools.Steam.SteamWorkshopMain.Instance
staticget

You can use the static Instance property to access the Steam Workshop API from wherever you need it in your code. See also SteamWorkshopMain.IsInstanceSet.

◆ IsDebugLogEnabled

bool LapinerTools.Steam.SteamWorkshopMain.IsDebugLogEnabled
getset

Set this property to true if you want to see a detailed log in the console. Disabled by default.

◆ IsInstanceSet

bool LapinerTools.Steam.SteamWorkshopMain.IsInstanceSet
staticget

The static IsInstanceSet property can be used before accessing the Instance property to prevent a new SteamWorkshopMain instance from being created in the teardown phase. For example, if you want to unregister from an event, then first check that IsInstanceSet is true. If it is false, then your event registration is not valid anymore.

◆ IsSteamCacheEnabled

bool LapinerTools.Steam.SteamWorkshopMain.IsSteamCacheEnabled
getset

Set this property to true if you want your UI to respond faster, but sacrifice up-to-dateness. Disabled by default.

◆ SearchText

string LapinerTools.Steam.SteamWorkshopMain.SearchText
getset

This search filter is applied to the item list. See also SteamWorkshopMain.OnItemListLoaded and SteamWorkshopMain.GetItemList.

◆ Sorting

WorkshopSortMode LapinerTools.Steam.SteamWorkshopMain.Sorting
getset

Controls the item list sorting. See also SteamWorkshopMain.OnItemListLoaded and SteamWorkshopMain.GetItemList.

Event Documentation

◆ OnAddedFavorite

System.Action<WorkshopItemEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnAddedFavorite

Invoked when an item was successfully added to the user's favorites list. See also SteamWorkshopMain.AddFavorite.

◆ OnError

System.Action<ErrorEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnError

Invoked when a Steam error has occured.

◆ OnInstalled

System.Action<WorkshopItemEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnInstalled

Invoked when an item was successfully downloaded and installed. See also SteamWorkshopMain.Subscribe and SteamWorkshopMain.GetDownloadProgress.

◆ OnItemListLoaded

System.Action<WorkshopItemListEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnItemListLoaded

Invoked when the item list is fully loaded. See also SteamWorkshopMain.GetItemList.

◆ OnRemovedFavorite

System.Action<WorkshopItemEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnRemovedFavorite

Invoked when an item was successfully removed from the user's favorites list. See also SteamWorkshopMain.RemoveFavorite.

◆ OnSubscribed

System.Action<WorkshopItemEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnSubscribed

Invoked when an item was successfully subscribed. See also SteamWorkshopMain.Subscribe.

◆ OnUnsubscribed

System.Action<WorkshopItemEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnUnsubscribed

Invoked when an item was successfully unsubscribed. See also SteamWorkshopMain.Unsubscribe.

◆ OnUploaded

System.Action<WorkshopItemUpdateEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnUploaded

Invoked when an item was successfully uploaded or updated. See also SteamWorkshopMain.Upload and SteamWorkshopMain.GetUploadProgress.

◆ OnVoted

System.Action<WorkshopItemEventArgs> LapinerTools.Steam.SteamWorkshopMain.OnVoted

Invoked when an item was successfully voted up or down. See also SteamWorkshopMain.Vote.


The documentation for this class was generated from the following file: