Skip to content

Instantly share code, notes, and snippets.

@kjmehta01
Created September 20, 2015 20:25
Show Gist options
  • Save kjmehta01/93e5b0c96ab6362efcbc to your computer and use it in GitHub Desktop.
Save kjmehta01/93e5b0c96ab6362efcbc to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Tagpro scoreboard color changer
// @version 0.1
// @description Changes the color and opacity of score at bottom
// @author Browncoat or someone
// @include http://tagpro-*.koalabeast.com:*
// @include http://tangent.jukejuice.com:*
// @include http://*.newcompte.fr:*
// @grant none
// ==/UserScript==
tagpro.ready(function () {
var redTeamColor = "e74c3c";//red team color
var blueTeamColor = "3498db";//blue team color
var opacity = 1;//number from 0 to 1
var redColorHex = "#" + redTeamColor;
var blueColorHex = "#" + blueTeamColor;
// Team score colors
tagpro.ui.scores = function () {
var n = tagpro.score.r ? tagpro.score.r.toString() : "0";
var r = tagpro.score.b ? tagpro.score.b.toString() : "0";
if (tagpro.ui.sprites.redScore) {
tagpro.ui.sprites.redScore.text != n && tagpro.ui.sprites.redScore.setText(n);
tagpro.ui.sprites.blueScore.text != r && tagpro.ui.sprites.blueScore.setText(r);
} else {
var redStroke = "#000000";
if (redColorHex == "#000000") {
redStroke = "#FFFFFF"
}
var blueStroke = "#000000";
if (blueColorHex == "#000000") {
blueStroke = "#FFFFFF"
}
tagpro.ui.sprites.redScore = new PIXI.Text(n, {fill: redColorHex, stroke: redStroke, strokeThickness: 0, font: "bold 40pt Arial"});
tagpro.ui.sprites.blueScore = new PIXI.Text(r, {fill: blueColorHex, stroke: blueStroke, strokeThickness: 0, font: "bold 40pt Arial"});
tagpro.ui.sprites.redScore.alpha = opacity;
tagpro.ui.sprites.blueScore.alpha = opacity;
tagpro.ui.sprites.redScore.anchor.x = 1;
tagpro.ui.sprites.blueScore.anchor.x = 0;
tagpro.renderer.layers.ui.addChild(tagpro.ui.sprites.redScore);
tagpro.renderer.layers.ui.addChild(tagpro.ui.sprites.blueScore);
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment