001package com.fs.starfarer.api.impl.campaign.tutorial; 002 003import java.util.Map; 004 005import com.fs.starfarer.api.Global; 006import com.fs.starfarer.api.campaign.CampaignFleetAPI; 007import com.fs.starfarer.api.campaign.InteractionDialogAPI; 008import com.fs.starfarer.api.campaign.InteractionDialogPlugin; 009import com.fs.starfarer.api.campaign.OptionPanelAPI; 010import com.fs.starfarer.api.campaign.TextPanelAPI; 011import com.fs.starfarer.api.campaign.VisualPanelAPI; 012import com.fs.starfarer.api.campaign.econ.MarketAPI; 013import com.fs.starfarer.api.campaign.rules.MemoryAPI; 014import com.fs.starfarer.api.characters.PersonAPI; 015import com.fs.starfarer.api.combat.EngagementResultAPI; 016import com.fs.starfarer.api.util.Misc; 017 018public class TutorialLayInCourseDialogPluginImpl implements InteractionDialogPlugin { 019 020 public static enum OptionId { 021 INIT, 022 CONT1, 023 CONT2, 024 CONT3, 025 ; 026 } 027 028 protected InteractionDialogAPI dialog; 029 protected TextPanelAPI textPanel; 030 protected OptionPanelAPI options; 031 protected VisualPanelAPI visual; 032 033 protected CampaignFleetAPI playerFleet; 034 035 protected MarketAPI ancyra; 036 protected PersonAPI contact; 037 038 public TutorialLayInCourseDialogPluginImpl(MarketAPI ancyra, PersonAPI contact) { 039 this.ancyra = ancyra; 040 this.contact = contact; 041 } 042 043 public void init(InteractionDialogAPI dialog) { 044 this.dialog = dialog; 045 textPanel = dialog.getTextPanel(); 046 options = dialog.getOptionPanel(); 047 visual = dialog.getVisualPanel(); 048 049 playerFleet = Global.getSector().getPlayerFleet(); 050 051 //visual.showImagePortion("illustrations", "jump_point_hyper", 640, 400, 0, 0, 480, 300); 052 visual.showFleetInfo("Your fleet", playerFleet, null, null); 053 054 //dialog.setOptionOnEscape("Leave", OptionId.LEAVE); 055 056 optionSelected(null, OptionId.INIT); 057 } 058 059 public Map<String, MemoryAPI> getMemoryMap() { 060 return null; 061 } 062 063 public void backFromEngagement(EngagementResultAPI result) { 064 // no combat here, so this won't get called 065 } 066 067 public void optionSelected(String text, Object optionData) { 068 if (optionData == null) return; 069 070 OptionId option = (OptionId) optionData; 071 072 if (text != null) { 073 //textPanel.addParagraph(text, Global.getSettings().getColor("buttonText")); 074 dialog.addOptionSelectedText(option); 075 } 076 077 078 String name = ancyra.getName(); 079 080 String personName = contact.getPost().toLowerCase() + " " + contact.getName().getLast(); 081 082 switch (option) { 083 case INIT: 084 textPanel.addParagraph("Shortly after dispatching the pirates, you receive a tight-beam communication from the " + 085 "system's main inhabited world, " + name + "."); 086 087 textPanel.addParagraph("The message is brief and asks you to travel there and contact " + personName + " as soon as possible."); 088 089 options.clearOptions(); 090 options.addOption("Continue", OptionId.CONT1, null); 091 break; 092 case CONT1: 093 textPanel.addParagraph("Let's lay in a course for " + name + ". You don't need to do this to travel, " + 094 "but it helps keep track of where you're going and how long it'll take to get there."); 095 096 097 String intel = Global.getSettings().getControlStringForEnumName("CORE_INTEL"); 098 textPanel.addPara("After dismissing this dialog, press %s to open the intel screen to view the " + 099 "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