Starsector API
Loading...
Searching...
No Matches
TutorialGoSlowDialogPluginImpl.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.tutorial;
2
3import java.util.Map;
4
5import com.fs.starfarer.api.Global;
6import com.fs.starfarer.api.campaign.CampaignFleetAPI;
7import com.fs.starfarer.api.campaign.InteractionDialogAPI;
8import com.fs.starfarer.api.campaign.InteractionDialogPlugin;
9import com.fs.starfarer.api.campaign.OptionPanelAPI;
10import com.fs.starfarer.api.campaign.TextPanelAPI;
11import com.fs.starfarer.api.campaign.VisualPanelAPI;
12import com.fs.starfarer.api.campaign.rules.MemoryAPI;
13import com.fs.starfarer.api.combat.EngagementResultAPI;
14import com.fs.starfarer.api.util.Misc;
15
16public class TutorialGoSlowDialogPluginImpl implements InteractionDialogPlugin {
17
18 public static enum OptionId {
19 INIT,
20 CONT1,
21 CONT2,
22 ;
23 }
24
25 protected InteractionDialogAPI dialog;
26 protected TextPanelAPI textPanel;
27 protected OptionPanelAPI options;
28 protected VisualPanelAPI visual;
29
30 protected CampaignFleetAPI playerFleet;
31
34
35 public void init(InteractionDialogAPI dialog) {
36 this.dialog = dialog;
37 textPanel = dialog.getTextPanel();
38 options = dialog.getOptionPanel();
39 visual = dialog.getVisualPanel();
40
41 playerFleet = Global.getSector().getPlayerFleet();
42
43 //visual.showImagePortion("illustrations", "jump_point_hyper", 640, 400, 0, 0, 480, 300);
44 visual.showFleetInfo("Your fleet", playerFleet, null, null);
45
46 //dialog.setOptionOnEscape("Leave", OptionId.LEAVE);
47
48 optionSelected(null, OptionId.INIT);
49 }
50
51 public Map<String, MemoryAPI> getMemoryMap() {
52 return null;
53 }
54
55 public void backFromEngagement(EngagementResultAPI result) {
56 // no combat here, so this won't get called
57 }
58
59 public void optionSelected(String text, Object optionData) {
60 if (optionData == null) return;
61
62 OptionId option = (OptionId) optionData;
63
64 if (text != null) {
65 //textPanel.addParagraph(text, Global.getSettings().getColor("buttonText"));
66 dialog.addOptionSelectedText(option);
67 }
68
69
70 String control = Global.getSettings().getControlStringForEnumName("GO_SLOW");
71
72 switch (option) {
73 case INIT:
74 textPanel.addParagraph("You're coming up on an asteroid belt!");
75
76 textPanel.addParagraph("If you go through at full speed, there's a chance your fleet may be knocked off course, " +
77 "and some of your ships might even suffer damage from asteroid impacts.");
78
79 options.clearOptions();
80 options.addOption("Continue", OptionId.CONT1, null);
81 break;
82 case CONT1:
83 textPanel.addPara("A slow-moving fleet avoids this danger. Press and hold %s to move slowly, until " +
84 "you're through the asteroid belt.",
85 Misc.getHighlightColor(), control);
86
87 textPanel.addPara("The danger is low, however - especially since the belt is thin, " +
88 "and you're only going across it - so you could also get away with just going full speed.");
89 options.clearOptions();
90 options.addOption("Continue", OptionId.CONT2, null);
91 break;
92 case CONT2:
93 Global.getSector().setPaused(false);
94 dialog.dismiss();
95 break;
96 }
97 }
98
99
100
101
102 public void optionMousedOver(String optionText, Object optionData) {
103
104 }
105
106 public void advance(float amount) {
107
108 }
109
110 public Object getContext() {
111 return null;
112 }
113}
114
115
116
static SettingsAPI getSettings()
Definition Global.java:51
static SectorAPI getSector()
Definition Global.java:59
String getControlStringForEnumName(String name)