Bottom bar now changes depending on bulk-mode and has a height that fits all info (#354)

This commit is contained in:
DanielNoord
2020-11-26 18:56:34 +01:00
committed by GitHub
parent 66ac922ae2
commit 744ee0dc5e
3 changed files with 20 additions and 14 deletions

View File

@@ -629,7 +629,7 @@ CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timer
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bul-buy mode', toggle: false}; CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
CM.ConfigData.UpBarColor = {label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpBarColor();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpBarColor();}};
CM.ConfigData.Colors = { CM.ConfigData.Colors = {
desc: { desc: {
@@ -1049,7 +1049,7 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) {
CM.Disp.CreateBotBar = function() { CM.Disp.CreateBotBar = function() {
CM.Disp.BotBar = document.createElement('div'); CM.Disp.BotBar = document.createElement('div');
CM.Disp.BotBar.id = 'CMBotBar'; CM.Disp.BotBar.id = 'CMBotBar';
CM.Disp.BotBar.style.height = '55px'; CM.Disp.BotBar.style.height = '69px';
CM.Disp.BotBar.style.width = '100%'; CM.Disp.BotBar.style.width = '100%';
CM.Disp.BotBar.style.position = 'absolute'; CM.Disp.BotBar.style.position = 'absolute';
CM.Disp.BotBar.style.display = 'none'; CM.Disp.BotBar.style.display = 'none';
@@ -1112,11 +1112,14 @@ CM.Disp.UpdateBotBarOther = function() {
var count = 0; var count = 0;
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
var target = 'Objects';
if (Game.buyBulk == 10) {target = 'Objects10';}
if (Game.buyBulk == 100) {target = 'Objects100';}
count++; count++;
CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount; CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount;
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bonus, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache[target][i].bonus, 2);
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color; CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache[target][i].color;
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].pp, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache[target][i].pp, 2);
} }
} }
} }
@@ -1370,11 +1373,11 @@ CM.Disp.UpdateTimerBar = function() {
CM.Disp.UpdateBotTimerBarDisplay = function() { CM.Disp.UpdateBotTimerBarDisplay = function() {
if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px'; CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '104px'; l('game').style.bottom = '118px';
} }
else if (CM.Config.BotBar == 1) { else if (CM.Config.BotBar == 1) {
CM.Disp.BotBar.style.bottom = '0px'; CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '56px'; l('game').style.bottom = '70px';
} }
else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
l('game').style.bottom = '48px'; l('game').style.bottom = '48px';

View File

@@ -148,7 +148,7 @@ CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timer
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bul-buy mode', toggle: false}; CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
CM.ConfigData.UpBarColor = {label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpBarColor();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpBarColor();}};
CM.ConfigData.Colors = { CM.ConfigData.Colors = {
desc: { desc: {

View File

@@ -289,7 +289,7 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) {
CM.Disp.CreateBotBar = function() { CM.Disp.CreateBotBar = function() {
CM.Disp.BotBar = document.createElement('div'); CM.Disp.BotBar = document.createElement('div');
CM.Disp.BotBar.id = 'CMBotBar'; CM.Disp.BotBar.id = 'CMBotBar';
CM.Disp.BotBar.style.height = '55px'; CM.Disp.BotBar.style.height = '69px';
CM.Disp.BotBar.style.width = '100%'; CM.Disp.BotBar.style.width = '100%';
CM.Disp.BotBar.style.position = 'absolute'; CM.Disp.BotBar.style.position = 'absolute';
CM.Disp.BotBar.style.display = 'none'; CM.Disp.BotBar.style.display = 'none';
@@ -352,11 +352,14 @@ CM.Disp.UpdateBotBarOther = function() {
var count = 0; var count = 0;
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
var target = 'Objects';
if (Game.buyBulk == 10) {target = 'Objects10';}
if (Game.buyBulk == 100) {target = 'Objects100';}
count++; count++;
CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount; CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount;
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bonus, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache[target][i].bonus, 2);
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color; CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache[target][i].color;
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].pp, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache[target][i].pp, 2);
} }
} }
} }
@@ -610,11 +613,11 @@ CM.Disp.UpdateTimerBar = function() {
CM.Disp.UpdateBotTimerBarDisplay = function() { CM.Disp.UpdateBotTimerBarDisplay = function() {
if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px'; CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '104px'; l('game').style.bottom = '118px';
} }
else if (CM.Config.BotBar == 1) { else if (CM.Config.BotBar == 1) {
CM.Disp.BotBar.style.bottom = '0px'; CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '56px'; l('game').style.bottom = '70px';
} }
else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
l('game').style.bottom = '48px'; l('game').style.bottom = '48px';