Last active
May 20, 2019 03:41
-
-
Save bash-tp/baab15b87a5811476426dcb00c414915 to your computer and use it in GitHub Desktop.
TagPro Map Name Display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name TagPro Map Name Display | |
// @version 1.2 | |
// @author bash# | |
// @namespace http://www.reddit.com/user/bash_tp/ | |
// @description Shows the name of the current map above the clock | |
// @include *://*.koalabeast.com* | |
// @include *://*.jukejuice.com* | |
// @include *://*.newcompte.fr* | |
// @updateURL https://gist.github.com/bash-tp/baab15b87a5811476426dcb00c414915/raw/tagpro_map_name_display.user.js | |
// @downloadURL https://gist.github.com/bash-tp/baab15b87a5811476426dcb00c414915/raw/tagpro_map_name_display.user.js | |
// ==/UserScript== | |
tagpro.ready(function() { | |
var map_name; | |
var map_author; | |
var text_name; | |
var text_author; | |
function update_text() { | |
if (!text_name) { | |
text_name = new PIXI.Text(map_name, { fontSize: "10pt", strokeThickness: 3, fill: "#ffffff", fontWeight: "bold" }); | |
text_author = new PIXI.Text('by ' + map_author, { fontSize: "8pt", strokeThickness: 3, fill: "#ffffff", fontWeight: "bold" }); | |
text_name.anchor.x = 0.5; | |
text_author.anchor.x = 0.5; | |
tagpro.renderer.layers.ui.addChild(text_name); | |
tagpro.renderer.layers.ui.addChild(text_author); | |
} | |
var vp = $("#viewport"); | |
text_name.x = vp.width() / 2; | |
text_name.y = vp.height() - 90; | |
text_author.x = vp.width() / 2; | |
text_author.y = vp.height() - 70; | |
} | |
tagpro.socket.on('map', function(e) { | |
if (map_name) { | |
return; | |
} | |
map_name = e.info.name; | |
map_author = e.info.author; | |
update_text(); | |
}); | |
$(window).resize(function() { | |
update_text(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment