show github link in playfield

This commit is contained in:
yugecin 2016-10-04 14:40:41 +02:00
parent c0ea819ccb
commit 177e75ba29
6 changed files with 164 additions and 1 deletions

View File

@ -960,6 +960,23 @@ public class Options {
} }
}, },
DANCE_HIDE_WATERMARK ("Hide watermark", "HideWaterMark", "Hide the githublink in the top left corner of the playfield", false) {
@Override
public String getValueString() {
return Dancer.hidewatermark ? "Yes" : "No";
}
@Override
public void click(GameContainer container) {
Dancer.hidewatermark = false;
}
@Override
public boolean showRWM() {
return !Dancer.hidewatermark;
}
},
PIPPI_ENABLE ("Pippi", "Pippi", "Move in circles like dancing pippi (osu! april fools joke 2016)", Pippi.enabled) { PIPPI_ENABLE ("Pippi", "Pippi", "Move in circles like dancing pippi (osu! april fools joke 2016)", Pippi.enabled) {
@Override @Override
public void click(GameContainer container) { public void click(GameContainer container) {
@ -1131,6 +1148,8 @@ public class Options {
*/ */
public String getDescription() { return description; } public String getDescription() { return description; }
public boolean showRWM() { return false; } // this is probably a shitty way to implement this :)
/** /**
* Returns the boolean value for the option, if applicable. * Returns the boolean value for the option, if applicable.
* @return the boolean value * @return the boolean value

View File

@ -108,6 +108,10 @@ public class Updater {
/** The download object. */ /** The download object. */
private Download download; private Download download;
public String getCurrentVersion() {
return currentVersion.getMajorVersion() + "." + currentVersion.getMinorVersion() + "." + currentVersion.getIncrementalVersion();
}
/** /**
* Constructor. * Constructor.
*/ */

View File

@ -36,6 +36,7 @@ import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.beatmap.TimingPoint; import itdelatrisu.opsu.beatmap.TimingPoint;
import itdelatrisu.opsu.db.BeatmapDB; import itdelatrisu.opsu.db.BeatmapDB;
import itdelatrisu.opsu.db.ScoreDB; import itdelatrisu.opsu.db.ScoreDB;
import itdelatrisu.opsu.downloads.Updater;
import itdelatrisu.opsu.objects.Circle; import itdelatrisu.opsu.objects.Circle;
import itdelatrisu.opsu.objects.DummyObject; import itdelatrisu.opsu.objects.DummyObject;
import itdelatrisu.opsu.objects.GameObject; import itdelatrisu.opsu.objects.GameObject;
@ -630,6 +631,10 @@ public class Game extends BasicGameState {
UI.draw(g, (int) autoMousePosition.x, (int) autoMousePosition.y, Utils.isGameKeyPressed()); UI.draw(g, (int) autoMousePosition.x, (int) autoMousePosition.y, Utils.isGameKeyPressed());
else else
UI.draw(g); UI.draw(g);
if (!Dancer.hidewatermark) {
Fonts.SMALL.drawString(0.3f, 0.3f, "opsu!dance " + Updater.get().getCurrentVersion() + " by robin_be | https://github.com/yugecin/opsu-dance");
}
} }
@Override @Override

View File

@ -44,6 +44,7 @@ import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.state.transition.FadeInTransition; import org.newdawn.slick.state.transition.FadeInTransition;
import org.newdawn.slick.state.transition.EmptyTransition; import org.newdawn.slick.state.transition.EmptyTransition;
import yugecin.opsudance.ui.ItemList; import yugecin.opsudance.ui.ItemList;
import yugecin.opsudance.ui.RWM;
/** /**
* "Game Options" state. * "Game Options" state.
@ -129,6 +130,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.DANCE_REMOVE_BG, GameOption.DANCE_REMOVE_BG,
GameOption.DANCE_HIDE_OBJECTS, GameOption.DANCE_HIDE_OBJECTS,
GameOption.DANCE_HIDE_UI, GameOption.DANCE_HIDE_UI,
GameOption.DANCE_HIDE_WATERMARK,
}), }),
PIPPI ("Pippi", new GameOption[] { PIPPI ("Pippi", new GameOption[] {
GameOption.PIPPI_ENABLE, GameOption.PIPPI_ENABLE,
@ -203,16 +205,19 @@ public class OptionsMenu extends BasicGameState {
private final int state; private final int state;
private final ItemList list; private final ItemList list;
private final RWM rwm;
public OptionsMenu(int state) { public OptionsMenu(int state) {
this.state = state; this.state = state;
list = new ItemList(); list = new ItemList();
rwm = new RWM();
} }
@Override @Override
public void init(GameContainer container, StateBasedGame game) public void init(GameContainer container, StateBasedGame game)
throws SlickException { throws SlickException {
list.init(container); list.init(container);
rwm.init(container);
this.container = container; this.container = container;
this.game = game; this.game = game;
@ -288,6 +293,9 @@ public class OptionsMenu extends BasicGameState {
if (list.isVisible()) { if (list.isVisible()) {
list.render(container, game, g); list.render(container, game, g);
} }
if (rwm.isVisible()) {
rwm.render(container, game, g);
}
UI.getBackButton().draw(); UI.getBackButton().draw();
@ -311,6 +319,7 @@ public class OptionsMenu extends BasicGameState {
@Override @Override
public void update(GameContainer container, StateBasedGame game, int delta) public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException { throws SlickException {
rwm.update(delta);
UI.update(delta); UI.update(delta);
MusicController.loopTrackIfEnded(false); MusicController.loopTrackIfEnded(false);
int mouseX = input.getMouseX(), mouseY = input.getMouseY(); int mouseX = input.getMouseX(), mouseY = input.getMouseY();
@ -325,6 +334,9 @@ public class OptionsMenu extends BasicGameState {
if (list.isVisible()) { if (list.isVisible()) {
list.mouseReleased(button, x, y); list.mouseReleased(button, x, y);
} }
if (rwm.isVisible()) {
rwm.mouseReleased(button, x, y);
}
} }
@Override @Override
@ -333,6 +345,9 @@ public class OptionsMenu extends BasicGameState {
list.mousePressed(button, x, y); list.mousePressed(button, x, y);
return; return;
} }
if (rwm.isVisible()) {
return;
}
// key entry state // key entry state
if (keyEntryLeft || keyEntryRight) { if (keyEntryLeft || keyEntryRight) {
@ -367,7 +382,11 @@ public class OptionsMenu extends BasicGameState {
if (option != null) { if (option != null) {
Object[] listItems = option.getListItems(); Object[] listItems = option.getListItems();
if (listItems == null) { if (listItems == null) {
if (option.showRWM()) {
rwm.show();
} else {
option.click(container); option.click(container);
}
} else { } else {
list.setItems(listItems); list.setItems(listItems);
list.setClickListener(new Observer() { list.setClickListener(new Observer() {
@ -396,6 +415,9 @@ public class OptionsMenu extends BasicGameState {
list.mouseDragged(oldx, oldy, newx, newy); list.mouseDragged(oldx, oldy, newx, newy);
return; return;
} }
if (rwm.isVisible()) {
return;
}
// key entry state // key entry state
if (keyEntryLeft || keyEntryRight) if (keyEntryLeft || keyEntryRight)
@ -437,6 +459,10 @@ public class OptionsMenu extends BasicGameState {
list.keyPressed(key, c); list.keyPressed(key, c);
return; return;
} }
if (rwm.isVisible()) {
rwm.keyPressed(key, c);
return;
}
// key entry state // key entry state
if (keyEntryLeft || keyEntryRight) { if (keyEntryLeft || keyEntryRight) {

View File

@ -70,6 +70,7 @@ public class Dancer {
public static MoverDirection moverDirection = MoverDirection.RANDOM; public static MoverDirection moverDirection = MoverDirection.RANDOM;
public static boolean hideobjects = false; public static boolean hideobjects = false;
public static int cursortraillength = 20; public static int cursortraillength = 20;
public static boolean hidewatermark = false;
private int dir; private int dir;
public static final GameObject d = new DummyObject(); public static final GameObject d = new DummyObject();

View File

@ -0,0 +1,108 @@
/*
* opsu!dance - fork of opsu! with cursordance auto
* Copyright (C) 2016 yugecin
*
* opsu!dance is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* opsu!dance is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
*/
package yugecin.opsudance.ui;
import itdelatrisu.opsu.ui.Fonts;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.state.StateBasedGame;
import yugecin.opsudance.Dancer;
public class RWM {
private int x;
private int y;
private int width;
private int height;
private int delay;
private boolean visible;
public void init(GameContainer container) {
x = container.getWidth() / 10;
y = 0;
width = x * 8;
height = container.getHeight();
}
public boolean isVisible() {
return visible;
}
public void show() {
visible = true;
delay = 0;
}
public void update(int delta) {
delay += delta;
}
public void render(GameContainer container, StateBasedGame game, Graphics g) {
g.setColor(Color.black);
g.fillRect(x, y, width, height);
int y = 20;
y = drawCentered(y, "Hi! robin_be here", Color.cyan);
y = drawCentered(y, "I'm glad you're enjoying this client", Color.white);
y += 20;
y = drawCentered(y, "If you want to remove the watermark to make a video, please read following conditions:", Color.white);
y += 20;
y = drawCentered(y, "* You will not deny you used opsu!dance to make your video", Color.white);
y = drawCentered(y, "* You may provide a link to my repository. This is always very appreciated <3.", Color.white);
y = drawCentered(y, " Please do keep in mind I only made some adjustements/fixes and added the dancing stuff. opsu! was made by itdelatrisu", Color.white);
y = drawCentered(y, "* Asking for beatmap requests is discouraged. After all, everyone can download this and see it for themselves.", Color.white);
y = drawCentered(y, "* YOU WILL NOT PRETEND LIKE YOU MADE/OWN THIS SOFTWARE", Color.red);
y += 20;
y = drawCentered(y, "I'll love you if you leave the watermark visible, but I understand that it sucks to have that in a video.", Color.white);
y = drawCentered(y, "If you decide to hide it, please consider linking the repository in the video's description.", Color.white);
y += 20;
if (delay < 10000) {
y = drawCentered(y, "You can disable the watermark in a few seconds..", Color.white);
} else {
y += 50;
y = drawCentered(y, "Click this black area to disable it", Color.green);
}
}
public int drawCentered(int y, String text, Color color) {
int textwidth = Fonts.MEDIUM.getWidth(text);
Fonts.MEDIUM.drawString(x + width / 2 - textwidth / 2, y, text, color);
return y + Fonts.MEDIUM.getLineHeight() + 5;
}
public void mouseReleased(int button, int x, int y) {
if (x < this.x || x > this.x + width) {
this.visible = false;
return;
}
if (delay > 10000) {
Dancer.hidewatermark = true;
this.visible = false;
}
}
public void keyPressed(int key, char c) {
if (key == Input.KEY_ESCAPE) {
visible = false;
}
}
}