完善Game类的JSDoc类型注释

This commit is contained in:
shijian 2023-12-21 22:05:32 +08:00
parent 8e2bfc91ad
commit b02f62f392
4 changed files with 896 additions and 358 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1832,6 +1832,10 @@ export class Get extends Uninstantable {
return Math.sqrt(dx * dx + dy * dy); return Math.sqrt(dx * dx + dy * dy);
} }
static xyDistance(from, to) { return Math.sqrt((from[0] - to[0]) * (from[0] - to[0]) + (from[1] - to[1]) * (from[1] - to[1])) } static xyDistance(from, to) { return Math.sqrt((from[0] - to[0]) * (from[0] - to[0]) + (from[1] - to[1]) * (from[1] - to[1])) }
/**
* @overload
* @returns { void }
*/
/** /**
* @overload * @overload
* @param { string } obj * @param { string } obj

View File

@ -1,12 +1,14 @@
/** /**
* @typedef {InstanceType<typeof lib.element.Player>} Player * @typedef { InstanceType<typeof lib.element.Player> } Player
* @typedef {InstanceType<typeof lib.element.Card>} Card * @typedef { InstanceType<typeof lib.element.Card> } Card
* @typedef {InstanceType<typeof lib.element.VCard>} VCard * @typedef { InstanceType<typeof lib.element.VCard> } VCard
* @typedef {InstanceType<typeof lib.element.Button>} Button * @typedef { InstanceType<typeof lib.element.Button> } Button
* @typedef {InstanceType<typeof lib.element.Dialog>} Dialog * @typedef { InstanceType<typeof lib.element.Dialog> } Dialog
* @typedef {InstanceType<typeof lib.element.GameEvent>} GameEvent * @typedef { InstanceType<typeof lib.element.GameEvent> } GameEvent
* @typedef {InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise> & typeof Promise<lib.element.GameEvent>} GameEventPromise * @typedef { InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise> & typeof Promise<typeof lib.element.GameEvent> } GameEventPromise
* @typedef {InstanceType<typeof lib.element.NodeWS>} NodeWS * @typedef { InstanceType<typeof lib.element.NodeWS> } NodeWS
* @typedef { 'male' | 'female' | 'dobule' | 'none' } Sex
* @typedef { [Sex, string, number | string, string[], any[]] } Character
*/ */
import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js"; import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js";
import { AI as ai } from '../ai/index.js'; import { AI as ai } from '../ai/index.js';
@ -32,6 +34,9 @@ export class Library extends Uninstantable {
static changeLog = []; static changeLog = [];
static updates = []; static updates = [];
static canvasUpdates = []; static canvasUpdates = [];
/**
* @type { import('../game/index.js').Video[] }
*/
static video = []; static video = [];
static skilllist = []; static skilllist = [];
static connectBanned = []; static connectBanned = [];
@ -77,6 +82,17 @@ export class Library extends Uninstantable {
static extensionPack = {}; static extensionPack = {};
static cardType = {}; static cardType = {};
static hook = { globalskill: {} }; static hook = { globalskill: {} };
/**
* @returns {never}
*/
static typeAnnotation() {
/**
* @type { import('../game/index.js').Videos[] }
*/
// @ts-ignore
this.videos;
throw new Error('Do not call this method');
}
//函数钩子 //函数钩子
static hooks = { static hooks = {
// 本体势力的颜色 // 本体势力的颜色

View File

@ -36,6 +36,10 @@ export const status = {
renku: [], renku: [],
prehidden_skills: [], prehidden_skills: [],
postReconnect: {}, postReconnect: {},
/**
* @type { string | void }
*/
extension:undefined,
}; };
export const _status = status; export const _status = status;