1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 16:13:55 +00:00

Theme things.

This commit is contained in:
Harley White 2021-06-06 23:45:32 -04:00
parent 43932fd977
commit affdd85133
6 changed files with 48 additions and 34 deletions

View file

@ -1,7 +1,10 @@
# The Modding Tree changelog:
- Added backgroundStyle to mod.js.
- If an upgrade has both canAfford and cost, it checks both.
- Releasing a held buyable/clickable with onHold doesn't click it again.
- Attempt to fix buttons sometimes not updating.
- Improvements to theme code, partially by Cubedey.
## v2.6.0.1 - 6/4/21
- Removed excess NaN alerts (now only checks player, not temp).

View file

@ -392,9 +392,10 @@ function gameLoop(diff) {
}
function hardReset() {
function hardReset(resetOptions) {
if (!confirm("Are you sure you want to do this? You will lose all your progress!")) return
player = null
if(resetOptions) options = null
save();
window.location.reload();
}

View file

@ -21,18 +21,7 @@ function resizeCanvas() {
drawTree();
}
var colors = {
default: {
1: "#ffffff",
2: "#bfbfbf",
3: "#7f7f7f",
},
aqua: {
1: "#bfdfff",
2: "#8fa7bf",
3: "#5f6f7f",
},
}
var colors_theme
function drawTree() {
@ -86,4 +75,4 @@ function drawTreeBranch(num1, data, prefix) { // taken from Antimatter Dimension
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
}
}

View file

@ -6,7 +6,7 @@ function getStartOptions() {
return {
autosave: true,
msDisplay: "always",
theme: null,
theme: "default",
hqTree: false,
offlineProd: true,
hideChallenges: false,

View file

@ -222,7 +222,7 @@ function loadOptions() {
options = Object.assign(getStartOptions(), JSON.parse(decodeURIComponent(escape(atob(get2)))));
else
options = getStartOptions()
if (themes.indexOf(options.theme) < 0) theme = "default"
}

View file

@ -1,29 +1,50 @@
// ************ Themes ************
const themes = {
1: "aqua"
};
const theme_names = {
aqua: "Aqua"
};
var themes = ["default", "aqua"]
var colors = {
default: {
1: "#ffffff",//Branch color 1
2: "#bfbfbf",//Branch color 2
3: "#7f7f7f",//Branch color 3
color: "#dfdfdf",
points: "#ffffff",
locked: "#bf8f8f",
background: "#0f0f0f",
background_tooltip: "rgba(0, 0, 0, 0.75)",
},
aqua: {
1: "#bfdfff",
2: "#8fa7bf",
3: "#5f6f7f",
color: "#bfdfff",
points: "#dfefff",
locked: "#c4a7b3",
background: "#001f3f",
background_tooltip: "rgba(0, 15, 31, 0.75)",
},
}
function changeTheme() {
let aqua = options.theme == "aqua";
colors_theme = colors[options.theme || "default"];
document.body.style.setProperty('--background', aqua ? "#001f3f" : "#0f0f0f");
document.body.style.setProperty('--background_tooltip', aqua ? "rgba(0, 15, 31, 0.75)" : "rgba(0, 0, 0, 0.75)");
document.body.style.setProperty('--color', aqua ? "#bfdfff" : "#dfdfdf");
document.body.style.setProperty('--points', aqua ? "#dfefff" : "#ffffff");
document.body.style.setProperty("--locked", aqua ? "#c4a7b3" : "#bf8f8f");
document.body.style.setProperty('--background', colors_theme["background"]);
document.body.style.setProperty('--background_tooltip', colors_theme["background_tooltip"]);
document.body.style.setProperty('--color', colors_theme["color"]);
document.body.style.setProperty('--points', colors_theme["points"]);
document.body.style.setProperty("--locked", colors_theme["locked"]);
}
function getThemeName() {
return options.theme ? theme_names[options.theme] : "Default";
return options.theme? options.theme : "default";
}
function switchTheme() {
if (options.theme === null)
options.theme = themes[1];
let index = themes.indexOf(options.theme)
if (options.theme === null || index >= themes.length-1 || index < 0) {
options.theme = themes[0];
}
else {
options.theme = themes[Object.keys(themes)[options.theme] + 1];
if (!options.theme)
options.theme = null;
index ++;
options.theme = themes[index];
options.theme = themes[1];
}
changeTheme();
resizeCanvas();