Merge pull request #420 from Chorizorro/fix/disp

Move CM.Disp.Draw out of bottom bar section
This commit is contained in:
DanielNoord
2020-12-05 23:15:38 +01:00
committed by GitHub
2 changed files with 40 additions and 34 deletions

View File

@@ -1174,6 +1174,26 @@ CM.Disp.UpdateBackground = function() {
Game.LeftBackground.canvas.height = Game.LeftBackground.canvas.parentNode.offsetHeight;
}
/**
* This function handles custom drawing for the Game.Draw() function.
* It is hooked on 'draw' by CM.RegisterHooks()
*/
CM.Disp.Draw = function () {
// Draw autosave timer in stats menu
if (
(Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks
(Game.onMenu == 'stats' && CM.Config.Stats) // while being on the stats menu only
) {
var timer = document.getElementById('CMStatsAutosaveTimer');
if (timer) {
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
}
}
}
/********
* Section: Functions related to the Bottom Bar */
/**
* This function toggle the bottom bar
* It is called by CM.Disp.UpdateAscendState() and a change in CM.Config.BotBar
@@ -1293,23 +1313,6 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) {
time.appendChild(document.createElement('td'));
}
/**
* This function handles custom drawing for the Game.Draw() function.
* It is hooked on 'draw' by CM.RegisterHooks()
*/
CM.Disp.Draw = function () {
// Draw autosave timer in stats menu
if (
(Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks
(Game.onMenu == 'stats' && CM.Config.Stats) // while being on the stats menu only
) {
var timer = document.getElementById('CMStatsAutosaveTimer');
if (timer) {
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
}
}
}
/********
* Section: Functions related to the Timer Bar

View File

@@ -286,6 +286,26 @@ CM.Disp.UpdateBackground = function() {
Game.LeftBackground.canvas.height = Game.LeftBackground.canvas.parentNode.offsetHeight;
}
/**
* This function handles custom drawing for the Game.Draw() function.
* It is hooked on 'draw' by CM.RegisterHooks()
*/
CM.Disp.Draw = function () {
// Draw autosave timer in stats menu
if (
(Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks
(Game.onMenu == 'stats' && CM.Config.Stats) // while being on the stats menu only
) {
var timer = document.getElementById('CMStatsAutosaveTimer');
if (timer) {
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
}
}
}
/********
* Section: Functions related to the Bottom Bar */
/**
* This function toggle the bottom bar
* It is called by CM.Disp.UpdateAscendState() and a change in CM.Config.BotBar
@@ -405,23 +425,6 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) {
time.appendChild(document.createElement('td'));
}
/**
* This function handles custom drawing for the Game.Draw() function.
* It is hooked on 'draw' by CM.RegisterHooks()
*/
CM.Disp.Draw = function () {
// Draw autosave timer in stats menu
if (
(Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks
(Game.onMenu == 'stats' && CM.Config.Stats) // while being on the stats menu only
) {
var timer = document.getElementById('CMStatsAutosaveTimer');
if (timer) {
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
}
}
}
/********
* Section: Functions related to the Timer Bar