Added Loop to hook of modding api #468

This commit is contained in:
Daniel van Noord
2021-01-31 19:44:00 +01:00
parent d9e0e46e64
commit bbdbbfb667
3 changed files with 42 additions and 44 deletions

View File

@@ -1510,11 +1510,11 @@ CM.Disp.UpdateBackground = function() {
};
/**
* This function handles custom drawing for the Game.Draw() function.
* This function handles all 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
// Draw autosave timer in stats menu, this must be done here to make it count down correctly
if (
(Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks
(Game.onMenu == 'stats' && CM.Options.Stats) // while being on the stats menu only
@@ -1524,6 +1524,25 @@ CM.Disp.Draw = function () {
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
}
}
// Update colors
CM.Disp.UpdateBuildings();
CM.Disp.UpdateUpgrades();
// Redraw timers
CM.Disp.UpdateTimerBar();
// Update Bottom Bar
CM.Disp.UpdateBotBar();
// Update Tooltip
CM.Disp.UpdateTooltip();
// Update Wrinkler Tooltip
CM.Disp.CheckWrinklerTooltip();
CM.Disp.UpdateWrinklerTooltip();
// Change menu refresh interval
CM.Disp.RefreshMenu();
};
/********
@@ -4314,26 +4333,6 @@ CM.Loop = function() {
// Calculate PP
CM.Cache.RemakePP();
// Update colors
CM.Disp.UpdateBuildings();
CM.Disp.UpdateUpgrades();
// Redraw timers
CM.Disp.UpdateTimerBar();
// Update Bottom Bar
CM.Disp.UpdateBotBar();
// Update Tooltip
CM.Disp.UpdateTooltip();
// Update Wrinkler Tooltip
CM.Disp.CheckWrinklerTooltip();
CM.Disp.UpdateWrinklerTooltip();
// Change menu refresh interval
CM.Disp.RefreshMenu();
}
// Check all changing minigames and game-states

View File

@@ -296,11 +296,11 @@ CM.Disp.UpdateBackground = function() {
};
/**
* This function handles custom drawing for the Game.Draw() function.
* This function handles all 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
// Draw autosave timer in stats menu, this must be done here to make it count down correctly
if (
(Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks
(Game.onMenu == 'stats' && CM.Options.Stats) // while being on the stats menu only
@@ -310,6 +310,25 @@ CM.Disp.Draw = function () {
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
}
}
// Update colors
CM.Disp.UpdateBuildings();
CM.Disp.UpdateUpgrades();
// Redraw timers
CM.Disp.UpdateTimerBar();
// Update Bottom Bar
CM.Disp.UpdateBotBar();
// Update Tooltip
CM.Disp.UpdateTooltip();
// Update Wrinkler Tooltip
CM.Disp.CheckWrinklerTooltip();
CM.Disp.UpdateWrinklerTooltip();
// Change menu refresh interval
CM.Disp.RefreshMenu();
};
/********

View File

@@ -182,26 +182,6 @@ CM.Loop = function() {
// Calculate PP
CM.Cache.RemakePP();
// Update colors
CM.Disp.UpdateBuildings();
CM.Disp.UpdateUpgrades();
// Redraw timers
CM.Disp.UpdateTimerBar();
// Update Bottom Bar
CM.Disp.UpdateBotBar();
// Update Tooltip
CM.Disp.UpdateTooltip();
// Update Wrinkler Tooltip
CM.Disp.CheckWrinklerTooltip();
CM.Disp.UpdateWrinklerTooltip();
// Change menu refresh interval
CM.Disp.RefreshMenu();
}
// Check all changing minigames and game-states