diff --git a/app/public/dist/client/changelog/patch-4.10.md b/app/public/dist/client/changelog/patch-4.10.md index 92a94e1be2..58ef55c550 100644 --- a/app/public/dist/client/changelog/patch-4.10.md +++ b/app/public/dist/client/changelog/patch-4.10.md @@ -67,3 +67,4 @@ - New title: Stargazer - Get Solgaleo or Lunala - Changed Scribble "Rare is Expensive": Buying XP now costs 8 instead of 4. Units are bought and sold for 1 gold less. - New Scribble rule: Free Market +- New keybiding for emotes: maintain Ctrl to show emote menu, Ctrl+1..9 to trigger emote 1..9 diff --git a/app/public/dist/client/locales/en/translation.json b/app/public/dist/client/locales/en/translation.json index 1c85d8c4e3..9f9f190209 100644 --- a/app/public/dist/client/locales/en/translation.json +++ b/app/public/dist/client/locales/en/translation.json @@ -2558,6 +2558,7 @@ "key_desc_refresh": "Refresh shop", "key_desc_avatar_anim": "Play avatar animation", "key_desc_avatar_emotes": "Toggle emote menu", + "key_desc_avatar_show_emote": "Trigger emote", "jukebox": "Jukebox", "gadgets": "Gadgets", "gadgets_unlocked": "gadgets unlocked", diff --git a/app/public/dist/client/locales/fr/translation.json b/app/public/dist/client/locales/fr/translation.json index 89c58ceece..86fb1037d0 100644 --- a/app/public/dist/client/locales/fr/translation.json +++ b/app/public/dist/client/locales/fr/translation.json @@ -2507,6 +2507,7 @@ "key_desc_refresh": "Relancer la boutique", "key_desc_avatar_anim": "Jouer l'emote de l'avatar", "key_desc_avatar_emotes": "Voir le menu des emotes", + "key_desc_avatar_show_emote": "Lancer l'emote", "jukebox": "Jukebox", "gadgets": "Gadgets", "gadgets_unlocked": "gadgets débloqués", diff --git a/app/public/src/game/components/board-manager.ts b/app/public/src/game/components/board-manager.ts index f958b10736..bad5576153 100644 --- a/app/public/src/game/components/board-manager.ts +++ b/app/public/src/game/components/board-manager.ts @@ -510,7 +510,7 @@ export default class BoardManager { return benchSize } - toggleAnimation(playerId: string, emote?: string) { + showEmote(playerId: string, emote?: string) { const player = this.playerAvatar.playerId === playerId ? this.playerAvatar diff --git a/app/public/src/game/components/emote-menu.css b/app/public/src/game/components/emote-menu.css index 8bd77d4134..3a197cac15 100644 --- a/app/public/src/game/components/emote-menu.css +++ b/app/public/src/game/components/emote-menu.css @@ -9,6 +9,7 @@ .emote-menu li { display: block; list-style: none; + position: relative; } .emote-menu li img { @@ -20,6 +21,17 @@ box-shadow: 2px 2px #00000060; } +.emote-menu li .counter { + position: absolute; + bottom: 0; + left: 0.25em; + opacity: 0.5; + color: black; + font-size: 1em; + text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, + 1px 1px 0 #fff; +} + .emote-menu li img.locked { filter: grayscale(1) contrast(0.5); } diff --git a/app/public/src/game/components/emote-menu.tsx b/app/public/src/game/components/emote-menu.tsx index fb050426a0..5509f16da3 100644 --- a/app/public/src/game/components/emote-menu.tsx +++ b/app/public/src/game/components/emote-menu.tsx @@ -4,41 +4,21 @@ import ReactDOM from "react-dom/client" import { useTranslation } from "react-i18next" import { PRECOMPUTED_EMOTIONS_PER_POKEMON_INDEX } from "../../../../models/precomputed" import { IPlayer } from "../../../../types" -import { Emotion } from "../../../../types/enum/Emotion" -import { throttle } from "../../../../utils/function" +import { AvatarEmotions, Emotion } from "../../../../types/enum/Emotion" import { logger } from "../../../../utils/logger" import { cc } from "../../pages/utils/jsx" import store from "../../stores" -import { toggleAnimation } from "../../stores/NetworkStore" -import { getAvatarString, getPortraitSrc } from "../../utils" +import { getPortraitSrc } from "../../utils" import "./emote-menu.css" -const sendEmote = throttle(function ( - index: string, - shiny: boolean, - emotion: Emotion -) { - store.dispatch(toggleAnimation(getAvatarString(index, shiny, emotion))) -}, -3000) - export function EmoteMenuComponent(props: { player: IPlayer index: string shiny: boolean + sendEmote: (emotion: Emotion) => void }) { const { t } = useTranslation() - const emotions: Emotion[] = [ - Emotion.HAPPY, - Emotion.JOYOUS, - Emotion.DETERMINED, - Emotion.PAIN, - Emotion.ANGRY, - Emotion.CRYING, - Emotion.SURPRISED, - Emotion.STUNNED, - Emotion.DIZZY - ].filter((emotion) => { + const emotions: Emotion[] = AvatarEmotions.filter((emotion) => { const indexEmotion = Object.values(Emotion).indexOf(emotion) return ( PRECOMPUTED_EMOTIONS_PER_POKEMON_INDEX[props.index]?.[indexEmotion] === 1 @@ -52,7 +32,7 @@ export function EmoteMenuComponent(props: {
{t("no_emotions_available")}
) : (