Dark mode support and much other stuff

This commit is contained in:
tobspr 2020-05-17 13:24:47 +02:00
parent 53386e1cd9
commit 68769cb7ef
35 changed files with 243 additions and 83 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -40,7 +40,7 @@
&.waitingForFinish { &.waitingForFinish {
.videoInner { .videoInner {
@include BorderRadius(4px); @include S(border-radius, $globalBorderRadius);
overflow: hidden; overflow: hidden;
&::after { &::after {
@ -74,7 +74,7 @@
.adInner { .adInner {
@include BoxShadow3D(lighten($mainBgColor, 15)); @include BoxShadow3D(lighten($mainBgColor, 15));
@include BorderRadius(4px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 15px); @include S(padding, 15px);
// max-width: 960px; // max-width: 960px;
display: block !important; display: block !important;

View File

@ -53,7 +53,7 @@
font-family: monospace; font-family: monospace;
text-align: left; text-align: left;
@include S(padding, 6px); @include S(padding, 6px);
@include BorderRadius(2px); @include S(border-radius, $globalBorderRadius);
@include BoxShadow3D(#eee); @include BoxShadow3D(#eee);
position: absolute; position: absolute;
@include S(bottom, 25px); @include S(bottom, 25px);

View File

@ -169,20 +169,26 @@ button {
box-sizing: content-box; box-sizing: content-box;
@include S(padding, 3px, 10px); @include S(padding, 3px, 10px);
@include IncreasedClickArea(10px); @include IncreasedClickArea(10px);
@include BorderRadius(4px);
@include TextShadow3D(#fff, $borderColor: #28292a); @include TextShadow3D(#fff, $borderColor: #28292a);
@include ButtonText; @include ButtonText;
@include Button3D($accentColorBright); border: 0;
border: #{D(1px)} solid rgba(0, 10, 20, 0.2); background: $colorBlueBright;
color: #fff;
// border: #{D(1px)} solid rgba(0, 10, 20, 0.2);
@include S(border-bottom-width, 2px); @include S(border-bottom-width, 2px);
color: $accentColorDark; // color: $accentColorDark;
letter-spacing: 0.05em !important; letter-spacing: 0.05em !important;
box-shadow: 0 #{D(1px)} #{D(2px)} 0 rgba(0, 10, 20, 0.2); // box-shadow: 0 #{D(1px)} #{D(2px)} 0 rgba(0, 10, 20, 0.2);
.keybinding { .keybinding {
@include S(bottom, -2.5px); @include S(bottom, -2.5px);
@include S(right, -2px); @include S(right, -2px);
} }
transition: opacity 0.12s ease-in-out;
&:hover {
opacity: 0.9;
}
} }
::selection { ::selection {
@ -210,7 +216,7 @@ input[type="email"] {
@include Text; @include Text;
@include IncreasedClickArea(15px); @include IncreasedClickArea(15px);
@include BorderRadius(4px); @include S(border-radius, $globalBorderRadius);
&::placeholder { &::placeholder {
color: #fff; color: #fff;
@ -307,7 +313,7 @@ canvas {
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
border-radius: 4px; // border-radius: 4px;
background: #cdd0d4; background: #cdd0d4;
} }
@ -407,7 +413,7 @@ canvas {
content: "Coming soon!"; content: "Coming soon!";
z-index: 10000; z-index: 10000;
background: rgba(lighten($mainBgColor, 0), 0.4); background: rgba(lighten($mainBgColor, 0), 0.4);
@include BorderRadius(4px); @include S(border-radius, $globalBorderRadius);
position: absolute; position: absolute;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -480,7 +486,7 @@ canvas {
bottom: 0; bottom: 0;
z-index: 1; z-index: 1;
@include BoxShadow3D($themeColor, $size: 1px); @include BoxShadow3D($themeColor, $size: 1px);
@include BorderRadius(4px); @include S(border-radius, $globalBorderRadius);
transform-origin: 0% 50%; transform-origin: 0% 50%;
@ -568,7 +574,7 @@ canvas {
text-transform: uppercase; text-transform: uppercase;
@include S(padding, 1.5px, 3px, 2px); @include S(padding, 1.5px, 3px, 2px);
@include PlainText; @include PlainText;
@include BorderRadius(2px); @include S(border-radius, $globalBorderRadius);
&, &,
> span { > span {
@include S(font-size, 9px); @include S(font-size, 9px);

View File

@ -6,7 +6,7 @@
display: grid; display: grid;
@include S(padding, 6px); @include S(padding, 6px);
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(width, 240px); @include S(width, 240px);
@include S(grid-column-gap, 5px); @include S(grid-column-gap, 5px);
@ -14,6 +14,10 @@
grid-template-columns: 1fr auto; grid-template-columns: 1fr auto;
grid-template-rows: auto 1fr; grid-template-rows: auto 1fr;
@include DarkThemeOverride {
background-color: #55585a;
}
.buildingLabel { .buildingLabel {
@include PlainText; @include PlainText;
@include S(margin-bottom, 2px); @include S(margin-bottom, 2px);
@ -54,7 +58,7 @@
@include S(width, 100px); @include S(width, 100px);
@include S(height, 100px); @include S(height, 100px);
background: top left / 100% 100% no-repeat; background: top left / 100% 100% no-repeat;
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
} }
@include StyleBelowWidth(700px) { @include StyleBelowWidth(700px) {
@ -77,10 +81,14 @@
.keybinding { .keybinding {
position: relative; position: relative;
} }
@include DarkThemeOverride {
color: rgba(#fff, 0.5);
}
} }
.variant { .variant {
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
background: rgba(0, 10, 20, 0.1); background: rgba(0, 10, 20, 0.1);
display: flex; display: flex;
position: relative; position: relative;

View File

@ -56,10 +56,10 @@
} }
} }
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
&.selected { &.selected {
background-color: rgba(74, 163, 223, 0.3) !important; background-color: rgba($colorBlueBright, 0.3) !important;
transform: scale(1.05); transform: scale(1.05);
.keybinding { .keybinding {
color: #111; color: #111;

View File

@ -21,6 +21,19 @@
} }
} }
@include DarkThemeOverride {
background: rgba(#33363d, 0.9);
@include InlineAnimation(0.12s ease-in-out) {
0% {
background-color: transparent;
opacity: 0.5;
}
100% {
background-color: rgba(#33363d, 0.9);
}
}
}
&.visible { &.visible {
.dialogInner { .dialogInner {
opacity: 1; opacity: 1;
@ -43,12 +56,16 @@
@include S(min-width, 300px); @include S(min-width, 300px);
max-width: calc(100vw - #{D(40px)}); max-width: calc(100vw - #{D(40px)});
max-height: calc(100vh - #{D(40px)}); max-height: calc(100vh - #{D(40px)});
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@include S(padding, 12px); @include S(padding, 12px);
pointer-events: all; pointer-events: all;
@include DarkThemeOverride {
background: #333438;
}
&.optionChooserDialog { &.optionChooserDialog {
.optionParent { .optionParent {
display: grid; display: grid;
@ -59,6 +76,16 @@
cursor: pointer; cursor: pointer;
@include S(padding, 10px); @include S(padding, 10px);
background: #eee; background: #eee;
transition: background-color 0.12s ease-in-out;
&:hover {
background-color: #e7e7e7;
}
&.active {
background-color: $colorBlueBright;
color: #fff;
}
} }
} }
} }
@ -72,6 +99,7 @@
grid-template-columns: 1fr auto; grid-template-columns: 1fr auto;
@include S(margin-bottom, 10px); @include S(margin-bottom, 10px);
@include DarkThemeInvert();
> .closeButton { > .closeButton {
opacity: 0.7; opacity: 0.7;
@include S(width, 20px); @include S(width, 20px);
@ -87,6 +115,7 @@
} }
> .content { > .content {
@include PlainText;
overflow-y: auto; overflow-y: auto;
pointer-events: all; pointer-events: all;
} }
@ -101,6 +130,11 @@
@include S(min-width, 60px); @include S(min-width, 60px);
@include S(padding, 5px, 15px); @include S(padding, 5px, 15px);
transition: opacity 0.12s ease-in-out;
&:hover {
opacity: 0.9;
}
&.good { &.good {
background-color: $colorGreenBright; background-color: $colorGreenBright;
color: #fff; color: #fff;

View File

@ -27,6 +27,8 @@
position: relative; position: relative;
@include IncreasedClickArea(0px); @include IncreasedClickArea(0px);
@include DarkThemeInvert;
&:hover { &:hover {
opacity: 0.8; opacity: 0.8;
} }
@ -79,7 +81,6 @@
border-color: rgba(0, 0, 0, 0.1); border-color: rgba(0, 0, 0, 0.1);
@include S(padding, 5px, 5px, 5px); @include S(padding, 5px, 5px, 5px);
border-radius: 0 0 #{D(4px)} #{D(4px)};
@include S(padding-left, 30px); @include S(padding-left, 30px);
@include S(margin-right, 3px); @include S(margin-right, 3px);
@include IncreasedClickArea(0px); @include IncreasedClickArea(0px);
@ -144,7 +145,7 @@
@include S(min-width, 5px); @include S(min-width, 5px);
@include S(height, 10px); @include S(height, 10px);
@include S(padding, 1px, 3px, 2px); @include S(padding, 1px, 3px, 2px);
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
border: #{D(1px)} solid #fff; border: #{D(1px)} solid #fff;
@include InlineAnimation(1s ease-in-out infinite) { @include InlineAnimation(1s ease-in-out infinite) {
50% { 50% {

View File

@ -4,7 +4,7 @@
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
background: rgba(lighten(#f77, 5), 0.95); background: rgba(lighten(#f77, 5), 0.95);
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 6px, 10px); @include S(padding, 6px, 10px);
@include SuperSmallText; @include SuperSmallText;
color: #fff; color: #fff;

View File

@ -5,13 +5,17 @@
.notification { .notification {
background: rgba(#333438, 0.8); background: rgba(#333438, 0.8);
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(margin-top, 3px); @include S(margin-top, 3px);
color: #fff; color: #fff;
@include SuperSmallText; @include SuperSmallText;
@include S(padding, 7px, 10px); @include S(padding, 7px, 10px);
@include S(width, 150px); @include S(width, 150px);
@include DarkThemeOverride {
background-color: rgba(#55595d, 0.8);
}
&[data-icon] { &[data-icon] {
@include S(background-position-x, 8px); @include S(background-position-x, 8px);
background-position-y: center; background-position-y: center;

View File

@ -41,6 +41,10 @@
flex-direction: row; flex-direction: row;
grid-column: 2 / 3; grid-column: 2 / 3;
@include S(height, 9px); @include S(height, 9px);
@include DarkThemeOverride {
color: #eee;
}
} }
> .goalLabel { > .goalLabel {
@ -68,6 +72,8 @@
@include S(top, -4px); @include S(top, -4px);
@include S(left, -4px); @include S(left, -4px);
background: uiResource("icons/current_goal_marker.png") center center / contain no-repeat; background: uiResource("icons/current_goal_marker.png") center center / contain no-repeat;
@include DarkThemeInvert;
} }
} }
} }

View File

@ -27,6 +27,6 @@
@include S(grid-gap, 10px); @include S(grid-gap, 10px);
background: rgba(0, 10, 20, 0.1); background: rgba(0, 10, 20, 0.1);
@include S(padding, 20px); @include S(padding, 20px);
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
} }
} }

View File

@ -9,7 +9,7 @@
display: grid; display: grid;
grid-template-columns: auto 1fr auto; grid-template-columns: auto 1fr auto;
background: #eee; background: #eee;
@include S(border-radius, 3px); @include S(border-radius, $globalBorderRadius);
@include S(margin-bottom, 4px); @include S(margin-bottom, 4px);
@include S(padding, 5px, 10px); @include S(padding, 5px, 10px);
@include S(grid-row-gap, 1px); @include S(grid-row-gap, 1px);
@ -20,6 +20,10 @@
margin-bottom: 0; margin-bottom: 0;
} }
@include DarkThemeOverride {
background: #55585a;
}
.title { .title {
grid-column: 1 / 3; grid-column: 1 / 3;
grid-row: 1 / 2; grid-row: 1 / 2;
@ -32,7 +36,7 @@
.tier { .tier {
@include S(margin-right, 9px); @include S(margin-right, 9px);
background: $colorGreenBright; background: $colorGreenBright;
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
text-transform: uppercase; text-transform: uppercase;
@include PlainText; @include PlainText;
color: #fff; color: #fff;
@ -160,19 +164,23 @@
background: #e2e4e6; background: #e2e4e6;
@include S(line-height, 13px); @include S(line-height, 13px);
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 1px, 2px, 2px); @include S(padding, 1px, 2px, 2px);
position: relative; position: relative;
text-align: center; text-align: center;
@include S(min-width, 50px); @include S(min-width, 50px);
overflow: hidden; overflow: hidden;
@include DarkThemeOverride {
background: #333438;
}
.progressBar { .progressBar {
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
top: 0; top: 0;
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
position: absolute; position: absolute;
display: inline-block; display: inline-block;
z-index: -1; z-index: -1;

View File

@ -80,10 +80,14 @@
> div { > div {
background: #f4f4f4; background: #f4f4f4;
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(margin-bottom, 4px); @include S(margin-bottom, 4px);
display: grid; display: grid;
@include DarkThemeOverride {
background: #222428;
}
grid-template-columns: 1fr auto; grid-template-columns: 1fr auto;
@include S(padding, 5px); @include S(padding, 5px);
&:last-child { &:last-child {
@ -100,7 +104,7 @@
.counter { .counter {
@include SuperSmallText; @include SuperSmallText;
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 0, 3px); @include S(padding, 0, 3px);
} }
} }

View File

@ -17,7 +17,7 @@
.dialog { .dialog {
background: rgba(#222428, 0.5); background: rgba(#222428, 0.5);
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 30px); @include S(padding, 30px);
@include InlineAnimation(0.5s ease-in-out) { @include InlineAnimation(0.5s ease-in-out) {
@ -54,7 +54,7 @@
@include S(padding, 1px, 6px); @include S(padding, 1px, 6px);
@include S(margin, 20px, 0, 20px); @include S(margin, 20px, 0, 20px);
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
@include InlineAnimation(0.5s ease-in-out) { @include InlineAnimation(0.5s ease-in-out) {
0% { 0% {
transform: translateY(-60vh); transform: translateY(-60vh);
@ -111,7 +111,7 @@
background-position: center center; background-position: center center;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
box-shadow: #{D(2px)} #{D(3px)} 0 0 rgba(0, 0, 0, 0.15); box-shadow: #{D(2px)} #{D(3px)} 0 0 rgba(0, 0, 0, 0.15);
} }
} }

View File

@ -6,4 +6,9 @@
bottom: 0; bottom: 0;
background: uiResource("vignette.lossless.png") center center / cover no-repeat; background: uiResource("vignette.lossless.png") center center / cover no-repeat;
pointer-events: none; pointer-events: none;
@include DarkThemeOverride {
// Too many artifacts
display: none;
}
} }

View File

@ -62,9 +62,9 @@ ingame_HUD_MassSelector,
ingame_HUD_BetaOverlay, ingame_HUD_BetaOverlay,
// Dialogs // Dialogs
ingame_HUD_UnlockNotification,
ingame_HUD_Shop, ingame_HUD_Shop,
ingame_HUD_Statistics, ingame_HUD_Statistics,
ingame_HUD_UnlockNotification,
ingame_HUD_SettingsMenu; ingame_HUD_SettingsMenu;
$zindex: 100; $zindex: 100;

View File

@ -348,3 +348,16 @@ button,
@content; @content;
} }
} }
@mixin DarkThemeOverride {
@at-root body[data-theme="dark"] &,
&[data-theme="dark"] {
@content;
}
}
@mixin DarkThemeInvert {
@include DarkThemeOverride {
filter: invert(1);
}
}

View File

@ -4,9 +4,26 @@
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
background: rgb(140, 165, 194) center center / cover !important; // background: #aaacb4 center center / cover !important;
background: #bbc2cf center center / cover !important;
.settingsButton {
position: absolute;
@include S(bottom, 30px);
@include S(right, 30px);
@include S(width, 35px);
@include S(height, 35px);
pointer-events: all;
cursor: pointer;
background: uiResource("icons/settings.png") center center / contain no-repeat;
transition: opacity 0.12s ease-in-out;
&:hover {
opacity: 0.9;
}
}
.fullscreenBackgroundVideo { .fullscreenBackgroundVideo {
// display: none !important;
z-index: -1; z-index: -1;
position: fixed; position: fixed;
right: 50%; right: 50%;
@ -45,7 +62,7 @@
.standaloneBanner { .standaloneBanner {
background: rgb(255, 225, 238); background: rgb(255, 225, 238);
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
@include S(padding, 15px); @include S(padding, 15px);
@ -125,7 +142,7 @@
@include PlainText; @include PlainText;
background: $colorRedBright; background: $colorRedBright;
@include S(padding, 10px); @include S(padding, 10px);
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
color: #fff; color: #fff;
@include S(margin-top, 10px); @include S(margin-top, 10px);
border: #{D(2px)} solid rgba(0, 10, 20, 0.1); border: #{D(2px)} solid rgba(0, 10, 20, 0.1);
@ -138,7 +155,7 @@
flex-direction: column; flex-direction: column;
background: #fafafa; background: #fafafa;
@include S(padding, 20px); @include S(padding, 20px);
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
// border: #{D(2px)} solid rgba(0, 10, 20, 0.1); // border: #{D(2px)} solid rgba(0, 10, 20, 0.1);
height: 100%; height: 100%;
width: 100%; width: 100%;
@ -149,7 +166,7 @@
background-color: $colorRedBright; background-color: $colorRedBright;
@include PlainText; @include PlainText;
color: #fff; color: #fff;
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 5px); @include S(padding, 5px);
} }
@ -158,9 +175,10 @@
@include S(width, 130px); @include S(width, 130px);
@include S(padding, 15px, 20px); @include S(padding, 15px, 20px);
letter-spacing: 0.3em !important; letter-spacing: 0.3em !important;
font-weight: bold;
color: #fff; color: #fff;
background-color: $colorGreenBright; background-color: $colorGreenBright;
text-shadow: #{D(1px)} #{D(2px)} 0 rgba(0, 0, 0, 0.1);
transition: transform 0.12s ease-in-out; transition: transform 0.12s ease-in-out;
&:hover { &:hover {
transform: scale(1.02); transform: scale(1.02);
@ -184,7 +202,7 @@
.savegame { .savegame {
background: #eee; background: #eee;
@include BorderRadius(4px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 5px); @include S(padding, 5px);
display: grid; display: grid;
grid-template-columns: 1fr auto auto; grid-template-columns: 1fr auto auto;
@ -259,7 +277,7 @@
background: #fafafa; background: #fafafa;
@include S(padding, 5px); @include S(padding, 5px);
@include S(padding-left, 10px); @include S(padding-left, 10px);
@include S(border-radius, 4px); @include S(border-radius, $globalBorderRadius);
@include S(margin-left, 10px); @include S(margin-left, 10px);
@include SuperSmallText(); @include SuperSmallText();

View File

@ -32,7 +32,7 @@
@include BoxShadow3D(#fff); @include BoxShadow3D(#fff);
@include S(padding, 15px); @include S(padding, 15px);
@include BorderRadius(4px); @include S(border-radius, $globalBorderRadius);
@include DropShadow; @include DropShadow;
.errorHeader { .errorHeader {

View File

@ -8,10 +8,23 @@
@include Heading; @include Heading;
} }
.versionbar {
@include S(margin-top, 20px);
@include SuperSmallText;
display: grid;
align-items: center;
grid-template-columns: 1fr auto;
.buildVersion {
display: flex;
flex-direction: column;
color: #aaadaf;
}
}
.setting { .setting {
@include S(padding, 10px); @include S(padding, 10px);
background: #eee; background: #eee;
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(margin-bottom, 5px); @include S(margin-bottom, 5px);
label { label {
@ -31,6 +44,15 @@
grid-template-columns: 1fr auto; grid-template-columns: 1fr auto;
} }
&.disabled {
opacity: 0.3;
pointer-events: none;
* {
pointer-events: none !important;
cursor: default !important;
}
}
.value.enum { .value.enum {
background: #fff; background: #fff;
@include PlainText; @include PlainText;
@ -40,7 +62,7 @@
cursor: pointer; cursor: pointer;
justify-content: center; justify-content: center;
@include S(min-width, 100px); @include S(min-width, 100px);
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 4px); @include S(padding, 4px);
@include S(padding-right, 15px); @include S(padding-right, 15px);

View File

@ -33,7 +33,7 @@
.content { .content {
background: #fff; background: #fff;
@include S(border-radius, 2px); @include S(border-radius, $globalBorderRadius);
@include S(padding, 10px); @include S(padding, 10px);
max-height: calc(80vh - #{D(60px)}); max-height: calc(80vh - #{D(60px)});
overflow-y: auto; overflow-y: auto;

View File

@ -31,6 +31,7 @@ $mainBgColor: #dee1ea;
$accentColorBright: #e1e4ed; $accentColorBright: #e1e4ed;
$accentColorDark: #7d808a; $accentColorDark: #7d808a;
$colorGreenBright: #66bb6a; $colorGreenBright: #66bb6a;
$colorBlueBright: rgb(74, 163, 223);
$colorRedBright: #ef5072; $colorRedBright: #ef5072;
$themeColor: #393747; $themeColor: #393747;
$ingameHudBg: rgba($accentColorBright, 0.1); $ingameHudBg: rgba($accentColorBright, 0.1);
@ -39,7 +40,7 @@ $ingameHudBorder: #{D(1.5px)} solid $accentColorDark;
$text3dColor: #f4ffff; $text3dColor: #f4ffff;
// Dialog properties // Dialog properties
$modalDialogBg: rgba(#666a73, 0.8); $modalDialogBg: rgba(160, 165, 180, 0.8);
$dialogBgColor: lighten($mainBgColor, 10); $dialogBgColor: lighten($mainBgColor, 10);
$lightFontWeight: normal; $lightFontWeight: normal;

View File

@ -76,8 +76,8 @@ export const globalConfig = {
debug: { debug: {
/* dev:start */ /* dev:start */
fastGameEnter: true, // fastGameEnter: true,
noArtificialDelays: true, // noArtificialDelays: true,
// disableSavegameWrite: true, // disableSavegameWrite: true,
showEntityBounds: false, showEntityBounds: false,
showAcceptorEjectors: false, showAcceptorEjectors: false,

View File

@ -88,8 +88,11 @@ export class HUDSettingsMenu extends BaseHUDPart {
// this.background.classList.add("visible"); // this.background.classList.add("visible");
this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever); this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever);
const totalSecondsPlayed = Math.ceil(this.root.time.now()); const totalMinutesPlayed = Math.ceil(this.root.time.now() / 60);
this.timePlayed.querySelector(".playtime").innerText = formatSeconds(totalSecondsPlayed); this.timePlayed.querySelector(".playtime").innerText = T.global.time.xMinutes.replace(
"<x>",
"" + totalMinutesPlayed
);
} }
close() { close() {

View File

@ -56,7 +56,7 @@ export class HUDStatistics extends BaseHUDPart {
this.dataSource = source; this.dataSource = source;
this.dialogInner.setAttribute("data-datasource", source); this.dialogInner.setAttribute("data-datasource", source);
this.sourceExplanation.innerText = T.ingame.statistics.dataSources[source].title; this.sourceExplanation.innerText = T.ingame.statistics.dataSources[source].description;
if (this.visible) { if (this.visible) {
this.rerenderFull(); this.rerenderFull();
} }

View File

@ -7,6 +7,7 @@ import { Math_max, Math_round } from "../core/builtins";
import { Rectangle } from "../core/rectangle"; import { Rectangle } from "../core/rectangle";
import { createLogger } from "../core/logging"; import { createLogger } from "../core/logging";
import { smoothenDpi } from "../core/dpi_manager"; import { smoothenDpi } from "../core/dpi_manager";
import { THEME } from "./theme";
const logger = createLogger("chunk"); const logger = createLogger("chunk");
const chunkSizePixels = globalConfig.mapChunkSize * globalConfig.tileSize; const chunkSizePixels = globalConfig.mapChunkSize * globalConfig.tileSize;
@ -119,9 +120,9 @@ export class MapChunkView extends MapChunk {
context.scale(bgDpi, bgDpi); context.scale(bgDpi, bgDpi);
} else { } else {
if (this.containedEntities.length > 0) { if (this.containedEntities.length > 0) {
context.fillStyle = "#c5ccd6"; context.fillStyle = THEME.map.chunkOverview.filled;
} else { } else {
context.fillStyle = "#a6afbb"; context.fillStyle = THEME.map.chunkOverview.empty;
} }
context.fillRect(0, 0, 10000, 10000); context.fillRect(0, 0, 10000, 10000);
} }

View File

@ -3,5 +3,8 @@ export const THEMES = {
light: require("./themes/light.json"), light: require("./themes/light.json"),
}; };
// TODO: Make themes customizable export let THEME = THEMES.light;
export const THEME = THEMES.light;
export function applyGameTheme(id) {
THEME = THEMES[id];
}

View File

@ -10,6 +10,10 @@
"red": "#4a3d3f", "red": "#4a3d3f",
"green": "#3e4a3d", "green": "#3e4a3d",
"blue": "#35384a" "blue": "#35384a"
},
"chunkOverview": {
"empty": "#444856",
"filled": "#646b7d"
} }
}, },

View File

@ -10,6 +10,11 @@
"red": "#ffbfc1", "red": "#ffbfc1",
"green": "#cbffc4", "green": "#cbffc4",
"blue": "#bfdaff" "blue": "#bfdaff"
},
"chunkOverview": {
"empty": "#a6afbb",
"filled": "c5ccd6"
} }
}, },

View File

@ -6,7 +6,7 @@ import { ReadWriteProxy } from "../core/read_write_proxy";
import { BoolSetting, EnumSetting, BaseSetting } from "./setting_types"; import { BoolSetting, EnumSetting, BaseSetting } from "./setting_types";
import { createLogger } from "../core/logging"; import { createLogger } from "../core/logging";
import { ExplainedResult } from "../core/explained_result"; import { ExplainedResult } from "../core/explained_result";
import { THEMES } from "../game/theme"; import { THEMES, THEME, applyGameTheme } from "../game/theme";
const logger = createLogger("application_settings"); const logger = createLogger("application_settings");
@ -68,26 +68,14 @@ export const allApplicationSettings = [
}, },
G_IS_STANDALONE G_IS_STANDALONE
), ),
new EnumSetting("theme", {
options: Object.keys(THEMES),
valueGetter: theme => theme,
textGetter: theme => theme.substr(0, 1).toUpperCase() + theme.substr(1),
category: categoryApp,
restartRequired: false,
changeCb:
/**
* @param {Application} app
*/
(app, id) => document.body.setAttribute("data-theme", id),
}),
new BoolSetting( new BoolSetting(
"soundsMuted", "soundsMuted",
categoryApp, categoryApp,
/** /**
* @param {Application} app * @param {Application} app
*/ */
(app, value) => app.sound.setSoundsMuted(value), (app, value) => app.sound.setSoundsMuted(value)
false
), ),
new BoolSetting( new BoolSetting(
"musicMuted", "musicMuted",
@ -95,11 +83,25 @@ export const allApplicationSettings = [
/** /**
* @param {Application} app * @param {Application} app
*/ */
(app, value) => app.sound.setMusicMuted(value), (app, value) => app.sound.setMusicMuted(value)
false
), ),
// GAME // GAME
new EnumSetting("theme", {
options: Object.keys(THEMES),
valueGetter: theme => theme,
textGetter: theme => theme.substr(0, 1).toUpperCase() + theme.substr(1),
category: categoryGame,
restartRequired: false,
changeCb:
/**
* @param {Application} app
*/
(app, id) => {
applyGameTheme(id);
document.body.setAttribute("data-theme", id);
},
}),
]; ];
export function getApplicationSettingById(id) { export function getApplicationSettingById(id) {

View File

@ -148,7 +148,10 @@ export class InGameState extends GameState {
* Goes back to the settings state * Goes back to the settings state
*/ */
goToSettings() { goToSettings() {
this.saveThenGoToState("SettingsState"); this.saveThenGoToState("SettingsState", {
backToStateId: this.key,
backToStatePayload: this.creationPayload,
});
} }
/** /**

View File

@ -32,6 +32,8 @@ export class MainMenuState extends GameState {
return ` return `
<button class="settingsButton"></button>
<video autoplay muted loop class="fullscreenBackgroundVideo"> <video autoplay muted loop class="fullscreenBackgroundVideo">
<source src="${cachebust("res/bg_render.webm")}" type="video/webm"> <source src="${cachebust("res/bg_render.webm")}" type="video/webm">
</video> </video>
@ -191,6 +193,7 @@ export class MainMenuState extends GameState {
}); });
} }
this.trackClicks(qs(".settingsButton"), this.onSettingsButtonClicked);
this.renderSavegames(); this.renderSavegames();
} }
@ -281,6 +284,10 @@ export class MainMenuState extends GameState {
}); });
} }
onSettingsButtonClicked() {
this.moveToState("SettingsState");
}
onPlayButtonClicked() { onPlayButtonClicked() {
const savegame = this.app.savegameMgr.createNewSavegame(); const savegame = this.app.savegameMgr.createNewSavegame();
@ -288,7 +295,7 @@ export class MainMenuState extends GameState {
if (G_IS_DEV) { if (G_IS_DEV) {
// TODO // TODO
this.moveToState("SettingsState"); // this.moveToState("SettingsState");
} }
this.moveToState("InGameState", { this.moveToState("InGameState", {

View File

@ -19,12 +19,12 @@ export class SettingsState extends TextualGameState {
${ ${
this.app.platformWrapper.getSupportsKeyboard() this.app.platformWrapper.getSupportsKeyboard()
? ` ? `
<button class="styledButton editKeybindings">KEYBINDING TODO</button> <button class="styledButton editKeybindings">Keybindings</button>
` `
: "" : ""
} }
<button class="styledButton changelog">CHANGELOG TODO</button> <button class="styledButton changelog">Changelog</button>
</div> </div>
@ -33,7 +33,7 @@ export class SettingsState extends TextualGameState {
${this.getSettingsHtml()} ${this.getSettingsHtml()}
<div class="versionbar"> <div class="versionbar">
<div class="buildVersion">${T.global.loading} ...</div> <div class="buildVersion">${T.global.loading} ...</div>
<button class="styledButton copyright">COPYRIGHT TODO</button> <button class="styledButton copyright">Copyright & Licenses</button>
</div> </div>

View File

@ -45,6 +45,8 @@ global:
minutesAndSecondsShort: <minutes>m <seconds>s minutesAndSecondsShort: <minutes>m <seconds>s
hoursAndMinutesShort: <hours>h <minutes>s hoursAndMinutesShort: <hours>h <minutes>s
xMinutes: <x> minutes
keys: keys:
tab: TAB tab: TAB
control: CTRL control: CTRL
@ -290,11 +292,6 @@ settings:
description: >- description: >-
It is recommended to play the game in fullscreen to get the best experience. Only available in the standalone. It is recommended to play the game in fullscreen to get the best experience. Only available in the standalone.
theme:
title: Interface theme
description: >-
Choose the interface theme which also affects the game. Notice that everything except the default theme may lead to graphical issues.
soundsMuted: soundsMuted:
title: Mute Sounds title: Mute Sounds
description: >- description: >-
@ -304,3 +301,8 @@ settings:
title: Mute Music title: Mute Music
description: >- description: >-
If enabled, mutes all music. If enabled, mutes all music.
theme:
title: Game theme
description: >-
Choose the game theme which mainly affects the map background. Notice that everything except the light theme may lead to graphical issues.