diff --git a/android/assets/ui/x0.75/effects.png b/android/assets/ui/x0.75/effects.png new file mode 100644 index 0000000..710b8f7 Binary files /dev/null and b/android/assets/ui/x0.75/effects.png differ diff --git a/android/assets/ui/x1.0/effects.png b/android/assets/ui/x1.0/effects.png new file mode 100644 index 0000000..6998b21 Binary files /dev/null and b/android/assets/ui/x1.0/effects.png differ diff --git a/android/assets/ui/x1.25/effects.png b/android/assets/ui/x1.25/effects.png new file mode 100644 index 0000000..adf4350 Binary files /dev/null and b/android/assets/ui/x1.25/effects.png differ diff --git a/android/assets/ui/x1.5/effects.png b/android/assets/ui/x1.5/effects.png new file mode 100644 index 0000000..4b4be29 Binary files /dev/null and b/android/assets/ui/x1.5/effects.png differ diff --git a/android/assets/ui/x2.0/effects.png b/android/assets/ui/x2.0/effects.png new file mode 100644 index 0000000..76e5b2c Binary files /dev/null and b/android/assets/ui/x2.0/effects.png differ diff --git a/android/assets/ui/x4.0/effects.png b/android/assets/ui/x4.0/effects.png new file mode 100644 index 0000000..360a3d3 Binary files /dev/null and b/android/assets/ui/x4.0/effects.png differ diff --git a/core/src/io/github/lonamiwebs/klooni/SkinLoader.java b/core/src/io/github/lonamiwebs/klooni/SkinLoader.java index 7c07891..e8fcd7f 100644 --- a/core/src/io/github/lonamiwebs/klooni/SkinLoader.java +++ b/core/src/io/github/lonamiwebs/klooni/SkinLoader.java @@ -28,7 +28,7 @@ public class SkinLoader { private static String[] ids = { "play", "play_saved", "star", "stopwatch", "palette", "home", "replay", "share", "sound_on", "sound_off", "snap_on", "snap_off", "issues", "credits", - "web", "back", "ok", "cancel", "power_off" + "web", "back", "ok", "cancel", "power_off", "effects" }; private static float bestMultiplier; diff --git a/core/src/io/github/lonamiwebs/klooni/screens/CustomizeScreen.java b/core/src/io/github/lonamiwebs/klooni/screens/CustomizeScreen.java index fb9b6e2..22e1db0 100644 --- a/core/src/io/github/lonamiwebs/klooni/screens/CustomizeScreen.java +++ b/core/src/io/github/lonamiwebs/klooni/screens/CustomizeScreen.java @@ -49,6 +49,14 @@ class CustomizeScreen implements Screen { private final Screen lastScreen; + private final Table table; + private final SoftButton toggleShopButton; + private final VerticalGroup shopGroup; // Showing available themes or effects + private final ScrollPane shopScroll; + final MoneyBuyBand buyBand; + + private boolean showingEffectsShop; + private float themeDragStartX, themeDragStartY; //endregion @@ -64,13 +72,11 @@ class CustomizeScreen implements Screen { //region Constructor CustomizeScreen(Klooni game, final Screen lastScreen) { - final GameLayout layout = new GameLayout(); - this.game = game; this.lastScreen = lastScreen; stage = new Stage(); - Table table = new Table(); + table = new Table(); table.setFillParent(true); stage.addActor(table); @@ -101,6 +107,22 @@ class CustomizeScreen implements Screen { }); optionsGroup.addActor(soundButton); + // Toggle the current shop (themes or effects) + toggleShopButton = new SoftButton(2, "effects_texture"); + toggleShopButton.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + showingEffectsShop = !showingEffectsShop; + if (showingEffectsShop) { + toggleShopButton.updateImage("palette_texture"); + } else { + toggleShopButton.updateImage("effects_texture"); + } + loadShop(); + } + }); + optionsGroup.addActor(toggleShopButton); + // Snap to grid on/off final SoftButton snapButton = new SoftButton( 2, Klooni.shouldSnapToGrid() ? "snap_on_texture" : "snap_off_texture"); @@ -139,66 +161,18 @@ class CustomizeScreen implements Screen { table.add(new ScrollPane(optionsGroup)) .pad(20, 4, 12, 4).height(backButton.getHeight()); - // Load all the available themes - final MoneyBuyBand buyBand = new MoneyBuyBand(game); - + buyBand = new MoneyBuyBand(game); table.row(); - final VerticalGroup themesGroup = new VerticalGroup(); - for (Theme theme : Theme.getThemes()) { - final ThemeCard card = new ThemeCard(game, layout, theme); - card.addListener(new InputListener() { - @Override - public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { - themeDragStartX = x; - themeDragStartY = y; - return true; - } - // We could actually rely on touchDragged not being called, - // but perhaps it would be hard for some people not to move - // their fingers even the slightest bit, so we use a custom - // drag limit - - @Override - public void touchUp(InputEvent event, float x, float y, int pointer, int button) { - x -= themeDragStartX; - y -= themeDragStartY; - float distSq = x * x + y * y; - if (distSq < DRAG_LIMIT_SQ) { - if (Klooni.isThemeBought(card.theme)) - card.use(); - else - buyBand.askBuy(card); - - for (Actor a : themesGroup.getChildren()) { - ThemeCard c = (ThemeCard)a; - c.usedThemeUpdated(); - } - } - } - }); - themesGroup.addActor(card); - } - - final ScrollPane themesScroll = new ScrollPane(themesGroup); - table.add(themesScroll).expand().fill(); + // Load all the available themes as the default "shop" + shopGroup = new VerticalGroup(); + shopScroll = new ScrollPane(shopGroup); + table.add(shopScroll).expand().fill(); + loadShop(); // Show the current money row table.row(); table.add(buyBand).expandX().fillX(); - - // Scroll to the currently selected theme - table.layout(); - for (Actor a : themesGroup.getChildren()) { - ThemeCard c = (ThemeCard)a; - if (c.isUsed()) { - themesScroll.scrollTo( - c.getX(), c.getY() + c.getHeight(), - c.getWidth(), c.getHeight()); - break; - } - c.usedThemeUpdated(); - } } //endregion @@ -209,6 +183,66 @@ class CustomizeScreen implements Screen { CustomizeScreen.this.game.transitionTo(lastScreen); } + private void loadShop() { + final GameLayout layout = new GameLayout(); + shopGroup.clear(); + + if (showingEffectsShop) { + // TODO Show the effects shop + } else { + // Showing themes shop otherwise + for (Theme theme : Theme.getThemes()) { + final ThemeCard card = new ThemeCard(game, layout, theme); + card.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + themeDragStartX = x; + themeDragStartY = y; + return true; + } + + // We could actually rely on touchDragged not being called, + // but perhaps it would be hard for some people not to move + // their fingers even the slightest bit, so we use a custom + // drag limit + + @Override + public void touchUp(InputEvent event, float x, float y, int pointer, int button) { + x -= themeDragStartX; + y -= themeDragStartY; + float distSq = x * x + y * y; + if (distSq < DRAG_LIMIT_SQ) { + if (Klooni.isThemeBought(card.theme)) + card.use(); + else + buyBand.askBuy(card); + + for (Actor a : shopGroup.getChildren()) { + ThemeCard c = (ThemeCard)a; + c.usedThemeUpdated(); + } + } + } + }); + + shopGroup.addActor(card); + + // Scroll to the currently selected theme + table.layout(); + for (Actor a : shopGroup.getChildren()) { + ThemeCard c = (ThemeCard)a; + if (c.isUsed()) { + shopScroll.scrollTo( + c.getX(), c.getY() + c.getHeight(), + c.getWidth(), c.getHeight()); + break; + } + c.usedThemeUpdated(); + } + } + } + } + //endregion //region Public methods diff --git a/original-resources/buttons.svg b/original-resources/buttons.svg index b1d3c29..3bb5be3 100644 --- a/original-resources/buttons.svg +++ b/original-resources/buttons.svg @@ -152,9 +152,9 @@ borderopacity="1" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:zoom="1" - inkscape:cx="-18.655028" - inkscape:cy="163.7511" + inkscape:zoom="0.5" + inkscape:cx="-85.026722" + inkscape:cy="8.3628693" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" @@ -163,7 +163,7 @@ inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" - showguides="false" + showguides="true" inkscape:guide-bbox="true" units="px"> + transform="matrix(3.0000588,0,0,3.0000588,0,-2314.7845)"> buttons cells - measures + transform="matrix(3.0000588,0,0,3.0000588,-107.02664,-1835.9396)"> + transform="translate(-46.651447,-190.88537)"> + id="drop" + transform="translate(0,-190.88537)"> + + + + + + + + + + + + + + + diff --git a/original-resources/gen-ui-png.py b/original-resources/gen-ui-png.py index 106feb9..cd66144 100755 --- a/original-resources/gen-ui-png.py +++ b/original-resources/gen-ui-png.py @@ -19,6 +19,7 @@ ids = [ 'cancel', 'credits', 'cup', + 'effects', 'home', 'issues', 'ok',