tristan-wip #2
@ -67,8 +67,8 @@ onMounted(async () => {
|
|||||||
|
|
||||||
// Create the gradient background style
|
// Create the gradient background style
|
||||||
const backgroundStyle = computed(() => {
|
const backgroundStyle = computed(() => {
|
||||||
const primary = selectedGame?.value?.color_scheme?.primary ?? "#4d97f8";
|
const primary = selectedGame?.value?.colorScheme?.primary ?? "#4d97f8";
|
||||||
const secondary = selectedGame?.value?.color_scheme?.secondary ?? "#100a7d";
|
const secondary = selectedGame?.value?.colorScheme?.secondary ?? "#100a7d";
|
||||||
|
|
||||||
const backgroundImage = `linear-gradient(135deg, ${primary}, ${secondary})`;
|
const backgroundImage = `linear-gradient(135deg, ${primary}, ${secondary})`;
|
||||||
// const backgroundImage = !!bgImage ? `url(${bgImage})` : `linear-gradient(135deg, ${primary}, ${secondary})`;
|
// const backgroundImage = !!bgImage ? `url(${bgImage})` : `linear-gradient(135deg, ${primary}, ${secondary})`;
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<LocalImage
|
<LocalImage
|
||||||
:src="game.thumbnail_path"
|
:src="game.thumbnailPath"
|
||||||
class="h-32 w-48 object-cover"
|
class="h-32 w-48 object-cover"
|
||||||
:alt="game.title"
|
:alt="game.title"
|
||||||
:gameId="game.id"
|
:gameId="game.id"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="p-6 h-full w-full overflow-auto flex flex-col items-center">
|
<div class="p-6 h-full w-full overflow-auto flex flex-col items-center">
|
||||||
<div v-if="game" class="space-y-4 flex flex-col items-center w-full max-w-400">
|
<div v-if="game" class="space-y-4 flex flex-col items-center w-full max-w-400">
|
||||||
<img v-if="game.logo_path" :src="game.logo_path" :alt="game.title" class="h-72"/>
|
<img v-if="game.logoPath" :src="game.logoPath" :alt="game.title" class="h-72"/>
|
||||||
<h1 v-else class="text-4xl font-bold">{{ game.title }}</h1>
|
<h1 v-else class="text-4xl font-bold">{{ game.title }}</h1>
|
||||||
|
|
||||||
<!-- Actual carousel pls -->
|
<!-- Actual carousel pls -->
|
||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<div class="flex justify-between w-full space-y-1">
|
<div class="flex justify-between w-full space-y-1">
|
||||||
<ImageCarousel :gameId="game.id"
|
<ImageCarousel :gameId="game.id"
|
||||||
:links="game.media_paths"
|
:links="game.mediaPaths"
|
||||||
class="basis-1/4"
|
class="basis-1/4"
|
||||||
/>
|
/>
|
||||||
<!-- <LocalImage-->
|
<!-- <LocalImage-->
|
||||||
@ -56,8 +56,8 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
v-for="(link, name) in {
|
v-for="(link, name) in {
|
||||||
Repo: game?.public_repository_link ?? undefined,
|
Repo: game?.publicRepositoryLink,
|
||||||
Itch: game.itch_link
|
Itch: game?.itchLink
|
||||||
}">
|
}">
|
||||||
<button
|
<button
|
||||||
v-if="link"
|
v-if="link"
|
||||||
@ -93,7 +93,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { models } from "../../wailsjs/go/models";
|
import { models } from "../../wailsjs/go/models";
|
||||||
import Game = models.Game;
|
import Game = models.Game;
|
||||||
import LocalImage from "./LocalImage.vue";
|
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import DevCard from "./DevCard.vue";
|
import DevCard from "./DevCard.vue";
|
||||||
import { useAppStore } from "../stores/app-store";
|
import { useAppStore } from "../stores/app-store";
|
||||||
@ -106,8 +105,8 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const buttonStyle = computed(() => {
|
const buttonStyle = computed(() => {
|
||||||
const ternary = props.game?.color_scheme?.ternary ?? "#ffffff";
|
const ternary = props.game?.colorScheme?.ternary ?? "#ffffff";
|
||||||
const secondary = props.game?.color_scheme?.primary ?? "#100a99";
|
const secondary = props.game?.colorScheme?.primary ?? "#100a99";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
backgroundColor: secondary,
|
backgroundColor: secondary,
|
||||||
|
|||||||
@ -44,18 +44,18 @@ export namespace models {
|
|||||||
players: string;
|
players: string;
|
||||||
release: string;
|
release: string;
|
||||||
modification: string;
|
modification: string;
|
||||||
public_repository_link: string;
|
publicRepositoryLink: string;
|
||||||
itch_link: string;
|
itchLink: string;
|
||||||
genres: string;
|
genres: string;
|
||||||
collections: string;
|
collections: string;
|
||||||
executable: string;
|
executable: string;
|
||||||
thumbnail_path: string;
|
thumbnailPath: string;
|
||||||
logo_path: string;
|
logoPath: string;
|
||||||
backgroundImagePath: string;
|
backgroundImagePath: string;
|
||||||
media_paths: string[];
|
mediaPaths: string[];
|
||||||
audio_path: string;
|
audioPath: string;
|
||||||
developers: Developer[];
|
developers: Developer[];
|
||||||
color_scheme: ColorScheme;
|
colorScheme: ColorScheme;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
return new Game(source);
|
return new Game(source);
|
||||||
@ -70,18 +70,18 @@ export namespace models {
|
|||||||
this.players = source["players"];
|
this.players = source["players"];
|
||||||
this.release = source["release"];
|
this.release = source["release"];
|
||||||
this.modification = source["modification"];
|
this.modification = source["modification"];
|
||||||
this.public_repository_link = source["public_repository_link"];
|
this.publicRepositoryLink = source["publicRepositoryLink"];
|
||||||
this.itch_link = source["itch_link"];
|
this.itchLink = source["itchLink"];
|
||||||
this.genres = source["genres"];
|
this.genres = source["genres"];
|
||||||
this.collections = source["collections"];
|
this.collections = source["collections"];
|
||||||
this.executable = source["executable"];
|
this.executable = source["executable"];
|
||||||
this.thumbnail_path = source["thumbnail_path"];
|
this.thumbnailPath = source["thumbnailPath"];
|
||||||
this.logo_path = source["logo_path"];
|
this.logoPath = source["logoPath"];
|
||||||
this.backgroundImagePath = source["backgroundImagePath"];
|
this.backgroundImagePath = source["backgroundImagePath"];
|
||||||
this.media_paths = source["media_paths"];
|
this.mediaPaths = source["mediaPaths"];
|
||||||
this.audio_path = source["audio_path"];
|
this.audioPath = source["audioPath"];
|
||||||
this.developers = this.convertValues(source["developers"], Developer);
|
this.developers = this.convertValues(source["developers"], Developer);
|
||||||
this.color_scheme = this.convertValues(source["color_scheme"], ColorScheme);
|
this.colorScheme = this.convertValues(source["colorScheme"], ColorScheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
|||||||
@ -26,18 +26,18 @@ type Game struct {
|
|||||||
Players string `json:"players"`
|
Players string `json:"players"`
|
||||||
Release string `json:"release"`
|
Release string `json:"release"`
|
||||||
Modification string `json:"modification"`
|
Modification string `json:"modification"`
|
||||||
PublicRepositoryLink string `json:"public_repository_link"`
|
PublicRepositoryLink string `json:"publicRepositoryLink"`
|
||||||
ItchLink string `json:"itch_link"`
|
ItchLink string `json:"itchLink"`
|
||||||
Genres string `json:"genres"`
|
Genres string `json:"genres"`
|
||||||
Collections string `json:"collections"`
|
Collections string `json:"collections"`
|
||||||
Executable string `json:"executable"`
|
Executable string `json:"executable"`
|
||||||
ThumbnailPath string `json:"thumbnail_path"`
|
ThumbnailPath string `json:"thumbnailPath"`
|
||||||
LogoPath string `json:"logo_path"`
|
LogoPath string `json:"logoPath"`
|
||||||
BackgroundImagePath string `json:"backgroundImagePath"`
|
BackgroundImagePath string `json:"backgroundImagePath"`
|
||||||
MediaPaths []string `json:"media_paths"`
|
MediaPaths []string `json:"mediaPaths"`
|
||||||
AudioPath string `json:"audio_path"`
|
AudioPath string `json:"audioPath"`
|
||||||
Developers []Developer `json:"developers"`
|
Developers []Developer `json:"developers"`
|
||||||
ColorScheme ColorScheme `json:"color_scheme"`
|
ColorScheme ColorScheme `json:"colorScheme"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Developer struct {
|
type Developer struct {
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -181,7 +180,6 @@ func ExtractGame(game models.Metadata) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetConjureGameInfo() []models.Metadata {
|
func GetConjureGameInfo() []models.Metadata {
|
||||||
|
|
||||||
gamePath := config.GetDefaultConjureGamesDirectory()
|
gamePath := config.GetDefaultConjureGamesDirectory()
|
||||||
|
|
||||||
entries, err := os.ReadDir(gamePath)
|
entries, err := os.ReadDir(gamePath)
|
||||||
@ -196,11 +194,18 @@ func GetConjureGameInfo() []models.Metadata {
|
|||||||
continue
|
continue
|
||||||
} else if filepath.Ext(e.Name()) == ".conj" {
|
} else if filepath.Ext(e.Name()) == ".conj" {
|
||||||
conjPath := filepath.Join(gamePath, e.Name())
|
conjPath := filepath.Join(gamePath, e.Name())
|
||||||
|
conjBase := strings.TrimSuffix(conjPath, ".conj")
|
||||||
|
|
||||||
|
// Check if the destination folder already exists
|
||||||
|
if _, err := os.Stat(conjBase); os.IsNotExist(err) {
|
||||||
err = extractZipToSiblingFolder(conjPath)
|
err = extractZipToSiblingFolder(conjPath)
|
||||||
check(err)
|
check(err)
|
||||||
conjBase := strings.TrimSuffix(conjPath, ".conj")
|
}
|
||||||
|
|
||||||
|
// Now read metadata from the extracted directory
|
||||||
entries, err := os.ReadDir(conjBase)
|
entries, err := os.ReadDir(conjBase)
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
fmt.Println("Contents of", conjPath)
|
fmt.Println("Contents of", conjPath)
|
||||||
for _, f := range entries {
|
for _, f := range entries {
|
||||||
if f.Name() == "metadata.txt" {
|
if f.Name() == "metadata.txt" {
|
||||||
@ -210,18 +215,17 @@ func GetConjureGameInfo() []models.Metadata {
|
|||||||
|
|
||||||
fmt.Println("Contents of metadata.txt:")
|
fmt.Println("Contents of metadata.txt:")
|
||||||
metadata, err := io.ReadAll(rc)
|
metadata, err := io.ReadAll(rc)
|
||||||
|
check(err)
|
||||||
game := parseGameInfo([]byte(escapeBackslashes(string(metadata))))
|
game := parseGameInfo([]byte(escapeBackslashes(string(metadata))))
|
||||||
fmt.Println(game.ThumbnailPath)
|
fmt.Println(game.ThumbnailPath)
|
||||||
games = append(games, game)
|
games = append(games, game)
|
||||||
check(err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(games) > 0 {
|
if len(games) > 0 {
|
||||||
fmt.Println("Found Conjure Games: " + string(rune(len(games))))
|
fmt.Println("Found Conjure Games:", len(games))
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("No Conjure games Found")
|
fmt.Println("No Conjure games Found")
|
||||||
}
|
}
|
||||||
@ -246,34 +250,6 @@ func printIndentedPath(path string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func readFolder(entry fs.DirEntry, path string) []models.Metadata {
|
|
||||||
newPath := path + "/" + entry.Name()
|
|
||||||
entries, err := os.ReadDir(newPath)
|
|
||||||
check(err)
|
|
||||||
|
|
||||||
var games []models.Metadata
|
|
||||||
|
|
||||||
for _, e := range entries {
|
|
||||||
if e.IsDir() {
|
|
||||||
games = append(games, readFolder(e, newPath)...)
|
|
||||||
} else {
|
|
||||||
filenamesplit := strings.Split(e.Name(), ".")
|
|
||||||
|
|
||||||
if filenamesplit[1] == "conf" && filenamesplit[2] == "yml" {
|
|
||||||
game := parseGameInfoFromFile(newPath + "/" + e.Name())
|
|
||||||
games = append(games, game)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return games
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseGameInfoFromFile(path string) models.Metadata {
|
|
||||||
data, err := os.ReadFile(path)
|
|
||||||
check(err)
|
|
||||||
return parseGameInfo(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseGameInfo(data []byte) models.Metadata {
|
func parseGameInfo(data []byte) models.Metadata {
|
||||||
game := models.Metadata{}
|
game := models.Metadata{}
|
||||||
err := yaml.Unmarshal(data, &game)
|
err := yaml.Unmarshal(data, &game)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user