Skip to content

Commit 1ddabe6

Browse files
committed
Change get worlds call in Community browser to include creatorName.
creatorName is used to indicate that MyWorlds has been selected. Will be null if not.
1 parent f0d3a75 commit 1ddabe6

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

main/Boku/Common/LevelBrowsers/CommunityLevelBrowser.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void Update()
183183
// maxLevelsInMemoryCushion is the number of worlds we keep textures for on each side of the
184184
// cursor's current position. If a user is just scrolling forward, this will limit us to
185185
// about 100 textures in memory. If the user is scrolling forward and backward we may have
186-
// up to 200 textures.
186+
187187
int maxLevelsInMemoryCushion = 100;
188188
if (queries.Count > 0)
189189
{
@@ -354,6 +354,29 @@ public bool StartFetchingMore(ILevelSetQuery query)
354354
string keywords = filter.SearchString;
355355
string creator = (filter.FilterGenres & Genres.MyWorlds) != 0 ? Auth.CreatorName : null;
356356

357+
// In the Community menu we can't rely on the MyWorlds bit to indicate that MyWorlds
358+
// has been chosen since it's included in All. For the Community
359+
creator = filter.FilterGenres == Genres.All ? null : Auth.CreatorName;
360+
creator = Auth.CreatorName;
361+
362+
// In the Community menu we can't rely on the MyWorlds bit to indicate that MyWorlds
363+
// has been chosen since it's included in All. We also can't use the grid settings
364+
// because they don't seem to be right. I suspect that it's due to the selection
365+
// state not filtering through on the first frame.
366+
//
367+
// For the Community browser we start by assuming MyWorlds is chosen and clear it if
368+
// - Filter is set to All
369+
// - MyWorlds bit is clear
370+
// - CreatorName is Guest
371+
//
372+
// creatorName is then passed to the server where, if it's not null, we use the "MyWorlds" version of Search and Get.
373+
string creatorName = Auth.CreatorName;
374+
if (filter.FilterGenres == Genres.All || ((filter.FilterGenres & Genres.MyWorlds) == 0) || Auth.CreatorName == Auth.DefaultCreatorName)
375+
{
376+
creatorName = null;
377+
}
378+
Debug.WriteLine(creatorName);
379+
357380
pagingOpCount += 1;
358381

359382

@@ -366,7 +389,8 @@ public bool StartFetchingMore(ILevelSetQuery query)
366389
sortDir = sortDir,
367390
range = "all",
368391
keywords = keywords,
369-
creator = creator
392+
creator = creator,
393+
creatorName = creatorName
370394
};
371395
KoduService.Search(args, (object results) => {
372396
//4scoy NOTE in case of fail (results==null) we still pass

main/Boku/Common/LevelBrowsers/LocalLevelBrowser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private void ReadDataSource(string folder, Genres tag, StorageSource sources)
221221
state.level = level;
222222
level.BrowserState = state;
223223

224-
// Force the creator name of built-ins to "Microsoft"
224+
// Force the creator name of built-ins to "Kodu Team"
225225
if ((level.Genres & Genres.BuiltInWorlds) != 0)
226226
{
227227
level.Creator = "Kodu Team";

main/Boku/Common/Sharing/KoduService.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public enum RequestState
2929
public static string KGLUrl = @"https://www.kodugamelab.com";
3030

3131
// Our service address
32-
public static string ServiceApiUrl = "https://api.koduworlds.com/api/";
33-
//public static string ServiceApiUrl = "http://koduapi-latency.azurewebsites.net/api/";//High latency test server.
34-
//public static string ServiceApiUrl = "http://koduapi-stage.azurewebsites.net/api/";
35-
//public static string ServiceApiUrl = "http://localhost.fiddler:3000/api/";//Localhost for development
32+
public static string ServiceApiUrl = "https://api.koduworlds.com/api/"; // Production.
33+
//public static string ServiceApiUrl = "http://koduapi-stage2.azurewebsites.net/api/"; // Staging API (test only)
34+
//public static string ServiceApiUrl = "http://localhost.fiddler:3000/api/"; //Localhost for development
35+
//public static string ServiceApiUrl = "http://koduapi-latency.azurewebsites.net/api/"; //High latency test server.
3636

3737
// Used by rest of system to keep track of state. LoadLevelMenu
3838
// needs to poll this for Complete or Error and handle dialogs.
@@ -241,11 +241,11 @@ public static void UploadWorld(object args, string levelPath,string thumbPath,st
241241
Newtonsoft.Json.Linq.JContainer container = JsonConvert.DeserializeObject(text) as Newtonsoft.Json.Linq.JContainer;
242242

243243
string status = container.Value<string>("status");
244-
if(status!=null && status != "ok")
244+
if (status != null && status != "ok")
245245
{
246-
//authorize error.
247-
ShareRequestState = RequestState.Error;
248-
callback(null);
246+
//authorize error.
247+
ShareRequestState = RequestState.Error;
248+
callback(null);
249249
}
250250

251251
string uploadDataUrl = container.Value<string>("dataUrl");
@@ -280,6 +280,7 @@ public static void UploadWorld(object args, string levelPath,string thumbPath,st
280280
}
281281
});
282282

283+
// NOTE: Screen
283284
UploadDataFromFile(uploadScreenUrl, @"image/jpeg", thumbPath, (uploadResponse) => {
284285
if (uploadResponse == null)
285286
{

0 commit comments

Comments
 (0)