mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
feat(GCG): 添加 GCG 数据,目前只有简略的
This commit is contained in:
@@ -14,8 +14,7 @@
|
||||
<script lang="ts" setup>
|
||||
import TSidebar from "./components/t-sidebar.vue";
|
||||
import useAppStore from "./store/modules/app";
|
||||
import { TGAppDataList } from "./data";
|
||||
import { getDataList } from "./data/init";
|
||||
import { TGAppDataList, TGGetDataList } from "./data";
|
||||
import { fs } from "@tauri-apps/api";
|
||||
import { BaseDirectory } from "@tauri-apps/api/fs";
|
||||
import { onMounted } from "vue";
|
||||
@@ -58,7 +57,7 @@ async function writeData() {
|
||||
async function writeIndex() {
|
||||
console.log("开始写入 IndexedDB...");
|
||||
await InitTGData();
|
||||
getDataList.map(async item => {
|
||||
TGGetDataList.map(async item => {
|
||||
await WriteTGData(item.name, item.data);
|
||||
});
|
||||
console.log("IndexedDB 写入完成!");
|
||||
|
||||
1736
src/data/app/GCG.json
Normal file
1736
src/data/app/GCG.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,12 +5,16 @@
|
||||
* @since Alpha
|
||||
*/
|
||||
|
||||
// Data
|
||||
import achievements from "./achievements.json";
|
||||
import achievementSeries from "./achievementSeries.json";
|
||||
import GCG from "./GCG.json";
|
||||
import nameCards from "./nameCards.json";
|
||||
// Interface
|
||||
import { Achievement, AchievementSeries } from "../../interface/Achievements";
|
||||
import { NameCard } from "../../interface/NameCard";
|
||||
import { Map } from "../../interface/Base";
|
||||
import { BaseCard } from "../../interface/GCG";
|
||||
import { NameCard } from "../../interface/NameCard";
|
||||
|
||||
export const AppDataList = [
|
||||
{
|
||||
@@ -21,6 +25,10 @@ export const AppDataList = [
|
||||
name: "achievementSeries.json",
|
||||
data: achievementSeries as Map<AchievementSeries>,
|
||||
},
|
||||
{
|
||||
name: "GCG.json",
|
||||
data: GCG as BaseCard[],
|
||||
},
|
||||
{
|
||||
name: "nameCards.json",
|
||||
data: nameCards as unknown as Map<NameCard[]>,
|
||||
@@ -30,5 +38,6 @@ export const AppDataList = [
|
||||
export const AppData = {
|
||||
achievements: achievements as Map<Achievement>,
|
||||
achievementSeries: achievementSeries as Map<AchievementSeries>,
|
||||
GCG: GCG as BaseCard[],
|
||||
nameCards: nameCards as unknown as Map<NameCard[]>,
|
||||
};
|
||||
|
||||
37
src/data/init/GCG.ts
Normal file
37
src/data/init/GCG.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @file data init GCG
|
||||
* @description data init GCG
|
||||
* @description 分类参考:米游社卡牌图鉴
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha
|
||||
*/
|
||||
import { AppData } from "../app";
|
||||
import { BaseCard } from "../../interface/GCG";
|
||||
|
||||
/**
|
||||
* @description 卡牌表参数
|
||||
* @since Alpha
|
||||
*/
|
||||
export const Config = {
|
||||
storeName: "GCG",
|
||||
keyPath: "name",
|
||||
// 根据 type 分类
|
||||
indexes: [
|
||||
"type",
|
||||
"info.element",
|
||||
"info.weapon",
|
||||
"info.camp",
|
||||
"info.actionType",
|
||||
"info.actionTag",
|
||||
"info.actionCost",
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 卡牌数据
|
||||
* @since Alpha
|
||||
* @return {BaseCard[]}
|
||||
*/
|
||||
export function getData() {
|
||||
return AppData.GCG;
|
||||
}
|
||||
@@ -4,17 +4,14 @@
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha
|
||||
*/
|
||||
import { Config as NameCardConfig, getData as getNameCardData } from "./nameCard";
|
||||
import { Config as AchievementsConfig, getData as getAchievementsData } from "./achievements";
|
||||
import { Config as GCGConfig, getData as getGCGData } from "./GCG";
|
||||
import { Config as NameCardConfig, getData as getNameCardData } from "./nameCard";
|
||||
import { Config as SeriesConfig, getData as getSeriesData } from "./achievementSeries";
|
||||
|
||||
export const ConfigList = [NameCardConfig, AchievementsConfig, SeriesConfig];
|
||||
export const ConfigList = [AchievementsConfig, GCGConfig, NameCardConfig, SeriesConfig];
|
||||
|
||||
export const getDataList = [
|
||||
{
|
||||
name: "NameCard",
|
||||
data: getNameCardData(),
|
||||
},
|
||||
{
|
||||
name: "Achievements",
|
||||
data: getAchievementsData(),
|
||||
@@ -23,4 +20,12 @@ export const getDataList = [
|
||||
name: "AchievementSeries",
|
||||
data: getSeriesData(),
|
||||
},
|
||||
{
|
||||
name: "GCG",
|
||||
data: getGCGData(),
|
||||
},
|
||||
{
|
||||
name: "NameCard",
|
||||
data: getNameCardData(),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -21,23 +21,45 @@ export enum BaseCardType {
|
||||
monsterCard = "魔物牌",
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Gcg 基本卡牌
|
||||
* @interface BaseCard
|
||||
* @since Alpha
|
||||
* @see BaseCardType
|
||||
* @see CharacterCard
|
||||
* @see ActionCard
|
||||
* @see MonsterCard
|
||||
* @property {string} name 卡牌名称
|
||||
* @property {string} type 卡牌类型
|
||||
* @property {unknown} icon 卡牌图标
|
||||
* @property {unknown} info 卡牌信息
|
||||
* @property {unknown} skills 卡牌技能,仅角色卡与魔物卡有
|
||||
* @property {unknown} affect 卡牌效果,仅行动卡有
|
||||
* @return BaseCard
|
||||
*/
|
||||
export interface BaseCard {
|
||||
name: string;
|
||||
type: BaseCardType;
|
||||
icon: unknown;
|
||||
info: unknown;
|
||||
skills?: unknown;
|
||||
affect?: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Gcg 角色卡牌
|
||||
* @interface CharacterCard
|
||||
* @since Alpha
|
||||
* @see BaseCard
|
||||
* @see CharacterCardType
|
||||
* @property {string} name 角色名称
|
||||
* @property icon 卡牌图标
|
||||
* @property {string} icon.normal 正常图标
|
||||
* @property {string} icon.special 特殊图标
|
||||
* @property info 卡牌信息
|
||||
* @property {EnumElement} info.element 元素
|
||||
* @property {EnumWeapon} info.weapon 武器
|
||||
* @property {EnumCamp} info.camp 阵营
|
||||
* @property {string} info.source 卡牌来源
|
||||
* @property {string} info.title 卡牌标题
|
||||
* @property {string} info.description 卡牌描述
|
||||
* @property skills 卡牌技能
|
||||
* @property {string} skills[].name 技能名称
|
||||
* @property {string} skills[].type 技能类型
|
||||
* @property {string} skills[].description 技能描述
|
||||
@@ -48,8 +70,8 @@ export enum BaseCardType {
|
||||
* @property {number} skills[].count 可用次数
|
||||
* @return CharacterCard
|
||||
*/
|
||||
export interface CharacterCard {
|
||||
name: string;
|
||||
export interface CharacterCard extends BaseCard {
|
||||
type: BaseCardType.characterCard;
|
||||
icon: {
|
||||
normal: string;
|
||||
special?: string;
|
||||
@@ -78,12 +100,10 @@ export interface CharacterCard {
|
||||
* @description Gcg 行动卡牌
|
||||
* @interface ActionCard
|
||||
* @since Alpha
|
||||
* @see BaseCard
|
||||
* @see ActionCardType
|
||||
* @property {string} name 卡牌名称
|
||||
* @property icon 卡牌图标
|
||||
* @property {string} icon.normal 正常图标
|
||||
* @property {string} icon.special 特殊图标
|
||||
* @property info 卡牌信息
|
||||
* @property {EnumActionType} info.actionType 类型
|
||||
* @property {EnumActionTag} info.actionTag 标签
|
||||
* @property {EnumActionCost} info.actionCost 花费
|
||||
@@ -95,8 +115,8 @@ export interface CharacterCard {
|
||||
* @property {string} affect 卡牌效果
|
||||
* @return ActionCard
|
||||
*/
|
||||
export interface ActionCard {
|
||||
name: string;
|
||||
export interface ActionCard extends BaseCard {
|
||||
type: BaseCardType.actionCard;
|
||||
icon: {
|
||||
normal: string;
|
||||
special?: string;
|
||||
@@ -118,17 +138,14 @@ export interface ActionCard {
|
||||
* @description 与角色卡牌类似
|
||||
* @interface MonsterCard
|
||||
* @since Alpha
|
||||
* @see BaseCard
|
||||
* @see CharacterCardType
|
||||
* @property {string} name 角色名称
|
||||
* @description 只有一个图标
|
||||
* @property {string} icon 卡牌图标
|
||||
* @property info 卡牌信息
|
||||
* @property {EnumElement} info.element 元素
|
||||
* @property {EnumWeapon} info.weapon 武器
|
||||
* @property {EnumCamp} info.camp 阵营
|
||||
* @property {string} info.source 卡牌来源
|
||||
* @description 无标题跟描述
|
||||
* @property skills 卡牌技能
|
||||
* @property {string} skills[].name 技能名称
|
||||
* @property {string} skills[].type 技能类型
|
||||
* @property {string} skills[].description 技能描述
|
||||
@@ -138,8 +155,8 @@ export interface ActionCard {
|
||||
* @description 当技能类型为 “召唤物” 时,会有以下属性
|
||||
* @return MonsterCard
|
||||
*/
|
||||
export interface MonsterCard {
|
||||
name: string;
|
||||
export interface MonsterCard extends BaseCard {
|
||||
type: BaseCardType.monsterCard;
|
||||
icon: string;
|
||||
info: {
|
||||
element: EnumElement;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @since Alpha
|
||||
*/
|
||||
|
||||
import { ConfigList } from "../data/init";
|
||||
import { TGConfigList } from "../data";
|
||||
|
||||
// 数据库参数
|
||||
export const DB_NAME = "TGData";
|
||||
@@ -21,7 +21,7 @@ export async function InitTGData() {
|
||||
request.onupgradeneeded = () => {
|
||||
const db = request.result;
|
||||
// 创建表
|
||||
ConfigList.forEach(config => {
|
||||
TGConfigList.forEach(config => {
|
||||
const store = db.createObjectStore(config.storeName, {
|
||||
keyPath: config.keyPath,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user