-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the first part of #260, implementing in-game level tagging for LBP1. This also exposes an APIv3 endpoint for getting a list of levels by tag, and also shows the tags of a level on API level responses.
- Loading branch information
Showing
13 changed files
with
338 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Refresh.GameServer/Types/Levels/Categories/ByTagCategory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Bunkum.Core; | ||
using Refresh.GameServer.Database; | ||
using Refresh.GameServer.Endpoints.Game.Levels.FilterSettings; | ||
using Refresh.GameServer.Services; | ||
using Refresh.GameServer.Types.UserData; | ||
|
||
namespace Refresh.GameServer.Types.Levels.Categories; | ||
|
||
public class ByTagCategory : LevelCategory | ||
{ | ||
internal ByTagCategory() : base("tag", "tag", false) | ||
{ | ||
// Technically this category can apply to any user, but since we fallback to the regular user this name & description still applies | ||
this.Name = "Tag Search"; | ||
this.Description = "Search for levels using tags given by users like you!"; | ||
this.IconHash = "g820605"; | ||
this.FontAwesomeIcon = "tag"; | ||
this.Hidden = true; // The by-tag category is not meant to be shown, as it requires a special implementation on all frontends | ||
} | ||
|
||
public override DatabaseList<GameLevel>? Fetch(RequestContext context, int skip, int count, | ||
MatchService matchService, GameDatabaseContext database, GameUser? accessor, | ||
LevelFilterSettings levelFilterSettings, GameUser? user) | ||
{ | ||
string? tagStr = context.QueryString["tag"]; | ||
|
||
if (tagStr == null) | ||
return null; | ||
|
||
Tag? tag = TagExtensions.FromLbpString(tagStr); | ||
|
||
if (tag == null) | ||
return null; | ||
|
||
return database.GetLevelsByTag(count, skip, user, tag.Value, levelFilterSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.