mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Show confirm dialog instead of notification
This commit is contained in:
parent
6a279923e3
commit
0ba4722be6
@ -13,7 +13,7 @@ import { T } from "../../../translations";
|
|||||||
import { KEYMAPPINGS } from "../../key_action_mapper";
|
import { KEYMAPPINGS } from "../../key_action_mapper";
|
||||||
import { THEME } from "../../theme";
|
import { THEME } from "../../theme";
|
||||||
import { enumHubGoalRewards } from "../../tutorial_goals";
|
import { enumHubGoalRewards } from "../../tutorial_goals";
|
||||||
import { enumNotificationType } from "./notifications";
|
import { Blueprint } from "../../blueprint";
|
||||||
|
|
||||||
const logger = createLogger("hud/mass_selector");
|
const logger = createLogger("hud/mass_selector");
|
||||||
|
|
||||||
@ -146,18 +146,10 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
if (this.selectedUids.size > 0) {
|
if (this.selectedUids.size > 0) {
|
||||||
const entityUids = Array.from(this.selectedUids);
|
const entityUids = Array.from(this.selectedUids);
|
||||||
|
|
||||||
|
const cutAction = () => {
|
||||||
// copy code relies on entities still existing, so must copy before deleting.
|
// copy code relies on entities still existing, so must copy before deleting.
|
||||||
this.root.hud.signals.buildingsSelectedForCopy.dispatch(entityUids);
|
this.root.hud.signals.buildingsSelectedForCopy.dispatch(entityUids);
|
||||||
|
|
||||||
let canPaste = false;
|
|
||||||
const placer = this.root.hud.parts.blueprintPlacer;
|
|
||||||
if (placer) {
|
|
||||||
const blueprint = placer.currentBlueprint.get();
|
|
||||||
if (blueprint) {
|
|
||||||
canPaste = blueprint.canAfford(this.root);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canPaste) {
|
|
||||||
for (let i = 0; i < entityUids.length; ++i) {
|
for (let i = 0; i < entityUids.length; ++i) {
|
||||||
const uid = entityUids[i];
|
const uid = entityUids[i];
|
||||||
const entity = this.root.entityMgr.findByUid(uid);
|
const entity = this.root.entityMgr.findByUid(uid);
|
||||||
@ -166,12 +158,18 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
this.selectedUids.delete(uid);
|
this.selectedUids.delete(uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const blueprint = Blueprint.fromUids(this.root, entityUids);
|
||||||
|
if (blueprint.canAfford(this.root)) {
|
||||||
|
cutAction();
|
||||||
} else {
|
} else {
|
||||||
this.selectedUids = new Set();
|
const { cancel, ok } = this.root.hud.parts.dialogs.showWarning(
|
||||||
this.root.hud.signals.notification.dispatch(
|
T.dialogs.massCutInsufficientConfirm.title,
|
||||||
T.ingame.notifications.massCutInsufficient,
|
T.dialogs.massCutInsufficientConfirm.desc,
|
||||||
enumNotificationType.success
|
["cancel:good:escape", "ok:bad:enter"]
|
||||||
);
|
);
|
||||||
|
ok.add(cutAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.root.soundProxy.playUiClick();
|
this.root.soundProxy.playUiClick();
|
||||||
|
@ -243,6 +243,11 @@ dialogs:
|
|||||||
desc: >-
|
desc: >-
|
||||||
You are cutting a lot of buildings (<count> to be exact)! Are you sure you want to do this?
|
You are cutting a lot of buildings (<count> to be exact)! Are you sure you want to do this?
|
||||||
|
|
||||||
|
massCutInsufficientConfirm:
|
||||||
|
title: Confirm cut
|
||||||
|
desc: >-
|
||||||
|
The cost for pasting is insufficient! Are you sure you want to do this?
|
||||||
|
|
||||||
blueprintsNotUnlocked:
|
blueprintsNotUnlocked:
|
||||||
title: Not unlocked yet
|
title: Not unlocked yet
|
||||||
desc: >-
|
desc: >-
|
||||||
@ -337,7 +342,6 @@ ingame:
|
|||||||
notifications:
|
notifications:
|
||||||
newUpgrade: A new upgrade is available!
|
newUpgrade: A new upgrade is available!
|
||||||
gameSaved: Your game has been saved.
|
gameSaved: Your game has been saved.
|
||||||
massCutInsufficient: The cost for pasting is insufficient!
|
|
||||||
|
|
||||||
# The "Upgrades" window
|
# The "Upgrades" window
|
||||||
shop:
|
shop:
|
||||||
|
@ -263,6 +263,11 @@ dialogs:
|
|||||||
desc: >-
|
desc: >-
|
||||||
多数の建造物をカットしようとしています! (<count> 個の選択) 続行しますか?
|
多数の建造物をカットしようとしています! (<count> 個の選択) 続行しますか?
|
||||||
|
|
||||||
|
massCutInsufficientConfirm:
|
||||||
|
title: カット確認
|
||||||
|
desc: >-
|
||||||
|
設置コストが不足しています! 続行しますか?
|
||||||
|
|
||||||
exportScreenshotWarning:
|
exportScreenshotWarning:
|
||||||
title: スクリーンショット出力
|
title: スクリーンショット出力
|
||||||
desc: >-
|
desc: >-
|
||||||
@ -325,7 +330,6 @@ ingame:
|
|||||||
notifications:
|
notifications:
|
||||||
newUpgrade: 新しいアップグレードが利用可能です!
|
newUpgrade: 新しいアップグレードが利用可能です!
|
||||||
gameSaved: ゲームをセーブしました。
|
gameSaved: ゲームをセーブしました。
|
||||||
massCutInsufficient: 設置コストが不足しています!
|
|
||||||
|
|
||||||
# The "Upgrades" window
|
# The "Upgrades" window
|
||||||
shop:
|
shop:
|
||||||
|
Loading…
Reference in New Issue
Block a user