Compare commits

...
Author SHA1 Message Date
legonzaur 4e8a619cb9 fix : dockerfile
release-tag / release-image (push) Successful in 30s
2024-08-06 13:41:06 +02:00
legonzaur cb74d78928 fix : update dockerfile
release-tag / release-image (push) Failing after 11s
2024-08-06 13:38:40 +02:00
legonzaur a3ff9596d7 ci : add tokens to dockerfile
release-tag / release-image (push) Failing after 10s
2024-08-06 13:36:00 +02:00
legonzaur d18a2ab4f2 feat : token visuals draft 2024-08-06 13:30:43 +02:00
legonzaur 517f1bef5d chore: optimize loading by using defineComponent instead of defineAsyncComponent 2024-08-06 11:48:21 +02:00
legonzaur 77724d5539 ci : remove public directory
release-tag / release-image (push) Successful in 30s
2024-08-04 11:39:41 +02:00
legonzaur 21c41bb9fd ci : fix image directory
release-tag / release-image (push) Successful in 28s
2024-08-04 11:36:52 +02:00
legonzaur bb625b1fee ci : copy pngs into production stage
release-tag / release-image (push) Successful in 29s
2024-08-04 11:35:20 +02:00
legonzaur fd3cf0ba23 ci : fix image not being copied
release-tag / release-image (push) Successful in 28s
2024-08-04 11:33:10 +02:00
legonzaur 4ec29cf811 fix : champion polygon
release-tag / release-image (push) Successful in 29s
2024-08-04 11:21:41 +02:00
legonzaur b92eb4b901 fix : unify font for champion preview 2024-08-04 10:29:25 +02:00
legonzaur e36c916e0b feat : add health point to champion preview 2024-08-04 10:25:39 +02:00
legonzaur ca8e38624e fix : focused player card zone clip 2024-08-03 21:56:14 +02:00
10 changed files with 175 additions and 64 deletions
+3 -1
View File
@@ -24,4 +24,6 @@ logs
!.env.example
assets/images/*
public/img/skins
public/img/skins
public/img/icon
public/img/tokens
+12 -2
View File
@@ -4,11 +4,19 @@ COPY package*.json ./
RUN npm install
COPY . .
FROM git.legonzaur.fr/heronfief/cards-gen:main AS svg-stage
FROM git.legonzaur.fr/heronfief/cards-gen:main AS card-svg-stage
RUN python3 -u ./src/generate_cards_mvp.py
FROM git.legonzaur.fr/heronfief/tokens-gen:main AS token-svg-stage
RUN python3 -u ./src/generate_tokens_mvp.py
FROM install-stage AS build-stage
COPY --from=svg-stage /app/output/heron ./assets/images/cards/heron-svg
COPY --from=card-svg-stage /app/output/heron ./assets/images/cards/heron-svg
COPY --from=card-svg-stage /app/img/skins ./public/img
COPY --from=token-svg-stage /app/output/heron ./assets/images/tokens
COPY --from=token-svg-stage /app/img/icon ./public/img
ARG NUXT_PUBLIC_ENDPOINT
ARG NUXT_PUBLIC_DISCORD_LOGIN_ENDPOINT
@@ -19,4 +27,6 @@ RUN npx nuxi generate
# étape de production
FROM nginx:stable-alpine AS production-stage
COPY --from=build-stage /app/.output/public /usr/share/nginx/html
COPY --from=card-svg-stage /app/img/skins /usr/share/nginx/html/img/skins
COPY --from=token-svg-stage /app/img/icon /usr/share/nginx/html/img/icon
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
+3 -2
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { cards, compileCards } from "./services/loadCards";
import { compileCards, compileTokens } from "./services/loadCards";
import { getCurrentInstance } from "vue";
// import goStore, { oauth2_register_discord, setup_websocket, heron_cookie_login } from "@/netcode";
@@ -12,7 +12,8 @@ const app = getCurrentInstance()?.appContext.app;
if (!app) {
throw new Error("Couldn't bake cards: instance is null");
}
await compileCards(app);
await compileCards();
await compileTokens();
console.log("compiling done");
useHead({
+10
View File
@@ -0,0 +1,10 @@
{
"sacrifice":{
"title": "Sacrifice",
"description": "Destroy a card, forever"
},
"make_discard":{
"title": "Make Discard",
"description": "Give a fuck to your opponent"
}
}
+47 -13
View File
@@ -1,6 +1,7 @@
<script setup lang="ts">
import type { Effect } from "~/netcode/interfaces";
import { tokens } from "~/services/loadCards";
import effect_locales from "~/assets/locales/effects.json";
type Props = {
token: Effect;
};
@@ -14,24 +15,57 @@ function onClick(e: MouseEvent) {
</script>
<template>
<div @click.stop="onClick" @mousedown.left.stop="" id="token">
{{ props.token.effect }}
<div @click.stop="onClick" @mousedown.left.stop="" class="token_container">
<Component
:is="tokens[props.token.effect]"
v-if="props.token.effect in tokens"
/>
<span v-else>{{ props.token.effect }}</span>
<div class="token_description" v-if="props.token.effect in effect_locales">
<span
><b>{{ effect_locales[props.token.effect].title }}</b></span
>
<span>{{ effect_locales[props.token.effect].description }}</span>
</div>
</div>
</template>
<style scoped>
#token {
width: 50px;
height: 50px;
background: white;
border: 1px solid white;
<style>
.token_container {
margin: 15px;
/* backdrop-filter: blur(60px); */
background: rgba(201, 212, 38, 1);
border: 5px solid black;
width: min-content;
cursor: pointer;
box-sizing: border-box;
transition: 0.2s all;
border-radius: 15px;
border-radius: 10px;
display: flex;
flex-direction: row;
transition: 0.1s all var(--animation-curve);
position: relative;
z-index: 50;
}
#token:hover {
border: 1px solid red;
.token_container:hover {
border: 5px solid red;
transform: scale(110%);
}
.token_description {
min-width: max-content;
min-height: 45px;
position: absolute;
right: -10px;
transform: translateX(100%);
display: none;
flex-direction: column;
background: rgb(168, 175, 74);
border: 5px solid red;
border-radius: 10px;
}
.token_container:hover .token_description {
display: flex;
}
</style>
+36 -4
View File
@@ -56,14 +56,38 @@ const active = ref(false);
></GameCardAtom>
</div>
</foreignObject>
<circle
cx="2"
cy="-1"
r="1"
:fill="card.guard ? 'black' : 'lightgray'"
stroke="white"
stroke-width="0.2"
class="champion_small_defense"
:class="{ active }"
></circle>
<text
text-anchor="middle"
font-family="Helvetica"
font-weight="bold"
class="champion_small_defense"
font-size="1.5"
:class="{ active }"
x="2"
y="-.5"
:fill="card.guard ? 'white' : 'black'"
>
{{ card.defense }}
</text>
</svg>
</div>
</template>
<style>
.champion_small {
z-index: 10;
z-index: 2;
width: 100%;
margin-top: 10px;
}
.champion_small_svg {
@@ -75,8 +99,8 @@ const active = ref(false);
clip-path: polygon(
58% 62%,
67% 56%,
59% 34%,
40% 34%,
59% 35.8%,
40% 35.8%,
31% 55%,
41% 62%,
49% 67.77%
@@ -86,6 +110,15 @@ const active = ref(false);
cursor: pointer;
}
.champion_small_defense {
transition: 0.15s all var(--animation-curve);
pointer-events: none;
}
.champion_small_defense.active {
opacity: 0;
}
.champion_small_foreignObject.active {
clip-path: polygon(100% 100%, 100% 50%, 100% 0, 0 0, 0 50%, 0 100%, 49% 100%);
transform: translate(-50%, -50%);
@@ -97,7 +130,6 @@ const active = ref(false);
transform: translate(0, -20%) scale(50%);
display: flex;
position: relative;
z-index: 10;
}
.champion_small_foreignObject.active .champion_small_inside {
-1
View File
@@ -309,7 +309,6 @@ function discardCardClick(card: Card) {
"turn_buttons";
justify-items: center;
transition: all 1s;
overflow-x: hidden;
}
#current_player_board {
+2
View File
@@ -107,4 +107,6 @@ export interface Card extends GameObject {
cardId: number;
cardType: CardType;
effects: Effect[];
defense?: number;
guard?: boolean;
}
+1 -1
View File
@@ -489,7 +489,7 @@ footer {
display: flex;
flex-direction: column;
justify-content: center;
overflow-x: hidden;
overflow-x: clip;
/* background: url('/img/bg-darkgrass.png'); */
}
+61 -40
View File
@@ -1,40 +1,13 @@
import type { App, Component, DefineComponent } from "vue";
export const cards = {} as Record<string, Component>;
export const tokens = {} as Record<string, Component>;
export async function compileCards(app: App<any>) {
export async function compileCards() {
const svgs = import.meta.glob("@/assets/images/cards/heron-svg/*.svg", {
eager: true,
});
// const components = await Promise.all(
// Object.entries(svgs).map(async ([k, v]) => {
// const regex = /([\d]+)(?=\.svg)/gm;
// const url = (v as any).default as string;
// let template = await (await fetch(url)).text();
// let arrayTemplate = template.split("\n");
// arrayTemplate.splice(0, 1);
// template = arrayTemplate.join("\n");
// return [
// k.match(regex)![0],
// defineComponent({
// props: ["used_effects_indexes", "card"],
// setup(_props) {
// const count = ref(0);
// return { count };
// },
// methods: {
// effectClick(effect: number) {
// this.$emit("effectClick", effect);
// },
// },
// template: template,
// }),
// ];
// })
// );
const components = await Promise.all(
Object.entries(svgs).map(async ([k, v]) => {
const regex = /([\d]+)(?=\.svg)/gm;
@@ -52,18 +25,29 @@ export async function compileCards(app: App<any>) {
template = arrayTemplate.join("\n");
return [
Number(k.match(regex)![0]).toString(),
// markRaw(
// defineAsyncComponent({
// loader: async () =>
// defineComponent({
// props: ["used_effects_indexes", "cardId"],
// methods: {
// effectClick(effect: number) {
// this.$emit("effectClick", effect);
// },
// },
// template: template,
// }),
// })
// ),
markRaw(
defineAsyncComponent({
loader: async () =>
defineComponent({
props: ["used_effects_indexes", "cardId"],
methods: {
effectClick(effect: number) {
this.$emit("effectClick", effect);
},
},
template: template,
}),
defineComponent({
props: ["used_effects_indexes", "cardId"],
methods: {
effectClick(effect: number) {
this.$emit("effectClick", effect);
},
},
template: template,
})
),
];
@@ -79,3 +63,40 @@ export async function compileCards(app: App<any>) {
Object.assign(cards, Object.fromEntries(components));
}
export async function compileTokens() {
const svgs = import.meta.glob("@/assets/images/tokens/*.svg", {
eager: true,
});
const components = await Promise.all(
Object.entries(svgs).map(async ([k, v]) => {
const regex = /([\w]+)(?=\.svg)/gm;
const url = (v as any).default as string;
try {
let template: string;
if (process.dev && !process.client) {
template = (await import(/* @vite-ignore */ k + "?raw")).default;
} else {
template = await (await fetch(url)).text();
}
let arrayTemplate = template.split("\n");
arrayTemplate.splice(0, 1);
template = arrayTemplate.join("\n");
return [
k.match(regex)![0].toString(),
markRaw(
defineComponent({
template: template,
})
),
];
} catch (e) {
console.error(e, k);
return [];
}
})
);
Object.assign(tokens, Object.fromEntries(components));
}