Implement shop anim

This commit is contained in:
thepaperpilot 2023-02-20 21:30:02 -06:00
parent c2ef210947
commit a402ed164c
5 changed files with 17 additions and 7 deletions

BIN
public/shop.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/shop1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -40,13 +40,17 @@
} }
.reroll { .reroll {
flex-direction: column; height: 18vmin;
margin: 2vmin;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
transition-duration: 0s; transition-duration: 0s;
} }
.reroll img {
height: 100%;
transform: scale(1.5) translateY(-18%);
}
.startStream { .startStream {
height: 16vmin; height: 16vmin;
cursor: pointer; cursor: pointer;

View file

@ -27,6 +27,8 @@ import { createParticles } from "features/particles/particles";
import { render } from "util/vue"; import { render } from "util/vue";
import { globalBus } from "game/events"; import { globalBus } from "game/events";
import victoryParticles from "./victory.json"; import victoryParticles from "./victory.json";
import shopStill from "../../public/shop1.png";
import shopGif from "../../public/shop.gif";
export const characters: Record<string, CharacterInfo> = { export const characters: Record<string, CharacterInfo> = {
// Tier 1 // Tier 1
@ -257,6 +259,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
}[] }[]
>([]); >([]);
const frozen = ref<number[]>([]); const frozen = ref<number[]>([]);
const showRefreshAnim = ref<boolean>(false);
const battle = ref<{ const battle = ref<{
team: Character[]; team: Character[];
@ -681,10 +684,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
} }
}} }}
> >
<span class="material-icons" style="font-size: 8vmin"> <img src={showRefreshAnim.value ? shopGif : shopStill} />
casino
</span>
<span style="font-size: 2vmin">Roll</span>
</div> </div>
{shop.value.map((item, i) => ( {shop.value.map((item, i) => (
<CharacterSlot <CharacterSlot
@ -774,7 +774,8 @@ export const main = createLayer("main", function (this: BaseLayer) {
playClicked, playClicked,
prepareMove, prepareMove,
particles, particles,
queue queue,
showRefreshAnim
}; };
}); });

View file

@ -131,9 +131,12 @@ function setupSocket(socket: Socket<ServerToClientEvents, ClientToServerEvents>)
presence: characters[item].initialPresence, presence: characters[item].initialPresence,
exp: 1 exp: 1
})); }));
main.frozen.value = main.frozen.value.map((_, i) => i);
setTimeout(() => { setTimeout(() => {
shop.forEach((_, i) => poof(`shop-char-${i}`)); shop.forEach((_, i) => poof(`shop-char-${i}`));
}, 0); }, 0);
main.showRefreshAnim.value = true;
setTimeout(() => (main.showRefreshAnim.value = false), 500);
}); });
socket.on("reroll", shop => { socket.on("reroll", shop => {
main.gold.value--; main.gold.value--;
@ -147,6 +150,8 @@ function setupSocket(socket: Socket<ServerToClientEvents, ClientToServerEvents>)
setTimeout(() => { setTimeout(() => {
shop.forEach((_, i) => poof(`shop-char-${i}`)); shop.forEach((_, i) => poof(`shop-char-${i}`));
}, 0); }, 0);
main.showRefreshAnim.value = true;
setTimeout(() => (main.showRefreshAnim.value = false), 500);
}); });
socket.on("buy", (shopIndex, teamIndex, char) => { socket.on("buy", (shopIndex, teamIndex, char) => {
main.team.value[teamIndex] = char; main.team.value[teamIndex] = char;