Differential D2412 Diff 10323 binaries/data/mods/public/gui/lobby/LobbyPage/GameListFilters/Rating.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/lobby/LobbyPage/GameListFilters/Rating.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
GameListFilters.Rating = class | |||||
{ | |||||
constructor(onFilterChange) | |||||
{ | |||||
this.gameRatingFilter = Engine.GetGUIObjectByName("gameRatingFilter"); | |||||
this.gameRatingFilter.list = [ | |||||
translateWithContext("map", "Any"), | |||||
...this.RatingFilters | |||||
]; | |||||
this.gameRatingFilter.list_data = [ | |||||
"", | |||||
...this.RatingFilters.map(r => | |||||
sprintf( | |||||
r[0] == ">" ? | |||||
translateWithContext("gamelist filter", "> %(rating)s") : | |||||
translateWithContext("gamelist filter", "< %(rating)s"), | |||||
{ | |||||
"rating": r.substr(1) | |||||
})) | |||||
]; | |||||
this.gameRatingFilter.hidden = Engine.ConfigDB_GetValue("user", "lobby.columns.gamerating") != "true"; | |||||
this.gameRatingFilter.selected = 0; | |||||
this.gameRatingFilter.onSelectionChange = onFilterChange; | |||||
} | |||||
filter(game) | |||||
{ | |||||
let selected = this.gameRatingFilter.list_data[this.gameRatingFilter.selected]; | |||||
return !selected || (selected[0] == ">") == (+selected.substr(1) >= game.gameRating); | |||||
} | |||||
}; | |||||
GameListFilters.Rating.prototype.RatingFilters = [ | |||||
">1500", | |||||
">1400", | |||||
">1300", | |||||
">1200", | |||||
"<1200", | |||||
"<1100", | |||||
"<1000" | |||||
]; |
Wildfire Games · Phabricator