Starsector API
Loading...
Searching...
No Matches
DuelDialogDelegate.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.eventide;
2
3import java.util.Map;
4
5import com.fs.starfarer.api.campaign.CustomUIPanelPlugin;
6import com.fs.starfarer.api.campaign.CustomVisualDialogDelegate;
7import com.fs.starfarer.api.campaign.InteractionDialogAPI;
8import com.fs.starfarer.api.campaign.rules.MemKeys;
9import com.fs.starfarer.api.campaign.rules.MemoryAPI;
10import com.fs.starfarer.api.impl.campaign.rulecmd.FireBest;
11import com.fs.starfarer.api.ui.CustomPanelAPI;
12
15 protected float endDelay = 2f;
16 protected boolean finished = false;
17
18 protected String musicId;
21 protected Map<String, MemoryAPI> memoryMap;
22 protected boolean tutorialMode;
23
24
26 Map<String, MemoryAPI> memoryMap, boolean tutorialMode) {
27 this.musicId = musicId;
28 this.duelPanel = duelPanel;
29 this.dialog = dialog;
30 this.memoryMap = memoryMap;
31 this.tutorialMode = tutorialMode;
32 }
37 this.callbacks = callbacks;
40// if (musicId != null && !musicId.isEmpty()) {
41// Global.getSoundPlayer().setSuspendDefaultMusicPlayback(true);
42// Global.getSoundPlayer().playCustomMusic(1, 1, musicId);
43// } else {
44// Global.getSoundPlayer().pauseMusic();
45// Global.getSoundPlayer().setSuspendDefaultMusicPlayback(true);
46// }
47 }
48 public float getNoiseAlpha() {
49 return 0;
50 }
51 public void advance(float amount) {
52 if (!finished &&
54 endDelay -= amount;
55 if (endDelay <= 0f) {
59 finished = true;
60 }
61 }
62 }
63 }
64 public void reportDismissed(int option) {
65// Global.getSoundPlayer().setSuspendDefaultMusicPlayback(false);
66// Global.getSoundPlayer().restartCurrentMusic();
67
68 if (memoryMap != null) { // null when called from the test dialog
69 if (!tutorialMode) {
70 if (duelPanel.getPlayer().health > 0) {
71 memoryMap.get(MemKeys.LOCAL).set("$soe_playerWonDuel", true, 0);
72 } else {
73 memoryMap.get(MemKeys.LOCAL).set("$soe_playerLostDuel", true, 0);
74 }
75 FireBest.fire(null, dialog, memoryMap, "SOEDuelFinished");
76 } else {
77 FireBest.fire(null, dialog, memoryMap, "SOETutorialFinished");
78 }
79 }
80 }
81}
82
void init(CustomPanelAPI panel, DialogCallbacks callbacks)
DuelDialogDelegate(@Deprecated String musicId, DuelPanel duelPanel, InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap, boolean tutorialMode)
void init(CustomPanelAPI panel, DialogCallbacks callbacks, InteractionDialogAPI dialog)
static boolean fire(String ruleId, InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap, String params)
Definition FireBest.java:56
void setDurationOut(float durationOut)