mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-18 22:52:46 +00:00
Implement Stop/Start trading with all (#2278)
fixes #2275 Added global Start/Stop trading; use your **player panel** to trigger it. <img width="370" height="540" alt="Screenshot 2025-10-23 184447" src="https://github.com/user-attachments/assets/c3b7967e-ffdd-4f37-ba67-b60a602278ce" /> - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced regression is found: abodcraft1
This commit is contained in:
committed by
evanpelle
parent
6b696685b5
commit
0a2b6ed9a6
@@ -28,6 +28,7 @@ import { CloseViewEvent, MouseUpEvent } from "../../InputHandler";
|
||||
import {
|
||||
SendAllianceRequestIntentEvent,
|
||||
SendBreakAllianceIntentEvent,
|
||||
SendEmbargoAllIntentEvent,
|
||||
SendEmbargoIntentEvent,
|
||||
SendEmojiIntentEvent,
|
||||
SendTargetPlayerIntentEvent,
|
||||
@@ -223,6 +224,16 @@ export class PlayerPanel extends LitElement implements Layer {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
private onStopTradingAllClick(e: Event) {
|
||||
e.stopPropagation();
|
||||
this.eventBus.emit(new SendEmbargoAllIntentEvent("start"));
|
||||
}
|
||||
|
||||
private onStartTradingAllClick(e: Event) {
|
||||
e.stopPropagation();
|
||||
this.eventBus.emit(new SendEmbargoAllIntentEvent("stop"));
|
||||
}
|
||||
|
||||
private handleEmojiClick(e: Event, myPlayer: PlayerView, other: PlayerView) {
|
||||
e.stopPropagation();
|
||||
this.emojiTable.showTable((emoji: string) => {
|
||||
@@ -709,6 +720,37 @@ export class PlayerPanel extends LitElement implements Layer {
|
||||
})
|
||||
: ""}
|
||||
</div>
|
||||
|
||||
${other === my
|
||||
? html`<div class="grid auto-cols-fr grid-flow-col gap-1">
|
||||
${actionButton({
|
||||
onClick: (e: MouseEvent) => this.onStopTradingAllClick(e),
|
||||
icon: stopTradingIcon,
|
||||
iconAlt: "Stop Trading With All",
|
||||
title: !this.actions?.canEmbargoAll
|
||||
? `${translateText("player_panel.stop_trade_all")} - ${translateText("cooldown")}`
|
||||
: translateText("player_panel.stop_trade_all"),
|
||||
label: !this.actions?.canEmbargoAll
|
||||
? `${translateText("player_panel.stop_trade_all")} ⏳`
|
||||
: translateText("player_panel.stop_trade_all"),
|
||||
type: "yellow",
|
||||
disabled: !this.actions?.canEmbargoAll,
|
||||
})}
|
||||
${actionButton({
|
||||
onClick: (e: MouseEvent) => this.onStartTradingAllClick(e),
|
||||
icon: startTradingIcon,
|
||||
iconAlt: "Start Trading With All",
|
||||
title: !this.actions?.canEmbargoAll
|
||||
? `${translateText("player_panel.start_trade_all")} - ${translateText("cooldown")}`
|
||||
: translateText("player_panel.start_trade_all"),
|
||||
label: !this.actions?.canEmbargoAll
|
||||
? `${translateText("player_panel.start_trade_all")} ⏳`
|
||||
: translateText("player_panel.start_trade_all"),
|
||||
type: "green",
|
||||
disabled: !this.actions?.canEmbargoAll,
|
||||
})}
|
||||
</div>`
|
||||
: ""}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user