forked from googlearchive/gamebuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
steamworks.patch
77 lines (71 loc) · 2.87 KB
/
steamworks.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
--- Assets/LapinerTools/Steam/Workshop/Scripts/SteamWorkshopMain.cs 2019-10-29 16:38:44.950011700 -0400
+++ SteamWorkshopMain.cs 2019-10-29 16:35:08.160664000 -0400
@@ -98,6 +98,9 @@
set{ m_searchText = value; }
}
+ // GAME BUILDER MOD
+ public List<string> m_excludeTags = new List<string>();
+
[SerializeField, Tooltip("This tag filter is applied to the item list. See also SearchMatchAnyTag, OnItemListLoaded and GetItemList.")]
private List<string> m_searchTags = new List<string>();
/// <summary>
@@ -131,6 +134,20 @@
set{ m_isSteamCacheEnabled = value; }
}
+ // GAME BUILDER MOD
+ // This function is necessary because we reuse the SteamWorkshopMain instance across multiple menus
+ // and starting a new search does not reset the search parameters. Hence we should call this manually
+ // before starting a new search. (We cannot reset immediately after a search, as it is asychronous
+ // and the search parameters still need to be read.)
+ public void ResetItemSearch()
+ {
+ m_sorting = new WorkshopSortMode();
+ m_searchMatchAnyTag = true;
+ m_searchText = null;
+ m_searchTags.Clear();
+ m_excludeTags.Clear();
+ }
+
/// <summary>
/// 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.
@@ -465,7 +482,11 @@
bool isContentToUploadFound = false;
if (!string.IsNullOrEmpty(p_itemData.ContentPath))
{
- string[] filesAtContentPath = System.IO.Directory.GetFiles(p_itemData.ContentPath);
+ // GAME BUILDER MOD
+ // This allows us to upload a folder with subdirectories.
+ string[] filesAtContentPath = System.IO.Directory.GetFiles(p_itemData.ContentPath, "*.*", System.IO.SearchOption.AllDirectories);
+ // string[] filesAtContentPath = System.IO.Directory.GetFiles(p_itemData.ContentPath);
+
foreach (string filePath in filesAtContentPath)
{
if (!System.IO.Path.Equals(filePath, p_itemData.IconPath))
@@ -1082,6 +1103,14 @@
#endregion
+ // GAME BUILDER MOD
+ // Exposing this so we can query for specific file IDs.
+ public WorkshopItem RegisterQueryResultItem(UGCQueryHandle_t p_handle, uint p_indexInHandle, SteamUGCDetails_t p_itemDetails)
+ {
+ var item = ParseItem(p_handle, p_indexInHandle, p_itemDetails);
+ m_items[item.SteamNative.m_nPublishedFileId] = item;
+ return item;
+ }
#region InternalLogic
@@ -1239,6 +1268,15 @@
SteamUGC.AddRequiredTag(queryHandle, m_searchTags[i]);
}
}
+
+ // GAME BUILDER MOD
+ if (m_excludeTags != null && m_excludeTags.Count > 0)
+ {
+ for (int i = 0; i < m_excludeTags.Count; i++)
+ {
+ SteamUGC.AddExcludedTag(queryHandle, m_excludeTags[i]);
+ }
+ }
}
else
{