Reuse auction controls for pending bids and distinguish phase actions
This commit is contained in:
parent
26c4e5c245
commit
126de02ea2
25 changed files with 335 additions and 90 deletions
|
|
@ -1,3 +1,11 @@
|
|||
module.exports = {
|
||||
presets: ['@vue/cli-plugin-babel/preset'],
|
||||
// Webpack 4 cannot parse these forms even when modern browsers support them.
|
||||
presets: [
|
||||
[
|
||||
'@vue/cli-plugin-babel/preset',
|
||||
{
|
||||
include: ['@babel/plugin-transform-numeric-separator', '@babel/plugin-transform-export-namespace-from'],
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "powergrid-viewer",
|
||||
"version": "2.3.4",
|
||||
"version": "2.3.5",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/boardgamers/powergrid.git",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
|
|||
|
||||
@Component({
|
||||
created(this: Calculator) {
|
||||
this.value = this.minValue;
|
||||
this.value = Math.min(this.maxValue, Math.max(this.minValue, this.initialValue ?? this.minValue));
|
||||
},
|
||||
})
|
||||
export default class Calculator extends Vue {
|
||||
|
|
@ -32,6 +32,8 @@ export default class Calculator extends Vue {
|
|||
@Prop()
|
||||
maxValue;
|
||||
|
||||
@Prop() initialValue?: number;
|
||||
|
||||
value: number = 0;
|
||||
|
||||
// The legal floor can rise while the calculator is open (e.g. a rival bid in a
|
||||
|
|
|
|||
|
|
@ -4,29 +4,6 @@
|
|||
<div class="statusBar">
|
||||
<span class="status-message">{{ getStatusMessage() }}</span>
|
||||
</div>
|
||||
<div v-if="revisableBid || canChangePowering" class="choice-revision">
|
||||
<template v-if="revisableBid">
|
||||
<form v-if="editingBid === revisableBid" @submit.prevent="replaceBid(false)">
|
||||
<label
|
||||
>Your bid
|
||||
<input
|
||||
v-model.number="replacementBid"
|
||||
type="number"
|
||||
:min="revisionBids[0]"
|
||||
:max="revisionBids[revisionBids.length - 1]"
|
||||
step="1"
|
||||
required
|
||||
/></label>
|
||||
<button type="submit" :disabled="!revisionBids.includes(replacementBid)">Save bid</button>
|
||||
<button v-if="player !== G.auctioningPlayer" type="button" @click="replaceBid(true)">
|
||||
Pass
|
||||
</button>
|
||||
<button type="button" @click="editingBid = null">Cancel</button>
|
||||
</form>
|
||||
<button v-else type="button" @click="editBid">Change bid</button>
|
||||
</template>
|
||||
<button v-if="canChangePowering" type="button" @click="reopenPowering">Change powered plants</button>
|
||||
</div>
|
||||
<RoundPlanner
|
||||
v-if="!tutorialMove && !paused && hasPlanPanel"
|
||||
:plan="roundPlan"
|
||||
|
|
@ -195,7 +172,9 @@
|
|||
:canChoose="canChoose()"
|
||||
:chooseablePowerPlants="getChooseablePowerPlants()"
|
||||
:cardsLeft="G.cardsLeft"
|
||||
:minBid="G.currentBid + 1 || G.minimunBid"
|
||||
:minBid="changingBid ? revisionBids[0] : G.currentBid + 1 || G.minimunBid"
|
||||
:initialBid="changingBid ? replacementBid : undefined"
|
||||
:editingBid="changingBid"
|
||||
:maxBid="G.players[player] ? G.players[player].money : 0"
|
||||
:nextCardWeak="G.nextCardWeak"
|
||||
:plantDiscountActive="G.plantDiscountActive"
|
||||
|
|
@ -476,16 +455,18 @@
|
|||
>
|
||||
<PassButton
|
||||
transform="translate(15, 15)"
|
||||
:enabled="canPass()"
|
||||
:highlightButton="canPass()"
|
||||
:text="tutorialMove || roundPlan || canUndo() ? 'Done' : 'Pass'"
|
||||
@click="checkPass()"
|
||||
:enabled="canUsePhaseButton"
|
||||
:highlightButton="canUsePhaseButton"
|
||||
:text="phaseButtonText"
|
||||
:icon="phaseButtonIcon"
|
||||
@click="usePhaseButton"
|
||||
/>
|
||||
<UndoButton
|
||||
transform="translate(15, 56)"
|
||||
:enabled="canUndo()"
|
||||
:highlightButton="canUndo()"
|
||||
@click="undo()"
|
||||
:enabled="changingBid || canUndo()"
|
||||
:highlightButton="changingBid || canUndo()"
|
||||
:text="changingBid ? 'Cancel bid edit' : 'Undo last move'"
|
||||
@click="changingBid ? (editingBid = null) : undo()"
|
||||
/>
|
||||
<BoardOption
|
||||
transform="translate(15, 97)"
|
||||
|
|
@ -1277,6 +1258,9 @@ export default class Game extends Vue {
|
|||
? bidRevision(this.G, this.player)
|
||||
: undefined;
|
||||
}
|
||||
get changingBid(): boolean {
|
||||
return !!this.editingBid && this.editingBid === this.revisableBid;
|
||||
}
|
||||
get revisionBids(): number[] {
|
||||
return this.revisableBid ? availableMoves(this.G!, this.G!.players[this.player!])[MoveName.Bid] || [] : [];
|
||||
}
|
||||
|
|
@ -1311,6 +1295,40 @@ export default class Game extends Vue {
|
|||
]);
|
||||
this.editingBid = null;
|
||||
}
|
||||
get canUsePhaseButton(): boolean {
|
||||
if (this.changingBid) return this.player !== this.G!.auctioningPlayer;
|
||||
return !!this.revisableBid || this.canChangePowering || this.canPass();
|
||||
}
|
||||
get phaseButtonText(): string {
|
||||
if (this.changingBid) return 'Pass bid';
|
||||
if (this.revisableBid) return 'Edit bid';
|
||||
if (this.canChangePowering) return 'Edit powering';
|
||||
if (this.tutorialMove || this.roundPlan) return 'Done';
|
||||
switch (this.G?.phase) {
|
||||
case Phase.Auction: return this.G?.chosenPowerPlant ? 'Pass bid' : 'Skip auction';
|
||||
case Phase.Resources: return 'Finish buying';
|
||||
case Phase.Building: return 'Finish building';
|
||||
case Phase.Bureaucracy: return 'Finish powering';
|
||||
default: return 'Done';
|
||||
}
|
||||
}
|
||||
get phaseButtonIcon(): string {
|
||||
if (this.revisableBid && !this.changingBid || this.canChangePowering) return 'edit';
|
||||
switch (this.G?.phase) {
|
||||
case Phase.Auction: return 'auction';
|
||||
case Phase.Resources: return 'resources';
|
||||
case Phase.Building: return 'building';
|
||||
case Phase.Bureaucracy: return 'powering';
|
||||
default: return 'done';
|
||||
}
|
||||
}
|
||||
usePhaseButton() {
|
||||
if (!this.canUsePhaseButton) return;
|
||||
if (this.changingBid) this.replaceBid(true);
|
||||
else if (this.revisableBid) this.editBid();
|
||||
else if (this.canChangePowering) this.reopenPowering();
|
||||
else this.checkPass();
|
||||
}
|
||||
reopenPowering() {
|
||||
if (this.canChangePowering)
|
||||
this.emitter.emit('move', [{ name: MoveName.ReopenPowering, data: this.G!.round, time: Date.now() }]);
|
||||
|
|
@ -1859,6 +1877,11 @@ export default class Game extends Vue {
|
|||
}
|
||||
|
||||
bid(bid: number) {
|
||||
if (this.changingBid) {
|
||||
this.replacementBid = bid;
|
||||
this.replaceBid(false);
|
||||
return;
|
||||
}
|
||||
this.sendMove({ name: MoveName.Bid, data: bid });
|
||||
}
|
||||
|
||||
|
|
@ -2279,6 +2302,7 @@ export default class Game extends Vue {
|
|||
}
|
||||
|
||||
canBid() {
|
||||
if (this.changingBid) return this.revisionBids.length > 0;
|
||||
if (!this.canMove()) return false;
|
||||
|
||||
const currentPlayer = this.G!.players[this.player!];
|
||||
|
|
@ -3121,38 +3145,6 @@ export default class Game extends Vue {
|
|||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.choice-revision {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
padding: 0.4rem 0.8rem;
|
||||
}
|
||||
.choice-revision form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.choice-revision button,
|
||||
.choice-revision input {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
background: var(--pg-panel-bg, #f5f1e5);
|
||||
border: 1px solid currentColor;
|
||||
border-radius: 0.4rem;
|
||||
padding: 0.35rem 0.65rem;
|
||||
}
|
||||
.choice-revision button {
|
||||
cursor: pointer;
|
||||
}
|
||||
.choice-revision input {
|
||||
width: 6rem;
|
||||
}
|
||||
.choice-revision button:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-block-start: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,11 @@
|
|||
instance would keep displaying the previous auction's bid floor. -->
|
||||
<Calculator
|
||||
v-if="canBid"
|
||||
:key="'calc' + chosenPowerPlant.powerPlant.number"
|
||||
:key="'calc' + chosenPowerPlant.powerPlant.number + (editingBid ? '-edit' : '')"
|
||||
:transform="`translate(${actualMarketWidth}, 80)`"
|
||||
:minValue="minBid"
|
||||
:maxValue="maxBid"
|
||||
:initialValue="initialBid"
|
||||
@bid="bid($event)"
|
||||
/>
|
||||
</template>
|
||||
|
|
@ -94,6 +95,8 @@ export default class PowerPlantMarket extends Vue {
|
|||
@Prop() chooseablePowerPlants?: number[];
|
||||
@Prop() minBid?: number;
|
||||
@Prop() maxBid?: number;
|
||||
@Prop() initialBid?: number;
|
||||
@Prop() editingBid?: boolean;
|
||||
|
||||
@Inject() preferences!: Preferences;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:class="['button', { enabled, highlightButton }]"
|
||||
data-board-control="pass"
|
||||
role="button"
|
||||
:aria-label="text === 'Done' ? 'Done' : 'Pass turn'"
|
||||
:aria-label="text"
|
||||
:tabindex="enabled ? 0 : -1"
|
||||
:aria-disabled="!enabled"
|
||||
@click="enabled && $emit('click')"
|
||||
|
|
@ -11,17 +11,39 @@
|
|||
@keydown.space.prevent="enabled && $emit('click')"
|
||||
>
|
||||
<rect width="80" height="26" fill="gainsboro" stroke="black" rx="2" />
|
||||
<image x="30" y="3" width="20" height="20" href="../../icons/pass.svg" aria-hidden="true" />
|
||||
<title>{{ text === 'Done' ? 'Done' : 'Pass turn' }}</title>
|
||||
<path
|
||||
:d="iconPath"
|
||||
transform="translate(30, 4)"
|
||||
fill="none"
|
||||
stroke="black"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<title>{{ text }}</title>
|
||||
</g>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Inject } from 'vue-property-decorator';
|
||||
import { Vue, Component, Prop } from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class PassButton extends Vue {
|
||||
@Prop() enabled!: boolean;
|
||||
@Prop() highlightButton!: boolean;
|
||||
@Prop() text!: string;
|
||||
@Prop({ default: 'done' }) icon!: string;
|
||||
|
||||
get iconPath(): string {
|
||||
const paths: Record<string, string> = {
|
||||
auction: 'M2 4L6 0L12 6L8 10Z M9 7L16 14 M0 16H10',
|
||||
resources: 'M1 6H16L14 16H3Z M5 6L8 0L12 6',
|
||||
building: 'M0 7L8 0L16 7 M2 6V16H14V6 M6 16V10H10V16',
|
||||
powering: 'M10 0L2 10H8L6 17L15 6H9Z',
|
||||
edit: 'M2 11L12 1L16 5L6 15L1 16Z M10 3L14 7',
|
||||
done: 'M1 9L6 14L16 2',
|
||||
};
|
||||
return paths[this.icon] || paths.done;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:class="['button', { enabled, highlightButton }]"
|
||||
data-board-control="undo"
|
||||
role="button"
|
||||
aria-label="Undo last move"
|
||||
:aria-label="text"
|
||||
:tabindex="enabled ? 0 : -1"
|
||||
:aria-disabled="!enabled"
|
||||
@click="enabled && $emit('click')"
|
||||
|
|
@ -11,8 +11,24 @@
|
|||
@keydown.space.prevent="enabled && $emit('click')"
|
||||
>
|
||||
<rect width="80" height="26" fill="gainsboro" stroke="black" rx="2" />
|
||||
<image x="30" y="3" width="20" height="20" href="../../icons/undo.svg" aria-hidden="true" />
|
||||
<title>Undo last move</title>
|
||||
<image
|
||||
v-if="text === 'Undo last move'"
|
||||
x="30"
|
||||
y="3"
|
||||
width="20"
|
||||
height="20"
|
||||
href="../../icons/undo.svg"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<path
|
||||
v-else
|
||||
d="M33 6L47 20 M47 6L33 20"
|
||||
stroke="black"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<title>{{ text }}</title>
|
||||
</g>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
|
|
@ -20,6 +36,7 @@ import { Vue, Component, Prop } from 'vue-property-decorator';
|
|||
|
||||
@Component
|
||||
export default class UndoButton extends Vue {
|
||||
@Prop({ default: 'Undo last move' }) text!: string;
|
||||
@Prop() enabled!: boolean;
|
||||
@Prop() highlightButton!: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Brug dit gratis spring til at bygge her for ${p0} (kun byggefeltets pris)? Byen kan ikke nås fra dit netværk på anden vis.",
|
||||
"Change bid": "Ændr bud",
|
||||
"Change powered plants": "Ændr aktiverede kraftværker",
|
||||
"Save bid": "Gem bud"
|
||||
"Save bid": "Gem bud",
|
||||
"Edit bid": "Rediger bud",
|
||||
"Pass bid": "Pas på bud",
|
||||
"Edit powering": "Rediger strømproduktion",
|
||||
"Skip auction": "Spring auktion over",
|
||||
"Finish building": "Afslut byggeri",
|
||||
"Finish powering": "Afslut strømproduktion",
|
||||
"Cancel bid edit": "Annuller budændring"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Den Freisprung nutzen, um hier für {p0} $ zu bauen (nur Bauplatzkosten)? Von deinem Netz aus ist diese Stadt sonst nicht erreichbar.",
|
||||
"Change bid": "Gebot ändern",
|
||||
"Change powered plants": "Aktivierte Kraftwerke ändern",
|
||||
"Save bid": "Gebot speichern"
|
||||
"Save bid": "Gebot speichern",
|
||||
"Edit bid": "Gebot ändern",
|
||||
"Pass bid": "Beim Gebot passen",
|
||||
"Edit powering": "Stromerzeugung ändern",
|
||||
"Skip auction": "Auktion überspringen",
|
||||
"Finish building": "Bauen abschließen",
|
||||
"Finish powering": "Stromerzeugung abschließen",
|
||||
"Cancel bid edit": "Gebotsänderung abbrechen"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Χρήση του δωρεάν άλματος για κατασκευή εδώ με {p0} $ (μόνο το κόστος θέσης); Η πόλη δεν συνδέεται με το δίκτυό σου με άλλον τρόπο.",
|
||||
"Change bid": "Αλλαγή προσφοράς",
|
||||
"Change powered plants": "Αλλαγή ενεργοποιημένων σταθμών",
|
||||
"Save bid": "Αποθήκευση προσφοράς"
|
||||
"Save bid": "Αποθήκευση προσφοράς",
|
||||
"Edit bid": "Αλλαγή προσφοράς",
|
||||
"Pass bid": "Πάσο στην προσφορά",
|
||||
"Edit powering": "Αλλαγή ηλεκτροδότησης",
|
||||
"Skip auction": "Παράλειψη δημοπρασίας",
|
||||
"Finish building": "Ολοκλήρωση κατασκευής",
|
||||
"Finish powering": "Ολοκλήρωση ηλεκτροδότησης",
|
||||
"Cancel bid edit": "Ακύρωση αλλαγής προσφοράς"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.",
|
||||
"Change bid": "Change bid",
|
||||
"Change powered plants": "Change powered plants",
|
||||
"Save bid": "Save bid"
|
||||
"Save bid": "Save bid",
|
||||
"Edit bid": "Edit bid",
|
||||
"Pass bid": "Pass bid",
|
||||
"Edit powering": "Edit powering",
|
||||
"Skip auction": "Skip auction",
|
||||
"Finish building": "Finish building",
|
||||
"Finish powering": "Finish powering",
|
||||
"Cancel bid edit": "Cancel bid edit"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "با پرش رایگان اینجا به قیمت ${p0} بسازید (فقط هزینهٔ جایگاه)؟ این شهر بدون پرش از شبکهٔ شما قابل دسترسی نیست.",
|
||||
"Change bid": "تغییر پیشنهاد",
|
||||
"Change powered plants": "تغییر نیروگاههای فعال",
|
||||
"Save bid": "ذخیرهٔ پیشنهاد"
|
||||
"Save bid": "ذخیرهٔ پیشنهاد",
|
||||
"Edit bid": "ویرایش پیشنهاد",
|
||||
"Pass bid": "انصراف از پیشنهاد",
|
||||
"Edit powering": "ویرایش تولید برق",
|
||||
"Skip auction": "رد کردن مزایده",
|
||||
"Finish building": "پایان ساختوساز",
|
||||
"Finish powering": "پایان تولید برق",
|
||||
"Cancel bid edit": "لغو ویرایش پیشنهاد"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Utiliser votre saut gratuit pour construire ici pour {p0} $ (coût de la case uniquement) ? Votre réseau ne peut pas atteindre cette ville autrement.",
|
||||
"Change bid": "Modifier l’enchère",
|
||||
"Change powered plants": "Modifier les centrales activées",
|
||||
"Save bid": "Enregistrer l’enchère"
|
||||
"Save bid": "Enregistrer l’enchère",
|
||||
"Edit bid": "Modifier la mise",
|
||||
"Pass bid": "Passer cette enchère",
|
||||
"Edit powering": "Modifier la production",
|
||||
"Skip auction": "Passer les enchères",
|
||||
"Finish building": "Terminer la construction",
|
||||
"Finish powering": "Terminer la production",
|
||||
"Cancel bid edit": "Annuler la modification"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "क्या मुफ़्त छलाँग से यहाँ ${p0} में निर्माण करना चाहते हैं (केवल स्थान की लागत)? इस शहर को आपके नेटवर्क से जोड़ने का दूसरा रास्ता नहीं है।",
|
||||
"Change bid": "बोली बदलें",
|
||||
"Change powered plants": "सक्रिय बिजलीघर बदलें",
|
||||
"Save bid": "बोली सहेजें"
|
||||
"Save bid": "बोली सहेजें",
|
||||
"Edit bid": "बोली बदलें",
|
||||
"Pass bid": "बोली छोड़ें",
|
||||
"Edit powering": "बिजली उत्पादन बदलें",
|
||||
"Skip auction": "नीलामी छोड़ें",
|
||||
"Finish building": "निर्माण पूरा करें",
|
||||
"Finish powering": "बिजली उत्पादन पूरा करें",
|
||||
"Cancel bid edit": "बोली का बदलाव रद्द करें"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Usare il salto gratuito per costruire qui per ${p0} (solo il costo dello spazio)? Non puoi raggiungere questa città dalla tua rete in altro modo.",
|
||||
"Change bid": "Modifica offerta",
|
||||
"Change powered plants": "Modifica centrali attivate",
|
||||
"Save bid": "Salva offerta"
|
||||
"Save bid": "Salva offerta",
|
||||
"Edit bid": "Modifica offerta",
|
||||
"Pass bid": "Passa sulla puntata",
|
||||
"Edit powering": "Modifica produzione",
|
||||
"Skip auction": "Salta asta",
|
||||
"Finish building": "Termina costruzione",
|
||||
"Finish powering": "Termina produzione",
|
||||
"Cancel bid edit": "Annulla modifica offerta"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "무료 점프로 건설 칸 비용 ${p0}만 지불하고 이곳에 건설하시겠습니까? 다른 방법으로는 네트워크에서 이 도시에 도달할 수 없습니다.",
|
||||
"Change bid": "입찰 변경",
|
||||
"Change powered plants": "가동한 발전소 변경",
|
||||
"Save bid": "입찰 저장"
|
||||
"Save bid": "입찰 저장",
|
||||
"Edit bid": "입찰 수정",
|
||||
"Pass bid": "입찰 포기",
|
||||
"Edit powering": "발전 수정",
|
||||
"Skip auction": "경매 건너뛰기",
|
||||
"Finish building": "건설 완료",
|
||||
"Finish powering": "발전 완료",
|
||||
"Cancel bid edit": "입찰 수정 취소"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Je gratis sprong gebruiken om hier voor ${p0} te bouwen (alleen het bouwvak)? Anders is deze stad niet bereikbaar vanuit je netwerk.",
|
||||
"Change bid": "Bod wijzigen",
|
||||
"Change powered plants": "Geactiveerde centrales wijzigen",
|
||||
"Save bid": "Bod opslaan"
|
||||
"Save bid": "Bod opslaan",
|
||||
"Edit bid": "Bod wijzigen",
|
||||
"Pass bid": "Passen bij bod",
|
||||
"Edit powering": "Stroomproductie wijzigen",
|
||||
"Skip auction": "Veiling overslaan",
|
||||
"Finish building": "Bouwen afronden",
|
||||
"Finish powering": "Stroomproductie afronden",
|
||||
"Cancel bid edit": "Bodwijziging annuleren"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Użyć darmowego skoku, aby zbudować tu za {p0} $ (tylko koszt pola)? Nie możesz inaczej połączyć tego miasta ze swoją siecią.",
|
||||
"Change bid": "Zmień ofertę",
|
||||
"Change powered plants": "Zmień uruchomione elektrownie",
|
||||
"Save bid": "Zapisz ofertę"
|
||||
"Save bid": "Zapisz ofertę",
|
||||
"Edit bid": "Zmień ofertę",
|
||||
"Pass bid": "Pasuj w licytacji",
|
||||
"Edit powering": "Zmień produkcję energii",
|
||||
"Skip auction": "Pomiń aukcję",
|
||||
"Finish building": "Zakończ budowę",
|
||||
"Finish powering": "Zakończ produkcję energii",
|
||||
"Cancel bid edit": "Anuluj zmianę oferty"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Usar seu salto grátis para construir aqui por ${p0} (apenas o custo do espaço)? Não é possível alcançar esta cidade a partir da sua rede de outra forma.",
|
||||
"Change bid": "Alterar lance",
|
||||
"Change powered plants": "Alterar usinas ativadas",
|
||||
"Save bid": "Salvar lance"
|
||||
"Save bid": "Salvar lance",
|
||||
"Edit bid": "Editar lance",
|
||||
"Pass bid": "Passar no lance",
|
||||
"Edit powering": "Editar geração",
|
||||
"Skip auction": "Pular leilão",
|
||||
"Finish building": "Concluir construção",
|
||||
"Finish powering": "Concluir geração",
|
||||
"Cancel bid edit": "Cancelar edição do lance"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Folosești saltul gratuit pentru a construi aici cu {p0} $ (doar costul spațiului)? Orașul nu poate fi conectat altfel la rețeaua ta.",
|
||||
"Change bid": "Modifică oferta",
|
||||
"Change powered plants": "Modifică centralele activate",
|
||||
"Save bid": "Salvează oferta"
|
||||
"Save bid": "Salvează oferta",
|
||||
"Edit bid": "Modifică oferta",
|
||||
"Pass bid": "Renunță la ofertă",
|
||||
"Edit powering": "Modifică producția",
|
||||
"Skip auction": "Sari peste licitație",
|
||||
"Finish building": "Încheie construcția",
|
||||
"Finish powering": "Încheie producția",
|
||||
"Cancel bid edit": "Anulează modificarea ofertei"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Использовать бесплатный прыжок, чтобы построить здесь за {p0} $ (только цена места)? Иначе этот город нельзя подключить к вашей сети.",
|
||||
"Change bid": "Изменить ставку",
|
||||
"Change powered plants": "Изменить включённые электростанции",
|
||||
"Save bid": "Сохранить ставку"
|
||||
"Save bid": "Сохранить ставку",
|
||||
"Edit bid": "Изменить ставку",
|
||||
"Pass bid": "Пас на торгах",
|
||||
"Edit powering": "Изменить выработку",
|
||||
"Skip auction": "Пропустить аукцион",
|
||||
"Finish building": "Завершить строительство",
|
||||
"Finish powering": "Завершить выработку",
|
||||
"Cancel bid edit": "Отменить изменение ставки"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "Dùng bước nhảy miễn phí để xây tại đây với giá ${p0} (chỉ tính ô xây dựng)? Bạn không thể kết nối thành phố này với mạng lưới bằng cách khác.",
|
||||
"Change bid": "Đổi giá đấu",
|
||||
"Change powered plants": "Đổi nhà máy đã kích hoạt",
|
||||
"Save bid": "Lưu giá đấu"
|
||||
"Save bid": "Lưu giá đấu",
|
||||
"Edit bid": "Sửa giá đấu",
|
||||
"Pass bid": "Bỏ giá đấu",
|
||||
"Edit powering": "Sửa phát điện",
|
||||
"Skip auction": "Bỏ qua đấu giá",
|
||||
"Finish building": "Hoàn tất xây dựng",
|
||||
"Finish powering": "Hoàn tất phát điện",
|
||||
"Cancel bid edit": "Hủy sửa giá đấu"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1998,5 +1998,12 @@
|
|||
"Use your Free Jump to build here for ${p0} (slot cost only)? This city is not reachable from your network otherwise.": "要使用免費跳躍,花費 ${p0} 在此建設嗎(只計建設格費用)?你的電網無法以其他方式到達這座城市。",
|
||||
"Change bid": "更改出價",
|
||||
"Change powered plants": "更改啟用的發電廠",
|
||||
"Save bid": "儲存出價"
|
||||
"Save bid": "儲存出價",
|
||||
"Edit bid": "修改出價",
|
||||
"Pass bid": "放棄出價",
|
||||
"Edit powering": "修改發電",
|
||||
"Skip auction": "跳過拍賣",
|
||||
"Finish building": "完成建設",
|
||||
"Finish powering": "完成發電",
|
||||
"Cancel bid edit": "取消修改出價"
|
||||
}
|
||||
|
|
|
|||
80
viewer/tests/unit/choice-revision-ui.spec.ts
Normal file
80
viewer/tests/unit/choice-revision-ui.spec.ts
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
import { mount } from '@vue/test-utils';
|
||||
import { expect } from 'chai';
|
||||
import Game from '@/components/Game.vue';
|
||||
import Calculator from '@/components/Calculator.vue';
|
||||
import PassButton from '@/components/buttons/PassButton.vue';
|
||||
import { Phase } from 'powergrid-engine';
|
||||
|
||||
const options = (Game as any).options;
|
||||
const computed = (name: string, context: any) => options.computed[name].get.call(context);
|
||||
|
||||
describe('pending auction UI', () => {
|
||||
it('starts the reused calculator at the submitted bid and allows lowering it to the legal floor', async () => {
|
||||
const wrapper = mount(Calculator, { propsData: { minValue: 3, maxValue: 50, initialValue: 12 } });
|
||||
expect((wrapper.vm as any).value).to.equal(12);
|
||||
for (let i = 0; i < 20; i++) (wrapper.vm as any).sub();
|
||||
(wrapper.vm as any).bid();
|
||||
expect(wrapper.emitted('bid')![0]).to.deep.equal([3]);
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('submits a replacement through the normal calculator without sending an ordinary turn', () => {
|
||||
const emitted: any[] = [];
|
||||
const context: any = {
|
||||
changingBid: true,
|
||||
editingBid: 'auction-1',
|
||||
revisableBid: 'auction-1',
|
||||
revisionBids: [3, 4, 5],
|
||||
emitter: { emit: (...args: any[]) => emitted.push(args) },
|
||||
sendMove: () => {
|
||||
throw new Error('revision must not use normal turn buffer');
|
||||
},
|
||||
};
|
||||
context.replaceBid = (pass: boolean) => options.methods.replaceBid.call(context, pass);
|
||||
options.methods.bid.call(context, 4);
|
||||
expect(emitted[0][1][0]).to.include({ name: 'Bid', data: 4, revision: 'auction-1' });
|
||||
expect(context.editingBid).to.equal(null);
|
||||
});
|
||||
|
||||
it('does not send a stale edit after the auction changes', () => {
|
||||
const context = {
|
||||
editingBid: 'old-auction',
|
||||
revisableBid: 'new-auction',
|
||||
replacementBid: 4,
|
||||
revisionBids: [3, 4],
|
||||
emitter: {
|
||||
emit: () => {
|
||||
throw new Error('stale revision');
|
||||
},
|
||||
},
|
||||
};
|
||||
expect(computed('changingBid', context)).to.equal(false);
|
||||
options.methods.replaceBid.call(context, false);
|
||||
});
|
||||
|
||||
it('lets bidders replace their bid with a pass but never lets the auctioneer pass', () => {
|
||||
expect(computed('canUsePhaseButton', { changingBid: true, player: 1, G: { auctioningPlayer: 0 } })).to.equal(
|
||||
true
|
||||
);
|
||||
expect(computed('canUsePhaseButton', { changingBid: true, player: 0, G: { auctioningPlayer: 0 } })).to.equal(
|
||||
false
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('phase button', () => {
|
||||
it('distinguishes resources, building and powering with icons and accessible labels without visible text', () => {
|
||||
const paths: string[] = [];
|
||||
for (const phase of [Phase.Resources, Phase.Building, Phase.Bureaucracy]) {
|
||||
const context = { G: { phase } };
|
||||
const text = computed('phaseButtonText', context);
|
||||
const icon = computed('phaseButtonIcon', context);
|
||||
const wrapper = mount(PassButton, { propsData: { text, icon, enabled: true } });
|
||||
expect(wrapper.attributes('aria-label')).to.equal(text);
|
||||
expect(wrapper.find('text').exists()).to.equal(false);
|
||||
paths.push(wrapper.find('path').attributes('d') as string);
|
||||
wrapper.destroy();
|
||||
}
|
||||
expect(new Set(paths).size).to.equal(3);
|
||||
});
|
||||
});
|
||||
|
|
@ -18,6 +18,15 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
chainWebpack: (config) => {
|
||||
// This is a Vue 2 viewer; Vue 2.7's compiler-sfc is not the Vue 3
|
||||
// parser expected by the legacy CLI's automatic detection.
|
||||
if (config.plugins.has('fork-ts-checker')) {
|
||||
config.plugin('fork-ts-checker').tap((args) => {
|
||||
args[0].vue.compiler = 'vue-template-compiler';
|
||||
return args;
|
||||
});
|
||||
}
|
||||
|
||||
// App and library builds use different Vue import transforms.
|
||||
for (const name of ['js', 'ts', 'tsx', 'vue']) {
|
||||
const rule = config.module.rule(name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue