Starsector API
Loading...
Searching...
No Matches
TutorialLevelUpDialogPluginImpl.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 TutorialLevelUpDialogPluginImpl implements InteractionDialogPlugin {
17
18 public static enum OptionId {
19 INIT,
20 CONT1,
21 CONT2,
22 CONT3,
23 CONT4,
24 ;
25 }
26
27 protected InteractionDialogAPI dialog;
28 protected TextPanelAPI textPanel;
29 protected OptionPanelAPI options;
30 protected VisualPanelAPI visual;
31
32 protected CampaignFleetAPI playerFleet;
33
34 public void init(InteractionDialogAPI dialog) {
35 this.dialog = dialog;
36 textPanel = dialog.getTextPanel();
37 options = dialog.getOptionPanel();
38 visual = dialog.getVisualPanel();
39
40 playerFleet = Global.getSector().getPlayerFleet();
41
42 //visual.showImagePortion("illustrations", "jump_point_hyper", 640, 400, 0, 0, 480, 300);
43 visual.showFleetInfo("Your fleet", playerFleet, null, null);
44
45 //dialog.setOptionOnEscape("Leave", OptionId.LEAVE);
46
47 optionSelected(null, OptionId.INIT);
48 }
49
50 public Map<String, MemoryAPI> getMemoryMap() {
51 return null;
52 }
53
54 public void backFromEngagement(EngagementResultAPI result) {
55 // no combat here, so this won't get called
56 }
57
58 public void optionSelected(String text, Object optionData) {
59 if (optionData == null) return;
60
61 OptionId option = (OptionId) optionData;
62
63 if (text != null) {
64 //textPanel.addParagraph(text, Global.getSettings().getColor("buttonText"));
65 dialog.addOptionSelectedText(option);
66 }
67
68
69 String control = Global.getSettings().getControlStringForEnumName("CORE_CHARACTER");
70
71 switch (option) {
72 case INIT:
73 textPanel.addParagraph("You've gained a level!");
74 textPanel.addPara("You gain %s skill point with each level-up, " +
75 "and an additional point at the start of the campaign.",
76 Misc.getHighlightColor(), "1");
77
78 textPanel.addPara("You also gain " + Misc.STORY + " points as you gain experience; these can be used to " +
79 "take exceptional actions - to \"make your own story\", in a way. The tutorial will introduce " +
80 "using these a bit later.",
81 Misc.getStoryOptionColor(), Misc.STORY + " points");
82 options.clearOptions();
83 options.addOption("Continue", OptionId.CONT1, null);
84 break;
85 case CONT1:
86 textPanel.addParagraph("Skill points are used to learn skills. Skills are arranged in four aptitudes - " +
87 "Combat, Leadership, Technology, and Industry. Each aptitude has a number of tiers, you advance to the higher tiers by picking skills from the lower ones.");
88
89 textPanel.addPara("Skills that affect your piloted ship - all Combat skills, and a few skills in other " +
90 "aptitudes - can be made \"elite\" at the cost of a " + Misc.STORY + " point.",
91 Misc.getStoryOptionColor(), Misc.STORY + " point");
92
93 String max = "" + (int) Global.getSettings().getLevelupPlugin().getMaxLevel();
94 textPanel.addPara("The maximum level you can reach is %s.",
95 Misc.getHighlightColor(), max);
96 options.clearOptions();
97 options.addOption("Continue", OptionId.CONT3, null);
98 break;
99 case CONT2:
100// textPanel.addParagraph("Each aptitude has skills ");
101// options.clearOptions();
102// options.addOption("Continue", OptionId.CONT3, null);
103 break;
104 case CONT3:
105 textPanel.addPara("Press %s to open the character tab and consider your options. You don't " +
106 "have to actually spend the points now if you don't want to.",
107 Misc.getHighlightColor(), control);
108
109 options.clearOptions();
110 options.addOption("Finish", OptionId.CONT4, null);
111 break;
112 case CONT4:
113 Global.getSector().setPaused(false);
114 dialog.dismiss();
115 break;
116 }
117 }
118
119
120
121
122 public void optionMousedOver(String optionText, Object optionData) {
123
124 }
125
126 public void advance(float amount) {
127
128 }
129
130 public Object getContext() {
131 return null;
132 }
133}
134
135
136
static SettingsAPI getSettings()
Definition Global.java:51
static SectorAPI getSector()
Definition Global.java:59
String getControlStringForEnumName(String name)