Differential D1461 Diff 15205 ps/trunk/binaries/data/mods/public/gui/session/chat/ChatMessageFormatNetwork.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/chat/ChatMessageFormatNetwork.js
/** | /** | ||||
* This class parses network events sent from the NetClient, such as players connecting or disconnecting from the game. | * This class parses network events sent from the NetClient, such as players connecting or disconnecting from the game. | ||||
*/ | */ | ||||
class ChatMessageFormatNetwork | class ChatMessageFormatNetwork | ||||
{ | { | ||||
} | } | ||||
ChatMessageFormatNetwork.clientlist = class | ChatMessageFormatNetwork.clientlist = class | ||||
{ | { | ||||
parse() | parse() | ||||
{ | { | ||||
return getUsernameList(); | return { "text": getUsernameList() }; | ||||
} | } | ||||
}; | }; | ||||
ChatMessageFormatNetwork.connect = class | ChatMessageFormatNetwork.connect = class | ||||
{ | { | ||||
parse(msg) | parse(msg) | ||||
{ | { | ||||
return sprintf( | return { | ||||
"text": sprintf( | |||||
g_PlayerAssignments[msg.guid].player != -1 ? | g_PlayerAssignments[msg.guid].player != -1 ? | ||||
// Translation: A player that left the game joins again | // Translation: A player that left the game joins again | ||||
translate("%(player)s is starting to rejoin the game.") : | translate("%(player)s is starting to rejoin the game.") : | ||||
// Translation: A player joins the game for the first time | // Translation: A player joins the game for the first time | ||||
translate("%(player)s is starting to join the game."), | translate("%(player)s is starting to join the game."), | ||||
{ "player": colorizePlayernameByGUID(msg.guid) }); | { "player": colorizePlayernameByGUID(msg.guid) }) | ||||
}; | |||||
} | } | ||||
}; | }; | ||||
ChatMessageFormatNetwork.disconnect = class | ChatMessageFormatNetwork.disconnect = class | ||||
{ | { | ||||
parse(msg) | parse(msg) | ||||
{ | { | ||||
return sprintf(translate("%(player)s has left the game."), { | return { | ||||
"text": sprintf(translate("%(player)s has left the game."), { | |||||
"player": colorizePlayernameByGUID(msg.guid) | "player": colorizePlayernameByGUID(msg.guid) | ||||
}); | }) | ||||
}; | |||||
} | } | ||||
}; | }; | ||||
ChatMessageFormatNetwork.kicked = class | ChatMessageFormatNetwork.kicked = class | ||||
{ | { | ||||
parse(msg) | parse(msg) | ||||
{ | { | ||||
return sprintf( | return { | ||||
"text": sprintf( | |||||
msg.banned ? | msg.banned ? | ||||
translate("%(username)s has been banned") : | translate("%(username)s has been banned") : | ||||
translate("%(username)s has been kicked"), | translate("%(username)s has been kicked"), | ||||
{ | { | ||||
"username": colorizePlayernameHelper( | "username": colorizePlayernameHelper( | ||||
msg.username, | msg.username, | ||||
g_Players.findIndex(p => p.name == msg.username) | g_Players.findIndex(p => p.name == msg.username) | ||||
) | ) | ||||
}); | }) | ||||
}; | |||||
} | } | ||||
}; | }; | ||||
ChatMessageFormatNetwork.rejoined = class | ChatMessageFormatNetwork.rejoined = class | ||||
{ | { | ||||
parse(msg) | parse(msg) | ||||
{ | { | ||||
return sprintf( | return { | ||||
"text": sprintf( | |||||
g_PlayerAssignments[msg.guid].player != -1 ? | g_PlayerAssignments[msg.guid].player != -1 ? | ||||
// Translation: A player that left the game joins again | // Translation: A player that left the game joins again | ||||
translate("%(player)s has rejoined the game.") : | translate("%(player)s has rejoined the game.") : | ||||
// Translation: A player joins the game for the first time | // Translation: A player joins the game for the first time | ||||
translate("%(player)s has joined the game."), | translate("%(player)s has joined the game."), | ||||
{ "player": colorizePlayernameByGUID(msg.guid) }); | { "player": colorizePlayernameByGUID(msg.guid) }) | ||||
}; | |||||
} | } | ||||
}; | }; |
Wildfire Games · Phabricator