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 TutorialLevelUpDialogPluginImpl implements InteractionDialogPlugin { 017 018 public static enum OptionId { 019 INIT, 020 CONT1, 021 CONT2, 022 CONT3, 023 CONT4, 024 ; 025 } 026 027 protected InteractionDialogAPI dialog; 028 protected TextPanelAPI textPanel; 029 protected OptionPanelAPI options; 030 protected VisualPanelAPI visual; 031 032 protected CampaignFleetAPI playerFleet; 033 034 public void init(InteractionDialogAPI dialog) { 035 this.dialog = dialog; 036 textPanel = dialog.getTextPanel(); 037 options = dialog.getOptionPanel(); 038 visual = dialog.getVisualPanel(); 039 040 playerFleet = Global.getSector().getPlayerFleet(); 041 042 //visual.showImagePortion("illustrations", "jump_point_hyper", 640, 400, 0, 0, 480, 300); 043 visual.showFleetInfo("Your fleet", playerFleet, null, null); 044 045 //dialog.setOptionOnEscape("Leave", OptionId.LEAVE); 046 047 optionSelected(null, OptionId.INIT); 048 } 049 050 public Map<String, MemoryAPI> getMemoryMap() { 051 return null; 052 } 053 054 public void backFromEngagement(EngagementResultAPI result) { 055 // no combat here, so this won't get called 056 } 057 058 public void optionSelected(String text, Object optionData) { 059 if (optionData == null) return; 060 061 OptionId option = (OptionId) optionData; 062 063 if (text != null) { 064 //textPanel.addParagraph(text, Global.getSettings().getColor("buttonText")); 065 dialog.addOptionSelectedText(option); 066 } 067 068 069 String control = Global.getSettings().getControlStringForEnumName("CORE_CHARACTER"); 070 071 switch (option) { 072 case INIT: 073 textPanel.addParagraph("You've gained a level!"); 074 textPanel.addPara("You gain %s skill point with each level-up, " + 075 "and an additional point at the start of the campaign.", 076 Misc.getHighlightColor(), "1"); 077 078 textPanel.addPara("You also gain " + Misc.STORY + " points as you gain experience; these can be used to " + 079 "take exceptional actions - to \"make your own story\", in a way. The tutorial will introduce " + 080 "using these a bit later.", 081 Misc.getStoryOptionColor(), Misc.STORY + " points"); 082 options.clearOptions(); 083 options.addOption("Continue", OptionId.CONT1, null); 084 break; 085 case CONT1: 086 textPanel.addParagraph("Skill points are used to learn skills. Skills are arranged in four aptitudes - " + 087 "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."); 088 089 textPanel.addPara("Skills that affect your piloted ship - all Combat skills, and a few skills in other " + 090 "aptitudes - can be made \"elite\" at the cost of a " + Misc.STORY + " point.", 091 Misc.getStoryOptionColor(), Misc.STORY + " point"); 092 093 String max = "" + (int) Global.getSettings().getLevelupPlugin().getMaxLevel(); 094 textPanel.addPara("The maximum level you can reach is %s.", 095 Misc.getHighlightColor(), max); 096 options.clearOptions(); 097 options.addOption("Continue", OptionId.CONT3, null); 098 break; 099 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