Index: ps/trunk/binaries/data/mods/public/gui/lobby/LobbyPage/ProfilePanel.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/lobby/LobbyPage/ProfilePanel.js +++ ps/trunk/binaries/data/mods/public/gui/lobby/LobbyPage/ProfilePanel.js @@ -72,7 +72,7 @@ if (!playerName) return; - this.playernameText.caption = playerName; + this.playernameText.caption = PlayerColor.ColorPlayerName(escapeText(playerName)); this.updatePlayerRoleText(playerName); this.rankText.caption = this.NotAvailable; @@ -91,7 +91,7 @@ if (attributes.rating == "-2" || attributes.player != this.requestedPlayer) return; - this.playernameText.caption = attributes.player; + this.playernameText.caption = PlayerColor.ColorPlayerName(escapeText(attributes.player), attributes.rating); this.updatePlayerRoleText(attributes.player); this.rankText.caption = attributes.rank; Index: ps/trunk/binaries/data/mods/public/gui/lobby/ProfilePage/ProfilePage.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/lobby/ProfilePage/ProfilePage.js +++ ps/trunk/binaries/data/mods/public/gui/lobby/ProfilePage/ProfilePage.js @@ -12,6 +12,8 @@ this.fetchInput = Engine.GetGUIObjectByName("fetchInput"); this.fetchInput.onPress = this.onPressLookup.bind(this); + this.fetchInput.onTab = this.autocomplete.bind(this); + this.fetchInput.tooltip = colorizeAutocompleteHotkey(); Engine.GetGUIObjectByName("viewProfileButton").onPress = this.onPressLookup.bind(this); Engine.GetGUIObjectByName("profileBackButton").onPress = this.onPressClose.bind(this, true); @@ -46,6 +48,20 @@ Engine.SendGetProfile(this.requestedPlayer); } + autocomplete() + { + const listPlayerNames = Engine.GetPlayerList().map(player => escapeText(player.name)); + // Remove duplicates with the board list. The board list has lower case names. + const listPlayerNamesLower = listPlayerNames.map(playerName => playerName.toLowerCase()); + for (const entry of Engine.GetBoardList()) + { + const escapedName = escapeText(entry.name); + if (!listPlayerNamesLower.includes(escapedName)) + listPlayerNames.push(escapedName); + } + autoCompleteText(this.fetchInput, listPlayerNames); + } + onPressClose() { this.profilePage.hidden = true; @@ -73,7 +89,7 @@ return; } - this.profilePlayernameText.caption = escapeText(attributes.player); + this.profilePlayernameText.caption = PlayerColor.ColorPlayerName(escapeText(attributes.player), attributes.rating); this.profileRankText.caption = attributes.rank; this.profileHighestRatingText.caption = attributes.highestRating; this.profileTotalGamesText.caption = attributes.totalGamesPlayed; Index: ps/trunk/binaries/data/mods/public/gui/prelobby/login/login.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/prelobby/login/login.js +++ ps/trunk/binaries/data/mods/public/gui/prelobby/login/login.js @@ -40,7 +40,9 @@ Engine.ConnectXmppClient(); } - +/** + * The data from Engine.SendGetBoardList() is used for the leaderboard, but also for autocompletion in the profile player search field. + */ function onLogin(message) { saveCredentials(); @@ -48,4 +50,5 @@ Engine.SwitchGuiPage("page_lobby.xml", { "dialog": false }); + Engine.SendGetBoardList(); }