完成成就导入

This commit is contained in:
BTMuli
2025-12-01 23:52:39 +08:00
committed by 目棃
parent 14c47369e7
commit 38f3301664
8 changed files with 133 additions and 115 deletions

View File

@@ -1,60 +1,69 @@
/**
* @file types/Plugins/UIAF.d.ts
* @description UIAF 插件类型定义文件
* @since Beta v0.6.0
* UIAF 插件类型定义文件
* @since Beta v0.7.8
*/
/**
* @description UIAF 插件类型命名空间
* @namespace TGApp.Plugins.UIAF
* @merberof TGApp.Plugins
* @since Beta v0.6.0
*/
declare namespace TGApp.Plugins.UIAF {
/**
* @interface Data
* UIAF完整数据
* @since Alpha v0.1.5
* @description UIAF 成就数据
* @property {Export} info UIAF 头部信息
* @property {Achievement[]} list UIAF 成就列表
* @return Data
*/
interface Data {
type Data = {
/* UIAF 头部信息 */
info: Export;
list: Achievement[];
}
/* UIAF 成就列表 */
list: Array<Achievement>;
};
/**
* @interface Export
* UIAF 头部信息
* @since Alpha v0.1.5
* @description UIAF 头部信息
* @property {string} export_app 导出的应用名称
* @property {number} export_timestamp 导出时间戳,正确时间戳得乘以 1000
* @property {string} export_app_version 导出的应用版本
* @property {string} uiaf_version UIAF 版本
* @return Export
*/
interface Export {
type Export = {
/* 导出的应用名称 */
export_app: string;
/* 导出时间戳,秒级 */
export_timestamp: number;
/* 导出的应用版本 */
export_app_version: string;
/* UIAF 版本 */
uiaf_version: string;
}
};
/**
* @interface Achievement
* @since Alpha v0.1.5
* @description UIAF 单个成就数据
* @property {number} id 成就 ID
* @property {number} timestamp 成就记录时间戳,正确时间戳得乘以 1000
* @property {number} current 成就进度
* @property {number} status 成就状态0 为未完成1 为已完成
* @return Achievement
* 成就完成状态
* @since Beta v0.7.8
*/
interface Achievement {
const AchiItemStat = <const>{
/* 无效状态 */
Invalid: 0,
/* 未完成 */
Unfinished: 1,
/* 已完成未领取奖励 */
Finished: 2,
/* 已领取奖励 */
RewardTaken: 3,
};
/**
* 成就完成状态枚举
* @since Beta v0.7.8
*/
type AchiItemStatEnum = (typeof AchiItemStat)[keyof typeof AchiItemStat];
/**
* 成就信息
* @since Beta v0.7.8
* @description UIAF 单个成就数据
*/
type Achievement = {
/* 成就 ID */
id: number;
/* 成就记录时间戳,秒级 */
timestamp: number;
/* 成就进度 */
current: number;
status: number;
}
/* 成就状态 */
status: AchiItemStatEnum;
};
}

View File

@@ -8,44 +8,5 @@ declare namespace TGApp.Plugins.Yae {
* 后端返的成就列表数据
* @since Beta v0.7.8
*/
type AchiListRes = Array<AchiItemRes>;
/**
* 成就完成状态
* @since Beta v0.7.8
*/
const AchiItemStat = <const>{
/* 无效状态 */
Invalid: 0,
/* 未完成 */
Unfinished: 1,
/* 已完成未领取奖励 */
Finished: 2,
/* 已领取奖励 */
RewardTaken: 3,
};
/**
* 成就完成状态m枚举
* @since Beta v0.7.8
*/
type AchiItemStatEnum = (typeof AchiItemStat)[keyof typeof AchiItemStat];
/**
* 后端返的单个成就数据
* @since Beta v0.7.8
* @see src-tauri/yae/proto.rs AchiItemRes
*/
type AchiItemRes = {
/* 成就 ID */
id: number;
/* 成就总进度 */
total: number;
/* 成就当前进度 */
cur: number;
/* 完成时间戳,单位秒 */
ts: number;
/* 成就完成状态 */
stat: AchiItemStatEnum;
};
type AchiListRes = Array<TGApp.Plugins.UIAF.Achievement>;
}