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