Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/lobby/LobbyPage/Game.js
Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | let players; | ||||
if (player.Team == "observer") | if (player.Team == "observer") | ||||
++observerCount; | ++observerCount; | ||||
else | else | ||||
playerRatingTotal += playerNickRating.rating || g_DefaultLobbyRating; | playerRatingTotal += playerNickRating.rating || g_DefaultLobbyRating; | ||||
// Sort games with playing buddies above games with spectating buddies | // Sort games with playing buddies above games with spectating buddies | ||||
if (hasBuddies < 2 && g_Buddies.indexOf(playerNickRating.nick) != -1) | if (hasBuddies < 2 && g_Buddies.indexOf(playerNickRating.nick) != -1) | ||||
hasBuddies = player.Team == "observer" ? 1 : 2; | hasBuddies = player.Team == "observer" ? 1 : 2; | ||||
} | } | ||||
GrapjasAuthorUnsubmitted Not Done Inline ActionsGrapjas: ```
++playerCount;
``` | |||||
this.observerCount = observerCount; | this.observerCount = observerCount; | ||||
this.hasBuddies = hasBuddies; | this.hasBuddies = hasBuddies; | ||||
let displayData = this.displayData; | let displayData = this.displayData; | ||||
let sortValues = this.sortValues; | let sortValues = this.sortValues; | ||||
displayData.buddy = this.hasBuddies ? setStringTags(g_BuddySymbol, displayData.tags) : ""; | displayData.buddy = this.hasBuddies ? coloredText(g_BuddySymbol, "gold") : ""; | ||||
Done Inline ActionsDuplication is bad, should be a constant like g_BuddySymbol. vladislavbelov: Duplication is bad, should be a constant like `g_BuddySymbol`. | |||||
sortValues.hasBuddyString = String(hasBuddies); | sortValues.hasBuddyString = String(hasBuddies); | ||||
sortValues.buddy = sortValues.hasBuddyString + sortValues.gameName; | sortValues.buddy = sortValues.hasBuddyString + sortValues.gameName; | ||||
let playerCount = players.length - observerCount; | let playerCount = players.length - observerCount; | ||||
let gameRating = | let gameRating = | ||||
playerCount ? | playerCount ? | ||||
Math.round(playerRatingTotal / playerCount) : | Math.round(playerRatingTotal / playerCount) : | ||||
g_DefaultLobbyRating; | g_DefaultLobbyRating; | ||||
Show All 30 Lines | updateMods(newStanza) | ||||
Engine.ProfileStop(); | Engine.ProfileStop(); | ||||
} | } | ||||
} | } | ||||
updateGameTags(newStanza) | updateGameTags(newStanza) | ||||
{ | { | ||||
let displayData = this.displayData; | let displayData = this.displayData; | ||||
displayData.tags = this.isCompatible ? this.StateTags[newStanza.state] : this.IncompatibleTags; | displayData.tags = this.isCompatible ? this.StateTags[newStanza.state] : this.IncompatibleTags; | ||||
displayData.buddy = this.hasBuddies ? setStringTags(g_BuddySymbol, displayData.tags) : ""; | displayData.buddy = this.hasBuddies ? coloredText(g_BuddySymbol, "gold") : ""; | ||||
this.updateGameName(newStanza); | this.updateGameName(newStanza); | ||||
} | } | ||||
updateGameName(newStanza) | updateGameName(newStanza) | ||||
{ | { | ||||
let displayData = this.displayData; | let displayData = this.displayData; | ||||
displayData.gameName = setStringTags(escapeText(newStanza.name), displayData.tags); | displayData.gameName = setStringTags(escapeText(newStanza.name), displayData.tags); | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
// Translation: The number of players in this game | // Translation: The number of players in this game | ||||
Game.prototype.PlayerCountNoObservers = translate("%(current)s/%(max)s"); | Game.prototype.PlayerCountNoObservers = translate("%(current)s/%(max)s"); | ||||
/** | /** | ||||
* Compatible games will be listed in these colors. | * Compatible games will be listed in these colors. | ||||
*/ | */ | ||||
Game.prototype.StateTags = { | Game.prototype.StateTags = { | ||||
"init": { | "init": { | ||||
"color": "0 219 0" | "color": "white" | ||||
}, | }, | ||||
"waiting": { | "waiting": { | ||||
"color": "255 127 0" | "color": "orange" | ||||
}, | }, | ||||
"running": { | "running": { | ||||
"color": "219 0 0" | "color": "red" | ||||
} | } | ||||
}; | }; | ||||
/** | /** | ||||
* Games that require different mods than the ones launched by the current player are grayed out. | * Games that require different mods than the ones launched by the current player are grayed out. | ||||
*/ | */ | ||||
Game.prototype.IncompatibleTags = { | Game.prototype.IncompatibleTags = { | ||||
"color": "gray" | "color": "gray" | ||||
}; | }; | ||||
/** | /** | ||||
* Color for the player count number in the games list. | * Color for the player count number in the games list. | ||||
*/ | */ | ||||
Game.prototype.PlayerCountTags = { | Game.prototype.PlayerCountTags = { | ||||
"CurrentPlayers": { | "CurrentPlayers": { | ||||
"color": "0 160 160" | "color": "persiangreen" | ||||
}, | }, | ||||
"MaxPlayers": { | "MaxPlayers": { | ||||
"color": "0 160 160" | "color": "persiangreen" | ||||
}, | }, | ||||
"Observers": { | "Observers": { | ||||
"color": "0 128 128" | "color": "persiangreen" | ||||
} | } | ||||
}; | }; |
Wildfire Games · Phabricator