Moved hats and emotes to common
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package org.saturnclient.cosmetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Emotes {
|
||||
public static List<String> availableEmotes = new ArrayList<>();
|
||||
|
||||
public static void initialize() {
|
||||
availableEmotes.add("tpose");
|
||||
availableEmotes.add("back_flip");
|
||||
availableEmotes.add("facepalm");
|
||||
availableEmotes.add("cry");
|
||||
availableEmotes.add("giga_chad");
|
||||
availableEmotes.add("front_flip");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.saturnclient.cosmetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.saturnclient.client.ServiceClient;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
|
||||
public class Hats {
|
||||
public static final String[] ALL_HATS = { "horns_black", "horns_white", "halo", "halo_black" };
|
||||
public static List<String> availableHats = new ArrayList<>();
|
||||
|
||||
public static void initialize() {
|
||||
availableHats.add(0, "");
|
||||
}
|
||||
|
||||
public static void setHat(String hatName) {
|
||||
if (availableHats.contains(hatName)) {
|
||||
setHat(ServiceClient.uuid, hatName);
|
||||
ServiceClient.setHat(hatName);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setHat(UUID uuid, String hatName) {
|
||||
SaturnPlayer player = SaturnPlayer.get(uuid);
|
||||
if (player != null) {
|
||||
player.hat = hatName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package org.saturnclient.ui.screens;
|
||||
|
||||
import org.saturnclient.cosmetics.Emotes;
|
||||
import org.saturnclient.client.ServiceClient;
|
||||
import org.saturnclient.common.minecraft.bindings.SaturnClientBindings;
|
||||
import org.saturnclient.config.AnimationConfig;
|
||||
import org.saturnclient.config.Config;
|
||||
import org.saturnclient.ui.SaturnScreen;
|
||||
import org.saturnclient.ui.Utils;
|
||||
import org.saturnclient.ui.anim.Fade;
|
||||
import org.saturnclient.ui.anim.SlideY;
|
||||
import org.saturnclient.ui.elements.AnimationStagger;
|
||||
import org.saturnclient.ui.elements.ImageTexture;
|
||||
import org.saturnclient.ui.elements.TextureButton;
|
||||
import org.saturnclient.ui.resources.Textures;
|
||||
|
||||
public class EmoteWheel extends SaturnScreen {
|
||||
int page = 1;
|
||||
|
||||
public EmoteWheel() {
|
||||
super("Emote Wheel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ui() {
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
// =============================
|
||||
// Logo
|
||||
// =============================
|
||||
|
||||
draw(new ImageTexture(Textures.LOGO_TEXT)
|
||||
.dimensions(98, 10)
|
||||
.centerOffset(width, height, 0, -105)
|
||||
.animation(new Fade(AnimationConfig.logo.duration.value)));
|
||||
|
||||
draw(new ImageTexture(Config.getLogo())
|
||||
.dimensions(98, 98)
|
||||
.centerOffset(width, height, 0, -149)
|
||||
.animation(new SlideY(AnimationConfig.logo, -20)));
|
||||
|
||||
// =============================
|
||||
// Navigation Buttons
|
||||
// =============================
|
||||
|
||||
draw(new TextureButton(Textures.LEFT, () -> {
|
||||
if (page > 1) {
|
||||
page--;
|
||||
elements.clear();
|
||||
ui();
|
||||
}
|
||||
}).dimensions(30, 30)
|
||||
.centerOffset(width, height, -50, 105)
|
||||
.animation(new Fade(500)));
|
||||
|
||||
draw(new TextureButton(Textures.RIGHT, () -> {
|
||||
if ((page * 8) < Emotes.availableEmotes.size()) {
|
||||
page++;
|
||||
elements.clear();
|
||||
ui();
|
||||
}
|
||||
}).dimensions(30, 30)
|
||||
.centerOffset(width, height, 50, 105)
|
||||
.animation(new Fade(500)));
|
||||
|
||||
// =============================
|
||||
// Emote Grid (Staggered)
|
||||
// =============================
|
||||
|
||||
AnimationStagger emoteStagger = new AnimationStagger(AnimationConfig.emoteWheel);
|
||||
|
||||
while (row < 3) {
|
||||
|
||||
int idx = (row * 3 + col) + ((page - 1) * 8);
|
||||
|
||||
if (row == 1 && col == 1) {
|
||||
col++;
|
||||
}
|
||||
|
||||
String emote = Utils.getOrNull(Emotes.availableEmotes, idx);
|
||||
|
||||
emoteStagger.draw(
|
||||
new TextureButton(Textures.getEmotePreview(emote), () -> {
|
||||
if (emote != null)
|
||||
SaturnClientBindings.emotes().setEmote(ServiceClient.uuid, emote);
|
||||
|
||||
provider.close();
|
||||
})
|
||||
.dimensions(70, 70)
|
||||
.centerOffset(width, height,
|
||||
-80 + (col * 80),
|
||||
-35 + (row * 80))
|
||||
.animation(new SlideY(AnimationConfig.emoteWheel, 12)));
|
||||
|
||||
if (col < 2) {
|
||||
col++;
|
||||
} else {
|
||||
col = 0;
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
||||
draw(emoteStagger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldPause() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -69,8 +69,7 @@ public class CloakMenu extends SaturnScreen {
|
||||
.animation(new Fade(500)));
|
||||
|
||||
draw(new Sidebar(2, this.provider::close)
|
||||
.centerOffset(width, height, -(scrollWidth / 2 + 20), 0)
|
||||
.animation(new Fade(400)));
|
||||
.centerOffset(width, height, -(scrollWidth / 2 + 20), 0));
|
||||
|
||||
draw(new TabMenu(0,
|
||||
new TabMenuComponent(Textures.CLOAK, () -> {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.saturnclient.ui.screens.cosmetics;
|
||||
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
// import org.saturnclient.cosmetics.hat.Hats;
|
||||
import org.saturnclient.common.minecraft.MinecraftProvider;
|
||||
import org.saturnclient.config.AnimationConfig;
|
||||
import org.saturnclient.cosmetics.Hats;
|
||||
import org.saturnclient.ui.SaturnScreen;
|
||||
import org.saturnclient.ui.anim.Fade;
|
||||
import org.saturnclient.ui.anim.SlideY;
|
||||
@@ -36,24 +36,23 @@ public class HatMenu extends SaturnScreen {
|
||||
AnimationStagger stagger = new AnimationStagger(AnimationConfig.cosmeticsMenu);
|
||||
|
||||
if (player != null) {
|
||||
// for (String hat : Hats.availableHats) {
|
||||
for (String hat : Hats.availableHats) {
|
||||
stagger.draw(
|
||||
new CosmeticPreview(
|
||||
hat == player.hat,
|
||||
Textures.getHatPreview(hat),
|
||||
() -> Hats.setHat(hat))
|
||||
.dimensions(50, 50)
|
||||
.position((50 + g) * col, (50 + g) * row)
|
||||
.animation(new SlideY(AnimationConfig.cosmeticsMenu, 14)));
|
||||
|
||||
// stagger.draw(
|
||||
// new CosmeticPreview(
|
||||
// hat == player.hat,
|
||||
// Textures.getHatPreview(hat),
|
||||
// () -> Hats.setHat(hat))
|
||||
// .dimensions(50, 50)
|
||||
// .position((50 + g) * col, (50 + g) * row)
|
||||
// .animation(new SlideY(AnimationConfig.cosmeticsMenu, 14)));
|
||||
|
||||
// if (col == 5) {
|
||||
// col = 0;
|
||||
// row++;
|
||||
// } else {
|
||||
// col++;
|
||||
// }
|
||||
// }
|
||||
if (col == 5) {
|
||||
col = 0;
|
||||
row++;
|
||||
} else {
|
||||
col++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scroll.draw(stagger);
|
||||
@@ -70,8 +69,7 @@ public class HatMenu extends SaturnScreen {
|
||||
.animation(new Fade(500)));
|
||||
|
||||
draw(new Sidebar(2, this.provider::close)
|
||||
.centerOffset(width, height, -(scrollWidth / 2 + 20), 0)
|
||||
.animation(new Fade(400)));
|
||||
.centerOffset(width, height, -(scrollWidth / 2 + 20), 0));
|
||||
|
||||
draw(new TabMenu(1,
|
||||
new TabMenuComponent(Textures.CLOAK, () -> {
|
||||
|
||||
@@ -98,8 +98,7 @@ public class CloakStore extends SaturnScreen {
|
||||
.centerOffset(width, height, 15, 0));
|
||||
|
||||
draw(new Sidebar(5, this.provider::close)
|
||||
.centerOffset(width, height, -((scrollWidth - 30) / 2 + 20), 0)
|
||||
.animation(new Fade(400)));
|
||||
.centerOffset(width, height, -((scrollWidth - 30) / 2 + 20), 0));
|
||||
|
||||
draw(new TabMenu(0,
|
||||
new TabMenuComponent(Textures.CLOAK, () -> {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.saturnclient.ui.screens.store;
|
||||
|
||||
// import org.saturnclient.cosmetics.hat.Hats;
|
||||
import org.saturnclient.client.ServiceClient;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.saturnclient.common.minecraft.MinecraftProvider;
|
||||
import org.saturnclient.config.AnimationConfig;
|
||||
import org.saturnclient.config.Theme;
|
||||
import org.saturnclient.cosmetics.Hats;
|
||||
import org.saturnclient.ui.SaturnScreen;
|
||||
import org.saturnclient.ui.anim.Fade;
|
||||
import org.saturnclient.ui.anim.SlideY;
|
||||
@@ -50,44 +50,44 @@ public class HatStore extends SaturnScreen {
|
||||
AnimationStagger stagger = new AnimationStagger(AnimationConfig.cosmeticsMenu);
|
||||
|
||||
if (player != null) {
|
||||
// for (String hat : Hats.ALL_HATS) {
|
||||
// if (!Hats.availableHats.contains(hat)) {
|
||||
for (String hat : Hats.ALL_HATS) {
|
||||
if (!Hats.availableHats.contains(hat)) {
|
||||
|
||||
// int x = (50 + gx) * col;
|
||||
// int y = (50 + gy) * row;
|
||||
int x = (50 + gx) * col;
|
||||
int y = (50 + gy) * row;
|
||||
|
||||
// stagger.draw(
|
||||
// new CosmeticPreview(
|
||||
// hat == player.hat,
|
||||
// Textures.getHatPreview(hat),
|
||||
// () -> handlePurchase(hat))
|
||||
// .dimensions(50, 50)
|
||||
// .position(x, y)
|
||||
// .animation(new SlideY(AnimationConfig.cosmeticsMenu, 16)));
|
||||
stagger.draw(
|
||||
new CosmeticPreview(
|
||||
hat == player.hat,
|
||||
Textures.getHatPreview(hat),
|
||||
() -> handlePurchase(hat))
|
||||
.dimensions(50, 50)
|
||||
.position(x, y)
|
||||
.animation(new SlideY(AnimationConfig.cosmeticsMenu, 16)));
|
||||
|
||||
// String t = "50";
|
||||
String t = "50";
|
||||
|
||||
// stagger.draw(
|
||||
// new Text(t)
|
||||
// .position(x + Fonts.centerX(50, t, Theme.FONT.value), y + 53)
|
||||
// .scale(0.5f)
|
||||
// .animation(new Fade(400)));
|
||||
stagger.draw(
|
||||
new Text(t)
|
||||
.position(x + Fonts.centerX(50, t, Theme.FONT.value), y + 53)
|
||||
.scale(0.5f)
|
||||
.animation(new Fade(400)));
|
||||
|
||||
// stagger.draw(
|
||||
// new ImageTexture(Textures.COINS)
|
||||
// .dimensions(16, 16)
|
||||
// .position(x + Fonts.getWidth(t, Theme.FONT.value) + 4, y + 52)
|
||||
// .scale(0.5f)
|
||||
// .animation(new Fade(400)));
|
||||
stagger.draw(
|
||||
new ImageTexture(Textures.COINS)
|
||||
.dimensions(16, 16)
|
||||
.position(x + Fonts.getWidth(t, Theme.FONT.value) + 4, y + 52)
|
||||
.scale(0.5f)
|
||||
.animation(new Fade(400)));
|
||||
|
||||
// if (col == 8) {
|
||||
// col = 0;
|
||||
// row++;
|
||||
// } else {
|
||||
// col++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (col == 8) {
|
||||
col = 0;
|
||||
row++;
|
||||
} else {
|
||||
col++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scroll.draw(stagger);
|
||||
@@ -99,8 +99,7 @@ public class HatStore extends SaturnScreen {
|
||||
.centerOffset(width, height, 15, 0));
|
||||
|
||||
draw(new Sidebar(5, this.provider::close)
|
||||
.centerOffset(width, height, -((scrollWidth - 30) / 2 + 20), 0)
|
||||
.animation(new Fade(400)));
|
||||
.centerOffset(width, height, -((scrollWidth - 30) / 2 + 20), 0));
|
||||
|
||||
draw(new TabMenu(1,
|
||||
new TabMenuComponent(Textures.CLOAK, () -> {
|
||||
|
||||
Reference in New Issue
Block a user