Emote wheel animation config
This commit is contained in:
@@ -18,6 +18,9 @@ public class AnimationConfig {
|
|||||||
// Shift menu
|
// Shift menu
|
||||||
public static final AnimationConfig shiftMenu = new AnimationConfig(true, 300, 120);
|
public static final AnimationConfig shiftMenu = new AnimationConfig(true, 300, 120);
|
||||||
|
|
||||||
|
// Emote wheel
|
||||||
|
public static final AnimationConfig emoteWheel = new AnimationConfig(true, 500, 80);
|
||||||
|
|
||||||
public static void init(ConfigManager parent) {
|
public static void init(ConfigManager parent) {
|
||||||
config = new ConfigManager(parent, "Animations");
|
config = new ConfigManager(parent, "Animations");
|
||||||
|
|
||||||
@@ -25,6 +28,7 @@ public class AnimationConfig {
|
|||||||
mainMenu.init("Main Menu");
|
mainMenu.init("Main Menu");
|
||||||
modMenu.init("Mod Menu");
|
modMenu.init("Mod Menu");
|
||||||
shiftMenu.init("Shift Menu");
|
shiftMenu.init("Shift Menu");
|
||||||
|
emoteWheel.init("Emote Wheel");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animation properties
|
// Animation properties
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.saturnclient.ui2.SaturnScreen;
|
|||||||
import org.saturnclient.ui2.Utils;
|
import org.saturnclient.ui2.Utils;
|
||||||
import org.saturnclient.ui2.anim.Fade;
|
import org.saturnclient.ui2.anim.Fade;
|
||||||
import org.saturnclient.ui2.anim.SlideY;
|
import org.saturnclient.ui2.anim.SlideY;
|
||||||
|
import org.saturnclient.ui2.elements.AnimationStagger;
|
||||||
import org.saturnclient.ui2.elements.ImageTexture;
|
import org.saturnclient.ui2.elements.ImageTexture;
|
||||||
import org.saturnclient.ui2.elements.TextureButton;
|
import org.saturnclient.ui2.elements.TextureButton;
|
||||||
import org.saturnclient.ui2.resources.Textures;
|
import org.saturnclient.ui2.resources.Textures;
|
||||||
@@ -30,29 +31,53 @@ public class EmoteWheel extends SaturnScreen {
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
|
|
||||||
draw(new ImageTexture(Textures.LOGO_TEXT).dimensions(98, 10).centerOffset(width, height, 0, -105)
|
// =============================
|
||||||
|
// Logo
|
||||||
|
// =============================
|
||||||
|
|
||||||
|
draw(new ImageTexture(Textures.LOGO_TEXT)
|
||||||
|
.dimensions(98, 10)
|
||||||
|
.centerOffset(width, height, 0, -105)
|
||||||
.animation(new Fade(AnimationConfig.logo.duration.value)));
|
.animation(new Fade(AnimationConfig.logo.duration.value)));
|
||||||
draw(new ImageTexture(Config.getLogo()).dimensions(98, 98).centerOffset(width, height, 0, -149)
|
|
||||||
|
draw(new ImageTexture(Config.getLogo())
|
||||||
|
.dimensions(98, 98)
|
||||||
|
.centerOffset(width, height, 0, -149)
|
||||||
.animation(new SlideY(AnimationConfig.logo, -20)));
|
.animation(new SlideY(AnimationConfig.logo, -20)));
|
||||||
|
|
||||||
|
// =============================
|
||||||
|
// Navigation Buttons
|
||||||
|
// =============================
|
||||||
|
|
||||||
draw(new TextureButton(Textures.LEFT, () -> {
|
draw(new TextureButton(Textures.LEFT, () -> {
|
||||||
if (page > 1) {
|
if (page > 1) {
|
||||||
page--;
|
page--;
|
||||||
elements.clear();
|
elements.clear();
|
||||||
ui();
|
ui();
|
||||||
}
|
}
|
||||||
}).dimensions(30, 30).centerOffset(width, height, -20, 45).animation(new Fade(700)));
|
}).dimensions(30, 30)
|
||||||
|
.centerOffset(width, height, -50, 105)
|
||||||
|
.animation(new Fade(500)));
|
||||||
|
|
||||||
draw(new TextureButton(Textures.RIGHT, () -> {
|
draw(new TextureButton(Textures.RIGHT, () -> {
|
||||||
if ((8 * page) < Emotes.availableEmotes.size()) {
|
if ((page * 8) < Emotes.availableEmotes.size()) {
|
||||||
page++;
|
page++;
|
||||||
elements.clear();
|
elements.clear();
|
||||||
ui();
|
ui();
|
||||||
}
|
}
|
||||||
}).dimensions(30, 30).centerOffset(width, height, 20, 45).animation(new Fade(700)));
|
}).dimensions(30, 30)
|
||||||
|
.centerOffset(width, height, 50, 105)
|
||||||
|
.animation(new Fade(500)));
|
||||||
|
|
||||||
|
// =============================
|
||||||
|
// Emote Grid (Staggered)
|
||||||
|
// =============================
|
||||||
|
|
||||||
|
AnimationStagger emoteStagger = new AnimationStagger(AnimationConfig.emoteWheel);
|
||||||
|
|
||||||
while (row < 3) {
|
while (row < 3) {
|
||||||
int idx = (row * 3 + col) * page;
|
|
||||||
|
int idx = (row * 3 + col) + ((page - 1) * 8);
|
||||||
|
|
||||||
if (row == 1 && col == 1) {
|
if (row == 1 && col == 1) {
|
||||||
col++;
|
col++;
|
||||||
@@ -60,21 +85,35 @@ public class EmoteWheel extends SaturnScreen {
|
|||||||
|
|
||||||
String emote = Utils.getOrNull(Emotes.availableEmotes, idx);
|
String emote = Utils.getOrNull(Emotes.availableEmotes, idx);
|
||||||
|
|
||||||
draw(new TextureButton(Textures.getEmotePreview(emote), () -> {
|
emoteStagger.draw(
|
||||||
if (emote == null) {
|
new TextureButton(Textures.getEmotePreview(emote), () -> {
|
||||||
|
|
||||||
|
if (emote == null)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
|
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(
|
||||||
if (animationStack.isActive() && animationStack.getPriority() == 1000) {
|
SaturnClient.client.player);
|
||||||
|
|
||||||
|
if (animationStack.isActive()
|
||||||
|
&& animationStack.getPriority() == 1000) {
|
||||||
animationStack.removeLayer(1000);
|
animationStack.removeLayer(1000);
|
||||||
}
|
}
|
||||||
animationStack.addAnimLayer(1000,
|
|
||||||
PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient",
|
animationStack.addAnimLayer(
|
||||||
emote)).playAnimation());
|
1000,
|
||||||
|
PlayerAnimationRegistry
|
||||||
|
.getAnimation(
|
||||||
|
Identifier.of("saturnclient", emote))
|
||||||
|
.playAnimation());
|
||||||
|
|
||||||
ServiceClient.emote(emote);
|
ServiceClient.emote(emote);
|
||||||
close();
|
close();
|
||||||
}).dimensions(70, 70).centerOffset(width, height, -80 + (col * 80), -35 + (row * 80))
|
})
|
||||||
.animation(new Fade(700)));
|
.dimensions(70, 70)
|
||||||
|
.centerOffset(width, height,
|
||||||
|
-80 + (col * 80),
|
||||||
|
-35 + (row * 80))
|
||||||
|
.animation(new SlideY(AnimationConfig.emoteWheel, 12)));
|
||||||
|
|
||||||
if (col < 2) {
|
if (col < 2) {
|
||||||
col++;
|
col++;
|
||||||
@@ -83,6 +122,8 @@ public class EmoteWheel extends SaturnScreen {
|
|||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
draw(emoteStagger);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user