Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e8a619cb9 | ||
|
|
cb74d78928 | ||
|
|
a3ff9596d7 | ||
|
|
d18a2ab4f2 | ||
|
|
517f1bef5d | ||
|
|
77724d5539 | ||
|
|
21c41bb9fd | ||
|
|
bb625b1fee | ||
|
|
fd3cf0ba23 |
+3
-1
@@ -24,4 +24,6 @@ logs
|
|||||||
!.env.example
|
!.env.example
|
||||||
|
|
||||||
assets/images/*
|
assets/images/*
|
||||||
public/img/skins
|
public/img/skins
|
||||||
|
public/img/icon
|
||||||
|
public/img/tokens
|
||||||
+12
-2
@@ -4,11 +4,19 @@ COPY package*.json ./
|
|||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
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
|
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
|
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_ENDPOINT
|
||||||
ARG NUXT_PUBLIC_DISCORD_LOGIN_ENDPOINT
|
ARG NUXT_PUBLIC_DISCORD_LOGIN_ENDPOINT
|
||||||
@@ -19,4 +27,6 @@ RUN npx nuxi generate
|
|||||||
# étape de production
|
# étape de production
|
||||||
FROM nginx:stable-alpine AS production-stage
|
FROM nginx:stable-alpine AS production-stage
|
||||||
COPY --from=build-stage /app/.output/public /usr/share/nginx/html
|
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
|
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { cards, compileCards } from "./services/loadCards";
|
import { compileCards, compileTokens } from "./services/loadCards";
|
||||||
import { getCurrentInstance } from "vue";
|
import { getCurrentInstance } from "vue";
|
||||||
// import goStore, { oauth2_register_discord, setup_websocket, heron_cookie_login } from "@/netcode";
|
// import goStore, { oauth2_register_discord, setup_websocket, heron_cookie_login } from "@/netcode";
|
||||||
|
|
||||||
@@ -12,7 +12,8 @@ const app = getCurrentInstance()?.appContext.app;
|
|||||||
if (!app) {
|
if (!app) {
|
||||||
throw new Error("Couldn't bake cards: instance is null");
|
throw new Error("Couldn't bake cards: instance is null");
|
||||||
}
|
}
|
||||||
await compileCards(app);
|
await compileCards();
|
||||||
|
await compileTokens();
|
||||||
console.log("compiling done");
|
console.log("compiling done");
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
|
|||||||
@@ -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
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Effect } from "~/netcode/interfaces";
|
import type { Effect } from "~/netcode/interfaces";
|
||||||
|
import { tokens } from "~/services/loadCards";
|
||||||
|
import effect_locales from "~/assets/locales/effects.json";
|
||||||
type Props = {
|
type Props = {
|
||||||
token: Effect;
|
token: Effect;
|
||||||
};
|
};
|
||||||
@@ -14,24 +15,57 @@ function onClick(e: MouseEvent) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div @click.stop="onClick" @mousedown.left.stop="" id="token">
|
<div @click.stop="onClick" @mousedown.left.stop="" class="token_container">
|
||||||
{{ props.token.effect }}
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style>
|
||||||
#token {
|
.token_container {
|
||||||
width: 50px;
|
margin: 15px;
|
||||||
height: 50px;
|
/* backdrop-filter: blur(60px); */
|
||||||
background: white;
|
background: rgba(201, 212, 38, 1);
|
||||||
border: 1px solid white;
|
border: 5px solid black;
|
||||||
|
width: min-content;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
box-sizing: border-box;
|
|
||||||
transition: 0.2s all;
|
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 {
|
.token_container:hover {
|
||||||
border: 1px solid red;
|
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>
|
</style>
|
||||||
|
|||||||
+61
-40
@@ -1,40 +1,13 @@
|
|||||||
import type { App, Component, DefineComponent } from "vue";
|
import type { App, Component, DefineComponent } from "vue";
|
||||||
|
|
||||||
export const cards = {} as Record<string, Component>;
|
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", {
|
const svgs = import.meta.glob("@/assets/images/cards/heron-svg/*.svg", {
|
||||||
eager: true,
|
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(
|
const components = await Promise.all(
|
||||||
Object.entries(svgs).map(async ([k, v]) => {
|
Object.entries(svgs).map(async ([k, v]) => {
|
||||||
const regex = /([\d]+)(?=\.svg)/gm;
|
const regex = /([\d]+)(?=\.svg)/gm;
|
||||||
@@ -52,18 +25,29 @@ export async function compileCards(app: App<any>) {
|
|||||||
template = arrayTemplate.join("\n");
|
template = arrayTemplate.join("\n");
|
||||||
return [
|
return [
|
||||||
Number(k.match(regex)![0]).toString(),
|
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(
|
markRaw(
|
||||||
defineAsyncComponent({
|
defineComponent({
|
||||||
loader: async () =>
|
props: ["used_effects_indexes", "cardId"],
|
||||||
defineComponent({
|
methods: {
|
||||||
props: ["used_effects_indexes", "cardId"],
|
effectClick(effect: number) {
|
||||||
methods: {
|
this.$emit("effectClick", effect);
|
||||||
effectClick(effect: number) {
|
},
|
||||||
this.$emit("effectClick", effect);
|
},
|
||||||
},
|
template: template,
|
||||||
},
|
|
||||||
template: template,
|
|
||||||
}),
|
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@@ -79,3 +63,40 @@ export async function compileCards(app: App<any>) {
|
|||||||
|
|
||||||
Object.assign(cards, Object.fromEntries(components));
|
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));
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user