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.rules.MemoryAPI; 013import com.fs.starfarer.api.combat.EngagementResultAPI; 014import com.fs.starfarer.api.util.Misc; 015 016public class TutorialGoSlowDialogPluginImpl implements InteractionDialogPlugin { 017 018 public static enum OptionId { 019 INIT, 020 CONT1, 021 CONT2, 022 ; 023 } 024 025 protected InteractionDialogAPI dialog; 026 protected TextPanelAPI textPanel; 027 protected OptionPanelAPI options; 028 protected VisualPanelAPI visual; 029 030 protected CampaignFleetAPI playerFleet; 031 032 public TutorialGoSlowDialogPluginImpl() { 033 } 034 035 public void init(InteractionDialogAPI dialog) { 036 this.dialog = dialog; 037 textPanel = dialog.getTextPanel(); 038 options = dialog.getOptionPanel(); 039 visual = dialog.getVisualPanel(); 040 041 playerFleet = Global.getSector().getPlayerFleet(); 042 043 //visual.showImagePortion("illustrations", "jump_point_hyper", 640, 400, 0, 0, 480, 300); 044 visual.showFleetInfo("Your fleet", playerFleet, null, null); 045 046 //dialog.setOptionOnEscape("Leave", OptionId.LEAVE); 047 048 optionSelected(null, OptionId.INIT); 049 } 050 051 public Map<String, MemoryAPI> getMemoryMap() { 052 return null; 053 } 054 055 public void backFromEngagement(EngagementResultAPI result) { 056 // no combat here, so this won't get called 057 } 058 059 public void optionSelected(String text, Object optionData) { 060 if (optionData == null) return; 061 062 OptionId option = (OptionId) optionData; 063 064 if (text != null) { 065 //textPanel.addParagraph(text, Global.getSettings().getColor("buttonText")); 066 dialog.addOptionSelectedText(option); 067 } 068 069 070 String control = Global.getSettings().getControlStringForEnumName("GO_SLOW"); 071 072 switch (option) { 073 case INIT: 074 textPanel.addParagraph("You're coming up on an asteroid belt!"); 075 076 textPanel.addParagraph("If you go through at full speed, there's a chance your fleet may be knocked off course, " + 077 "and some of your ships might even suffer damage from asteroid impacts."); 078 079 options.clearOptions(); 080 options.addOption("Continue", OptionId.CONT1, null); 081 break; 082 case CONT1: 083 textPanel.addPara("A slow-moving fleet avoids this danger. Press and hold %s to move slowly, until " + 084 "you're through the asteroid belt.", 085 Misc.getHighlightColor(), control); 086 087 textPanel.addPara("The danger is low, however - especially since the belt is thin, " + 088 "and you're only going across it - so you could also get away with just going full speed."); 089 options.clearOptions(); 090 options.addOption("Continue", OptionId.CONT2, null); 091 break; 092 case CONT2: 093 Global.getSector().setPaused(false); 094 dialog.dismiss(); 095 break; 096 } 097 } 098 099 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