Skip to content
Snippets Groups Projects
Commit 965970c6 authored by Anton Danilov's avatar Anton Danilov
Browse files

#115 Created mouse dialog hiding after 3 seconds

parent 1450477a
Branches
Tags
No related merge requests found
......@@ -22,6 +22,8 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.game.AbstractTablexiaGame;
......@@ -54,6 +56,7 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti
private static final int MOUSE_DIALOG_WIDTH = 300;
private static final int MOUSE_DIALOG_HEIGHT = 50;
private static final float MOUSE_IMAGE_DIALOG_POINT_HEIGHT = 3f / 5f;
private static final long MOUSE_DIALOG_DURATION = 3000;
private static final String SCREEN_STATE_SCROLL_POSITION_X = "scrollPositionX";
public static final String SCROLL_TO_TROPHY_KEY = "scrollToTrophy";
......@@ -292,6 +295,8 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti
float dialogX = mouseImage.getX() - scrollPane.getScrollX();
float dialogY = mouseImage.getY() + (mouseImage.getImageHeight() * MOUSE_POSITION_PROPERTIES.getThird() * MOUSE_IMAGE_DIALOG_POINT_HEIGHT);
final Timer timer = new Timer();
final DynamicBubbleDialog mouseDialog = new MouseDialog(getText(TrophyHelper.MouseTexts.getMouseText(threeStarsCount)), dialogX, dialogY, MOUSE_DIALOG_WIDTH, MOUSE_DIALOG_HEIGHT);
mouseDialog.addListener(new ClickListener() {
@Override
......@@ -299,9 +304,19 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti
mouseImage.setDrawable(new SpriteDrawable(new Sprite(mouseTexture)));
mouseImage.setTouchable(Touchable.enabled);
mouseDialog.hide();
timer.cancel();
}
});
mouseDialog.show(getStage());
timer.schedule(new TimerTask() {
@Override
public void run() {
mouseImage.setDrawable(new SpriteDrawable(new Sprite(mouseTexture)));
mouseImage.setTouchable(Touchable.enabled);
mouseDialog.hide();
}
}, MOUSE_DIALOG_DURATION);
}
});
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment