mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Fixed achievement ingame empty space
This commit is contained in:
parent
db8cd2cd77
commit
e5dfa08212
@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
backdrop-filter: blur(D(1px));
|
backdrop-filter: blur(D(1px));
|
||||||
|
|
||||||
|
.stats ~ .achievements {
|
||||||
|
grid-column: 1;
|
||||||
|
}
|
||||||
|
|
||||||
> button,
|
> button,
|
||||||
> .button {
|
> .button {
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
@ -38,7 +42,7 @@
|
|||||||
@include DarkThemeInvert;
|
@include DarkThemeInvert;
|
||||||
|
|
||||||
&.achievements {
|
&.achievements {
|
||||||
grid-column: 1;
|
grid-column: 3;
|
||||||
& {
|
& {
|
||||||
/* @load-async */
|
/* @load-async */
|
||||||
background-image: uiResource("icons/achievements.png");
|
background-image: uiResource("icons/achievements.png");
|
||||||
|
@ -18,8 +18,13 @@ export class DynamicDomAttach {
|
|||||||
* @param {string=} param2.attachClass If set, attaches a class while the element is visible
|
* @param {string=} param2.attachClass If set, attaches a class while the element is visible
|
||||||
* @param {boolean=} param2.trackHover If set, attaches the 'hovered' class if the cursor is above the element. Useful
|
* @param {boolean=} param2.trackHover If set, attaches the 'hovered' class if the cursor is above the element. Useful
|
||||||
* for fading out the element if its below the cursor for example.
|
* for fading out the element if its below the cursor for example.
|
||||||
|
* @param {boolean=} param2.prepend If set, adds the element before other childs
|
||||||
*/
|
*/
|
||||||
constructor(root, element, { timeToKeepSeconds = 0, attachClass = null, trackHover = false } = {}) {
|
constructor(
|
||||||
|
root,
|
||||||
|
element,
|
||||||
|
{ timeToKeepSeconds = 0, attachClass = null, trackHover = false, prepend = false } = {}
|
||||||
|
) {
|
||||||
/** @type {GameRoot} */
|
/** @type {GameRoot} */
|
||||||
this.root = root;
|
this.root = root;
|
||||||
|
|
||||||
@ -34,6 +39,8 @@ export class DynamicDomAttach {
|
|||||||
this.timeToKeepSeconds = timeToKeepSeconds;
|
this.timeToKeepSeconds = timeToKeepSeconds;
|
||||||
this.lastVisibleTime = 0;
|
this.lastVisibleTime = 0;
|
||||||
|
|
||||||
|
this.prepend = prepend;
|
||||||
|
|
||||||
// We start attached, so detach the node first
|
// We start attached, so detach the node first
|
||||||
this.attached = true;
|
this.attached = true;
|
||||||
this.internalDetach();
|
this.internalDetach();
|
||||||
@ -55,7 +62,8 @@ export class DynamicDomAttach {
|
|||||||
*/
|
*/
|
||||||
internalAttach() {
|
internalAttach() {
|
||||||
if (!this.attached) {
|
if (!this.attached) {
|
||||||
this.parent.appendChild(this.element);
|
if (this.prepend) this.parent.insertBefore(this.element, this.parent.firstChild);
|
||||||
|
else this.parent.appendChild(this.element);
|
||||||
assert(this.element.parentElement === this.parent, "Invalid parent #1");
|
assert(this.element.parentElement === this.parent, "Invalid parent #1");
|
||||||
this.attached = true;
|
this.attached = true;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ export class HUDGameMenu extends BaseHUDPart {
|
|||||||
]),
|
]),
|
||||||
visible: () =>
|
visible: () =>
|
||||||
!this.root.app.settings.getAllSettings().offerHints || this.root.hubGoals.level >= 3,
|
!this.root.app.settings.getAllSettings().offerHints || this.root.hubGoals.level >= 3,
|
||||||
|
domAttachSettings: {},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "stats",
|
id: "stats",
|
||||||
@ -33,6 +34,7 @@ export class HUDGameMenu extends BaseHUDPart {
|
|||||||
keybinding: KEYMAPPINGS.ingame.menuOpenStats,
|
keybinding: KEYMAPPINGS.ingame.menuOpenStats,
|
||||||
visible: () =>
|
visible: () =>
|
||||||
!this.root.app.settings.getAllSettings().offerHints || this.root.hubGoals.level >= 3,
|
!this.root.app.settings.getAllSettings().offerHints || this.root.hubGoals.level >= 3,
|
||||||
|
domAttachSettings: { prepend: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "achievements",
|
id: "achievements",
|
||||||
@ -40,6 +42,7 @@ export class HUDGameMenu extends BaseHUDPart {
|
|||||||
handler: () => this.root.hud.parts.achievements.show(),
|
handler: () => this.root.hud.parts.achievements.show(),
|
||||||
keybinding: KEYMAPPINGS.ingame.menuOpenAchievements,
|
keybinding: KEYMAPPINGS.ingame.menuOpenAchievements,
|
||||||
visible: () => !(this.root.achievementProxy.provider instanceof NoAchievementProvider),
|
visible: () => !(this.root.achievementProxy.provider instanceof NoAchievementProvider),
|
||||||
|
domAttachSettings: {},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -60,7 +63,8 @@ export class HUDGameMenu extends BaseHUDPart {
|
|||||||
* }>} */
|
* }>} */
|
||||||
this.visibilityToUpdate = [];
|
this.visibilityToUpdate = [];
|
||||||
|
|
||||||
buttons.forEach(({ id, label, handler, keybinding, badge, notification, visible }) => {
|
buttons.forEach(
|
||||||
|
({ id, label, handler, keybinding, badge, notification, visible, domAttachSettings }) => {
|
||||||
const button = document.createElement("button");
|
const button = document.createElement("button");
|
||||||
button.classList.add(id);
|
button.classList.add(id);
|
||||||
this.element.appendChild(button);
|
this.element.appendChild(button);
|
||||||
@ -75,7 +79,7 @@ export class HUDGameMenu extends BaseHUDPart {
|
|||||||
this.visibilityToUpdate.push({
|
this.visibilityToUpdate.push({
|
||||||
button,
|
button,
|
||||||
condition: visible,
|
condition: visible,
|
||||||
domAttach: new DynamicDomAttach(this.root, button),
|
domAttach: new DynamicDomAttach(this.root, button, domAttachSettings),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +94,8 @@ export class HUDGameMenu extends BaseHUDPart {
|
|||||||
condition: visible,
|
condition: visible,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.saveButton = makeDiv(this.element, null, ["button", "save", "animEven"]);
|
this.saveButton = makeDiv(this.element, null, ["button", "save", "animEven"]);
|
||||||
this.settingsButton = makeDiv(this.element, null, ["button", "settings"]);
|
this.settingsButton = makeDiv(this.element, null, ["button", "settings"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user