Starsector API
Loading...
Searching...
No Matches
CampaignPingSpec.java
Go to the documentation of this file.
1package com.fs.starfarer.api.loading;
2
3import java.awt.Color;
4import java.util.ArrayList;
5import java.util.List;
6
7import org.json.JSONArray;
8import org.json.JSONException;
9import org.json.JSONObject;
10
11public class CampaignPingSpec {
12// "danger":{
13// "sounds":["ui_new_radar_icon", "", ""],
14// "color":"textEnemyColor",
15// "range":100,
16// "duration":1,
17// "invert":false,
18//
19// "num":3,
20// "delay":0.5,
21// },
22
23
24 private String id;
25 private List<String> sounds = new ArrayList<String>();
26 private Color color;
27 private float minRange, range, duration, delay = 1f, width, alphaMult = 1f, inFraction = 0.1f;
28 private boolean invert;
29 private boolean useFactionColor;
30 private int num = 1;
31
32
33
35 super();
36 }
37
38 public CampaignPingSpec(String id, Color color, JSONObject json) throws JSONException {
39 this.id = id;
40
41 this.color = color;
42
43 sounds = new ArrayList<String>();
44 JSONArray arr = json.optJSONArray("sounds");
45 if (arr != null) {
46 for (int i = 0; i < arr.length(); i++) {
47 sounds.add(arr.getString(i));
48 }
49 }
50
51 inFraction = (float) json.optDouble("inFraction", 0.1f);
52 minRange = (float) json.optDouble("minRange", 0f);
53 range = (float) json.getDouble("range");
54 width = (float) json.getDouble("width");
55 duration = (float) json.getDouble("duration");
56 delay = (float) json.optDouble("delay", 1f);
57 alphaMult = (float) json.optDouble("alphaMult", 1f);
58 num = json.optInt("num", 1);
59
60 invert = json.optBoolean("invert", false);
61 useFactionColor = json.optBoolean("useFactionColor", false);
62 }
63
64 public float getAlphaMult() {
65 return alphaMult;
66 }
67
68 public float getInFraction() {
69 return inFraction;
70 }
71
72 public boolean isUseFactionColor() {
73 return useFactionColor;
74 }
75
76 public String getId() {
77 return id;
78 }
79
80 public List<String> getSounds() {
81 return sounds;
82 }
83
84 public Color getColor() {
85 return color;
86 }
87
88 public float getRange() {
89 return range;
90 }
91
92 public float getDuration() {
93 return duration;
94 }
95
96 public float getDelay() {
97 return delay;
98 }
99
100 public boolean isInvert() {
101 return invert;
102 }
103
104 public int getNum() {
105 return num;
106 }
107
108 public float getWidth() {
109 return width;
110 }
111
112 public float getMinRange() {
113 return minRange;
114 }
115
116 public void setId(String id) {
117 this.id = id;
118 }
119
120 public void setSounds(List<String> sounds) {
121 this.sounds = sounds;
122 }
123
124 public void setColor(Color color) {
125 this.color = color;
126 }
127
128 public void setMinRange(float minRange) {
129 this.minRange = minRange;
130 }
131
132 public void setRange(float range) {
133 this.range = range;
134 }
135
136 public void setDuration(float duration) {
137 this.duration = duration;
138 }
139
140 public void setDelay(float delay) {
141 this.delay = delay;
142 }
143
144 public void setWidth(float width) {
145 this.width = width;
146 }
147
148 public void setAlphaMult(float alphaMult) {
149 this.alphaMult = alphaMult;
150 }
151
152 public void setInFraction(float inFraction) {
153 this.inFraction = inFraction;
154 }
155
156 public void setInvert(boolean invert) {
157 this.invert = invert;
158 }
159
160 public void setUseFactionColor(boolean useFactionColor) {
161 this.useFactionColor = useFactionColor;
162 }
163
164 public void setNum(int num) {
165 this.num = num;
166 }
167
168
169}
170
171
172
173
174
175
176
CampaignPingSpec(String id, Color color, JSONObject json)