Skip to content
Snippets Groups Projects
Commit 19141d06 authored by Matyáš Latner's avatar Matyáš Latner
Browse files

Merge branch 'feature-halloffame_devel' into 'devel'

#115 Feature halloffame devel - mouse dialog automatically hides after 5 seconds

Mouse dialog automatically hides after 5 seconds

See merge request !177
parents 222f8d46 8b7c7b43
No related branches found
No related tags found
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 = 5000;
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% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment