fix object color override for sb

This commit is contained in:
yugecin 2016-11-13 00:58:50 +01:00
parent e853abcd9f
commit 711fd0a03e
7 changed files with 45 additions and 4 deletions

View File

@ -101,4 +101,9 @@ public class FakeGameObject extends GameObject {
public void setTime(int time) {
this.halfTime = time;
}
@Override
public void updateColor() {
}
}

View File

@ -60,6 +60,8 @@ public class Circle extends GameObject {
/** Whether or not the circle result ends the combo streak. */
private boolean comboEnd;
private int comboColorIndex;
/**
* Initializes the Circle data type with map modifiers, images, and dimensions.
* @param container the game container
@ -86,9 +88,9 @@ public class Circle extends GameObject {
this.game = game;
this.data = data;
this.comboEnd = comboEnd;
this.comboColorIndex = comboColorIndex;
updateColor();
updatePosition();
color = Dancer.colorOverride.getColor(comboColorIndex);
mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex);
}
public Circle(float x, float y, int time) {
@ -265,4 +267,10 @@ public class Circle extends GameObject {
return mirrorColor;
}
@Override
public void updateColor() {
color = Dancer.colorOverride.getColor(comboColorIndex);
mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex);
}
}

View File

@ -100,4 +100,8 @@ public class DummyObject extends GameObject {
return null;
}
@Override
public void updateColor() {
}
}

View File

@ -101,4 +101,6 @@ public abstract class GameObject {
public abstract Color getColor();
public abstract Color getMirroredColor();
public abstract void updateColor();
}

View File

@ -117,6 +117,8 @@ public class Slider extends GameObject {
public float pixelLength;
private int comboColorIndex;
/**
* Initializes the Slider data type with images and dimensions.
* @param container the game container
@ -162,8 +164,8 @@ public class Slider extends GameObject {
this.game = game;
this.data = data;
this.comboEnd = comboEnd;
color = Dancer.colorOverride.getColor(comboColorIndex);
mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex);
this.comboColorIndex = comboColorIndex;
updateColor();
updatePosition();
this.pixelLength = hitObject.getPixelLength();
@ -710,4 +712,10 @@ public class Slider extends GameObject {
return ticks;
}
@Override
public void updateColor() {
color = Dancer.colorOverride.getColor(comboColorIndex);
mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex);
}
}

View File

@ -438,4 +438,7 @@ public class Spinner extends GameObject {
return null;
}
@Override
public void updateColor() {
}
}

View File

@ -188,6 +188,7 @@ public class SBOverlay {
for (Object o : options.entrySet()) {
Map.Entry<Options.GameOption, String> next = (Map.Entry<Options.GameOption, String>) o;
next.getKey().read(next.getValue());
readOption(next.getKey());
}
}
}
@ -212,6 +213,16 @@ public class SBOverlay {
for (Options.GameOption o : options.getSavedOptionList()) {
if (initialOptions.containsKey(o)) {
o.read(initialOptions.get(o));
readOption(o);
}
}
}
// needed for object color overrides...
private void readOption(Options.GameOption o) {
if (o == Options.GameOption.DANCE_OBJECT_COLOR_OVERRIDE || o == Options.GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED) {
for (int i = index; i < gameObjects.length; i++) {
gameObjects[i].updateColor();
}
}
}