Starsector API
Loading...
Searching...
No Matches
GateIntel.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.intel.misc;
2
3import java.awt.Color;
4import java.util.Set;
5
6import com.fs.starfarer.api.Global;
7import com.fs.starfarer.api.campaign.FactionAPI;
8import com.fs.starfarer.api.campaign.SectorEntityToken;
9import com.fs.starfarer.api.impl.campaign.GateEntityPlugin;
10import com.fs.starfarer.api.impl.campaign.ids.Tags;
11import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
12import com.fs.starfarer.api.loading.Description;
13import com.fs.starfarer.api.loading.Description.Type;
14import com.fs.starfarer.api.ui.SectorMapAPI;
15import com.fs.starfarer.api.ui.TooltipMakerAPI;
16import com.fs.starfarer.api.util.Misc;
17
18public class GateIntel extends BaseIntelPlugin {
19
20 protected SectorEntityToken gate;
21
22 public GateIntel(SectorEntityToken gate) {
23 this.gate = gate;
24 //Global.getSector().getIntelManager().addIntel(this);
25 }
26
27 protected void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode) {
28
29 boolean active = GateEntityPlugin.isActive(gate);
30
31 Color h = Misc.getHighlightColor();
32 Color g = Misc.getGrayColor();
33 float pad = 3f;
34 float opad = 10f;
35
36 float initPad = pad;
37 if (mode == ListInfoMode.IN_DESC) initPad = opad;
38
39 Color tc = getBulletColorForMode(mode);
40
41 bullet(info);
42 boolean isUpdate = getListInfoParam() != null;
43
44// if (mode == ListInfoMode.INTEL) {
45// info.addPara("Located in the " + gate.getContainingLocation().getNameWithLowercaseTypeShort(), tc, initPad);
46// initPad = 0f;
47// }
48
50 info.addPara("Scanned", tc, initPad);
51 initPad = 0f;
52 }
53
54 unindent(info);
55 }
56
57
58 @Override
59 public void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode) {
60 String pre = "";
61 String post = "";
62 if (mode == ListInfoMode.MESSAGES) {
63 pre = "Discovered: ";
64 }
65
66 if (mode == ListInfoMode.INTEL) {
67 post = " - " + gate.getContainingLocation().getNameWithTypeShort();
68 }
69
70
71 Color c = getTitleColor(mode);
72 info.addPara(pre + getName() + post, c, 0f);
73 addBulletPoints(info, mode);
74 }
75
76 @Override
77 public void createSmallDescription(TooltipMakerAPI info, float width, float height) {
78 Color h = Misc.getHighlightColor();
79 Color g = Misc.getGrayColor();
80 Color tc = Misc.getTextColor();
81 float pad = 3f;
82 float opad = 10f;
83
84 if (gate.getCustomInteractionDialogImageVisual() != null) {
85 info.addImage(gate.getCustomInteractionDialogImageVisual().getSpriteName(), width, opad);
86 }
87
88 Description desc = Global.getSettings().getDescription(gate.getCustomDescriptionId(), Type.CUSTOM);
89 info.addPara(desc.getText1(), opad);
90
93 info.addPara("You've scanned this gate and are able to transit it.", opad);
94 } else {
95 info.addPara("You've scanned this gate.", opad);
96 }
97 }
98
99 //addBulletPoints(info, ListInfoMode.IN_DESC);
100
101 }
102
103 protected boolean isActive() {
105 }
106
107 @Override
108 public String getIcon() {
109 if (isActive()) {
110 return Global.getSettings().getSpriteName("intel", "gate_active");
111 }
112 return Global.getSettings().getSpriteName("intel", "gate_inactive");
113 }
114
115 @Override
116 public Set<String> getIntelTags(SectorMapAPI map) {
117 Set<String> tags = super.getIntelTags(map);
118 tags.add(Tags.INTEL_GATES);
119 return tags;
120 }
121
122 public String getSortString() {
123 if (isActive()) {
124 return "Active Gate " + gate.getName();
125 }
126 return "Inactive Gate " + gate.getName();
127 }
128
129
130
131 public String getName() {
132 return gate.getName();
133 }
134
135 @Override
136 public FactionAPI getFactionForUIColors() {
137 return super.getFactionForUIColors();
138 }
139
140 public String getSmallDescriptionTitle() {
141 return getName() + " - " + gate.getContainingLocation().getNameWithTypeShort();
142 }
143
144 @Override
145 public SectorEntityToken getMapLocation(SectorMapAPI map) {
146 return gate;
147 }
148
149 @Override
150 public boolean shouldRemoveIntel() {
151 return false;
152 }
153
154 @Override
155 public String getCommMessageSound() {
156 return "ui_discovered_entity";
157 }
158
159 public SectorEntityToken getGate() {
160 return gate;
161 }
162
163
164}
165
166
167
168
169
170
171
static SettingsAPI getSettings()
Definition Global.java:51
static boolean isScanned(SectorEntityToken gate)
static boolean isActive(SectorEntityToken gate)
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
void createSmallDescription(TooltipMakerAPI info, float width, float height)
SectorEntityToken getMapLocation(SectorMapAPI map)
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
Description getDescription(String id, Type type)
String getSpriteName(String category, String id)