1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Merge branch 'master' into cut-paste-blueprints

This commit is contained in:
hexagonhexagon
2020-06-11 18:05:44 -04:00
54 changed files with 4571 additions and 1612 deletions

View File

@@ -58,11 +58,20 @@
}
}
&:not(.placementActive) .binding.placementOnly {
&:not(.placementActive) .binding.placementOnly,
&.mapOverviewActive .binding.placementOnly {
display: none;
}
&.placementActive .noPlacementOnly {
&.placementActive:not(.mapOverviewActive) .noPlacementOnly {
display: none;
}
&:not(.mapOverviewActive) .binding.overviewOnly {
display: none;
}
&.mapOverviewActive .noOverviewOnly {
display: none;
}

View File

@@ -74,24 +74,39 @@
&.goal,
&.blueprint {
.amountLabel {
&::after {
content: " ";
position: absolute;
display: inline-block;
@include S(width, 8px);
@include S(height, 8px);
@include S(top, 4px);
@include S(left, -7px);
background: uiResource("icons/current_goal_marker.png") center center / contain no-repeat;
.amountLabel::after {
content: " ";
position: absolute;
display: inline-block;
@include S(width, 8px);
@include S(height, 8px);
@include S(top, 4px);
@include S(left, -7px);
background: center center / contain no-repeat;
}
@include DarkThemeInvert;
&.goal .amountLabel {
&::after {
background-image: uiResource("icons/current_goal_marker.png");
background-size: 90%;
}
@include DarkThemeOverride {
&::after {
background-image: uiResource("icons/current_goal_marker_inverted.png") !important;
}
}
}
&.blueprint .amountLabel::after {
background-image: uiResource("icons/blueprint_marker.png");
background-size: 90%;
&.blueprint .amountLabel {
&::after {
background-image: uiResource("icons/blueprint_marker.png");
background-size: 90%;
}
@include DarkThemeOverride {
&::after {
background-image: uiResource("icons/blueprint_marker_inverted.png") !important;
}
}
}
}
}

View File

@@ -46,7 +46,7 @@
color: #fff;
text-align: center;
font-weight: bold;
@include S(width, 50px);
@include S(min-width, 50px);
@include S(padding, 0px, 5px);
&[data-tier="0"] {

View File

@@ -29,7 +29,7 @@
display: flex;
align-items: center;
flex-direction: column;
max-height: 90vh;
max-height: 100vh;
color: #fff;
text-align: center;
@@ -55,7 +55,7 @@
.subTitle {
@include PlainText;
display: inline-block;
@include S(margin, 0px, 0, 20px);
@include S(margin, 5px, 0, 20px);
color: $colorGreenBright;
@include S(border-radius, $globalBorderRadius);

View File

@@ -79,7 +79,11 @@
@include S(grid-column-gap, 10px);
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-columns: 1fr;
&.demo {
grid-template-columns: 1fr 1fr;
}
.standaloneBanner {
background: rgb(255, 234, 245);

View File

@@ -1,9 +1,22 @@
export const CHANGELOG = [
// {
// version: "1.1.10",
// date: "unreleased",
// entries: [
// "Add and update more translations (Big thank you to all translators!)",
// "Prevent invalid connection if existing underground tunnel entrance exists (by jaysc)",
// ],
// },
{
version: "1.1.9",
date: "unreleased",
date: "11.06.2020",
entries: [
"Support for translations! Interested in helping out? Check out the <a target='_blank' href='https://github.com/tobspr/shapez.io/tree/master/translations'>translation guide</a>!",
"Update stacker artwork to clarify how it works",
"Update keybinding hints on the top left to be more accurate",
"Make it more clear when blueprints are unlocked when trying to use them",
"Fix pinned shape icons not being visible in dark mode",
"Fix being able to select buildings via hotkeys in map overview mode",
"Make shapes unpinnable in the upgrades tab (By hexy)",
],
},

View File

@@ -175,6 +175,8 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
rotationVariant: 0,
connectedEntities: [contents],
};
} else {
break;
}
}
}

View File

@@ -151,6 +151,11 @@ export class HUDBuildingsToolbar extends BaseHUDPart {
return;
}
if (this.root.camera.getIsMapOverlayActive()) {
this.root.soundProxy.playUiError();
return;
}
// Allow clicking an item again to deselect it
for (const buildingId in this.buildingHandles) {
const handle = this.buildingHandles[buildingId];

View File

@@ -2,6 +2,7 @@ import { makeDiv } from "../../../core/utils";
import { T } from "../../../translations";
import { getStringForKeyCode, KEYMAPPINGS } from "../../key_action_mapper";
import { BaseHUDPart } from "../base_hud_part";
import { TrackedState } from "../../../core/tracked_state";
export class HUDKeybindingOverlay extends BaseHUDPart {
initialize() {
@@ -9,6 +10,8 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
this.onSelectedBuildingForPlacementChanged,
this
);
this.trackedMapOverviewActive = new TrackedState(this.applyCssClasses, this);
}
createElements(parent) {
@@ -35,11 +38,17 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
<div class="binding noPlacementOnly">
<div class="binding noPlacementOnly noOverviewOnly">
<code class="keybinding rightMouse"></code>
<label>${T.ingame.keybindingsOverlay.delete}</label>
</div>
<div class="binding noPlacementOnly overviewOnly">
<code class="keybinding rightMouse"></code>
<label>${T.ingame.keybindingsOverlay.createMarker}</label>
</div>
<div class="binding noPlacementOnly">
<code class="keybinding builtinKey">${getKeycode(
KEYMAPPINGS.massSelect.massSelectStart
@@ -70,12 +79,17 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
<label>${T.ingame.keybindingsOverlay.rotateBuilding}</label>
</div>
` +
(this.root.app.settings.getAllSettings().alwaysMultiplace
? ""
: `
<div class="binding placementOnly">
<code class="keybinding builtinKey shift">${getKeycode(
KEYMAPPINGS.placementModifiers.placeMultiple
)}</code>
<label>${T.ingame.keybindingsOverlay.placeMultiple}</label>
</div>
</div>`) +
`
`
);
}
@@ -84,5 +98,11 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
this.element.classList.toggle("placementActive", !!selectedMetaBuilding);
}
update() {}
applyCssClasses() {
this.element.classList.toggle("mapOverviewActive", this.root.camera.getIsMapOverlayActive());
}
update() {
this.trackedMapOverviewActive.set(this.root.camera.getIsMapOverlayActive());
}
}

View File

@@ -98,7 +98,9 @@ export class HUDShop extends BaseHUDPart {
// Set description
handle.elemDescription.innerText = T.shopUpgrades[upgradeId].description
.replace("<currentMult>", currentTierMultiplier.toString())
.replace("<newMult>", (currentTierMultiplier + tierHandle.improvement).toString());
.replace("<newMult>", (currentTierMultiplier + tierHandle.improvement).toString())
// Backwards compatibility
.replace("<gain>", (tierHandle.improvement * 100.0).toString());
tierHandle.required.forEach(({ shape, amount }) => {
const container = makeDiv(handle.elemRequirements, null, ["requirement"]);

View File

@@ -74,9 +74,7 @@ export class HubSystem extends GameSystemWithFilter {
context.fillText("" + formatBigNumber(delivered), pos.x + textOffsetX, pos.y + textOffsetY);
// Required
context.font = "13px GameFont";
context.fillStyle = "#a4a6b0";
context.fillText(
"/ " + formatBigNumber(goals.required),
@@ -85,16 +83,33 @@ export class HubSystem extends GameSystemWithFilter {
);
// Reward
context.font = "bold 11px GameFont";
const rewardText = T.storyRewards[goals.reward].title.toUpperCase();
if (rewardText.length > 12) {
context.font = "bold 9px GameFont";
} else {
context.font = "bold 11px GameFont";
}
context.fillStyle = "#fd0752";
context.textAlign = "center";
context.fillText(T.storyRewards[goals.reward].title.toUpperCase(), pos.x, pos.y + 46);
context.fillText(rewardText, pos.x, pos.y + 46);
// Level
context.font = "bold 11px GameFont";
context.fillStyle = "#fff";
context.fillText("" + this.root.hubGoals.level, pos.x - 42, pos.y - 36);
// Texts
context.textAlign = "center";
context.fillStyle = "#fff";
context.font = "bold 7px GameFont";
context.fillText(T.buildings.hub.levelShortcut, pos.x - 42, pos.y - 47);
context.fillStyle = "#64666e";
context.font = "bold 11px GameFont";
context.fillText(T.buildings.hub.deliver.toUpperCase(), pos.x, pos.y - 40);
context.fillText(T.buildings.hub.toUnlock.toUpperCase(), pos.x, pos.y + 30);
context.textAlign = "left";
}
}

View File

@@ -26,4 +26,28 @@ export const LANGUAGES = {
code: "pt",
region: "BR",
},
"cs": {
name: "Čeština",
data: require("./built-temp/base-cz.json"),
code: "cs",
region: "",
},
"es-419": {
name: "Español (Latinoamérica)",
data: require("./built-temp/base-es.json"),
code: "es",
region: "419",
},
"pl": {
name: "Polski",
data: require("./built-temp/base-pl.json"),
code: "pl",
region: "",
},
"ru": {
name: "Русский",
data: require("./built-temp/base-ru.json"),
code: "ru",
region: "",
},
};

View File

@@ -134,7 +134,7 @@ export const allApplicationSettings = [
new EnumSetting("theme", {
options: Object.keys(THEMES),
valueGetter: theme => theme,
textGetter: theme => theme.substr(0, 1).toUpperCase() + theme.substr(1),
textGetter: theme => T.settings.labels.theme.themes[theme],
category: categoryGame,
restartRequired: false,
changeCb:

View File

@@ -20,7 +20,7 @@ export class AboutState extends TextualGameState {
<br><br>
If you want to contribute, check out <a href="${THIRDPARTY_URLS.github}" target="_blank">shapez.io on github</a>.
<br><br>
This game wouldn't have been possible without the great discord community arround my games - You should really join the <a href="${THIRDPARTY_URLS.discord}" target="_blank">discord server</a>!
This game wouldn't have been possible without the great discord community around my games - You should really join the <a href="${THIRDPARTY_URLS.discord}" target="_blank">discord server</a>!
<br><br>
The soundtrack was made by <a href="https://soundcloud.com/pettersumelius" target="_blank">Peppsen</a> - He's awesome.
<br><br>

View File

@@ -29,8 +29,7 @@ export class MainMenuState extends GameState {
<a href="#" class="steamLink" target="_blank">Get the shapez.io standalone!</a>
`;
return (
`
return `
<div class="topButtons">
<button class="languageChoose" data-languageicon="${this.app.settings.getLanguage()}"></button>
@@ -63,20 +62,6 @@ export class MainMenuState extends GameState {
<div class="sideContainer">
${IS_DEMO ? `<div class="standaloneBanner">${bannerHtml}</div>` : ""}
<div class="contest">
<h3>${T.mainMenu.contests.contest_01_03062020.title}</h3>
` +
/*<p>${T.mainMenu.contests.contest_01_03062020.desc}</p>
<button class="styledButton participateContest">${
T.mainMenu.contests.showInfo
}</button>*/
`
<p>${T.mainMenu.contests.contestOver}</p>
</div>
</div>
<div class="mainContainer">
@@ -111,8 +96,7 @@ export class MainMenuState extends GameState {
<div class="author">Made by <a class="producerLink" target="_blank">Tobias Springer</a></div>
</div>
`
);
`;
}
requestImportSavegame() {

View File

@@ -68,38 +68,6 @@ export class PreloadState extends GameState {
startLoading() {
this.setStatus("Booting")
.then(() => this.setStatus("Checking for updates"))
.then(() => {
if (G_IS_STANDALONE) {
return Promise.race([
new Promise(resolve => setTimeout(resolve, 10000)),
fetch(
"https://itch.io/api/1/x/wharf/latest?target=tobspr/shapezio&channel_name=windows",
{
cache: "no-cache",
}
)
.then(res => res.json())
.then(({ latest }) => {
if (latest !== G_BUILD_VERSION) {
const { ok } = this.dialogs.showInfo(
T.dialogs.newUpdate.title,
T.dialogs.newUpdate.desc,
["ok:good"]
);
return new Promise(resolve => {
ok.add(resolve);
});
}
})
.catch(err => {
logger.log("Failed to fetch version:", err);
}),
]);
}
})
.then(() => this.setStatus("Creating platform wrapper"))
.then(() => this.app.platformWrapper.initialize())

View File

@@ -93,7 +93,9 @@ export function autoDetectLanguageId() {
return trans;
}
}
return null;
// Fallback
return "en";
}
function matchDataRecursive(dest, src) {