66import com .badlogic .gdx .graphics .Color ;
77import com .badlogic .gdx .graphics .Texture ;
88import com .badlogic .gdx .graphics .g2d .SpriteBatch ;
9+ import com .evacipated .cardcrawl .modthespire .lib .SpireInitializer ;
910import com .megacrit .cardcrawl .helpers .ImageMaster ;
1011import com .megacrit .cardcrawl .helpers .Prefs ;
1112import com .megacrit .cardcrawl .helpers .SaveHelper ;
12- import com .megacrit .cardcrawl .rooms .* ;
13+ import com .megacrit .cardcrawl .rooms .AbstractRoom ;
1314
15+ @ SpireInitializer
1416public class ColoredMap implements PostInitializeSubscriber {
1517 private static final String MODNAME = "Colored Map" ;
16- private static final String AUTHOR = "t-larson" ;
17- private static final String DESCRIPTION = "v1.2.1" ;
18-
19- @ SuppressWarnings ("unused" )
18+ private static final String AUTHOR = "timeracers, t-larson" ;
19+ private static final String DESCRIPTION = "v1.3" ;
20+
2021 public ColoredMap () {
21- BaseMod .subscribeToPostInitialize (this );
22+ BaseMod .subscribe (this );
2223 }
23-
24- @ SuppressWarnings ("unused" )
24+
2525 public static void initialize () {
26- ColoredMap cm = new ColoredMap ();
26+ new ColoredMap ();
2727 }
28-
28+
29+ @ Override
2930 public void receivePostInitialize () {
3031 Prefs modPrefs = SaveHelper .getPrefs ("ColoredMapPrefs" );
3132
3233 ModPanel settingsPanel = new ModPanel ();
3334 settingsPanel .state .put ("selection" , -1 );
34-
35- //ModLabel instructions =
35+
3636 ModImage background = new ModImage (451.0f , 456.0f , "img/IconBackground.png" );
37- settingsPanel .addImage (background );
37+ settingsPanel .addUIElement (background );
3838
3939 ModColorDisplay [] icons = new ModColorDisplay [6 ];
4040 ModSlider redSlider = new ModSlider ("R" , 350.0f , 700.0f , 255.0f , "" , settingsPanel , (me ) -> {
@@ -45,7 +45,7 @@ public void receivePostInitialize() {
4545 modPrefs .flush ();
4646 }
4747 });
48- settingsPanel .addSlider (redSlider );
48+ settingsPanel .addUIElement (redSlider );
4949
5050 ModSlider greenSlider = new ModSlider ("G" , 350.0f , 650.0f , 255.0f , "" , settingsPanel , (me ) -> {
5151 int selection = settingsPanel .state .get ("selection" );
@@ -55,7 +55,7 @@ public void receivePostInitialize() {
5555 modPrefs .flush ();
5656 }
5757 });
58- settingsPanel .addSlider (redSlider );
58+ settingsPanel .addUIElement (redSlider );
5959
6060 ModSlider blueSlider = new ModSlider ("B" , 350.0f , 600.0f , 255.0f , "" , settingsPanel , (me ) -> {
6161 int selection = settingsPanel .state .get ("selection" );
@@ -65,7 +65,7 @@ public void receivePostInitialize() {
6565 modPrefs .flush ();
6666 }
6767 });
68- settingsPanel .addSlider (greenSlider );
68+ settingsPanel .addUIElement (greenSlider );
6969
7070 ModSlider outlineSlider = new ModSlider ("Outline" , 350.0f , 550.0f , 100.0f , "%" , settingsPanel , (me ) -> {
7171 int selection = settingsPanel .state .get ("selection" );
@@ -75,7 +75,7 @@ public void receivePostInitialize() {
7575 modPrefs .flush ();
7676 }
7777 });
78- settingsPanel .addSlider (blueSlider );
78+ settingsPanel .addUIElement (blueSlider );
7979
8080 icons [0 ] = new ModColorDisplay (800.0f , 625.0f , ImageMaster .MAP_NODE_ENEMY , ImageMaster .MAP_NODE_ENEMY_OUTLINE , (me ) -> {
8181 settingsPanel .state .put ("selection" , 0 );
@@ -84,7 +84,7 @@ public void receivePostInitialize() {
8484 blueSlider .setValue (modPrefs .getFloat ("b_icon_0" , 1.0f ));
8585 outlineSlider .setValue (modPrefs .getFloat ("a_icon_0" , 1.0f ));
8686 });
87- settingsPanel .addSlider (outlineSlider );
87+ settingsPanel .addUIElement (outlineSlider );
8888
8989 icons [1 ] = new ModColorDisplay (625.0f , 625.0f , ImageMaster .MAP_NODE_ELITE , ImageMaster .MAP_NODE_ELITE_OUTLINE , (me ) -> {
9090 settingsPanel .state .put ("selection" , 1 );
@@ -131,7 +131,7 @@ public void receivePostInitialize() {
131131 icons [i ].g = modPrefs .getFloat ("g_icon_" + i , 1.0f );
132132 icons [i ].b = modPrefs .getFloat ("b_icon_" + i , 1.0f );
133133 icons [i ].aOutline = modPrefs .getFloat ("a_icon_" + i , 1.0f );
134- settingsPanel .addColorDisplay (icons [i ]);
134+ settingsPanel .addUIElement (icons [i ]);
135135 }
136136
137137 Texture badgeTexture = new Texture (Gdx .files .internal ("img/ColoredMapBadge.png" ));
@@ -141,20 +141,27 @@ public void receivePostInitialize() {
141141 public static void setIconOutlineColor (AbstractRoom room , SpriteBatch sb ) {
142142 Prefs modPrefs = SaveHelper .getPrefs ("ColoredMapPrefs" );
143143 float a = 0.0f ;
144-
145- if (room .getMapSymbol () == "E" ) {
146- a = modPrefs .getFloat ("a_icon_1" , 1.0f );
147- } else if (room .getMapSymbol () == "M" ) {
148- a = modPrefs .getFloat ("a_icon_0" , 1.0f );
149- } else if (room .getMapSymbol () == "$" ) {
150- a = modPrefs .getFloat ("a_icon_2" , 1.0f );
151- } else if (room .getMapSymbol () == "R" ) {
152- a = modPrefs .getFloat ("a_icon_3" , 1.0f );
153- } else if (room .getMapSymbol () == "T" ) {
154- a = modPrefs .getFloat ("a_icon_4" , 1.0f );
155- } else if (room .getMapSymbol () == "?" ) {
156- a = modPrefs .getFloat ("a_icon_5" , 1.0f );
157- }
144+
145+ switch (room .getMapSymbol ()) {
146+ case "E" :
147+ a = modPrefs .getFloat ("a_icon_1" , 1.0f );
148+ break ;
149+ case "M" :
150+ a = modPrefs .getFloat ("a_icon_0" , 1.0f );
151+ break ;
152+ case "$" :
153+ a = modPrefs .getFloat ("a_icon_2" , 1.0f );
154+ break ;
155+ case "R" :
156+ a = modPrefs .getFloat ("a_icon_3" , 1.0f );
157+ break ;
158+ case "T" :
159+ a = modPrefs .getFloat ("a_icon_4" , 1.0f );
160+ break ;
161+ case "?" :
162+ a = modPrefs .getFloat ("a_icon_5" , 1.0f );
163+ break ;
164+ }
158165
159166 sb .setColor (new Color (0.0f , 0.0f , 0.0f , a ));
160167 }
@@ -164,31 +171,38 @@ public static void setIconColor(AbstractRoom room, SpriteBatch sb) {
164171 float r = 0.0f ;
165172 float g = 0.0f ;
166173 float b = 0.0f ;
167-
168- if (room .getMapSymbol () == "E" ) {
169- r = modPrefs .getFloat ("r_icon_1" , 1.0f );
170- g = modPrefs .getFloat ("g_icon_1" , 1.0f );
171- b = modPrefs .getFloat ("b_icon_1" , 1.0f );
172- } else if (room .getMapSymbol () == "M" ) {
173- r = modPrefs .getFloat ("r_icon_0" , 1.0f );
174- g = modPrefs .getFloat ("g_icon_0" , 1.0f );
175- b = modPrefs .getFloat ("b_icon_0" , 1.0f );
176- } else if (room .getMapSymbol () == "$" ) {
177- r = modPrefs .getFloat ("r_icon_2" , 1.0f );
178- g = modPrefs .getFloat ("g_icon_2" , 1.0f );
179- b = modPrefs .getFloat ("b_icon_2" , 1.0f );
180- } else if (room .getMapSymbol () == "R" ) {
181- r = modPrefs .getFloat ("r_icon_3" , 1.0f );
182- g = modPrefs .getFloat ("g_icon_3" , 1.0f );
183- b = modPrefs .getFloat ("b_icon_3" , 1.0f );
184- } else if (room .getMapSymbol () == "T" ) {
185- r = modPrefs .getFloat ("r_icon_4" , 1.0f );
186- g = modPrefs .getFloat ("g_icon_4" , 1.0f );
187- b = modPrefs .getFloat ("b_icon_4" , 1.0f );
188- } else if (room .getMapSymbol () == "?" ) {
189- r = modPrefs .getFloat ("r_icon_5" , 1.0f );
190- g = modPrefs .getFloat ("g_icon_5" , 1.0f );
191- b = modPrefs .getFloat ("b_icon_5" , 1.0f );
174+
175+ switch (room .getMapSymbol ()) {
176+ case "E" :
177+ r = modPrefs .getFloat ("r_icon_1" , 1.0f );
178+ g = modPrefs .getFloat ("g_icon_1" , 1.0f );
179+ b = modPrefs .getFloat ("b_icon_1" , 1.0f );
180+ break ;
181+ case "M" :
182+ r = modPrefs .getFloat ("r_icon_0" , 1.0f );
183+ g = modPrefs .getFloat ("g_icon_0" , 1.0f );
184+ b = modPrefs .getFloat ("b_icon_0" , 1.0f );
185+ break ;
186+ case "$" :
187+ r = modPrefs .getFloat ("r_icon_2" , 1.0f );
188+ g = modPrefs .getFloat ("g_icon_2" , 1.0f );
189+ b = modPrefs .getFloat ("b_icon_2" , 1.0f );
190+ break ;
191+ case "R" :
192+ r = modPrefs .getFloat ("r_icon_3" , 1.0f );
193+ g = modPrefs .getFloat ("g_icon_3" , 1.0f );
194+ b = modPrefs .getFloat ("b_icon_3" , 1.0f );
195+ break ;
196+ case "T" :
197+ r = modPrefs .getFloat ("r_icon_4" , 1.0f );
198+ g = modPrefs .getFloat ("g_icon_4" , 1.0f );
199+ b = modPrefs .getFloat ("b_icon_4" , 1.0f );
200+ break ;
201+ case "?" :
202+ r = modPrefs .getFloat ("r_icon_5" , 1.0f );
203+ g = modPrefs .getFloat ("g_icon_5" , 1.0f );
204+ b = modPrefs .getFloat ("b_icon_5" , 1.0f );
205+ break ;
192206 }
193207
194208 sb .setColor (new Color (r , g , b , 1.0f ));
0 commit comments