Starsector API
Loading...
Searching...
No Matches
TutorialLayInCourseDialogPluginImpl.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.econ.MarketAPI;
13import com.fs.starfarer.api.campaign.rules.MemoryAPI;
14import com.fs.starfarer.api.characters.PersonAPI;
15import com.fs.starfarer.api.combat.EngagementResultAPI;
16import com.fs.starfarer.api.util.Misc;
17
18public class TutorialLayInCourseDialogPluginImpl implements InteractionDialogPlugin {
19
20 public static enum OptionId {
21 INIT,
22 CONT1,
23 CONT2,
24 CONT3,
25 ;
26 }
27
28 protected InteractionDialogAPI dialog;
29 protected TextPanelAPI textPanel;
30 protected OptionPanelAPI options;
31 protected VisualPanelAPI visual;
32
33 protected CampaignFleetAPI playerFleet;
34
35 protected MarketAPI ancyra;
36 protected PersonAPI contact;
37
38 public TutorialLayInCourseDialogPluginImpl(MarketAPI ancyra, PersonAPI contact) {
39 this.ancyra = ancyra;
40 this.contact = contact;
41 }
42
43 public void init(InteractionDialogAPI dialog) {
44 this.dialog = dialog;
45 textPanel = dialog.getTextPanel();
46 options = dialog.getOptionPanel();
47 visual = dialog.getVisualPanel();
48
49 playerFleet = Global.getSector().getPlayerFleet();
50
51 //visual.showImagePortion("illustrations", "jump_point_hyper", 640, 400, 0, 0, 480, 300);
52 visual.showFleetInfo("Your fleet", playerFleet, null, null);
53
54 //dialog.setOptionOnEscape("Leave", OptionId.LEAVE);
55
56 optionSelected(null, OptionId.INIT);
57 }
58
59 public Map<String, MemoryAPI> getMemoryMap() {
60 return null;
61 }
62
63 public void backFromEngagement(EngagementResultAPI result) {
64 // no combat here, so this won't get called
65 }
66
67 public void optionSelected(String text, Object optionData) {
68 if (optionData == null) return;
69
70 OptionId option = (OptionId) optionData;
71
72 if (text != null) {
73 //textPanel.addParagraph(text, Global.getSettings().getColor("buttonText"));
74 dialog.addOptionSelectedText(option);
75 }
76
77
78 String name = ancyra.getName();
79
80 String personName = contact.getPost().toLowerCase() + " " + contact.getName().getLast();
81
82 switch (option) {
83 case INIT:
84 textPanel.addParagraph("Shortly after dispatching the pirates, you receive a tight-beam communication from the " +
85 "system's main inhabited world, " + name + ".");
86
87 textPanel.addParagraph("The message is brief and asks you to travel there and contact " + personName + " as soon as possible.");
88
89 options.clearOptions();
90 options.addOption("Continue", OptionId.CONT1, null);
91 break;
92 case CONT1:
93 textPanel.addParagraph("Let's lay in a course for " + name + ". You don't need to do this to travel, " +
94 "but it helps keep track of where you're going and how long it'll take to get there.");
95
96
97 String intel = Global.getSettings().getControlStringForEnumName("CORE_INTEL");
98 textPanel.addPara("After dismissing this dialog, press %s to open the intel screen to view the " +
99 "details of the message you've just received.",
100 Misc.getHighlightColor(), intel);
101
102 textPanel.addPara("Select the message and click on the %s button to open the map centered directly on Ancyra. " +
103 "Then, left-click-and-hold on the planet, and select %s from the menu that pops up. Alternatively, you can just right-click on Ancyra.",
104 Misc.getHighlightColor(), "\"Show on map\"", "\"Lay in Course\"");
105
106 options.clearOptions();
107 options.addOption("Continue", OptionId.CONT2, null);
108 break;
109 case CONT2:
110 String map = Global.getSettings().getControlStringForEnumName("CORE_MAP");
111 textPanel.addPara("You could also press %s to open the map and locate Ancyra manually.",
112 Misc.getHighlightColor(), map);
113
114
115 textPanel.addParagraph("Once you get to Ancyra, open the comm directory to contact " + personName + ".");
116
117 options.clearOptions();
118 options.addOption("Finish", OptionId.CONT3, null);
119 break;
120 case CONT3:
121 Global.getSector().setPaused(false);
122 dialog.dismiss();
123 break;
124 }
125 }
126
127
128
129
130 public void optionMousedOver(String optionText, Object optionData) {
131
132 }
133
134 public void advance(float amount) {
135
136 }
137
138 public Object getContext() {
139 return null;
140 }
141}
142
143
144
static SettingsAPI getSettings()
Definition Global.java:51
static SectorAPI getSector()
Definition Global.java:59
String getControlStringForEnumName(String name)