Fixed (#388) and add percentage overlay to timers

This commit is contained in:
Daniel van Noord
2020-12-27 13:27:44 +01:00
parent 6edda5420f
commit b6cd262ff2
2 changed files with 16 additions and 26 deletions

View File

@@ -1558,7 +1558,7 @@ CM.Disp.CreateTimerBar = function() {
CM.Disp.TimerBar.id = 'CMTimerBar';
CM.Disp.TimerBar.style.position = 'absolute';
CM.Disp.TimerBar.style.display = 'none';
CM.Disp.TimerBar.style.height = '48px';
CM.Disp.TimerBar.style.height = '30px';
CM.Disp.TimerBar.style.fontSize = '10px';
CM.Disp.TimerBar.style.fontWeight = 'bold';
CM.Disp.TimerBar.style.backgroundColor = 'black';
@@ -1707,6 +1707,7 @@ CM.Disp.UpdateTimerBar = function() {
}
else classColor = CM.Disp.colorPurple;
timer.lastChild.children[1].className = CM.Disp.colorBackPre + classColor;
timer.lastChild.children[1].textContent = Math.round(100 * (Game.buffs[i].time / Game.buffs[i].maxTime)) + "%";
timer.lastChild.children[1].style.width = Math.round(Game.buffs[i].time * (maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8) / Game.buffs[i].maxTime) + 'px';
timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps);
numberOfTimers++;
@@ -1718,13 +1719,7 @@ CM.Disp.UpdateTimerBar = function() {
}
if (numberOfTimers != 0) {
var height = 48 / numberOfTimers;
for (var i in CM.Disp.TimerBars) {
CM.Disp.TimerBars[i].style.height = height + 'px';
}
for (var i in CM.Disp.BuffTimerBars) {
CM.Disp.BuffTimerBars[i].style.height = height + 'px';
}
CM.Disp.TimerBar.style.height = numberOfTimers * 12 + 2 + 'px';
}
}
}
@@ -1766,22 +1761,22 @@ CM.Disp.ToggleTimerBarPos = function() {
*/
CM.Disp.UpdateBotTimerBarPosition = function() {
if (CM.Options.BotBar == 1 && CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '118px';
CM.Disp.BotBar.style.bottom = CM.Disp.TimerBar.style.height;
l('game').style.bottom = Number(CM.Disp.TimerBar.style.height.replace("px","")) + 70 + "px";
}
else if (CM.Options.BotBar == 1) {
CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '70px';
}
else if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) {
l('game').style.bottom = '48px';
l('game').style.bottom = CM.Disp.TimerBar.style.height;
}
else { // No bars
l('game').style.bottom = '0px';
}
if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) {
l('sectionLeft').style.top = '48px';
l('sectionLeft').style.top = CM.Disp.TimerBar.style.height;
}
else {
l('sectionLeft').style.top = '';

View File

@@ -442,7 +442,7 @@ CM.Disp.CreateTimerBar = function() {
CM.Disp.TimerBar.id = 'CMTimerBar';
CM.Disp.TimerBar.style.position = 'absolute';
CM.Disp.TimerBar.style.display = 'none';
CM.Disp.TimerBar.style.height = '48px';
CM.Disp.TimerBar.style.height = '30px';
CM.Disp.TimerBar.style.fontSize = '10px';
CM.Disp.TimerBar.style.fontWeight = 'bold';
CM.Disp.TimerBar.style.backgroundColor = 'black';
@@ -591,6 +591,7 @@ CM.Disp.UpdateTimerBar = function() {
}
else classColor = CM.Disp.colorPurple;
timer.lastChild.children[1].className = CM.Disp.colorBackPre + classColor;
timer.lastChild.children[1].textContent = Math.round(100 * (Game.buffs[i].time / Game.buffs[i].maxTime)) + "%";
timer.lastChild.children[1].style.width = Math.round(Game.buffs[i].time * (maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8) / Game.buffs[i].maxTime) + 'px';
timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps);
numberOfTimers++;
@@ -602,13 +603,7 @@ CM.Disp.UpdateTimerBar = function() {
}
if (numberOfTimers != 0) {
var height = 48 / numberOfTimers;
for (var i in CM.Disp.TimerBars) {
CM.Disp.TimerBars[i].style.height = height + 'px';
}
for (var i in CM.Disp.BuffTimerBars) {
CM.Disp.BuffTimerBars[i].style.height = height + 'px';
}
CM.Disp.TimerBar.style.height = numberOfTimers * 12 + 2 + 'px';
}
}
}
@@ -650,22 +645,22 @@ CM.Disp.ToggleTimerBarPos = function() {
*/
CM.Disp.UpdateBotTimerBarPosition = function() {
if (CM.Options.BotBar == 1 && CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '118px';
CM.Disp.BotBar.style.bottom = CM.Disp.TimerBar.style.height;
l('game').style.bottom = Number(CM.Disp.TimerBar.style.height.replace("px","")) + 70 + "px";
}
else if (CM.Options.BotBar == 1) {
CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '70px';
}
else if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) {
l('game').style.bottom = '48px';
l('game').style.bottom = CM.Disp.TimerBar.style.height;
}
else { // No bars
l('game').style.bottom = '0px';
}
if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) {
l('sectionLeft').style.top = '48px';
l('sectionLeft').style.top = CM.Disp.TimerBar.style.height;
}
else {
l('sectionLeft').style.top = '';